optuna.distributions.IntUniformDistribution

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

整数上的均匀分布。

此对象由 suggest_int() 实例化,并通常传递给 samplers

备注

如果范围 \([\mathsf{low}, \mathsf{high}]\) 不能被 \(\mathsf{step}\) 整除,\(\mathsf{high}\) 将被替换为满足 \(k \times \mathsf{step} + \mathsf{low} < \mathsf{high}\) 的最大值,其中 \(k\) 是整数。

参数:
low

分布范围的下端点。low 包含在范围内。low 必须小于或等于 high

high

分布范围的上限。high 包含在范围内。high 必须大于或等于 low

step

一个离散化步骤。step 必须是一个正整数。

警告

在 v3.0.0 中已弃用。此功能将在未来被移除。该功能的移除目前计划在 v6.0.0 进行,但此计划可能会更改。请参阅 https://github.com/optuna/optuna/releases/tag/v3.0.0

使用 IntDistribution 代替。

方法

single()

测试此分布的范围是否仅包含一个值。

to_external_repr(param_value_in_internal_repr)

将参数值的内部表示转换为外部表示。

to_internal_repr(param_value_in_external_repr)

将参数值的外部表示转换为内部表示。

single()

测试此分布的范围是否仅包含一个值。

返回:

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

返回类型:

bool

to_external_repr(param_value_in_internal_repr)

将参数值的内部表示转换为外部表示。

参数:

param_value_in_internal_repr (float) – Optuna 内部表示的参数值。

返回:

Optuna 的参数值的外部表示。

返回类型:

int

to_internal_repr(param_value_in_external_repr)

将参数值的外部表示转换为内部表示。

参数:

param_value_in_external_repr (int) – Optuna 的参数值的外部表示。

返回:

Optuna 内部表示的参数值。

返回类型:

float