« Back to top page

Parallel

Parallel

Batch Sampler

Abstract BatchSampler solves a coordination problem that arises when running Optuna with multiple workers (n_jobs > 1). With default samplers, each worker calls sample_relative concurrently and sees the same incomplete view of the trial history — pending trials from the same batch are invisible to one another. This causes workers to suggest near-duplicate configurations, wasting the throughput gained from parallelism. BatchSampler uses a shared lock to coordinate workers: the first worker to find an empty cache calls a user-supplied suggest_fn once to obtain q suggestions jointly, then hands them out one at a time.

Max-value Entropy Search Samplers (sequential and batch)

Class or Function Names MESSampler GIBBONSampler Installation pip install scipy torch Overview Optuna’s acquisition functions all score a candidate by improvement over the incumbent (LogEI, LogPI) or by a posterior quantile (UCB, LCB). Max-value entropy search scores it instead by information: how much observing f(x) is expected to reduce the entropy of the distribution of the maximum value y* = max_x f(x). Writing mu(x), sigma(x) for the posterior mean and standard deviation, phi and Psi for the standard normal PDF and CDF, and gamma = (y* - mu(x)) / sigma(x), the acquisition is