Skip to main content

Module bayesian

Module bayesian 

Source
Expand description

Bayesian building blocks and an online operator-parameter tuner.

This module provides:

  • Honest conjugate posteriors that say what they are: BetaPosterior (Beta-Bernoulli over a probability), GammaPosterior (Gamma-Exponential over a positive rate), and RunningLogMoments (a moment tracker for log-scale quantities — not a Bayesian posterior, and named accordingly).
  • A ThompsonSamplingTuner: a genuine multi-armed-bandit tuner for GA operator parameters. Each tunable parameter is discretized into candidate values (“arms”); each arm carries a Beta posterior over P(offspring improves on parents | this value is used). Every generation an arm is Thompson-sampled per parameter and its value is applied to the operators; the observed improvement events are credited back to the arm that produced them.

The Beta draw taken during Thompson sampling is used only to pick an arm; it is never returned as the parameter value itself. This is the correct separation that the previous BayesianHyperparameterLearner got wrong (it sampled a P(improvement) posterior and used the draw as the mutation rate).

Structs§

BanditArm
One discretized candidate value for a tunable parameter, with a Beta posterior over P(offspring improves on parents | this value is used).
BanditParameter
A single tunable parameter, discretized into arms and tuned by Thompson sampling over each arm’s Beta posterior.
BetaPosterior
Beta distribution posterior for a probability parameter (Beta-Bernoulli).
GammaPosterior
Gamma posterior for the rate λ of an Exponential(λ) likelihood.
RunningLogMoments
Running mean/variance of ln(x) for positive quantities such as step sizes.
ThompsonConfig
Configuration for a ThompsonSamplingTuner wired into a GA.
ThompsonSamplingTuner
Thompson-sampling multi-armed-bandit tuner over GA operator parameters.
TunerSnapshot
A snapshot of a tuner’s per-arm posterior means at one generation.

Constants§

PARAM_CROSSOVER_PROB
Canonical parameter name for the whole-genome crossover probability arm set.
PARAM_MUTATION_RATE
Canonical parameter name for the per-gene mutation probability arm set.

Traits§

TunableMutation
Mutation operators whose per-gene mutation probability can be set by an online tuner such as ThompsonSamplingTuner.