GithubHelp home page GithubHelp logo

keon / policy-gradient Goto Github PK

View Code? Open in Web Editor NEW
158.0 10.0 43.0 3.62 MB

Minimal Monte Carlo Policy Gradient (REINFORCE) Algorithm Implementation in Keras

License: MIT License

Python 100.00%
policy-gradient deep-reinforcement-learning keras reinforcement-learning

policy-gradient's Introduction

Policy Gradient

Minimal implementation of Stochastic Policy Gradient Algorithm in Keras

Pong Agent

pg

This PG agent seems to get more frequent wins after about 8000 episodes. Below is the score graph.

score

policy-gradient's People

Contributors

keon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

policy-gradient's Issues

Minor Questions

  1. are the weights present in the repo. trained? Asking because they didn't work that well.
  2. do you find the approach better than simple feed-forward approach?(http://karpathy.github.io/2016/05/31/rl/)
  3. how did you narrow down on architecture?
    a. why only 1 conv. layer?
    b. why not deconv. layers?

Thanks.

Incorrect normalising of discounted rewards

Hey mate,

Great work, but I think you normalization of the discounted rewards is wrong.
pg.py_line 64: rewards = rewards / np.std(rewards - np.mean(rewards))

should maybe be:

rewards = (rewards - np.mean(rewards)) / np.std(rewards - np.mean(rewards))

Loss function/Labels for neural network used?

I do understand the backpropagation in policy gradient networks, but am not sure how your code work keras's auto-differentiation.

That is, how you transform it into a supervised learning problem.
For example, the code below:

Y = self.probs + self.learning_rate * np.squeeze(np.vstack([gradients]))

Why is Y not 1-hot vector for the action taken?
You compute the gradient assuming the action is correct, Y is one-hot vector. Then you multiplies it by the reward in the corresponding time-step. But while training you feed it as the correction.
I think one could multiply the rewards by one-hot vector instead. And then feed it straight away.

If possible please clarify my doubt. :)
https://github.com/keon/policy-gradient/blob/master/pg.py#L67

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.