optuna.distributions¶
-
class
optuna.distributions.UniformDistribution(low: float, high: float)[source]¶ A uniform distribution in the linear domain.
This object is instantiated by
suggest_uniform(), and passed tosamplersin general.-
low¶ Lower endpoint of the range of the distribution.
lowis included in the range.
-
high¶ Upper endpoint of the range of the distribution.
highis excluded from the range.
-
-
class
optuna.distributions.LogUniformDistribution(low: float, high: float)[source]¶ A uniform distribution in the log domain.
This object is instantiated by
suggest_loguniform(), and passed tosamplersin general.-
low¶ Lower endpoint of the range of the distribution.
lowis included in the range.
-
high¶ Upper endpoint of the range of the distribution.
highis excluded from the range.
-
-
class
optuna.distributions.DiscreteUniformDistribution(low: float, high: float, q: float)[source]¶ A discretized uniform distribution in the linear domain.
This object is instantiated by
suggest_discrete_uniform(), and passed tosamplersin general.Note
If the range \([\mathsf{low}, \mathsf{high}]\) is not divisible by \(q\), \(\mathsf{high}\) will be replaced with the maximum of \(k q + \mathsf{low} \lt \mathsf{high}\), where \(k\) is an integer.
-
low¶ Lower endpoint of the range of the distribution.
lowis included in the range.
-
high¶ Upper endpoint of the range of the distribution.
highis included in the range.
-
q¶ A discretization step.
-
-
class
optuna.distributions.IntUniformDistribution(low: int, high: int, step: int = 1)[source]¶ A uniform distribution on integers.
This object is instantiated by
suggest_int(), and passed tosamplersin general.Note
If the range \([\mathsf{low}, \mathsf{high}]\) is not divisible by \(\mathsf{step}\), \(\mathsf{high}\) will be replaced with the maximum of \(k \times \mathsf{step} + \mathsf{low} \lt \mathsf{high}\), where \(k\) is an integer.
-
low¶ Lower endpoint of the range of the distribution.
lowis included in the range.
-
high¶ Upper endpoint of the range of the distribution.
highis included in the range.
-
step¶ A step for spacing between values.
-
-
class
optuna.distributions.IntLogUniformDistribution(low: int, high: int, step: int = 1)[source]¶ A uniform distribution on integers in the log domain.
This object is instantiated by
suggest_int(), and passed tosamplersin general.Note
If the range \([\mathsf{low}, \mathsf{high}]\) is not divisible by \(\mathsf{step}\), \(\mathsf{high}\) will be replaced with the maximum of \(k \times \mathsf{step} + \mathsf{low} \lt \mathsf{high}\), where \(k\) is an integer.
-
low¶ Lower endpoint of the range of the distribution.
lowis included in the range.
-
high¶ Upper endpoint of the range of the distribution.
highis included in the range.
-
step¶ A step for spacing between values.
-
-
class
optuna.distributions.CategoricalDistribution(choices: Sequence[CategoricalChoiceType])[source]¶ A categorical distribution.
This object is instantiated by
suggest_categorical(), and passed tosamplersin 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,floatandstr.-
choices¶ Parameter value candidates.
-
optuna.distributions.distribution_to_json(dist: optuna.distributions.BaseDistribution) → str[source]¶ Serialize a distribution to JSON format.
- Parameters
dist – A distribution to be serialized.
- Returns
A JSON string of a given distribution.
-
optuna.distributions.json_to_distribution(json_str: str) → optuna.distributions.BaseDistribution[source]¶ Deserialize a distribution in JSON format.
- Parameters
json_str – A JSON-serialized distribution.
- Returns
A deserialized distribution.
-
optuna.distributions.check_distribution_compatibility(dist_old: optuna.distributions.BaseDistribution, dist_new: optuna.distributions.BaseDistribution) → None[source]¶ A function to check compatibility of two distributions.
Note that this method is not supposed to be called by library users.
- Parameters
dist_old – A distribution previously recorded in storage.
dist_new – A distribution newly added to storage.
- Returns
True denotes given distributions are compatible. Otherwise, they are not.