|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.labs.minion.classification.WeightedFeature com.sun.labs.minion.classification.ContingencyFeature
public class ContingencyFeature
A weighted feature class that contains a 2x2 contingency table that can be used to calculate the Mutual Information or Chi-squared measures.
Field Summary | |
---|---|
protected int |
a
The number of documents in the class that contain this feature. |
protected int |
b
The number of documents not in the class that contain this feature. |
protected int |
c
The number of documents in the class that don't contain this feature. |
static int |
CHI_SQUARED
A constant indicating that we should return the Chi-squared value as the weight for this feature. |
protected int |
d
The number of documents not in the class that don't contain this feature. |
protected java.util.Set<java.lang.Integer> |
docIDs
|
static int |
MUTUAL_INFORMATION
A constant indicating that we should return the MI value as the weight for this feature. |
protected int |
N
The total number of documents. |
protected int |
type
The type of weight that we'll return. |
protected boolean |
weightCalculated
Whether we've already calculated the weight. |
Fields inherited from class com.sun.labs.minion.classification.WeightedFeature |
---|
entry, freq, id, invWeightComparator, name, weight, weightComparator |
Constructor Summary | |
---|---|
ContingencyFeature()
Creates an empty contingency feature with the default MI type |
|
ContingencyFeature(ContingencyFeature cf)
Creates a copy of a contingency feature |
|
ContingencyFeature(int type)
Creates an empty feature. |
|
ContingencyFeature(java.lang.String name)
Creates a feature with the given name. |
Method Summary | |
---|---|
void |
addDoc(int docID)
|
int |
getA()
|
int |
getB()
|
protected java.util.Set<java.lang.Integer> |
getDocs()
|
float |
getWeight()
Gets the weight associated with this term. |
void |
setWeight(float weight)
Sets the weight associated with this feature. |
void |
sum(ContingencyFeature other)
Adds the other feature's weights to this one's |
java.lang.String |
toString()
|
protected void |
wipeDocs()
|
Methods inherited from class com.sun.labs.minion.classification.WeightedFeature |
---|
combine, compareTo, decode, encode, equals, getCount, getEntry, getFreq, getID, getInverseWeightComparator, getName, getWeightComparator, setCount, setEntry, setFreq, setID, setName |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int type
MUTUAL_INFORMATION
,
CHI_SQUARED
protected int a
protected int b
protected int c
protected int d
protected int N
protected boolean weightCalculated
public static final int MUTUAL_INFORMATION
public static final int CHI_SQUARED
protected java.util.Set<java.lang.Integer> docIDs
Constructor Detail |
---|
public ContingencyFeature()
public ContingencyFeature(int type)
public ContingencyFeature(java.lang.String name)
public ContingencyFeature(ContingencyFeature cf)
cf
- feature to copyMethod Detail |
---|
public void sum(ContingencyFeature other)
other
- public int getA()
public int getB()
public void addDoc(int docID)
protected void wipeDocs()
protected java.util.Set<java.lang.Integer> getDocs()
public float getWeight()
getWeight
in class WeightedFeature
public void setWeight(float weight)
WeightedFeature
setWeight
in class WeightedFeature
weight
- the weightpublic java.lang.String toString()
toString
in class WeightedFeature
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |