Skip to content

Instantly share code, notes, and snippets.

@18182324
Created April 12, 2021 11:58
Show Gist options
  • Save 18182324/da7d5a459caf70946487b4b39a719ac0 to your computer and use it in GitHub Desktop.
Save 18182324/da7d5a459caf70946487b4b39a719ac0 to your computer and use it in GitHub Desktop.
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)
# after several 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