GithubHelp home page GithubHelp logo

chingyaoc / pytorch-reinforce Goto Github PK

View Code? Open in Web Editor NEW
261.0 13.0 51.0 338 KB

PyTorch Implementation of REINFORCE for both discrete & continuous control

Python 100.00%
reinforcement-learning reinforce continuous-control mujoco pytorch gym

pytorch-reinforce's Introduction

PyTorch REINFORCE

PyTorch implementation of REINFORCE.
This repo supports both continuous and discrete environments in OpenAI gym.

Requirement

  • python 2.7
  • PyTorch
  • OpenAI gym
  • Mujoco (optional)

Run

Use the default hyperparameters. (Program will detect whether the environment is continuous or discrete)

python main.py --env_name [name of environment]

Experiment results

continuous: InvertedPendulum-v1

discrete: CartPole-v0

Reference

pytorch-reinforce's People

Contributors

chingyaoc 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  avatar  avatar  avatar

pytorch-reinforce's Issues

continuous-control doesn't work for MountainCarContinuous-v0

Hi. First af all - thanks for good clear code!
My problem. I am trying to run this continuous-control algorithm "as is" for simplest gym's enviroments such as MountainCarContinuous-v0, Pendulum-v0 and nothing work. I tryed to change lr, number of episodes, quantity of neural network layers, and so on - nothing. There are random fluctuations on the end of learning near low-reward position. Can you provide good parametres for this enviroments or give recommendations what to do?

A little confusion from a newbie.How to get the loss function of REINFORCE?

Hi, thanks for your code, they are well written and very helpful to newbie like me!!

But there is one line that I don't understand, I'd appreciate if you could explain that to me.

loss = loss - (log_probs[i](Variable(R).expand_as(log_probs[i])).cuda()).sum() - (0.0001entropies[i].cuda()).sum()
loss = loss / len(rewards)

image

I wonder how can I derive the loss function of REINFOCE algorithm. And why does the entropy term appear? This doesn't seem to be straight forward to me.

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.