|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectcontextFold.features.AbstractFeatureVector
public abstract class AbstractFeatureVector
A weight vector object.
Field Summary | |
---|---|
protected java.util.Map<java.lang.Integer,java.lang.String> |
featureNames
|
Constructor Summary | |
---|---|
AbstractFeatureVector()
|
Method Summary | |
---|---|
void |
add(AbstractFeatureVector other)
The same as add(AbstractFeatureVector, float) , where
amount = 1. |
void |
add(AbstractFeatureVector other,
float amount)
Adds to this object another weight vector. |
abstract void |
clear()
Sets all weights to 0. |
abstract int |
countNonZeroEntries()
|
float |
dot(AbstractFeatureVector other)
Computes the dot-product of two vectors. |
float |
filter(float propOfMaxWeight)
|
abstract float |
getFeatureWeight(int featureIx)
|
abstract java.util.Iterator<java.lang.Integer> |
getNonZeroFeatures()
|
abstract float |
norm()
|
void |
setFeatureNames(java.util.Map<java.lang.Integer,java.lang.String> names)
|
abstract void |
setFeatureWeight(int featureIx,
float newFeatureWeight)
Sets the weight of a given feature. |
void |
sub(AbstractFeatureVector other)
The same as sub(AbstractFeatureVector, float) , where
amount = 1. |
void |
sub(AbstractFeatureVector other,
float amount)
The same as add(AbstractFeatureVector, float) , where
other is being subtracted rather than added. |
float |
sum()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Map<java.lang.Integer,java.lang.String> featureNames
Constructor Detail |
---|
public AbstractFeatureVector()
Method Detail |
---|
public abstract float norm()
public void add(AbstractFeatureVector other, float amount)
w_i
of this object is set to be w_i = w_i + amount*w'_i
, where
w'_i
is the i-th weight of the other vector, and amount
is the given scaling parameter.
other
- a weight vector to be added.amount
- a scaling parameter.public void add(AbstractFeatureVector other)
add(AbstractFeatureVector, float)
, where
amount
= 1.
other
- a weight vector to be added.public void sub(AbstractFeatureVector other, float amount)
add(AbstractFeatureVector, float)
, where
other
is being subtracted rather than added.
other
- a weight vector to be subtracted.amount
- a scaling parameter.public void sub(AbstractFeatureVector other)
sub(AbstractFeatureVector, float)
, where
amount
= 1.
other
- a weight vector to be subtracted.public abstract float getFeatureWeight(int featureIx)
featureIx
- an index of a feature.
featureIx
.public abstract void setFeatureWeight(int featureIx, float newFeatureWeight)
featureIx
- an index of a feature.newFeatureWeight
- a value to be set as the weight of
the feature which index is featureIx
.public abstract java.util.Iterator<java.lang.Integer> getNonZeroFeatures()
public float dot(AbstractFeatureVector other)
Dotable
dot
in interface Dotable<AbstractFeatureVector>
other
- another vector.
this
and other
.public abstract void clear()
public float sum()
public void setFeatureNames(java.util.Map<java.lang.Integer,java.lang.String> names)
public abstract int countNonZeroEntries()
public float filter(float propOfMaxWeight)
propOfMaxWeight
- a fraction s.t. weights whose absolute values are
below this faction with respect to the absolute maximum weight, are set
to 0.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |