Reputation: 41
I am working on a multiclass problem with six different classes and I am using OneVsRestClassifier.
I have then performed hyperparameter tuning with GridSearchCV
and obtained the optimized classifier with clf.best_estimator_
.
As far as I understand, this returns one set of the hyperparameters for the aggregated model/every base estimator. Is there a way to perform hyperparameter tuning separately for each base estimator?
Upvotes: 0
Views: 517
Reputation: 12602
Sure, just reverse the order of the search and the multiclass wrapper:
one_class_clf = GridSearchCV(base_classifier, params, ...)
clf = OneVsRestClassifier(one_class_clf)
Fitting clf
generates the one-vs-rest problems, and for each of those fits a copy of the grid-searched base_classifier
.
Upvotes: 2