You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/09/04 08:19:08 UTC

[GitHub] [incubator-mxnet] anirudhacharya commented on issue #16053: Fixes #15543

anirudhacharya commented on issue #16053: Fixes #15543
URL: https://github.com/apache/incubator-mxnet/pull/16053#issuecomment-527795971
 
 
   > ![image](https://user-images.githubusercontent.com/8041160/64220273-a1a9bb80-ce7d-11e9-8b3b-9262de1d715b.png)
   > 
   > ```
   > mom = state
   > mom[:] *= self.momentum
   > weight[:] += lr * self.momentum * mom
   > weight[:] -= lr * (1 + self.self.momentum) * grad
   > mom[:] -=  grad
   > ```
   
   @zhanghang1989 The update rule in this PR is the following -
   
   ```cpp
   mom_data[i] = param_momentum*mom_data[i];
   KERNEL_ASSIGN(out_data[i], req, weight_data[i]-mom_data[i]
                                 +(param_momentum+1)*(mom_data[i]
                                   -(param_lr*(param_rescale_grad*grad_data[i]+param_wd*weight_data[i]))));
   ```
   this update rule is same as the following psuedocode - 
   ```
   weight = (weight - momentum * mom) + (momentum+1)*(momentum * mom - lr*(grad + wd*weight))
   ```
   which when simplified, translates to 
   ```
   weight[:] += (momentum**2 * mom) - (momentum + 1) * lr * (grad + wd*weight)
   ```
   Formula - 
   ![image](https://user-images.githubusercontent.com/2778341/64224954-3a483780-ce8e-11e9-98c4-00ce405fd3ad.png)
   
   ( it is the same rule used in keras as well - https://stats.stackexchange.com/questions/179915/whats-the-difference-between-momentum-based-gradient-descent-and-nesterovs-acc)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services