|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectLBJ2.learn.SparseWeightVector.WeightIterator
protected class SparseWeightVector.WeightIterator
This class simultaneously iterates over the features in the given vector
and their corresponding weights from a SparseWeightVector.
Member methods give read and write access to the weight that an object
of this class currently points to, and changes are reflected in the
SparseWeightVector.
| Field Summary | |
|---|---|
protected int |
arrayIndex
Pointer into weightArray. |
protected Feature |
currentFeature
The feature corresponding to the current weight. |
protected java.util.Iterator |
I
Iterates through the features corresponding to the weights to be iterated over for the current composite child. |
protected boolean |
isDiscrete
true iff the current feature is discrete. |
protected FeatureVector |
vector
The feature vector to iterate through. |
protected double[] |
weightArray
The array of weights, if applicable. |
| Constructor Summary | |
|---|---|
SparseWeightVector.WeightIterator(FeatureVector example)
This constructor selects a slice of weights from the SparseWeightVector representing all those weights
corresponding to features in the given vector. |
|
| Method Summary | |
|---|---|
Feature |
getCurrentFeature()
Returns the feature corresponding to the current weight. |
double |
getCurrentFeatureStrength()
Convenience method for determining the current feature's strength in the given example. |
java.lang.Double |
getWeight()
Returns the double precision value pointed to by this iterator. |
boolean |
hasNext()
Determines whether a call to next() will redirect this
iterator to point to a different weight. |
void |
next()
Repositions this iterator to point to the next weight in the iteration. |
void |
reset()
Restart the iteration. |
void |
setWeight(double w)
Modifies the weight vector. |
void |
setWeight(double w,
double d)
Modifies the weight vector. |
int |
totalFeatures()
Returns the total number of features to iterate through. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected FeatureVector vector
protected java.util.Iterator I
protected Feature currentFeature
protected boolean isDiscrete
true iff the current feature is discrete.
protected double[] weightArray
protected int arrayIndex
weightArray.
| Constructor Detail |
|---|
public SparseWeightVector.WeightIterator(FeatureVector example)
SparseWeightVector representing all those weights
corresponding to features in the given vector.
example - A vector of features extracted from an example object.| Method Detail |
|---|
public int totalFeatures()
public boolean hasNext()
next() will redirect this
iterator to point to a different weight.
true iff there are more weights in the iteration.public void next()
public void reset()
public Feature getCurrentFeature()
public double getCurrentFeatureStrength()
false, in which case the strength is 0. The strength of
a real feature is just its value.
public java.lang.Double getWeight()
null if the location in the weight vector pointed
to by this iterator is empty.public void setWeight(double w)
w is equivalent to calling setWeight(w, 0).
w - The new value for the weight pointed to by this iterator.setWeight(double,double)
public void setWeight(double w,
double d)
w - The new value for the weight pointed to by this iterator.d - The default value for other weights incidentally created by
this invocation.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||