gpt4 book ai didi

Python:可以支持多处理的 hyperopt 的替代方案?

转载 作者:行者123 更新时间:2023-12-01 02:03:13 25 4
gpt4 key购买 nike

除了HyperOpt之外,还有其他可以支持超参数搜索多重处理的吗?我知道HyperOpt可以配置为使用MongoDB,但似乎很容易出错并且在杂草中度过一周,有什么更受欢迎的吗有效吗?

最佳答案

查看射线调整!

您可以将其用于随机搜索、网格搜索和进化方法的多处理和多机执行。它还实现了 HyperBand 等流行算法。

这是文档页面 - ray.readthedocs.io/en/latest/tune.html

作为一次运行 4 个并行实验的示例:

import ray
import ray.tune as tune


def my_func(config, reporter): # add the reporter parameter
import time, numpy as np
i = 0
while True:
reporter(timesteps_total=i,
mean_accuracy=i ** config["alpha"])
i += 1
time.sleep(.01)


tune.register_trainable("my_func", my_func)
ray.init(num_cpus=4)
tune.run_experiments({
"my_experiment": {
"run": "my_func",
"stop": { "mean_accuracy": 100 },
"config": {
"alpha": tune.grid_search([0.2, 0.4, 0.6]),
"beta": tune.grid_search([1, 2]) } } })

免责声明:我从事这个项目 - 如果您有任何反馈,请告诉我!

关于Python:可以支持多处理的 hyperopt 的替代方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49373721/

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