Reinforcement Learning model

Thompson Sampling

A Bayesian approach to multi-armed bandits using probability matching.

Thompson Sampling is a Bayesian algorithm for the multi-armed bandit problem. It maintains a probability distribution for each action's reward and samples from these distributions to select actions. This naturally balances exploration and exploitation.

Formula

θ ~ Beta(α + successes, β + failures)

How it works

  • Initialize prior distribution for each action (e.g., Beta(1,1))
  • Sample from posterior distribution of each action
  • Select action with highest sampled value
  • Observe reward and update posterior
  • Posteriors become more confident over time

When to use it

  • For probabilistic action selection
  • When uncertainty matters
  • For online learning scenarios
  • In recommendation systems
  • For adaptive experiments

Advantages

  • Naturally handles uncertainty
  • Often outperforms UCB
  • Incorporates prior knowledge
  • Automatic exploration decay
  • Works well in practice

Limitations

  • Requires prior specification
  • Computational overhead for sampling
  • Posterior may be complex
  • Analysis is more difficult
  • May be slow for complex models

Example uses

  • A/B testing
  • Personalization
  • Drug dosage optimization
  • Portfolio selection
  • Ad placement

Need a model built on your data?

Tell us the decision you want to improve. We will tell you whether your data can support it and which approach fits.