public class SparseConfidenceWeighted extends LinearThresholdUnit
In this implementation, the user-specified confidence parameter is a real value representing the result of applying the inverse cumulative function of the normal distribution to a probability (ie, a real value greater than or equal to 0 and less than or equal to 1). The inverse of the normal cdf is a monotonically increasing function.
It is assumed that Learner.labeler is a single discrete classifier that produces the same
feature for every example object and that the values that feature may take are available through
the Classifier.allowableValues() method. The second value returned from
Classifier.allowableValues() is treated as "positive", and it is assumed there are
exactly 2 allowable values. Assertions will produce error messages if these assumptions do not
hold.
This algorithm's user-configurable parameters are stored in member fields of this class. They may
be set via either a constructor that names each parameter explicitly or a constructor that takes
an instance of Parameters as input. The documentation
in each member field in this class indicates the default value of the associated parameter when
using the former type of constructor. The documentation of the associated member field in the
Parameters class indicates the default value of the
parameter when using the latter type of constructor.
| Modifier and Type | Class and Description |
|---|---|
static class |
SparseConfidenceWeighted.Parameters
Simply a container for all of
SparseConfidenceWeighted's configurable parameters. |
| Modifier and Type | Field and Description |
|---|---|
protected double |
confidence
The confidence parameter as described above; default
defaultConfidence. |
static double |
defaultConfidence
Default value for
confidence. |
static double |
defaultInitialVariance
Default value for
initialVariance. |
protected double |
initialVariance
The strictly positive initial variance of the parameters; default
defaultInitialVariance. |
protected SparseWeightVector |
variances
The inverses of the current variances of the parameters.
|
protected double |
variancesBias
The bias element of the
variances vector. |
allowableValues, bias, defaultInitialWeight, defaultLearningRate, defaultThickness, defaultThreshold, defaultWeightVector, initialWeight, learningRate, negativeThickness, positiveThickness, threshold, weightVectorcandidates, encoding, extractor, labeler, labelLexicon, lcFilePath, lexFilePath, lexicon, lossFlag, predictions, readLexiconOnDemandcontainingPackage, name| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Returns a deep clone of this learning algorithm.
|
void |
demote(int[] exampleFeatures,
double[] exampleValues,
double rate)
This method does nothing.
|
void |
forget()
Reinitializes the learner to the state it started at before any learning was performed.
|
double |
getConfidence()
Returns the current value of the
confidence variable. |
double |
getInitialVariance()
Returns the current value of the
initialVariance variable. |
Learner.Parameters |
getParameters()
Retrieves the parameters that are set in this learner.
|
void |
learn(int[] exampleFeatures,
double[] exampleValues,
int[] exampleLabels,
double[] labelValues)
Updates the means and variances according to the new labeled example.
|
void |
promote(int[] exampleFeatures,
double[] exampleValues,
double rate)
This method does nothing.
|
void |
read(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in)
Reads the binary representation of a learner with this object's run-time type, overwriting
any and all learned or manually specified parameters as well as the label lexicon but without
modifying the feature lexicon.
|
void |
setConfidence(double c)
Sets the
confidence member variable to the specified value. |
void |
setInitialVariance(double v)
Sets the
initialVariance member variable to the specified value. |
void |
setParameters(SparseConfidenceWeighted.Parameters p)
Sets the values of parameters that control the behavior of this learning algorithm.
|
void |
write(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out)
Writes the learned function's internal representation in binary form.
|
void |
write(PrintStream out)
Writes the algorithm's internal representation as text.
|
allowableValues, classify, computeLearningRate, discreteValue, featureValue, getAllowableValues, getBias, getInitialWeight, getNegativeThickness, getPositiveThickness, getThreshold, getWeightVector, initialize, score, score, scores, setInitialWeight, setLabeler, setNegativeThickness, setParameters, setPositiveThickness, setThickness, setThreshold, shouldDemote, shouldPromoteclassify, classify, classify, classify, countFeatures, createPrediction, createPrediction, demandLexicon, discreteValue, discreteValue, doneLearning, doneWithRound, emptyClone, featureValue, featureValue, getCurrentLexicon, getExampleArray, getExampleArray, getExtractor, getLabeler, getLabelLexicon, getLexicon, getLexiconDiscardCounts, getLexiconLocation, getModelLocation, getPrunedLexiconSize, learn, learn, learn, learn, read, readLabelLexicon, readLearner, readLearner, readLearner, readLearner, readLearner, readLearner, readLexicon, readLexicon, readLexiconOnDemand, readLexiconOnDemand, readModel, readModel, readParameters, realValue, realValue, realValue, save, saveLexicon, saveModel, scores, scores, scoresAugmented, setCandidates, setEncoding, setExtractor, setLabelLexicon, setLexicon, setLexiconLocation, setLexiconLocation, setLossFlag, setModelLocation, setModelLocation, setParameters, setReadLexiconOnDemand, unclone, unsetLossFlag, write, writeLexicon, writeModel, writeParametersclassify, discreteValueArray, getCompositeChildren, getInputType, getOutputType, realValueArray, test, toString, valueIndexOfpublic static final double defaultConfidence
confidence.public static final double defaultInitialVariance
initialVariance.protected double confidence
defaultConfidence.protected double initialVariance
defaultInitialVariance.protected SparseWeightVector variances
protected double variancesBias
variances vector.public SparseConfidenceWeighted()
public SparseConfidenceWeighted(double c)
confidence parameter.c - The desired confidence value.public SparseConfidenceWeighted(double c,
double v)
confidence and initialVariance parameters.c - The desired confidence value.v - The desired initial variance.public SparseConfidenceWeighted(double c,
double v,
SparseWeightVector vm)
c - The desired confidence value.v - The desired initial variance.vm - An empty sparse weight vector of means, perhaps of an alternative subclass of
SparseWeightVector.public SparseConfidenceWeighted(double c,
double v,
SparseWeightVector vm,
SparseWeightVector vv)
confidence, initialVariance,
LinearThresholdUnit.weightVector, and variances parameters. Make sure that
the references passed to the last two arguments refer to different objects.c - The desired confidence value.v - The desired initial variance.vm - An empty sparse weight vector of means, perhaps of an alternative subclass of
SparseWeightVector.vv - An empty sparse weight vector of variances, perhaps of an alternative subclass of
SparseWeightVector.public SparseConfidenceWeighted(SparseConfidenceWeighted.Parameters p)
SparseConfidenceWeighted.Parameters object.p - The settings of all parameters.public SparseConfidenceWeighted(String n)
n - The name of the classifier.public SparseConfidenceWeighted(String n, double c)
confidence parameter.n - The name of the classifier.c - The desired confidence value.public SparseConfidenceWeighted(String n, double c, double v)
confidence and initialVariance parameters.n - The name of the classifier.c - The desired confidence value.v - The desired initial variance.public SparseConfidenceWeighted(String n, double c, double v, SparseWeightVector vm)
n - The name of the classifier.c - The desired confidence value.v - The desired initial variance.vm - An empty sparse weight vector of means, perhaps of an alternative subclass of
SparseWeightVector.public SparseConfidenceWeighted(String n, double c, double v, SparseWeightVector vm, SparseWeightVector vv)
confidence, initialVariance,
LinearThresholdUnit.weightVector, and variances parameters. Make sure that
the references passed to the last two arguments refer to different objects.n - The name of the classifier.c - The desired confidence value.v - The desired initial variance.vm - An empty sparse weight vector of means, perhaps of an alternative subclass of
SparseWeightVector.vv - An empty sparse weight vector of variances, perhaps of an alternative subclass of
SparseWeightVector.public SparseConfidenceWeighted(String n, SparseConfidenceWeighted.Parameters p)
SparseConfidenceWeighted.Parameters object.n - The name of the classifier.p - The settings of all parameters.public void setParameters(SparseConfidenceWeighted.Parameters p)
p - The parameters.public Learner.Parameters getParameters()
getParameters in class LinearThresholdUnitpublic double getConfidence()
confidence variable.confidence variable.public void setConfidence(double c)
confidence member variable to the specified value.c - The new value for confidence.public double getInitialVariance()
initialVariance variable.initialVariance variable.public void setInitialVariance(double v)
initialVariance member variable to the specified value.v - The new value for initialVariance.public void learn(int[] exampleFeatures,
double[] exampleValues,
int[] exampleLabels,
double[] labelValues)
learn in class LinearThresholdUnitexampleFeatures - The example's array of feature indicesexampleValues - The example's array of feature valuesexampleLabels - The example's label(s)labelValues - The labels' valuespublic void demote(int[] exampleFeatures,
double[] exampleValues,
double rate)
Learner.learn(Object).demote in class LinearThresholdUnitexampleFeatures - The example's array of feature indicesexampleValues - The example's array of feature valuesrate - The learning rate at which the weights are updated.public void promote(int[] exampleFeatures,
double[] exampleValues,
double rate)
Learner.learn(Object).promote in class LinearThresholdUnitexampleFeatures - The example's array of feature indicesexampleValues - The example's array of feature valuesrate - The learning rate at which the weights are updated.public void forget()
forget in class LinearThresholdUnitpublic void write(PrintStream out)
confidence and initialVariance.
Next, the annotation Begin means on its own line is followed by the contents of
LinearThresholdUnit.weightVector and the annotation End
means on its own line. Finally, the annotation Begin
variances on its own line is followed by the contents of variances and the
annotation End variances on its own line.public void write(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out)
write in class LinearThresholdUnitout - The output stream.public void read(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in)
read in class LinearThresholdUnitin - The input stream.public Object clone()
clone in class LinearThresholdUnitCopyright © 2016. All rights reserved.