autogluon.common.space

搜索空间

您可以使用 AutoGluon 搜索空间执行 HPO。有关高层概述,请参阅此示例

from autogluon.common import space

categorical_space = space.Categorical('a', 'b', 'c', 'd')  # Nested search space for hyperparameters which are categorical.
real_space = space.Real(0.01, 0.1)  # Search space for numeric hyperparameter that takes continuous values
int_space = space.Int(0, 100)  # Search space for numeric hyperparameter that takes integer values
bool_space = space.Bool()  # Search space for hyperparameter that is either True or False.

有关如何使用搜索空间执行 HPO,请查看表格数据深入教程

分类

class autogluon.common.space.Categorical(*data)[source]
用于分类超参数的嵌套搜索空间。此类超参数从提供的离散选项集中取一个值。

选项列表中的第一个值将是 HPO 期间首先尝试的默认值。

参数:

data (Spacepython 内置对象) – 选项候选项

示例

>>> a = Categorical('a', 'b', 'c', 'd')  # 'a' will be default value tried first during HPO

实数

class autogluon.common.space.Real(lower, upper, default=None, log=False)[source]

用于取连续值的数值超参数的搜索空间。

参数:
  • lower (float) – 搜索空间的下界(超参数的最小可能值)

  • upper (float) – 搜索空间的上界(超参数的最大可能值)

  • default (float (可选)) – 超参数优化期间首先尝试的默认值

  • log ((True/False)) – 是否在对数而非线性尺度上搜索值。这对于搜索空间跨越多个数量级的数值超参数(例如学习率)非常有用。

示例

>>> learning_rate = Real(0.01, 0.1, log=True)

整型

class autogluon.common.space.Int(lower, upper, default=None)[source]

用于取整数值的数值超参数的搜索空间。

参数:
  • lower (int) – 搜索空间的下界(超参数的最小可能值)

  • upper (int) – 搜索空间的上界(超参数的最大可能值)

  • default (int (可选)) – 超参数优化期间首先尝试的默认值

示例

>>> range = Int(0, 100)

布尔型

class autogluon.common.space.Bool[source]
用于取 True 或 False 的超参数的搜索空间。

Bool()Categorical(True, False) 的简写。

示例

>>> pretrained = Bool()