To estimate an arm's value you could store every reward it ever gave and average them, but that needs ever-growing memory. The same average can be maintained with just the current estimate and a count.
Implement update_action_value(q_values, counts, action, reward). Increment the pulled arm's count and move its estimate toward the new reward by 1 / count of the gap.
q_values is a float array and counts an integer array, one entry per arm.(q_values, counts); do not modify the inputs.Open one at a time. Each gives away a little more than the last.
Increase counts[action] first, so the first-ever reward uses a step size of exactly 1.
The update is q += (reward - q) / n.
No results yet
Run your code to check it against the examples, or submit to run every test.