Giter VIP home page Giter VIP logo

vanilla-policy-gradient's Introduction

Vanilla Policy Gradient

The implementation of this algorithm required some prior knowledge of some key components of RL

Not each was followed to the later but the same effect was achieved.

Trajectory

The trajectory was implemented using a deque object. It sort of acted like the group and its order was the total number of elements in it.

Each element consisted of a MDP implementation (S, A, R, S', p)

Reward Function

Both Finite-Horizon Discounted and Infinite-Horizon Undiscounted were tried upon. The gamma valu instantiated with the agent acts as our discount factor. However, the rewards to go approach was used to reduce variance and to focus more on the recent rewards.

Value Function

Both the on-policy value and on-policy action value functions were tried upon and different ways of implementing them to calculate the advantage were tried. Eventually, since the results yielded less for the episodes done a much simpler approach was used.

Minimalistic Approach

The model predicted the probs of trajectory states using current weights, they were then sampled using the Categorical distribution and the result was passed upon the log_prob() function to create log-likelihoods.

The log-likelihoods were then multiplied to the rewards-to-go and the all the result was summed up using the torch.sum() function. (# loss that when differentiated with autograd gives the gradient of J(θ))

The policy weights are then updated and the policy keeps training for set number of episodes.

vanilla-policy-gradient's People

Contributors

mmarxe avatar

Watchers

 avatar

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.