Module: ClassicBandit::ArmUpdatable
- Included in:
- EpsilonGreedy, Softmax, ThompsonSampling, Ucb1
- Defined in:
- lib/classic_bandit/arm_updatable.rb
Overview
Provides common update functionality for bandit algorithms to update arm statistics with observed rewards.
Instance Method Summary collapse
-
#update(arm, reward) ⇒ Object
Update the selected arm with the observed reward.
Instance Method Details
#update(arm, reward) ⇒ Object
Update the selected arm with the observed reward
18 19 20 21 22 23 |
# File 'lib/classic_bandit/arm_updatable.rb', line 18 def update(arm, reward) validate_reward!(reward) arm.trials += 1 arm.successes += reward end |