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,请查看Tabular Indepth Tutorial
分类¶
- class autogluon.common.space.Categorical(*data)[source]¶
- Nested search space for hyperparameters which are categorical. Such a hyperparameter takes one value out of the discrete set of provided options.
选项列表中的第一个值将是在HPO期间首先尝试的默认值。
- Parameters:
data (Space 或 python 内置对象) – 选择的候选对象
示例
>>> 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]¶
用于取连续值的数值超参数的搜索空间。
- Parameters:
lower (float) – 搜索空间的下限(超参数的最小可能值)
upper (float) – 搜索空间的上限(超参数的最大可能值)
默认值 (浮点数 (可选)) – 在超参数优化期间首先尝试的默认值
log ((True/False)) – 是否在对数尺度而非线性尺度上搜索值。这对于数值超参数(如学习率)非常有用,其搜索空间跨越多个数量级。
示例
>>> learning_rate = Real(0.01, 0.1, log=True)