Question: ` ` ` # TASK 2 . 3 # Complete the update _ q _ table function ( in Task 2 . 3 ) #

```
# TASK 2.3
# Complete the update_q_table function (in Task 2.3)
# This function will be called from the q_learning(...) function
# Inputs:
# q_table, r_table, current_state_index, action, next_state_index, alpha=0.1, gamma=0.9
# Outputs:
# q_table: with updated Q values
def update_q_table(q_table, r_table, current_state_index, action, next_state_index, alpha=0.1, gamma=0.9):
best_next_action = np.argmax(q_table[next_state_index])
td_target = r_table[current_state_index][action]+ gamma * q_table[next_state_index][best_next_action]
td_error = td_target - q_table[current_state_index][action]
q_table[current_state_index][action]+= alpha * td_error
return q_table
``` Task 2.3(5 Points)) Test update_q_table function (0/5)
Test Failed: unsupported operand type(s) for divmod(): 'tuple' and 'int'
` ` ` # TASK 2 . 3 # Complete the update _ q _

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!