jsat.math.optimization.stochastic
Class NAdaGrad
- java.lang.Object
-
- jsat.math.optimization.stochastic.NAdaGrad
-
- All Implemented Interfaces:
- java.io.Serializable, GradientUpdater
public class NAdaGrad extends java.lang.Object implements GradientUpdater
Normalized AdaGrad provides an adaptive learning rate for each individual feature, and is mostly scale invariant to the data distribution. NAdaGrad is meant for online stochastic learning where the update is obtained from one dataum at a time, and it relies on the gradient being a scalar multiplication of the training data. If the gradient given us aScaledVector, where the base vector is the datum, then NAdaGrad will work. If not the case, NAdaGrad will degenerate into something similar to normalAdaGrad.
The current implementation assumes that the bias term is always scaled correctly, and does normal AdaGrad on it.
See: Ross, S., Mineiro, P., & Langford, J. (2013). Normalized online learning. In Twenty-Ninth Conference on Uncertainty in Artificial Intelligence. Retrieved from here- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description NAdaGrad()Creates a new NAdaGrad updaterNAdaGrad(NAdaGrad toCopy)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description NAdaGradclone()voidsetup(int d)Sets up this updater to update a weight vector of dimensiondby a gradient of the same dimensionvoidupdate(Vec w, Vec grad, double eta)Updates the weight vectorxsuch that x = x-ηf(grad), where f(grad) is some function on the gradient that effectively returns a new vector.doubleupdate(Vec w, Vec grad, double eta, double bias, double biasGrad)Updates the weight vectorxsuch that x = x-ηf(grad), where f(grad) is some function on the gradient that effectively returns a new vector.
-
-
-
Constructor Detail
-
NAdaGrad
public NAdaGrad()
Creates a new NAdaGrad updater
-
NAdaGrad
public NAdaGrad(NAdaGrad toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
update
public void update(Vec w, Vec grad, double eta)
Description copied from interface:GradientUpdaterUpdates the weight vectorxsuch that x = x-ηf(grad), where f(grad) is some function on the gradient that effectively returns a new vector. It is not necessary for the internal implementation to ever explicitly form any of these objects, so long asxis mutated to have the correct result.- Specified by:
updatein interfaceGradientUpdater- Parameters:
w- the vector to mutate such that is has been updated by the gradientgrad- the gradient to update the weight vectorxfrometa- the learning rate to apply
-
update
public double update(Vec w, Vec grad, double eta, double bias, double biasGrad)
Description copied from interface:GradientUpdaterUpdates the weight vectorxsuch that x = x-ηf(grad), where f(grad) is some function on the gradient that effectively returns a new vector. It is not necessary for the internal implementation to ever explicitly form any of these objects, so long asxis mutated to have the correct result.
This version of the update method includes two extra parameters to make it easer to use when a scalar bias term is also used- Specified by:
updatein interfaceGradientUpdater- Parameters:
w- the vector to mutate such that is has been updated by the gradientgrad- the gradient to update the weight vectorxfrometa- the learning rate to applybias- the bias term of the vectorbiasGrad- the gradient for the bias term- Returns:
- the value to change the bias by, the update being
bias = bias - returnValue
-
clone
public NAdaGrad clone()
- Specified by:
clonein interfaceGradientUpdater- Overrides:
clonein classjava.lang.Object
-
setup
public void setup(int d)
Description copied from interface:GradientUpdaterSets up this updater to update a weight vector of dimensiondby a gradient of the same dimension- Specified by:
setupin interfaceGradientUpdater- Parameters:
d- the dimension of the weight vector that will be updated
-
-
DataMelt 3.0 © DataMelt by jWork.ORG