Tune.Optimizers.TPE (Tune v0.5.0)

Copy Markdown View Source

A categorical Tree-structured Parzen Estimator.

Each dimension is a categorical choice 0..n-1. The first n_startup suggestions are uniform. After that, observations are split into a good group (the best min(ceil(gamma * n), 25) scores, higher is better) and a bad group. For each dimension independently, smoothed category densities l(x) and g(x) are computed with a uniform prior of weight prior_weight; n_candidates values are sampled from l and the one with the highest l(x) / g(x) is chosen, earliest on ties.

This follows the documented behavior of Optuna's independent categorical TPE sampler. It does not reproduce Optuna's random number stream, multivariate mode, or Parzen weighting of older trials.

Summary

Functions

Builds a sampler for a space of dimension name to category count.

Suggests one choice from {choice, score} observations.

Types

choice()

@type choice() :: %{required(String.t()) => non_neg_integer()}

t()

@type t() :: %Tune.Optimizers.TPE{
  gamma: float(),
  n_candidates: pos_integer(),
  n_startup: non_neg_integer(),
  prior_weight: float(),
  space: %{required(String.t()) => pos_integer()}
}

Functions

new(space, opts \\ [])

@spec new(%{required(String.t()) => pos_integer()}, keyword()) :: t()

Builds a sampler for a space of dimension name to category count.

suggest(tpe, observations, ctx)

Suggests one choice from {choice, score} observations.