python - 当我在 Optuna 研究期间动态添加/删除参数时会发生什么?

标签 python optuna

Optuna 的常见问题解答有 clear answer当涉及到在研究过程中动态调整参数范围时:这不会造成任何问题,因为每个采样器都是单独定义的。

但是添加和/或删除参数又如何呢? Optuna 能够处理此类调整吗?

在执行此操作时我注意到的一件事是,在结果数据框中,这些参数会获取其他试验的 nan 条目。能够将这些 nan 设置为未采样时的(默认)值会有什么好处吗?考虑到所有这些未知的值,这项研究仍然合理吗?

最佳答案

问题已得到解答here :

Thanks for the question. Optuna internally supports two types of sampling: optuna.samplers.BaseSampler.sample_independent and optuna.samplers.BaseSampler.sample_relative.

The former optuna.samplers.BaseSampler.sample_independent is a method that samples independently on each parameter, and is not affected by the addition or removal of parameters. The added parameters are taken into account from the timing when they are added.

The latter optuna.samplers.BaseSampler.sample_relative is a method that samples by considering the correlation of parameters and is affected by the addition or removal of parameters. Optuna's default search space for correlation is the product set of the domains of the parameters that exist from the beginning of the hyperparameter tuning to the present. Developers who implement samplers can implement their own search space calculation method optuna.samplers.BaseSampler.infer_relative_search_space. This may allow correlations to be considered for hyperparameters that have been added or removed, but this depends on the sampling algorithm, so there is no API for normal users to modify.

关于python - 当我在 Optuna 研究期间动态添加/删除参数时会发生什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65362133/

相关文章:

python - Optuna 从 "outside"传递参数字典

pytorch - 针对验证损失的 Optuna 剪枝

python - 在 C++ 程序中嵌入 python-opencv 的问题(单张图片正常,但在网络摄像头上失败)

python - 在 Python 上出现异常时如何将 try/except 与 Selenium Webdriver 一起使用

python - xgboost 的 alpha、lambda 和 gamma 正则化参数有什么区别?

python - 生成 optuna 网格的函数提供了 sklearn 管道

python - InteractiveInterpreter.runco​​de 和 exec 函数之间的区别?

Python - 网络抓取 pubmed.gov 摘要 w/BeautifulSoup - 出现 nonetype 错误

python - 从另一个进程正在使用的文件中读取