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

gradient_boosting_regressor loss #203

Closed
MarkBusschers opened this issue Nov 17, 2023 · 1 comment
Closed

gradient_boosting_regressor loss #203

MarkBusschers opened this issue Nov 17, 2023 · 1 comment
Assignees
Labels

Comments

@MarkBusschers
Copy link

Hello,
I'm trying to define the following HyperoptEstimator:

estim = HyperoptEstimator(
regressor = gradient_boosting_regressor(
"gbr",
alpha=quantile,
loss="quantile",
n_estimators=hp.choice('n_estimators', list(np.arange(20, 80, 1, dtype=int))),
min_samples_leaf = hp.choice('min_samples', list(np.arange(10, 50, 1, dtype=int))),
max_features = hp.choice('max_features', list(np.arange(2, 10, 1, dtype=int))),
max_depth = hp.choice('max_depth', list(np.arange(2, 10, 1, dtype=int))),
min_samples_split = hp.choice('min_samples_split', list(np.arange(2, 50, 1, dtype=int))),
),
verbose=True,
algo=tpe.suggest,
max_evals=10,
trial_timeout=30,
)

This returns the folowing error:
Invalid parameter 'loss' with value 'quantile'. Choose 'squared_error', 'absolute_error', 'huber' or 'quantile'

I think the following piece of code should be changed:

@Validate(params=["loss"],
validation_test=lambda param: not isinstance(param, str) or param in ("squared_error", "absolute_error",
"huber" or "quantile"),
msg="Invalid parameter '%s' with value '%s'. "
"Choose 'squared_error', 'absolute_error', 'huber' or 'quantile'.")

To:

@Validate(params=["loss"],
validation_test=lambda param: not isinstance(param, str) or param in ("squared_error", "absolute_error",
"huber", "quantile"),
msg="Invalid parameter '%s' with value '%s'. "
"Choose 'squared_error', 'absolute_error', 'huber' or 'quantile'.")

@mandjevant
Copy link
Contributor

Good catch. Thank you for reporting this.

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

No branches or pull requests

2 participants