Fix issue with subsolvers whose hyperparameters share names but not types #221
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.
Optuna suggestion could raise error when a subbrick could take 2 different classes that have both an hyperparameter with same name but of a different kind. (For instance one being an
IntegerHyperparameter
, the other being aCategoricalHyperparameter
).To avoid this issue, we update the hyperparameter prefix when seen as a parameter of an optuna trial to include the actual class name of the chosen subbrick.
For example,
Here the trial params will be
(subsolver, subsolver.LPSolver.hp)
(subsolver, subsolver.CPSolver.hp, subsolver.CPSolver.coeff)
We modify
DummySolver2
in test_hyperparameters.py so that the issue raised in the tests before the fix and the tests are ok with it.NB: The issue could still arise if a subbrick could be of two different classes with same name (but from different modules) that also share same hyperparameter name of different type. This is higly unlikely to happen and could not justify having the whole path including the module to be inserted in the prefix. This would lead to a very unreadable parameter name in optuna trial.