Tune multiple models simultaneously with GridSearchCV

Поділитися
Вставка
  • Опубліковано 23 гру 2024

КОМЕНТАРІ • 17

  • @dataschool
    @dataschool  3 роки тому

    Thanks for watching! 🙌 If you're brand new to GridSearchCV, I recommend starting with this tutorial instead: ua-cam.com/video/Gol_qOgRqfA/v-deo.html

  • @Lumcoin
    @Lumcoin Рік тому +2

    OMG, a classic "UA-camr 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.

  • @hemanthkotagiri8865
    @hemanthkotagiri8865 3 роки тому +4

    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  3 роки тому

      That's awesome to hear! So glad I could be helpful, and thanks for your kind words 🙏

  • @gauravmalik3911
    @gauravmalik3911 2 роки тому

    Amazing video, there are very few videos on these such unique topics on UA-cam.
    Had one doubt, didn't understood the placeholder part at 2:15.

  • @AhmedThahir2002
    @AhmedThahir2002 2 місяці тому

    Amazing video!
    Does this work for RandomizedSearchCV as well?

  • @wayfaring.stranger
    @wayfaring.stranger 2 роки тому

    You're a good boy; this has streamlined my PhD's research.

  • @bakingbaker
    @bakingbaker 3 роки тому

    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 3 роки тому

      If you wrap it into a loop

    • @bakingbaker
      @bakingbaker 3 роки тому

      @@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.

  • @amarsharma336
    @amarsharma336 3 роки тому +1

    Thanks for saving our time, i used to do loops

  • @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 Рік тому

    Thanks, helpful