|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectLBJ2.learn.SparseWeightVector
LBJ2.learn.NaiveBayes.NaiveBayesVector
protected class NaiveBayes.NaiveBayesVector
Keeps track of all the counts associated with a given label.
Features are associated with NaiveBayes.Counts. Those not
appearing in this vector are assumed to have a count of 0. The
invocation of either of the scaledAdd methods increments
the prior count for the label.
RealFeatures are ignored by this vector - no counts will be
associated with them.
| Nested Class Summary | |
|---|---|
protected class |
NaiveBayes.NaiveBayesVector.NaiveBayesIterator
This class simultaneously iterates over the features in a given vector and their corresponding weights from a NaiveBayes.NaiveBayesVector. |
| Nested classes/interfaces inherited from class LBJ2.learn.SparseWeightVector |
|---|
SparseWeightVector.WeightIterator |
| Field Summary | |
|---|---|
protected NaiveBayes.Count |
priorCount
The prior count is the number of times either scaledAdd
method has been called. |
| Fields inherited from class LBJ2.learn.SparseWeightVector |
|---|
defaultWeight, weights |
| Constructor Summary | |
|---|---|
NaiveBayes.NaiveBayesVector()
Simply instantiates SparseWeightVector.weights. |
|
NaiveBayes.NaiveBayesVector(java.util.HashMap w)
Simply initializes SparseWeightVector.weights. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Returns a copy of this NaiveBayesVector in which the
SparseWeightVector.weights variable has been cloned deeply. |
double |
dot(FeatureVector example)
Takes the dot product of this vector with the given vector, using the hard coded smoothing weight. |
double |
dot(FeatureVector example,
double defaultW)
Takes the dot product of this vector with the given vector, using the specified default weight when encountering a feature that is not yet present in this vector. |
NaiveBayes.Count |
getPrior()
Returns the prior count of the prediction value associated with this vector. |
void |
scaledAdd(FeatureVector example,
double factor,
double defaultW)
This method is similar to the implementation in SparseWeightVector except that the factor
and defaultW arguments are ignored and
NaiveBayes.NaiveBayesVector.NaiveBayesIterator.incrementCount(double)
is called instead of
SparseWeightVector.WeightIterator.setWeight(double). |
java.lang.String |
toString()
Converts this NaiveBayesVector 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, scaledAdd, scaledAdd, write |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected NaiveBayes.Count priorCount
scaledAdd
method has been called.
| Constructor Detail |
|---|
public NaiveBayes.NaiveBayesVector()
SparseWeightVector.weights.
public NaiveBayes.NaiveBayesVector(java.util.HashMap w)
SparseWeightVector.weights.
w - A map of weights.| Method Detail |
|---|
public NaiveBayes.Count getPrior()
public SparseWeightVector.WeightIterator weightIterator(FeatureVector example)
weightIterator in class SparseWeightVectorexample - A vector of features extracted from an example object.
public double dot(FeatureVector example)
dot in class SparseWeightVectorexample - A vector of features extracted from an example object.
public double dot(FeatureVector example,
double defaultW)
dot in class SparseWeightVectorexample - A vector of features extracted from an example object.defaultW - The default weight.
public void scaledAdd(FeatureVector example,
double factor,
double defaultW)
SparseWeightVector except that the factor
and defaultW arguments are ignored and
NaiveBayes.NaiveBayesVector.NaiveBayesIterator.incrementCount(double)
is called instead of
SparseWeightVector.WeightIterator.setWeight(double).
scaledAdd in class SparseWeightVectorexample - A vector of features extracted from an example object.factor - The scaling factor.defaultW - The default weight.public java.lang.String toString()
NaiveBayesVector into a
String.
toString in class SparseWeightVectorString holding a textual representation of this
vector.public java.lang.Object clone()
NaiveBayesVector in which the
SparseWeightVector.weights variable has been cloned deeply.
clone in class SparseWeightVectorNaiveBayesVector.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||