Skip to content

Instantly share code, notes, and snippets.

@john-adeojo
Last active March 26, 2023 11:12
Show Gist options
  • Save john-adeojo/b444c4a25e15819c46745cf1aed4ca7d to your computer and use it in GitHub Desktop.
Save john-adeojo/b444c4a25e15819c46745cf1aed4ca7d to your computer and use it in GitHub Desktop.
from skopt import BayesSearchCV
# Tune XGBoost model
xgb_tuner = BayesSearchCV(
xgb_pipeline,
xgb_param_grid,
cv=5,
scoring='neg_root_mean_squared_error',
n_iter=30,
n_jobs=-1
)
xgb_tuner.fit(X_train, y_train)
# Tune RandomForest model
rf_tuner = BayesSearchCV(
rf_pipeline,
rf_param_grid,
cv=5,
scoring='neg_root_mean_squared_error',
n_iter=30,
n_jobs=-1
)
rf_tuner.fit(X_train, y_train)
# Tune Ridge model
ridge_tuner = BayesSearchCV(
ridge_pipeline,
ridge_param_grid,
cv=5,
scoring='neg_root_mean_squared_error',
n_iter=30,
n_jobs=-1
)
ridge_tuner.fit(X_train, y_train)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment