optuna.distributions.FloatDistribution

class optuna.distributions.FloatDistribution(low, high, log=False, step=None)[source]

A distribution on floats.

This object is instantiated by suggest_float(), and passed to samplers in general.

Note

When step is not None, 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} < \mathsf{high}$$, where $$k$$ is an integer.

Parameters
low

Lower endpoint of the range of the distribution. low is included in the range. low must be less than or equal to high. If log is True, low must be larger than 0.

high

Upper endpoint of the range of the distribution. high is included in the range. high must be greater than or equal to low.

log

If log is True, this distribution is in log-scaled domain. In this case, all parameters enqueued to the distribution must be positive values. This parameter must be False when the parameter step is not None.

step

A discretization step. step must be larger than 0. This parameter must be None when the parameter log is True.

Methods

 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]

Test whether the range of this distribution contains just a single value.

Returns

True if the range of this distribution contains just a single value, otherwise False.

Return type

bool

to_external_repr(param_value_in_internal_repr)

Convert internal representation of a parameter value into external representation.

Parameters

param_value_in_internal_repr (float) – Optuna’s internal representation of a parameter value.

Returns

Optuna’s external representation of a parameter value.

Return type

Any

to_internal_repr(param_value_in_external_repr)[source]

Convert external representation of a parameter value into internal representation.

Parameters

param_value_in_external_repr (float) – Optuna’s external representation of a parameter value.

Returns

Optuna’s internal representation of a parameter value.

Return type

float