Created
September 9, 2017 05:15
-
-
Save supachaic/03eac455456b154c444a15edb1ded7e2 to your computer and use it in GitHub Desktop.
ensemble vote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.ensemble import RandomForestClassifier | |
from sklearn.ensemble import AdaBoostClassifier | |
from sklearn.ensemble import ExtraTreesClassifier, VotingClassifier | |
from xgboost import XGBClassifier | |
rfo = RandomForestClassifier() | |
ada = AdaBoostClassifier() | |
ext = ExtraTreesClassifier() | |
xgb = XGBClassifier() | |
vote_list = [('rfo', rfo), ('ada', ada), ('ext', ext), ('xgb', xgb)] | |
vote = VotingClassifier(estimators=vote_list, voting='soft') | |
vote.fit(X_train, y_train) | |
score = vote.score(X_train, y_train) | |
y_pred = vote.predict(X_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment