optuna.distributions.CategoricalDistribution

class optuna.distributions.CategoricalDistribution(choices)[source]

カテゴリカル分布を表すクラス。

suggest_categorical() によって生成され、 samplers モジュールで使用されます。

Parameters:

choices (Sequence[CategoricalChoiceType]) – パラメータ値の候補。少なくとも1つの要素が必要です。

Note

すべての型がすべてのストレージ形式と互換性があるわけではありません。 選択肢の型は None, bool, int, float, str に限定することが推奨されます。

choices

パラメータ値の候補。

メソッド

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.

single()[source]

この分布の範囲が単一の値のみを含むかどうかを判定します。

Returns:

範囲が単一の値のみを含む場合 True、それ以外の場合 False

Return type:

bool

to_external_repr(param_value_in_internal_repr)[source]

パラメータ値の内部表現を外部表現に変換します。

Parameters:

param_value_in_internal_repr (float) – パラメータ値の内部表現。

Returns:

パラメータ値の外部表現。

Return type:

None | bool | int | float | str