optuna.distributions.CategoricalDistribution¶
-
class
optuna.distributions.
CategoricalDistribution
(choices)[source]¶ A categorical distribution.
This object is instantiated by
suggest_categorical()
, and passed tosamplers
in general.- Parameters
choices – Parameter value candidates.
Note
Not all types are guaranteed to be compatible with all storages. It is recommended to restrict the types of the choices to
None
,bool
,int
,float
andstr
.-
choices
¶ Parameter value candidates.
- Raises
ValueError – If
choices
do not contain any elements.
Methods
single
()Test whether the range of this distribution contains just a single value.
to_external_repr
(param_value_in_internal_repr)Convert internal representation of a parameter value into external representation.
to_internal_repr
(param_value_in_external_repr)Convert external representation of a parameter value into internal representation.
-
to_external_repr
(param_value_in_internal_repr)[source]¶ Convert internal representation of a parameter value into external representation.