DaNNet
Public Member Functions | Private Attributes | List of all members
dnn::opt_SGD_nesterov Class Reference

Stochastic Gradient Descent with Nesterov momentum optimizer class. More...

#include <dnn_opt.h>

Inheritance diagram for dnn::opt_SGD_nesterov:
dnn::opt

Public Member Functions

 opt_SGD_nesterov (DNN_Dtype s, DNN_Dtype m, DNN_Dtype l=0.0, DNN_Dtype a=0.0)
 SGD with Nesterov momentum constructor. More...
 
 ~opt_SGD_nesterov ()
 
void apply (arma::Cube< DNN_Dtype > &W, arma::Mat< DNN_Dtype > &B, const arma::Cube< DNN_Dtype > &Wgrad, const arma::Mat< DNN_Dtype > &Bgrad)
 Apply the optimizer to the layer parameters. More...
 
std::string get_algorithm (void)
 Get the optimizer algorithm information. More...
 
- Public Member Functions inherited from dnn::opt
 opt ()
 
 ~opt ()
 
void set_learn_rate_alg (LR_ALG alg, DNN_Dtype a=0.0, DNN_Dtype b=10.0)
 Set learning rate algorithm. More...
 
void update_learn_rate (void)
 Update learning rate. More...
 
DNN_Dtype get_learn_rate (void)
 Get the learning rate. More...
 

Private Attributes

arma::Cube< DNN_Dtypev
 
arma::Cube< DNN_Dtypevp
 
arma::Mat< DNN_DtypevB
 
arma::Mat< DNN_DtypevBp
 
DNN_Dtype mom
 

Additional Inherited Members

- Protected Attributes inherited from dnn::opt
std::string alg
 
DNN_Dtype lr
 Learning rate. More...
 
DNN_Dtype reg_lambda
 Regularisation parameter lambda. More...
 
DNN_Dtype reg_alpha
 Elastic net mix parameter - 0=ridge (L2) .. 1=LASSO (L1) More...
 
LR_ALG lr_alg
 Learning rate schedule algorithm. More...
 
DNN_Dtype lr_0
 Init value for lr. More...
 
DNN_Dtype lr_a
 Internal parameter a. More...
 
DNN_Dtype lr_b
 Internal parameter b. More...
 
arma::uword it
 Iteration counter. More...
 

Detailed Description

Stochastic Gradient Descent with Nesterov momentum optimizer class.

SGD with Nesterov momentum algorithm, see https://arxiv.org/pdf/1609.04747.pdf

Definition at line 271 of file dnn_opt.h.

Constructor & Destructor Documentation

◆ opt_SGD_nesterov()

dnn::opt_SGD_nesterov::opt_SGD_nesterov ( DNN_Dtype  s,
DNN_Dtype  m,
DNN_Dtype  l = 0.0,
DNN_Dtype  a = 0.0 
)
inline

SGD with Nesterov momentum constructor.

Parameters
[in]sStep size - learning rate
[in]mMomentum
[in]lRegularisation param lambda
[in]aRegularisation param alpha

Definition at line 287 of file dnn_opt.h.

◆ ~opt_SGD_nesterov()

dnn::opt_SGD_nesterov::~opt_SGD_nesterov ( )
inline

Definition at line 297 of file dnn_opt.h.

Member Function Documentation

◆ apply()

void dnn::opt_SGD_nesterov::apply ( arma::Cube< DNN_Dtype > &  W,
arma::Mat< DNN_Dtype > &  B,
const arma::Cube< DNN_Dtype > &  Wgrad,
const arma::Mat< DNN_Dtype > &  Bgrad 
)
inlinevirtual

Apply the optimizer to the layer parameters.

Parameters
[in,out]W,BLearnable parameters
[in]Wgrad,BgradGradient of the learnable parameters

Implements dnn::opt.

Definition at line 304 of file dnn_opt.h.

◆ get_algorithm()

std::string dnn::opt_SGD_nesterov::get_algorithm ( void  )
inlinevirtual

Get the optimizer algorithm information.

Returns
Algorithm information string

Reimplemented from dnn::opt.

Definition at line 341 of file dnn_opt.h.

Member Data Documentation

◆ mom

DNN_Dtype dnn::opt_SGD_nesterov::mom
private

Definition at line 278 of file dnn_opt.h.

◆ v

arma::Cube<DNN_Dtype> dnn::opt_SGD_nesterov::v
private

Definition at line 274 of file dnn_opt.h.

◆ vB

arma::Mat<DNN_Dtype> dnn::opt_SGD_nesterov::vB
private

Definition at line 276 of file dnn_opt.h.

◆ vBp

arma::Mat<DNN_Dtype> dnn::opt_SGD_nesterov::vBp
private

Definition at line 277 of file dnn_opt.h.

◆ vp

arma::Cube<DNN_Dtype> dnn::opt_SGD_nesterov::vp
private

Definition at line 275 of file dnn_opt.h.


The documentation for this class was generated from the following file: