Describe the bug When using BayesianOptimization with CategoricalParameter, I need to pass pbounds as Sequence[Any], but in __init__ the pbounds parameter is typed as Mapping[str, tuple[float, float]]. This type inconsistency should be fixed — pbounds should use BoundsMapping type like in TargetSpace.
To Reproduce
from bayes_opt import BayesianOptimization, CategoricalParameter
# Example with categorical parameter
pbounds = {
'x': (2, 4),
'category': ['option_a', 'option_b', 'option_c'] # CategoricalParameter needs Sequence[Any]
}
optimizer = BayesianOptimization(
f=lambda x, category: x ** 2,
pbounds=pbounds
)
Describe the bug When using
BayesianOptimizationwithCategoricalParameter, I need to passpboundsasSequence[Any], but in__init__thepboundsparameter is typed asMapping[str, tuple[float, float]]. This type inconsistency should be fixed —pboundsshould useBoundsMappingtype like inTargetSpace.To Reproduce