December 2018
Intermediate to advanced
764 pages
18h 18m
English
So far, we have randomly picked an action and applied it. Now let us apply some logic to picking the action instead of random chance. The third observation refers to the angle. If the angle is greater than zero, that means the pole is tilting right, thus we move the cart to the right (1). Otherwise, we move the cart to the left (0). Let us look at an example:
def policy_logic(env,obs): return 1 if obs[2] > 0 else 0def policy_random(env,obs): return env.action_space.sample()
Read now
Unlock full access