Skip to content

Instantly share code, notes, and snippets.

@xoelop
Last active November 3, 2018 18:39
Show Gist options
  • Save xoelop/1316f92827eb812260871b1bb49d189e to your computer and use it in GitHub Desktop.
Save xoelop/1316f92827eb812260871b1bb49d189e to your computer and use it in GitHub Desktop.
grid parameters gridsearch
model = RandomForestRegressor(n_jobs=-1, random_state=42, verbose=2)
grid = {'n_estimators': [10, 13, 18, 25, 33, 45, 60, 81, 110, 148, 200],
'max_features': [0.05, 0.07, 0.09, 0.11, 0.13, 0.15, 0.17, 0.19, 0.21, 0.23, 0.25],
'min_samples_split': [2, 3, 5, 8, 13, 20, 32, 50, 80, 126, 200]}
rf_gridsearch = GridSearchCV(estimator=model, param_grid=grid, n_jobs=4,
cv=cv, verbose=2, return_train_score=True)
rf_gridsearch.fit(X1, y1)
# and after some hours...
df_gridsearch = pd.DataFrame(rf_gridsearch.cv_results_)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment