I want to apply a voting classifier to several pipeline classifiers and tune the parameters in a grid search. Following minimal example gives me an error. Do I have to do this differently?
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import VotingClassifier
p1 = Pipeline([['clf1', RandomForestClassifier()]])
p2 = Pipeline([['clf2', AdaBoostClassifier()]])
p3 = Pipeline([['clf3', VotingClassifier(estimators=(p1, p2))]])
p3.get_params()
Error:
TypeError: cannot convert dictionary update sequence element #0 to a sequence
When you are specifying the estimators for
VotingClassifier
, you need to give each of them a name:This will output: