Giter Site home page Giter Site logo

Updates.py format about lasagne HOT 8 CLOSED

lasagne avatar lasagne commented on May 12, 2024
Updates.py format

from lasagne.

Comments (8)

benanne avatar benanne commented on May 12, 2024

Momentum needs to keep track of the accumulated previous gradients. That is what the mparam_i variables are for. They need to be updated at each iteration as well, hence the addition of the tuple (mparam_i, v) to the updates list.

The mparam_i tensors are initialized to zero, but during training they will be updated with the current accumulated gradient.

You could indeed scale the second term in v with (1 - momentum). This would allow you to experiment with different values of momentum and different learning rates more easily, in fact. But in literature and in practice, most people currently do not do this, so we opted not to do it either.

from lasagne.

skaae avatar skaae commented on May 12, 2024

Ok. I'm new in the theano graph world :)

mparam_i = theano.shared(np.zeros(param_i.get_value().shape, dtype=theano.config.floatX))

initialize a shared variable at zero which is later updated?

from lasagne.

benanne avatar benanne commented on May 12, 2024

Exactly :)

from lasagne.

f0k avatar f0k commented on May 12, 2024

You could indeed scale the second term in v with (1 - momentum). This would allow you to experiment with different values of momentum and different learning rates more easily, in fact. But in literature and in practice, most people currently do not do this, so we opted not to do it either.

It would be nice to have this as an option, though. Some people do use the less traditional formula. I'll make an issue for that so we don't forget.

from lasagne.

benanne avatar benanne commented on May 12, 2024

We should also consider if it's worth complicating the API for this. We had a very similar discussion in #10 :)

from lasagne.

f0k avatar f0k commented on May 12, 2024

We should also consider if it's worth complicating the API for this.

Hmm, you're right. It's enough if the user just scales the learning rate by (1-momentum), isn't it?

/edit: By the way, what is the weight decay doing in there? Shouldn't that just be part of the cost and then become part of the gradient automatically?

from lasagne.

benanne avatar benanne commented on May 12, 2024

By the way, what is the weight decay doing in there? Shouldn't that just be part of the cost and then become part of the gradient automatically?

Yep. I copied over most of this from my galaxy challenge code, it's probably a remnant of that. Having it as part of the cost is much cleaner.

from lasagne.

benanne avatar benanne commented on May 12, 2024

made a new issue for the weight decay thing, closing this one.

from lasagne.

Related Issues (20)

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.