optuna.distributions.IntUniformDistribution

class optuna.distributions.IntUniformDistribution(low, high, step=1)[source]

A uniform distribution on integers.

This object is instantiated by suggest_int(), and passed to samplers in 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} < \mathsf{high}\), where \(k\) is an integer.

Parameters
  • low (int) –

  • high (int) –

  • step (int) –

low

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

high

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

step

A discretization step. step must be a positive integer.

Warning

Deprecated in v3.0.0. This feature will be removed in the future. The removal of this feature is currently scheduled for v6.0.0, but this schedule is subject to change. See https://github.com/optuna/optuna/releases/tag/v3.0.0.

Use IntDistribution instead.

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.

single()

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

int

to_internal_repr(param_value_in_external_repr)

Convert external representation of a parameter value into internal representation.

Parameters

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

Returns

Optuna’s internal representation of a parameter value.

Return type

float