SARSA is an on-policy temporal difference (TD) learning algorithm. The name comes from the quintuple (State, Action, Reward, next State, next Action) used in each update. It learns Q-values (action-value estimates) by bootstrapping from the next state-action pair that the agent actually takes.
Given a Q-table and a single transition (s, a, r, s', a'), perform one SARSA update and return the updated Q-table.
Return a new two-dimensional list containing the updated Q-table.
Input: q_table = [[0, 0], [0, 0]], state = 0, action = 1, reward = 1, next_state = 1, next_action = 0, alpha = 0.1, gamma = 0.9
Output: [[0.0, 0.1], [0.0, 0.0]]
Explanation: The TD error is 1, so the selected Q-value increases by 0.1.
Input: q_table = [[1, 2], [3, 4]], state = 0, action = 0, reward = 5, next_state = 1, next_action = 1, alpha = 0.5, gamma = 0.9
Output: [[4.8, 2.0], [3.0, 4.0]]
Copy each Q-table row before writing the updated value.
Compute the TD error from the current and selected next-action values.
Sign in to take notes on this problem
Accepts: array
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Accepts: number
SARSA is an on-policy temporal difference (TD) learning algorithm. The name comes from the quintuple (State, Action, Reward, next State, next Action) used in each update. It learns Q-values (action-value estimates) by bootstrapping from the next state-action pair that the agent actually takes.
Given a Q-table and a single transition (s, a, r, s', a'), perform one SARSA update and return the updated Q-table.
Return a new two-dimensional list containing the updated Q-table.
Input: q_table = [[0, 0], [0, 0]], state = 0, action = 1, reward = 1, next_state = 1, next_action = 0, alpha = 0.1, gamma = 0.9
Output: [[0.0, 0.1], [0.0, 0.0]]
Explanation: The TD error is 1, so the selected Q-value increases by 0.1.
Input: q_table = [[1, 2], [3, 4]], state = 0, action = 0, reward = 5, next_state = 1, next_action = 1, alpha = 0.5, gamma = 0.9
Output: [[4.8, 2.0], [3.0, 4.0]]
Copy each Q-table row before writing the updated value.
Compute the TD error from the current and selected next-action values.
Sign in to take notes on this problem
Accepts: array
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Accepts: number
Accepts: number