Explore Library
Code QuizIntermediate

Exploration vs Exploitation Value

Find the swapped weights in this expected epsilon-greedy value.

Codejavascript
function epsilonGreedyValue(Q, s, epsilon) {
  const n = Q[s].length;
  const greedy = Math.max(...Q[s]);
  const avg = Q[s].reduce((a, b) => a + b, 0) / n;
  // expected value: exploit greedy vs explore uniformly
  return epsilon * greedy + (1 - epsilon) * avg;
}

What is the bug in this expected-value calculation?