Skip to content

OptunaのBoTorchSamplerのためのcandidates_funcの実装例および実験管理

Notifications You must be signed in to change notification settings

dai08srhg/botorchsampler-candidate_funcs

Repository files navigation

botorch-sampler-candidates-func

OptunaのBoTorchSamplerのためのcandidates_funcを実装

optuna.integration.BoTorchSampler

class optuna.integration.BoTorchSampler(*, candidates_func=None, constraints_func=None, n_startup_trials=10, independent_sampler=None, seed=None)
  • candidates_func (Optional[Callable[[torch.Tensor, torch.Tensor, Optional[torch.Tensor], torch.Tensor], torch.Tensor]]) –
    An optional function that suggests the next candidates. It must take the training data, the objectives, the constraints, the search space bounds and return the next candidates. The arguments are of type torch.Tensor. The return value must be a torch.Tensor. However, if constraints_func is omitted, constraints will be None. For any constraints that failed to compute, the tensor will contain NaN.
    If omitted, it is determined automatically based on the number of objectives. If the number of objectives is one, Quasi MC-based batch Expected Improvement (qEI) is used. If the number of objectives is either two or three, Quasi MC-based batch Expected Hypervolume Improvement (qEHVI) is used. Otherwise, for larger number of objectives, the faster Quasi MC-based extended ParEGO (qParEGO) is used.

candidates_func

以下のcandidates_funcを実装

  • Single Objective
    • qEI (Gamma Prior)
    • qEI (Dim-scale lognormal Prior)
    • qEI (SAAS)
    • qLogEI (Gamma Prior)
    • qLogEI (Dim-scale lognormal Prior)
    • LCB
    • Thompson Sampling
  • Multi Objective
    • qEHVI
    • qLogEHVI

Remarks

  • Use BoTorch==0.12.0
  • candidates_funcを指定しない場合はqEIもしくはqEHVIが利用されると記載されているが,実際にはqLogEI, qLogEHVIが利用されている模様.

Sample

Build image

$ docker compose up --build

Run experiment

$ python main.py 

Run experiment: StyblinskiTang40
Start trial:1
Start optimization using TPE
100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:06<00:00, 14.98it/s]

About

OptunaのBoTorchSamplerのためのcandidates_funcの実装例および実験管理

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published