def test_tie_situation():
 clf1 = LogisticRegression(random_state=123)
 clf2 = RandomForestClassifier(random_state=123)
 eclf = VotingClassifier(estimators=[('lr', clf1), ('rf', clf2)], voting='hard')
 assert_equal(clf1.fit(X, y).predict(X)[73], 2)
 assert_equal(clf2.fit(X, y).predict(X)[73], 1)
 assert_equal(eclf.fit(X, y).predict(X)[73], 1)

def test_tie_situation ( ) : clf1 = LogisticRegression ( random_state = 123 ) clf2 = RandomForestClassifier ( random_state = 123 ) eclf = VotingClassifier ( estimators = [ ( 'lr' , clf1 ) , ( 'rf' , clf2 ) ] , voting = 'hard' ) assert_equal ( clf1 . fit ( X , y ) . predict ( X ) [ 73 ] , 2 ) assert_equal ( clf2 . fit ( X , y ) . predict ( X ) [ 73 ] , 1 ) assert_equal ( eclf . fit ( X , y ) . predict ( X ) [ 73 ] , 1 )
check voting classifier selects smaller class label in tie situation .