How do you enumerate every combination of discrete tuning choices?

product generates a Cartesian product, choosing one item from each input pool for every tuple.

Python example and interpretation

Two batch sizes and two learning rates yield four trials. The input pools are collected in advance and must themselves be finite.

from itertools import product
list(product([8,16],[0.1,0.01]))

Result [(8, 0.1), (8, 0.01), (16, 0.1), (16, 0.01)]

中文

怎样系统枚举多个离散超参数的全部组合?

product 生成输入集合的笛卡尔积,每个输出元组从每个集合各取一个值。

Python 算例与适用条件

两个批次大小和两个学习率产生四个试验。它会预先保存各输入池,因此池本身应当有限。

from itertools import product
list(product([8,16],[0.1,0.01]))

结果 [(8, 0.1), (8, 0.01), (16, 0.1), (16, 0.01)]

References / 参考来源

Keep reading / 继续阅读