Problem
A retail team wants the best price for a product across many stores. Stores differ in demand level and demand changes with the season. Plain multi-armed bandits assume every response comes from one distribution. That forces store grouping and manual handling of trends. Testing bad prices in live stores costs margin.
Example from the article: 300 simulated stores, five candidate prices from 40 to 56, weekly Poisson sales with store-specific levels and an annual seasonal cycle.
Solution in brief
Use a contextual bandit. A demand model takes the store and the week as context and predicts sales for any price on the grid. Each week, Thompson sampling (TS) or the upper confidence bound (UCB) rule picks the price with the highest expected margin. On synthetic data, cumulative regret over 11 weeks was 0.55-0.66% with a Bayesian linear regression and 1.4-2.0% with a Gaussian process.
Questions this case answers
- How to choose an action from a discrete grid when the response depends on unit-level context and a time cycle, and exploration is costly
- How to compare bandit strategies and response models offline on synthetic data, using regret and the share of chosen actions
- How to choose the best price from a grid when stores differ in demand level and demand has seasonality?
- How to run Thompson sampling or UCB for prices with a demand model that takes store and week into account?
Tools and methods
- Contextual multi-armed bandit — picks a price per store and week.
- Thompson sampling — samples demand parameters, takes the best price.
- UCB — takes the price with the best mean plus standard deviations.
- Bayesian Poisson regression, MCMC (NUTS) in PyMC — linear demand model.
- Sparse Gaussian process with deep kernel learning (pyro) — nonlinear demand model.
Google or a one-time email code. No password.
