Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nesterov momentum is wrong in sgd #27

Closed
soumith opened this issue Oct 13, 2014 · 6 comments
Closed

nesterov momentum is wrong in sgd #27

soumith opened this issue Oct 13, 2014 · 6 comments

Comments

@soumith
Copy link
Member

soumith commented Oct 13, 2014

@clementfarabet elaborate here?

@soumith soumith added the bug label Oct 13, 2014
@clementfarabet
Copy link
Member

Yeah I think the nesterov mode in optim.sgd is missing a step. Here's a self-contained version of Nesterov Accelerated Gradient that I think is correct (I used it for a while, @dilipkay wrote it a while back).

But maybe I'm misreading the nesterov option in optim.sgd. @fidlej , it looks like you added this parameter. Was the intent to implement the NAG method or something slightly different? Thanks!

@fidlej
Copy link
Collaborator

fidlej commented Oct 13, 2014

If the learning rate is a constant, the implemented nesterov mode should behave like NAG.
The used update rule is derived here.
The state.dfdx in the code is the same as v_{t+1}/learningRate. I.e., state.dfdx is a decaying sum of the gradients.

@koraykv
Copy link
Member

koraykv commented Oct 13, 2014

I suggest we keep this one as it is. I think it is not wrong, but an approximation. The gist @clementfarabet posted is another implementation which I will put in a separate file.

@clementfarabet
Copy link
Member

Thanks for the clarification Ivo.

Once Koray adds it in we should probably compare them.

Clément

On Oct 13, 2014, at 1:00 PM, koray kavukcuoglu notifications@github.com wrote:

Closed #27.


Reply to this email directly or view it on GitHub.

@koraykv
Copy link
Member

koraykv commented Oct 13, 2014

I just added it in.

@clementfarabet
Copy link
Member

Cool, thanks Koray!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants