Search code examples
optuna

How to set n_trials for multiple processes when using parallelization?


When I execute code without parallel computation, n_trials in the optimize function means how many trials the program runs. When executed via parallel computation (following the tutorial here via launching it again in another console), it does n_trials for each process, not for all the sum of processes like I would like.

Is there a way to make sure that the sum of all parallel processes' trials are equal to a fixed number, regardless of how many process I launch?


Solution

  • Yes, MaxTrialsCallback is the exact feature for such a situation.