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

[Request] Need a more friendly error message for incompatible search_space #200

Open
nabenabe0928 opened this issue Dec 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nabenabe0928
Copy link
Contributor

nabenabe0928 commented Dec 6, 2024

Expected behavior

import optuna
import optunahub


def objective(trial: optuna.Trial) -> float:
    x = trial.suggest_float("x", -1, 1)
    y = trial.suggest_float("x", -1, 1)
    return x**2 + y**2


search_space = {
    "x": optuna.distributions.FloatDistribution(-1, 1),
    "y": optuna.distributions.FloatDistribution(-1, 1),
}
sampler = optunahub.load_module("samplers/hebo").HEBOSampler(search_space=search_space)
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=10)

The code above (the name specified for y is actually wrong) yields:

TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

However, this type of error message depends on which sampler we use, so we should have an error message natively supported by OptunaHub.

Environment

  • The package of OptunaHub which you are using:
  • Optuna version:
  • OptunaHub version:
  • Python version:
  • OS:
  • (Optional) Other libraries and their versions:

Error messages, stack traces, or logs

Please check above.

Steps to reproduce

Please check above.

Additional context (optional)

No response

@nabenabe0928 nabenabe0928 added the bug Something isn't working label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant