Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XGBoostError: b'value 1.16151 for Parameter colsample_bytree exceed bound [0,1]' #51

Open
daveliu-riviera opened this issue Dec 13, 2019 · 0 comments

Comments

@daveliu-riviera
Copy link

daveliu-riviera commented Dec 13, 2019

import numpy as np

import xgboost as xgb

from scipy.stats import randint as sp_randint
from scipy.stats import uniform as sp_float


# XGBoost with Hyperband Hyperparameter Optimization
clf = xgb.XGBRegressor()

clf.set_params(**{"n_jobs": 4})

# Hyperparameter search boundaries
param_grid = {
              # Parameters for Tree Booster
              'eta': sp_float(0, 1),
              'gamma': sp_randint(0, 100),
              'max_depth': sp_randint(1, 3),
              'learning_rate': sp_float(.001, .005),
              'n_estimators': sp_randint(5000, 40000),

              'min_child_weight': sp_randint(0, 50),
              'max_delta_step': sp_randint(0, np.log(upper_limit)),
              'subsample': sp_float(0, 1),

              # Family of parameters for subsampling of columns
              'colsample_bytree': sp_float(0.2, 1),
              'colsample_bylevel': sp_float(0.2, 1),
              'colsample_bynode': sp_float(0.2, 1),

              # Regularization Params
              'lambda': sp_randint(1, 10),
              'alpha': sp_randint(0, 100),
              }

from civismlext.hyperband import HyperbandSearchCV
    tuned_model = HyperbandSearchCV(regressor,
                                    param_distributions=param_grid,
                                    cost_parameter_max={'n_estimators': 20000},
                                    cost_parameter_min={'n_estimators': 2000},
                                    n_jobs=4,
                                    cv=2)

Somehow I got an out-of-bounds error when I tried to set the range for colsample_by* as (0.2, 1), but when I changed it back to (0, 1) it worked.

Seems like it might be an async/distributed computing issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant