Package moa.classifiers.functions
Class AdaGrad
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.classifiers.AbstractClassifier
-
- moa.classifiers.functions.SGD
-
- moa.classifiers.functions.AdaGrad
-
- All Implemented Interfaces:
Configurable
,Serializable
,CapabilitiesHandler
,Classifier
,MultiClassClassifier
,Regressor
,AWTRenderable
,Learner<Example<Instance>>
,MOAObject
,OptionHandler
public class AdaGrad extends SGD
Implements the AdaGrad oneline optimiser for learning various linear models (binary class SVM, binary class logistic regression and linear regression). For more information, see
Duchi, J., Hazan, E., & Singer, Y. (2011). Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12 (Jul), 2121-2159. * BibTeX:@inproceedings{duchi2011, author = {Duchi, John and Hazan, Elad and Singer, Yoram}, booktitle = {Journal of Machine Learning Research}, pages = {2121--2159}, volume={12}, number={Jul}, title = {Adaptive subgradient methods for online learning and stochastic optimization}, year = {2011} }
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description FloatOption
epsilonOption
protected double
m_biasVelocity
protected double
m_epsilon
The epsilon valueprotected DoubleVector
m_velocity
Stores the weights (+ bias in the last element)-
Fields inherited from class moa.classifiers.functions.SGD
HINGE, lambdaRegularizationOption, learningRateOption, LOGLOSS, lossFunctionOption, m_bias, m_lambda, m_learningRate, m_loss, m_numInstances, m_t, m_weights, SQUAREDLOSS
-
Fields inherited from class moa.classifiers.AbstractClassifier
classifierRandom, modelContext, randomSeed, randomSeedOption, trainingWeightSeenByModel
-
Fields inherited from class moa.options.AbstractOptionHandler
config
-
-
Constructor Summary
Constructors Constructor Description AdaGrad()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getEpsilon()
Get the epsilon value.protected String
getModelName()
String
getPurposeString()
Dictionary with option texts and objectsvoid
resetLearningImpl()
Resets this classifier.void
setEpsilon(double eps)
Set the epsilon value.void
trainOnInstanceImpl(Instance instance)
Trains the classifier with the given instance.-
Methods inherited from class moa.classifiers.functions.SGD
dloss, dotProd, getLambda, getLearningRate, getLossFunction, getModelDescription, getModelMeasurementsImpl, getVotesForInstance, isRandomizable, reset, setLambda, setLearningRate, setLossFunction, toString
-
Methods inherited from class moa.classifiers.AbstractClassifier
contextIsCompatible, copy, correctlyClassifies, defineImmutableCapabilities, getAttributeNameString, getAWTRenderer, getClassLabelString, getClassNameString, getDescription, getModel, getModelContext, getModelMeasurements, getNominalValueString, getPredictionForInstance, getPredictionForInstance, getSubClassifiers, getSublearners, getVotesForInstance, modelAttIndexToInstanceAttIndex, modelAttIndexToInstanceAttIndex, prepareForUseImpl, resetLearning, setModelContext, setRandomSeed, trainingHasStarted, trainingWeightSeenByModel, trainOnInstance, trainOnInstance
-
Methods inherited from class moa.options.AbstractOptionHandler
getCLICreationString, getOptions, getPreparedClassOption, prepareClassOptions, prepareForUse, prepareForUse
-
Methods inherited from class moa.AbstractMOAObject
copy, measureByteSize, measureByteSize
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface moa.capabilities.CapabilitiesHandler
getCapabilities
-
Methods inherited from interface moa.MOAObject
measureByteSize
-
Methods inherited from interface moa.options.OptionHandler
getCLICreationString, getOptions, prepareForUse, prepareForUse
-
-
-
-
Field Detail
-
m_epsilon
protected double m_epsilon
The epsilon value
-
epsilonOption
public FloatOption epsilonOption
-
m_velocity
protected DoubleVector m_velocity
Stores the weights (+ bias in the last element)
-
m_biasVelocity
protected double m_biasVelocity
-
-
Method Detail
-
getPurposeString
public String getPurposeString()
Description copied from class:AbstractOptionHandler
Dictionary with option texts and objects- Specified by:
getPurposeString
in interfaceOptionHandler
- Overrides:
getPurposeString
in classSGD
- Returns:
- the string with the purpose of this object
-
setEpsilon
public void setEpsilon(double eps)
Set the epsilon value.- Parameters:
eps
- the epsilon value to use.
-
getEpsilon
public double getEpsilon()
Get the epsilon value.- Returns:
- the epsilon value
-
resetLearningImpl
public void resetLearningImpl()
Description copied from class:AbstractClassifier
Resets this classifier. It must be similar to starting a new classifier from scratch.
The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. Note that this will produce compiler errors if not overridden.- Overrides:
resetLearningImpl
in classSGD
-
trainOnInstanceImpl
public void trainOnInstanceImpl(Instance instance)
Trains the classifier with the given instance.- Overrides:
trainOnInstanceImpl
in classSGD
- Parameters:
instance
- the new training instance to include in the model
-
getModelName
protected String getModelName()
- Overrides:
getModelName
in classSGD
-
-