YADQN is yet another implementation of Deep Q-Networks (DQN) described in the Deepmind paper Playing Atari with Deep Reinforcement Learning.
In this repository, DQN is used to control the CartPole-v1 environment on the openai gym. To do that, a Q-function is implemented in Keras to map a state into the relative value of applying a LEFT or a RIGHT force to the cart. The Q-function is then trained by minimising the TD error from a set of S,A,R,S' tuples randomly sampled from an experience replay buffer. Lastly, an e-greedy policy selects an action for a given state to control the cart.
On most runs, the algorithm was able to learn to balance the cart after a few hundred episodes: