Created
February 23, 2019 16:17
-
-
Save vikeshsingh37/4b6e79cb6e79f9f64eaf3da3676fa564 to your computer and use it in GitHub Desktop.
Example to use stack_model.py
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
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor | |
from sklearn.linear_model import ElasticNet | |
from stack_model import stack_model | |
rf_model = RandomForestRegressor() | |
gbm_model = GradientBoostingRegressor() | |
en_model = ElasticNet() | |
base_models = [rf_model,gbm_model,en_model] | |
meta_model = RandomForestRegressor(n_estimators =100) | |
stk_model = stack_model(base_models,meta_model,X[selected_features],y.values) | |
stk_model.fit(cvFolds = 5, random_state= 42) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment