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

Is it possible to add suggest_discrete_int? #888

Closed
hayata-yamamoto opened this issue Feb 4, 2020 · 2 comments
Closed

Is it possible to add suggest_discrete_int? #888

hayata-yamamoto opened this issue Feb 4, 2020 · 2 comments
Assignees
Labels
feature Change that does not break compatibility, but affects the public interfaces.

Comments

@hayata-yamamoto
Copy link
Contributor

Hello, Developers,
Is it possible to add suggest_discrete_int method to trial?

Motivation

We want to make a grid somehow so that parameter search becomes more efficient and less time-consuming.

Description

Optuna already has a discrete_uniform method on optuna.Trial. It's quite useful, but some of the models require integer values as their arguments. For instance, XGBoost. Since n_estimator and max_depth must be an integer, it raises an error when I pass float values to these.

Therefore, trial.suggest_int or trial.suggest_categorical are used so that I input the values I want. If optuna has a feature of throwing discrete integer, this operation could vanish.

Alternatives (optional)

From my perspectives, there are two options,

  1. To cast discrete_uniform output as an integer
  2. To use suggest_categorical like suggest_categorical('hoge', np.arange(0, 10, 2))

Additional context (optional)

@hayata-yamamoto hayata-yamamoto added the feature Change that does not break compatibility, but affects the public interfaces. label Feb 4, 2020
@toshihikoyanase toshihikoyanase self-assigned this Feb 4, 2020
@toshihikoyanase
Copy link
Member

Hi @hayata-yamamoto,

Thank you for your request!
We have already received similar requests like #510 and are discussing the design of new APIs there. (The last comment was about four month ago, though.) I think the (b) API of this comment is corresponding to your request.

(b) [MODIFIED] Trial.suggest_int(name: str, low: int, high: int, q: Optional[int]) (
suggest_int(name, low, high, q=10) is equivalent to Trial.suggest_discret_int(name, low, high, q=10)

So, I think we can merge this issue into #510. If it's OK, please add your comments there and close this issue.

@hayata-yamamoto
Copy link
Contributor Author

@toshihikoyanase
Nice information! I'm sorry for bothering you!

I'll close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Change that does not break compatibility, but affects the public interfaces.
Projects
None yet
Development

No branches or pull requests

2 participants