SARSA
SARSA (State-Action-Reward-State-Action) is an on-policy temporal difference learning algorithm used in reinforcement learning to estimate the value of a state-action pair. It is an extension of the Q-learning algorithm and was developed by Rummery and Niranjan in 1994. SARSA is an iterative algorithm that learns the value of a state-action pair by repeatedly taking an action in a state and observing the resulting reward and next state. The value of the state-action pair is then updated based on the observed reward and the estimated value of the next state-action pair.
How SARSA Works
SARSA works by maintaining a value function that estimates the value of each state-action pair. The value function is updated after each action is taken, based on the observed reward and the estimated value of the next state-action pair. The update rule for the value function is given by the following equation:
Q(s, a) <= Q(s, a) + α * (r + γ * Q(s', a') - Q(s, a))
where:
- Q(s, a) is the value of the state-action pair (s, a)
- r is the reward received after taking action a in state s
- γ is the discount factor
- Q(s', a') is the estimated value of the next state-action pair (s', a')
- α is the learning rate
The learning rate α controls how quickly the value function is updated. A higher learning rate will result in faster learning, but may also lead to instability. A lower learning rate will result in slower learning, but will be more stable.
Advantages of SARSA
SARSA has several advantages over other reinforcement learning algorithms. First, SARSA is an on-policy algorithm, which means that it learns the value of state-action pairs that are actually taken by the agent. This can lead to more efficient learning than off-policy algorithms, which learn the value of state-action pairs that may not be taken by the agent.
Second, SARSA is a temporal difference learning algorithm, which means that it learns the value of state-action pairs based on the difference between the expected reward and the actual reward. This can lead to faster learning than value-iteration algorithms, which learn the value of state-action pairs based on the expected reward only.