Prepare the data
Specify several Bernoulli arms and retain their true rates only for simulation evaluation.
Balance exploration with what already works.
A multi-armed bandit allocates actions while learning unknown reward rates. Comparing policies under a known simulator reveals the cost of exploration and the effect of changing rewards.
Learning concept · Not a validated service
A multi-armed bandit allocates actions while learning unknown reward rates. Comparing policies under a known simulator reveals the cost of exploration and the effect of changing rewards.
A possible application for experiment-design instructors: Let experiment-design students compare allocation strategies without exposing real users. This extension is not delivered by the supplied starter.
Specify several Bernoulli arms and retain their true rates only for simulation evaluation.
Implement epsilon-greedy and UCB policies with incremental action-value updates.
Plot cumulative pseudo-regret across repeated seeds and add a changing-reward scenario.
Create a simulation dashboard with action counts, regret and reproducible seeds.
The supplied NumPy simulation uses four fixed Bernoulli reward rates and an epsilon-greedy policy with epsilon 0.1 over 2,000 rounds. It prints action counts, estimated reward rates and total reward.
for step in range(1, 2001):
if rng.random() < epsilon:
action = rng.integers(len(true_reward_rates))
else:
action = int(np.argmax(estimated_values))
reward = 1 if rng.random() < true_reward_rates[action] else 0
action_counts[action] += 1
total_reward += reward
estimated_values[action] += (
reward - estimated_values[action]
) / action_counts[action]The source implements epsilon-greedy only; it has no policy comparison or regret analysis. The environment has stationary rewards and no state transitions. A single seeded run does not establish policy quality; compare regret across repeated simulations before considering any live experiment.
Proposed extension: Let experiment-design students compare allocation strategies without exposing real users.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its AI Engineer Course, with placement support and hands-on labs.