Package org.nd4j.linalg.learning.config
Class Nesterovs
- java.lang.Object
-
- org.nd4j.linalg.learning.config.Nesterovs
-
- All Implemented Interfaces:
Serializable
,Cloneable
,IUpdater
public class Nesterovs extends Object implements IUpdater
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Nesterovs.Builder
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_NESTEROV_LEARNING_RATE
static double
DEFAULT_NESTEROV_MOMENTUM
-
Constructor Summary
Constructors Constructor Description Nesterovs()
Nesterovs(double momentum)
Nesterovs(double learningRate, double momentum)
Nesterovs(double learningRate, ISchedule momentumSchedule)
Nesterovs(ISchedule learningRateSchedule)
Nesterovs(ISchedule learningRateSchedule, double momentum)
Nesterovs(ISchedule learningRateSchedule, ISchedule momentumSchedule)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Nesterovs
clone()
Clone the updaterdouble
currentMomentum(int iteration, int epoch)
double
getLearningRate(int iteration, int epoch)
Get the learning rate - if any - for the updater, at the specified iteration and epoch.boolean
hasLearningRate()
GradientUpdater
instantiate(Map<String,INDArray> updaterState, boolean initializeStateArrays)
GradientUpdater
instantiate(INDArray viewArray, boolean initializeViewArray)
Create a new gradient updatervoid
setLrAndSchedule(double lr, ISchedule lrSchedule)
Set the learning rate and schedule.long
stateSize(long numParams)
Determine the updater state size for the given number of parameters.
-
-
-
Field Detail
-
DEFAULT_NESTEROV_MOMENTUM
public static final double DEFAULT_NESTEROV_MOMENTUM
- See Also:
- Constant Field Values
-
DEFAULT_NESTEROV_LEARNING_RATE
public static final double DEFAULT_NESTEROV_LEARNING_RATE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Nesterovs
public Nesterovs()
-
Nesterovs
public Nesterovs(double momentum)
-
Nesterovs
public Nesterovs(double learningRate, double momentum)
-
Nesterovs
public Nesterovs(ISchedule learningRateSchedule)
-
Nesterovs
public Nesterovs(ISchedule learningRateSchedule, double momentum)
-
Nesterovs
public Nesterovs(double learningRate, ISchedule momentumSchedule)
-
-
Method Detail
-
stateSize
public long stateSize(long numParams)
Description copied from interface:IUpdater
Determine the updater state size for the given number of parameters. Usually a integer multiple (0,1 or 2) times the number of parameters in a layer.
-
instantiate
public GradientUpdater instantiate(INDArray viewArray, boolean initializeViewArray)
Description copied from interface:IUpdater
Create a new gradient updater- Specified by:
instantiate
in interfaceIUpdater
- Parameters:
viewArray
- The updater state size view awayinitializeViewArray
- If true: initialise the updater state- Returns:
-
instantiate
public GradientUpdater instantiate(Map<String,INDArray> updaterState, boolean initializeStateArrays)
- Specified by:
instantiate
in interfaceIUpdater
-
getLearningRate
public double getLearningRate(int iteration, int epoch)
Description copied from interface:IUpdater
Get the learning rate - if any - for the updater, at the specified iteration and epoch. Note that if no learning rate is applicable (AdaDelta, NoOp updaters etc) then Double.NaN should be return- Specified by:
getLearningRate
in interfaceIUpdater
- Parameters:
iteration
- Iteration at which to get the learning rateepoch
- Epoch at which to get the learning rate- Returns:
- Learning rate, or Double.NaN if no learning rate is applicable for this updater
-
hasLearningRate
public boolean hasLearningRate()
- Specified by:
hasLearningRate
in interfaceIUpdater
- Returns:
- True if the updater has a learning rate hyperparameter, false otherwise
-
setLrAndSchedule
public void setLrAndSchedule(double lr, ISchedule lrSchedule)
Description copied from interface:IUpdater
Set the learning rate and schedule. Note: may throw an exception ifIUpdater.hasLearningRate()
returns false.- Specified by:
setLrAndSchedule
in interfaceIUpdater
- Parameters:
lr
- Learning rate to set (typically not used if LR schedule is non-null)lrSchedule
- Learning rate schedule to set (may be null)
-
currentMomentum
public double currentMomentum(int iteration, int epoch)
-
-