No video

Tune multiple models simultaneously with GridSearchCV

  Рет қаралды 7,298

Data School

Data School

Күн бұрын

You can tune 2+ models using the same grid search! Here's how:
1. Create multiple parameter dictionaries
2. Specify the model within each dictionary
3. Put the dictionaries in a list
👉 New tips every TUESDAY and THURSDAY! 👈
🎥 Watch all tips: • scikit-learn tips
🗒️ Code for all tips: github.com/jus...
💌 Get tips via email: scikit-learn.tips
=== WANT TO GET BETTER AT MACHINE LEARNING? ===
1) LEARN THE FUNDAMENTALS in my intro course (free!): courses.datasc...
2) BUILD YOUR ML CONFIDENCE in my intermediate course: courses.datasc...
3) LET'S CONNECT!
- Newsletter: www.dataschool...
- Twitter: / justmarkham
- Facebook: / datascienceschool
- LinkedIn: / justmarkham

Пікірлер: 16
@dataschool
@dataschool 2 жыл бұрын
Thanks for watching! 🙌 If you're brand new to GridSearchCV, I recommend starting with this tutorial instead: kzfaq.info/get/bejne/fdWcktSAzLjVlnU.html
@hemanthkotagiri8865
@hemanthkotagiri8865 2 жыл бұрын
I was literally on my hunt to see if I can train 4 different models with different parameters all at once and here you upload this. Perfect timing! Thanks, man! Love your content!
@dataschool
@dataschool 2 жыл бұрын
That's awesome to hear! So glad I could be helpful, and thanks for your kind words 🙏
@Lumcoin
@Lumcoin Жыл бұрын
OMG, a classic "KZfaqr explains how to add 1+1" BUT NO ONE ELSE SAYS HOW TO ADD 1+1!!! Thanks a bunch, you most likely saved me two hours of frustrating trial and error.
@dataschool
@dataschool 10 ай бұрын
Happy to help! 🙌
@wayfaring.stranger
@wayfaring.stranger Жыл бұрын
You're a good boy; this has streamlined my PhD's research.
@dataschool
@dataschool Жыл бұрын
Thank you!
@amarsharma336
@amarsharma336 2 жыл бұрын
Thanks for saving our time, i used to do loops
@dataschool
@dataschool 2 жыл бұрын
You're very welcome!
@gauravmalik3911
@gauravmalik3911 2 жыл бұрын
Amazing video, there are very few videos on these such unique topics on KZfaq. Had one doubt, didn't understood the placeholder part at 2:15.
@marinapachecovillaschi2367
@marinapachecovillaschi2367 2 жыл бұрын
Nice tip!! As I'm solving a multi-output classification problem I'm using MultiOutputClassifier() for that and I think that's what's messing my code up when trying to run this solution. It looks something like this: pipeline = Pipeline([ ('vect', CountVectorizer(tokenizer=tokenize)), ('tfidf', TfidfTransformer()), ('classifier', MultiOutputClassifier(lr_clf)) ]) # parameter dict for logistic regression params_lr = { 'vect__decode_error' : ['strict', 'ignore', 'replace'], 'tfidf__norm' : ['l1', 'l2'], 'classifier__estimator__penalty' : ['l1', 'l2'], 'classifier__estimator__C' : [0.1, 1, 10], 'classifier__estimator' : [lr_clf] } # other dicts for different models # list of parameters dicts parameters = [params_lr, params_svc, params_rf] cv = GridSearchCV(pipeline, param_grid = parameters, n_jobs=-1) cv.fit(X_train, y_train) Any tips on this? I think the gridsearch doesn't understand the MultiOutputClassifier. Thanks in advance!!
@Amir-gi5fn
@Amir-gi5fn 8 ай бұрын
Thanks, helpful
@dataschool
@dataschool 8 ай бұрын
You're welcome!
@bakingbaker
@bakingbaker 2 жыл бұрын
I don't doubt this works, but it seems a bit odd to specify an instantiated classifier in the pipeline only to override it with another instantiated classifier. Is there a way to make the classifier in the pipeline a generic placeholder?
@DanielWeikert
@DanielWeikert 2 жыл бұрын
If you wrap it into a loop
@bakingbaker
@bakingbaker 2 жыл бұрын
@@DanielWeikert No need; I realized my question is kinda silly considering that it's no different then simply overriding default parameters. Instead of specifying attributes, each classifier is an object.
Adapt this pattern to solve many Machine Learning problems
7:49
Data School
Рет қаралды 12 М.
How do I encode categorical features using scikit-learn?
27:59
Data School
Рет қаралды 138 М.
Get 10 Mega Boxes OR 60 Starr Drops!!
01:39
Brawl Stars
Рет қаралды 17 МЛН
ROLLING DOWN
00:20
Natan por Aí
Рет қаралды 10 МЛН
Hyperparameter Tuning of Machine Learning Model in Python
24:12
Data Professor
Рет қаралды 43 М.
How to find the best model parameters in scikit-learn
27:46
Data School
Рет қаралды 154 М.
112 Tuning Hyperparameters | Scikit-learn Creating Machine Learning Models
23:16
Normalization Vs. Standardization (Feature Scaling in Machine Learning)
19:48
Scikit-Learn Model Pipeline Tutorial
16:50
Greg Hogg
Рет қаралды 26 М.
Multiple Linear Regression in Python - sklearn
10:35
RegenerativeToday
Рет қаралды 79 М.
Hyperparameter Tuning in Python with GridSearchCV
14:41
NeuralNine
Рет қаралды 14 М.
All Learning Algorithms Explained in 14 Minutes
14:10
CinemaGuess
Рет қаралды 222 М.