# optuna.distributions.IntUniformDistribution¶

class optuna.distributions.IntUniformDistribution(low, high, step=1)[源代码]

A uniform distribution on integers.

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

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.

high

Upper endpoint of the range of the distribution. high is included in the range.

step

A step for spacing between values.

ValueError – If low value is larger than high value, or step value is smaller or equal to 0.

• low (int) –

• high (int) –

• step (int) –

None

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()[源代码]

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

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

bool

to_external_repr(param_value_in_internal_repr)[源代码]

Convert internal representation of a parameter value into external representation.

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

Optuna’s external representation of a parameter value.

int

to_internal_repr(param_value_in_external_repr)[源代码]

Convert external representation of a parameter value into internal representation.

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

Optuna’s internal representation of a parameter value.

float