gpt4 book ai didi

python-3.x - 'num_samples' 在 Tune of Ray 包中用于超参数优化的目的

转载 作者:行者123 更新时间:2023-12-03 21:47:43 25 4
gpt4 key购买 nike

我正在尝试使用 Tune 为 LSTM(纯 Tensorflow)执行超参数优化任务.我在 hyperopt 上遵循了他们的示例算法。在示例中,他们在“配置”部分中使用了以下行。

"num_samples": 10 if args.smoke_test else 1000,



文档没有解释这是什么。我无法确定这是否是一段有用的代码,或者我应该如何为我的场景更改它。所以如果我能知道这行代码的含义就太好了。

可以通过 this link 找到示例 hyperopt 代码。

最佳答案

您可以找到参数 in the documentation of run_experiments .

By default, each random variable and grid search point is sampled once. To take multiple random samples, add num_samples: N to the experiment config. If grid_search is provided as an argument, the grid will be repeated num_samples of times.



本质上,该参数是配置的一部分,可用于对数据进行多次采样,而不仅仅是一次。

但是您的演示代码使用 run_experiment :
config = {
"my_exp": {
"run": "exp",
"num_samples": 10 if args.smoke_test else 1000,
"config": {
"iterations": 100,
},
"stop": {
"timesteps_total": 100
},
}
}
algo = HyperOptSearch(space, max_concurrent=4, reward_attr="neg_mean_loss")
scheduler = AsyncHyperBandScheduler(reward_attr="neg_mean_loss")
run_experiments(config, search_alg=algo, scheduler=scheduler) # here the config is passed

关于python-3.x - 'num_samples' 在 Tune of Ray 包中用于超参数优化的目的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53997000/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com