|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectLBJ2.learn.SparseWeightVector
LBJ2.learn.SparseAveragedPerceptron.AveragedWeightVector
public static class SparseAveragedPerceptron.AveragedWeightVector
This implementation of a sparse weight vector associates two
doubles with each Feature. The first plays the
role of the usual weight vector, and the second accumulates multiples of
examples on which mistakes were made to help implement the weighted
average.
| Nested Class Summary | |
|---|---|
protected class |
SparseAveragedPerceptron.AveragedWeightVector.AveragedWeightIterator
This class simultaneously iterates over the features in a given vector and their corresponding weights from an SparseAveragedPerceptron.AveragedWeightVector. |
| Nested classes/interfaces inherited from class LBJ2.learn.SparseWeightVector |
|---|
SparseWeightVector.WeightIterator |
| Field Summary | |
|---|---|
protected int |
examples
Counts the total number of training examples this vector has seen. |
| Fields inherited from class LBJ2.learn.SparseWeightVector |
|---|
defaultWeight, weights |
| Constructor Summary | |
|---|---|
SparseAveragedPerceptron.AveragedWeightVector()
Simply instantiates SparseWeightVector.weights. |
|
SparseAveragedPerceptron.AveragedWeightVector(java.util.HashMap w)
Simply initializes SparseWeightVector.weights. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Returns a copy of this AveragedWeightVector in which the
SparseWeightVector.weights variable has been cloned deeply. |
void |
correctExample()
Increments the examples variable. |
int |
getExamples()
Returns the examples variable. |
void |
scaledAdd(FeatureVector example,
double factor,
double defaultW)
Performs pairwise addition of the feature values in the given vector scaled by the given factor, modifying this weight vector, using the specified default weight when a feature from the given vector is not yet present in this vector. |
double |
simpleDot(FeatureVector example)
Takes the dot product of the regular, non-averaged, Perceptron weight vector with the given vector, using the hard coded default weight. |
double |
simpleDot(FeatureVector example,
double defaultW)
Takes the dot product of the regular, non-averaged, Perceptron weight vector with the given vector, using the specified default weight when a feature is not yet present in this vector. |
java.lang.String |
toString()
Converts this AveragedWeightVector into a
String. |
SparseWeightVector.WeightIterator |
weightIterator(FeatureVector example)
Produces an iterator that accesses the data in this vector associated with the features in the given vector. |
| Methods inherited from class LBJ2.learn.SparseWeightVector |
|---|
clear, dot, dot, scaledAdd, scaledAdd, write |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int examples
| Constructor Detail |
|---|
public SparseAveragedPerceptron.AveragedWeightVector()
SparseWeightVector.weights.
public SparseAveragedPerceptron.AveragedWeightVector(java.util.HashMap w)
SparseWeightVector.weights.
w - A map of weights.| Method Detail |
|---|
public void correctExample()
examples variable.
public int getExamples()
examples variable.
public SparseWeightVector.WeightIterator weightIterator(FeatureVector example)
weightIterator in class SparseWeightVectorexample - A vector of features extracted from an example object.
public double simpleDot(FeatureVector example)
example - A vector of features extracted from an example object.
public double simpleDot(FeatureVector example,
double defaultW)
example - A vector of features extracted from an example object.defaultW - An initial weight for new features.
public void scaledAdd(FeatureVector example,
double factor,
double defaultW)
scaledAdd in class SparseWeightVectorexample - A vector of features extracted from an example object.factor - The scaling factor.defaultW - An initial weight for new features.public java.lang.Object clone()
AveragedWeightVector in which the
SparseWeightVector.weights variable has been cloned deeply.
clone in class SparseWeightVectorAveragedWeightVector.public java.lang.String toString()
AveragedWeightVector into a
String.
toString in class SparseWeightVectorString holding a textual representation of this
vector.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||