public class AdaGrad extends Object implements Serializable, GradientUpdater
Modifier and Type | Class and Description |
---|---|
static class |
AdaGrad.AdaGradAggregator |
Modifier and Type | Field and Description |
---|---|
INDArray |
historicalGradient |
protected double |
learningRate |
protected int |
numIterations |
int[] |
shape |
Constructor and Description |
---|
AdaGrad(double learningRate) |
AdaGrad(double learningRate,
double epsilon) |
AdaGrad(int[] shape,
double learningRate) |
AdaGrad(int rows,
int cols) |
AdaGrad(int rows,
int cols,
double learningRate) |
Modifier and Type | Method and Description |
---|---|
AdaGrad |
createSubset(int index) |
GradientUpdaterAggregator |
getAggregator(boolean addThis)
Get a GradientUpdaterAggregator.
|
double |
getGradient(double gradient,
int column,
int[] shape) |
INDArray |
getGradient(INDArray gradient,
int iteration)
Gets feature specific learning rates
Adagrad keeps a history of gradients being passed in.
|
INDArray |
getGradient(INDArray gradient,
int slice,
int[] shape) |
void |
setStateViewArray(INDArray viewArray,
int[] gradientShape,
char gradientOrder,
boolean initialize)
For the internal updater state (if any): set this to use the provided array.
|
int |
stateSizeForInputSize(int inputSize)
For a give input size (length) array, how big is the internal state?
Typically 0, 1 or 2x the input size, depending on the type of updater
|
void |
update(Object... args)
update(learningRate,momentum)
|
public INDArray historicalGradient
public int[] shape
protected double learningRate
protected int numIterations
public AdaGrad(int rows, int cols, double learningRate)
rows
- cols
- learningRate
- public AdaGrad(int rows, int cols)
public AdaGrad(int[] shape, double learningRate)
public AdaGrad(double learningRate)
public AdaGrad(double learningRate, double epsilon)
public int stateSizeForInputSize(int inputSize)
GradientUpdater
stateSizeForInputSize
in interface GradientUpdater
inputSize
- Length of the input arraypublic void setStateViewArray(INDArray viewArray, int[] gradientShape, char gradientOrder, boolean initialize)
GradientUpdater
setStateViewArray
in interface GradientUpdater
viewArray
- Array (that is a view of a larger array) to use for the state.initialize
- If true: the updater must initialize the view array. If false: no change to view array contentspublic void update(Object... args)
GradientUpdater
update
in interface GradientUpdater
public INDArray getGradient(INDArray gradient, int iteration)
getGradient
in interface GradientUpdater
gradient
- the gradient to get learning rates foriteration
- public double getGradient(double gradient, int column, int[] shape)
public AdaGrad createSubset(int index)
public GradientUpdaterAggregator getAggregator(boolean addThis)
GradientUpdater
getAggregator
in interface GradientUpdater
addThis
- If true: return a GradientUpdaterAggregator with the GradientUpdater already added.
If false: return an empty (uninitialized) GradientUpdaterAggregatorCopyright © 2016. All Rights Reserved.