Skip to content

Instantly share code, notes, and snippets.

@risenW
Created July 10, 2019 12:08
Show Gist options
  • Save risenW/4284e9f0a14ce210e7a6af42bb116ed4 to your computer and use it in GitHub Desktop.
Save risenW/4284e9f0a14ce210e7a6af42bb116ed4 to your computer and use it in GitHub Desktop.
#Import the module
from sklearn.ensemble import VotingClassifier
#Pass the classifiers as a list of tuples with model names and the models themselves
max_model = VotingClassifier(estimators=[('logistic_reg', log_cf), ('KNN Classifier', knn_cf), ("SVC", svc_cf)], voting='hard')
max_model.fit(X_train, y_train)
print("Max Voting in sklearn")
print(get_acc(max_model.predict(X_val), y_val))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment