public class AdaGrad extends Learner
| Modifier and Type | Class and Description |
|---|---|
static class |
AdaGrad.Parameters
A container for all of
AdaGrad's configurable parameters. |
| Modifier and Type | Field and Description |
|---|---|
static double |
defaultLearningRate |
static String |
defaultLossFunction |
protected double |
learningRateA |
protected String |
lossFunctionA |
candidates, encoding, extractor, labeler, labelLexicon, lcFilePath, lexFilePath, lexicon, lossFlag, predictions, readLexiconOnDemandcontainingPackage, name| Constructor and Description |
|---|
AdaGrad()
Constructor
The learning rate takes the default value, while the name of the classifier gets the empty
string.
|
AdaGrad(AdaGrad.Parameters p)
Constructor
Sets all member variables to their associated settings.
|
AdaGrad(double r)
Constructor
Sets the learning rate to the specified value, while the name of the classifier gets the
empty string.
|
AdaGrad(String n)
Constructor
The learning rate takes the default value.
|
AdaGrad(String n,
AdaGrad.Parameters p)
Constructor
Sets all member variables to their associated settings.
|
AdaGrad(String n,
double r)
Constructor
Set desired learning rate
|
| Modifier and Type | Method and Description |
|---|---|
FeatureVector |
classify(int[] exampleFeatures,
double[] exampleValues)
Simply computes the dot product of the weight vector and the feature vector extracted from
the example object.
|
Feature |
featureValue(int[] f,
double[] v)
Returns the classification of the given example as a single feature instead of a
FeatureVector. |
double |
getConstantLearningRate()
Getter - get the constant learning rate
|
String |
getLossFunction()
Getter - get loss function
|
String |
getOutputType()
Returns a string describing the output feature type of this classifier.
|
double[] |
getWeightVector()
Getter - get weight vector
|
void |
learn(int[] exampleFeatures,
double[] exampleValues,
int[] exampleLabels,
double[] labelValues)
AdaGrad's Learning Function: Each row of feature vector + label feed in as arguments; Update
internal parameters;
Note: 1.
|
double |
realValue(int[] exampleFeatures,
double[] exampleValues)
Simply computes the dot product of the weight vector and the example
|
ScoreSet |
scores(int[] exampleFeatures,
double[] exampleValues)
Produces a set of scores indicating the degree to which each possible discrete classification
value is associated with the given example object.
|
void |
setParameters(AdaGrad.Parameters p)
Sets the values of parameters that control the behavior of this learning algorithm.
|
void |
write(PrintStream printStream)
Writes the learned function's internal representation as text.
|
classify, classify, classify, classify, clone, countFeatures, createPrediction, createPrediction, demandLexicon, discreteValue, discreteValue, discreteValue, doneLearning, doneWithRound, emptyClone, featureValue, featureValue, forget, getCurrentLexicon, getExampleArray, getExampleArray, getExtractor, getLabeler, getLabelLexicon, getLexicon, getLexiconDiscardCounts, getLexiconLocation, getModelLocation, getParameters, getPrunedLexiconSize, initialize, learn, learn, learn, learn, read, read, readLabelLexicon, readLearner, readLearner, readLearner, readLearner, readLearner, readLearner, readLexicon, readLexicon, readLexiconOnDemand, readLexiconOnDemand, readModel, readModel, readParameters, realValue, realValue, save, saveLexicon, saveModel, scores, scores, scoresAugmented, setCandidates, setEncoding, setExtractor, setLabeler, setLabelLexicon, setLexicon, setLexiconLocation, setLexiconLocation, setLossFlag, setModelLocation, setModelLocation, setParameters, setReadLexiconOnDemand, unclone, unsetLossFlag, write, write, writeLexicon, writeModel, writeParametersallowableValues, classify, discreteValueArray, getCompositeChildren, getInputType, realValueArray, test, toString, valueIndexOfprotected double learningRateA
protected String lossFunctionA
public static final double defaultLearningRate
public static final String defaultLossFunction
public AdaGrad()
public AdaGrad(double r)
r - The desired learning rate value.public AdaGrad(AdaGrad.Parameters p)
p - The settings of all parameters.public AdaGrad(String n)
n - The name of the classifier.public AdaGrad(String n, double r)
n - The name of the classifier.r - The desired learning rate value.public AdaGrad(String n, AdaGrad.Parameters p)
n - The name of the classifier.p - The settings of all parameters.public void setParameters(AdaGrad.Parameters p)
p - The parameters.public double[] getWeightVector()
public String getLossFunction()
public double getConstantLearningRate()
public void learn(int[] exampleFeatures,
double[] exampleValues,
int[] exampleLabels,
double[] labelValues)
public double realValue(int[] exampleFeatures,
double[] exampleValues)
public Feature featureValue(int[] f, double[] v)
FeatureVector.featureValue in class Learnerf - The features array.v - The values array.public FeatureVector classify(int[] exampleFeatures, double[] exampleValues)
public ScoreSet scores(int[] exampleFeatures, double[] exampleValues)
real
feature or more than one feature may implement this method by simply returning
null.public void write(PrintStream printStream)
public String getOutputType()
getOutputType in class Classifier"real"Copyright © 2016. All rights reserved.