Created
December 3, 2019 14:14
-
-
Save caiobvilar/726ec8953b1d729b6b7c231095f02f74 to your computer and use it in GitHub Desktop.
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
xgb_pipeline = Pipeline([("st_scaler", StandardScaler()),("xgb_model",xgb.XGBRegressor())]) | |
gbm_param_grid = { | |
'xgb_model__subsample': np.arange(.05, 1, 0.05), | |
'xgb_model__max_depth': np.arange(5,50,5), | |
'xgb_model__colsample_bytree': np.arange(.1,1.05,.05) | |
} | |
randomized_neg_mse = RandomizedSearchCV(estimator=xgb_pipeline, | |
param_distributions=gbm_param_grid, n_iter=10, | |
scoring='neg_mean_squared_error', cv=10) | |
randomized_neg_mse.fit(X, y) | |
print("Best rmse: ", np.sqrt(np.abs(randomized_neg_mse.best_score_))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment