Skip to content

Instantly share code, notes, and snippets.

@john-adeojo
Last active March 26, 2023 11:00
Show Gist options
  • Save john-adeojo/1e131460b4a495445eec0ce70cfd6f9c to your computer and use it in GitHub Desktop.
Save john-adeojo/1e131460b4a495445eec0ce70cfd6f9c to your computer and use it in GitHub Desktop.
from skopt.space import Real, Integer, Categorical
# Parameter grid for XGBoost
xgb_param_grid = {
'regressor__learning_rate': Real(0.01, 0.3, prior='log-uniform'),
'regressor__n_estimators': Integer(50, 2000),
'regressor__max_depth': Integer(3, 50),
'regressor__min_child_weight': Integer(1, 20),
'regressor__gamma': Real(0, 5),
'regressor__subsample': Real(0.5, 1),
'regressor__colsample_bytree': Real(0.5, 1),
'regressor__reg_alpha': Real(0.1, 1000, prior='log-uniform'),
'regressor__reg_lambda': Real(0.1, 1000, prior='log-uniform'),
}
# Parameter grid for RandomForest
rf_param_grid = {
'regressor__n_estimators': Integer(50, 2000),
'regressor__max_depth': Integer(3, 50),
'regressor__min_samples_split': Integer(2, 20),
'regressor__min_samples_leaf': Integer(1, 20),
}
# Parameter grid for Ridge
ridge_param_grid = {
'regressor__alpha': Real(0.1, 1000, prior='log-uniform'),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment