当我 add/remove 在 Optuna 研究期间动态设置参数时会发生什么?

What happens when I add/remove parameters dynamically during an Optuna study?

Optuna 的常见问题解答在研究期间动态调整参数范围时有一个 clear answer:它不会造成任何问题,因为每个采样器都是单独定义的。

但是添加 and/or 删除参数呢? 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.