|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.labs.minion.classification.WeightedFeature
public class WeightedFeature
| Field Summary | |
|---|---|
protected QueryEntry |
entry
The dictionary entry that gave us this feature. |
protected int |
freq
The frequency of the feature. |
protected int |
id
The ID for the feature, used when doing postings. |
protected static java.util.Comparator<WeightedFeature> |
invWeightComparator
An "inverse" weight comparator where large weights are less than small weights |
protected java.lang.String |
name
The name of the feature. |
protected float |
weight
The weight associated with the feature. |
protected static java.util.Comparator<WeightedFeature> |
weightComparator
A weight comparator where small weights are less than large weights |
| Constructor Summary | |
|---|---|
WeightedFeature()
|
|
WeightedFeature(java.lang.String name)
|
|
WeightedFeature(java.lang.String name,
float weight)
|
|
WeightedFeature(java.lang.String name,
int id,
float weight)
|
|
WeightedFeature(WeightedFeature f)
|
|
| Method Summary | |
|---|---|
void |
combine(WeightedFeature f)
Combines another weighted feature with this one. |
int |
compareTo(Feature o)
Compares two features on the basis of their names. |
void |
decode(ReadableBuffer b)
Decodes the information in this feature from the given buffer. |
void |
encode(WriteableBuffer b)
Encodes the information in this feature onto the given buffer. |
boolean |
equals(java.lang.Object o)
Two WeightedFeature objects are equal if they represent the same feature -- that is, their names are the same, but their weights need not be. |
int |
getCount()
Gets the count of occurrences that this feature represents. |
QueryEntry |
getEntry()
|
int |
getFreq()
|
int |
getID()
Gets the ID associated with an occurrence. |
static java.util.Comparator<WeightedFeature> |
getInverseWeightComparator()
Gets a comparator that compares weighted features based on their weights. |
java.lang.String |
getName()
Gets the name of this feature. |
float |
getWeight()
Gets the weight associated with this feature. |
static java.util.Comparator<WeightedFeature> |
getWeightComparator()
Gets a comparator that compares weighted features based on their weights. |
void |
setCount(int count)
Sets the count of occurrences that this occurrence represents. |
void |
setEntry(QueryEntry entry)
|
void |
setFreq(int freq)
|
void |
setID(int id)
Sets the ID associated with this feature. |
void |
setName(java.lang.String name)
Sets the name of this feature. |
void |
setWeight(float weight)
Sets the weight associated with this feature. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String name
protected int id
protected int freq
protected float weight
protected transient QueryEntry entry
DocumentVector.findSimilar
protected static java.util.Comparator<WeightedFeature> weightComparator
protected static java.util.Comparator<WeightedFeature> invWeightComparator
| Constructor Detail |
|---|
public WeightedFeature()
public WeightedFeature(java.lang.String name)
public WeightedFeature(java.lang.String name,
float weight)
public WeightedFeature(java.lang.String name,
int id,
float weight)
public WeightedFeature(WeightedFeature f)
| Method Detail |
|---|
public void setName(java.lang.String name)
setName in interface Featurename - the name of the feature.public java.lang.String getName()
getName in interface Featurepublic float getWeight()
public void setWeight(float weight)
weight - the weightpublic void combine(WeightedFeature f)
public void encode(WriteableBuffer b)
encode in interface Featureb - a buffer onto which the feature's information can be
encoded.public void decode(ReadableBuffer b)
decode in interface Featureb - a buffer from which the feature's information can be
decoded.public void setID(int id)
setID in interface Occurrenceid - the ID.public int getID()
getID in interface Occurrencepublic void setFreq(int freq)
public int getFreq()
public int getCount()
getCount in interface Occurrencepublic void setCount(int count)
setCount in interface Occurrencecount - the number of occurrences.public void setEntry(QueryEntry entry)
public QueryEntry getEntry()
public int compareTo(Feature o)
compareTo in interface java.lang.Comparable<Feature>public static java.util.Comparator<WeightedFeature> getWeightComparator()
public static java.util.Comparator<WeightedFeature> getInverseWeightComparator()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the object to compare to this one
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||