January 2020
Intermediate to advanced
432 pages
10h 18m
English
With policy evaluation under our belt, it is time to move on to improving the policy by looking ahead. Recall we do this by looking at one state ahead of the current state and then evaluating all possible actions. Let's look at how this works in code. Open up the Chapter_2_6.py example and follow the exercise:
def evaluate(V, action_values, env, gamma, state): for action in range(env.nA): for prob, next_state, reward, terminated in env.P[state][action]: action_values[action] += prob * (reward + gamma * V[next_state]) return action_valuesdef lookahead(env, state, V, gamma): action_values ...
Read now
Unlock full access