def test_gridsearch():
 clf1 = LogisticRegression(random_state=1)
 clf2 = RandomForestClassifier(random_state=1)
 clf3 = GaussianNB()
 eclf = VotingClassifier(estimators=[('lr', clf1), ('rf', clf2), ('gnb', clf3)], voting='soft')
 params = {'lr__C': [1.0, 100.0], 'voting': ['soft', 'hard'], 'weights': [[0.5, 0.5, 0.5], [1.0, 0.5, 0.5]]}
 grid = GridSearchCV(estimator=eclf, param_grid=params, cv=5)
 grid.fit(iris.data, iris.target)

def test_gridsearch ( ) : clf1 = LogisticRegression ( random_state = 1 ) clf2 = RandomForestClassifier ( random_state = 1 ) clf3 = GaussianNB ( ) eclf = VotingClassifier ( estimators = [ ( 'lr' , clf1 ) , ( 'rf' , clf2 ) , ( 'gnb' , clf3 ) ] , voting = 'soft' ) params = { 'lr__C' : [ 1.0 , 100.0 ] , 'voting' : [ 'soft' , 'hard' ] , 'weights' : [ [ 0.5 , 0.5 , 0.5 ] , [ 1.0 , 0.5 , 0.5 ] ] } grid = GridSearchCV ( estimator = eclf , param_grid = params , cv = 5 ) grid . fit ( iris . data , iris . target )
check gridsearch support .