Code Monkey home page Code Monkey logo

natural-gradients's Introduction

wiseodd's GitHub stats

natural-gradients's People

Contributors

wiseodd 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

natural-gradients's Issues

possible bug in kfac

In the pytorch implementation of kfac, G1_ is computed as:

G1_ = 1/m * a1.grad.t() @ a1.grad

However, the a1.grad is different from the a_1 in (1) of kfac's paper. Specifically, when you do backpropagation on the network to get a1.grad, it has a coefficient term 1/m in front of it, where m is the size of mini-batch. In other words, a1.grad = 1/m * a_1 (in kfac paper). Consequently, the G1_ is wrong. Similarly, G2_ and G3_ are also wrong.

Please correct me if I misunderstand something. Thanks!

full fisher script stability

I looked at the full_fisher numpy file and tried to change some parameters but it doesn't work. For example, when the X0 and X1 are changed as follows, the loss becomes nan after two steps:

X0 = np.random.randn(100, 2) - 2
X1 = np.random.randn(100, 2) + 2

What is the problem here? Thanks for your time.

Natural gradient for neural network?

Hi @wiseodd, thanks for great implementation! I wonder whether this can be generalized to a simple feed-forward network. In your code, the gradient wrt the parameters are computed directly. For networks, can you use auto-differentiation for that, say in pytorch? I find that is difficult because you need to get the gradient of the size (N, num_of_thetas). Since in my knowledge, when one does backpropagation, the loss should be a scalar, thus the batch N is omitted. What can one do to get the gradient for each instance in the batch?

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.