December 2018
Intermediate to advanced
764 pages
18h 18m
English
The observations returned by the pole-cart environment involves the state of the environment. The state of pole-cart is represented by continuous values that we need to discretize.
If we discretize these values into small state-space, then the agent gets trained faster, but with the caveat of risking the convergence to the optimal policy.
We use the following helper function to discretize the state-space of the pole-cart environment:
# discretize the value to a state spacedef discretize(val,bounds,n_states): discrete_val = 0 if val <= bounds[0]: discrete_val = 0 elif val >= bounds[1]: discrete_val = n_states-1 else: discrete_val = int(round( (n_states-1) * ((val-bounds[0])/ (bounds[1]-bounds[0])) ...
Read now
Unlock full access