Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contributor License Agreement
This repository (
optuna-dashboard
) and Goptuna share common code.This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.
Reference Issues/PRs
N/A
What does this implement/fix? Explain your changes.
distributions
intest_search_space.py
is not compatible with the type annotation ofcrate_trial
.We observe mypy failure like following when a check is run with Optuna v3.0.0b0.
distributions
has a typedict[str, UniformDistribution]
that is not compatible withDict[str, BaseDistribution]
. It means the type is not valid in the current implementation even if CIs are all green in the latest master branch.Optuna v2.10.0 unintentionally hides the information because
@experimental
decorator crushes a type hint of a method. Optuna v3.0.0 makescreate_trial
stable (i.e. removes@experimental
) and exposes type information to third-party libraries correctly. This is why we observe the mypy failure by upgrading the Optuna.https://github.com/optuna/optuna/blob/v2.10.0/optuna/trial/_frozen.py#L505-L516
This PR adds type hints
List[Dict[str, BaseDistribution]]
fordistributions
, which is compatible withOptional[Dict[str, BaseDistribution]]
ofcreate_trial
.