Last active
July 30, 2019 10:42
-
-
Save risenW/9fe2ecad38a3ef6492e02dec3677a0a2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#Bagging and Boosting models for both classification and regression problems | |
from sklearn.ensemble import RandomForestRegressor, ExtraTreesRegressor, BaggingRegressor | |
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier, BaggingClassifier | |
from sklearn.ensemble import GradientBoostingRegressor, AdaBoostRegressor | |
#import xgboost as xgb | |
#bagging algorithms for regression | |
rand_forest_reg = RandomForestRegressor(n_estimators=100, random_state=rand_seed) | |
extra_tree_reg = ExtraTreesRegressor(n_estimators=100,random_state=rand_seed) | |
#We use support vector regressor as our base model for bagging | |
bagging_meta_reg = BaggingRegressor(svr_reg, n_estimators=100, random_state=rand_seed) | |
#bagging algorithms for classification | |
rand_forest_cf = RandomForestClassifier(n_estimators=100, random_state=rand_seed) | |
extra_tree_cf = ExtraTreesClassifier(n_estimators=100, random_state=rand_seed) | |
#We use svc as our base model for bagging | |
bagging_meta_cf = BaggingClassifier(svc_cf, n_estimators=10, random_state=rand_seed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment