Are Q-learning and SARSA with greedy selection equivalent?

前端 未结 3 650
星月不相逢
星月不相逢 2021-02-09 11:08

The difference between Q-learning and SARSA is that Q-learning compares the current state and the best possible next state, whereas SARSA compares the current state against the

相关标签:
3条回答
  • 2021-02-09 11:33

    Well, not actually. A key difference between SARSA and Q-learning is that SARSA is an on-policy algorithm (it follows the policy that is learning) and Q-learning is an off-policy algorithm (it can follow any policy (that fulfills some convergence requirements).

    Notice that in the following pseudocode of both algorithms, that SARSA choose a' and s' and then updates the Q-function; while Q-learning first updates the Q-function, and the next action to perform is selected in the next iteration, derived from the updated Q-function and not necessarily equal to the a' selected to update Q.

    In any case, both algorithms require exploration (i.e., taking actions different from the greedy action) to converge.

    The pseudocode of SARSA and Q-learning have been extracted from Sutton and Barto's book: Reinforcement Learning: An Introduction (HTML version)

    0 讨论(0)
  • 2021-02-09 11:44

    If we use only the greedy policy then there will be no exploration so the learning will not work. In the limiting case where epsilon goes to 0 (like 1/t for example), then SARSA and Q-Learning would converge to the optimal policy q*. However with epsilon being fixed, SARSA will converge to the optimal epsilon-greedy policy while Q-Learning will converge to the optimal policy q*.

    I write a small note here to explain the differences between the two and hope it can help:

    https://tcnguyen.github.io/reinforcement_learning/sarsa_vs_q_learning.html

    0 讨论(0)
  • 2021-02-09 11:44

    If an optimal policy has already formed, SARSA with pure greedy and Q-learning are same.

    However, in training, we only have a policy or sub-optimal policy, SARSA with pure greedy will only converge to the "best" sub-optimal policy available without trying to explore the optimal one, while Q-learning will do, because of , which means it tries all actions available and choose the max one.

    0 讨论(0)
提交回复
热议问题