optuna.distributions.IntDistribution
- class optuna.distributions.IntDistribution(low, high, log=False, step=1)[source]
A distribution on integers.
This object is instantiated by
suggest_int()
, and passed tosamplers
in general.Note
When
step
is notNone
, 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.- low
Lower endpoint of the range of the distribution.
low
is included in the range.low
must be less than or equal tohigh
. Iflog
isTrue
,low
must be larger than or equal to 1.
- high
Upper endpoint of the range of the distribution.
high
is included in the range.high
must be greater than or equal tolow
.
- log
If
log
isTrue
, this distribution is in log-scaled domain. In this case, all parameters enqueued to the distribution must be positive values. This parameter must beFalse
when the parameterstep
is not 1.
- step
A discretization step.
step
must be a positive integer. This parameter must be 1 when the parameterlog
isTrue
.
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.