说明问题的代码示例:
from ray import tune
def objective(step, alpha, beta):
return (0.1 + alpha * step / 100)**(-1) + beta * 0.1
def training_function(config):
# Hyperparameters
alpha, beta = config["alpha"], config["beta"]
for step in range(10):
# Iterative training function - can be any arbitrary training procedure.
intermediate_score = objective(step, alpha, beta)
# Feed the score back back to Tune.
tune.report(mean_loss=intermediate_score)
analysis = tune.run(
training_function,
config={
"alpha": tune.grid_search([0.001, 0.01, 0.1]),
"beta": tune.choice(list(range(10000)))
},
num_samples=1000000)
我面临的问题是,在开始执行第一次试验之前,tune.run
调用将强制采样搜索空间时间。num_samples
问题:是否可以在每次试用后制作 Tune 样本搜索空间?
可以使用wrapper around search algorithm来限制tune.suggest.Searcher
-descendant 算法(AxSearch
例如)的并发试验次数。ConcurrencyLimiter
但是我怎样才能为随机搜索做到这一点?