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

Adjust HEBO to FloatDistribution with step #204

Merged

Conversation

nabenabe0928
Copy link
Contributor

@nabenabe0928 nabenabe0928 commented Dec 10, 2024

This PR adjusts HEBOSampler so that it can handle FloatDistribution with step properly.

Note

Originally, HEBOSampler falls back to sample_independent if there are any parameters with FloatDistribution and step.

Please use the following objective function for the verification!

def objective(trial: optuna.Trial) -> float:
    trial.suggest_float("f", -5, 5)
    trial.suggest_float("f-log", 1, 100, log=True)
    trial.suggest_float("f-step", -2, 7, step=0.5)
    trial.suggest_float("f-step-non-divisable", 2, 7, step=3)
    trial.suggest_int("i", -5, 5)
    trial.suggest_int("i-log", 1, 100, log=True)
    trial.suggest_int("i-step", -2, 6, step=2)
    trial.suggest_int("i-step-non-divisable", 2, 7, step=3)
    trial.suggest_categorical("c", ["a", "b", "c"])
    print(trial.params)
    return trial.number

@nabenabe0928
Copy link
Contributor Author

@y0z
Could you check this PR?

Copy link
Member

@HideakiImamura HideakiImamura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@HideakiImamura
Copy link
Member

@nabenabe0928 Could you resolve the conflict?

@HideakiImamura HideakiImamura self-assigned this Dec 13, 2024
@nabenabe0928 nabenabe0928 marked this pull request as draft December 13, 2024 02:18
@nabenabe0928
Copy link
Contributor Author

I noticed that I need to transform before hebo.observe as well.

@nabenabe0928 nabenabe0928 marked this pull request as ready for review December 13, 2024 02:52
@nabenabe0928
Copy link
Contributor Author

I fixed so that HEBO now knows the exact indices for each parameter.

@HideakiImamura HideakiImamura merged commit cbe99ce into optuna:main Dec 19, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants