|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.indiana.iucbrf.feature.stats.InformationTheory
public class InformationTheory
Field Summary | |
---|---|
protected java.util.HashSet |
allKeys
|
protected java.util.ArrayList |
cases
|
protected Domain |
domain
|
protected double |
entropyC
|
protected java.util.HashSet |
keysOfInterest
|
protected java.util.HashMap |
keyToGain
|
protected java.util.HashMap |
keyToGainRatio
|
protected FeatureKey |
maxGainKey
|
protected FeatureKey |
maxGainRatioKey
|
protected KeyToValueToDouble |
probKeyToCountMap
|
protected FeatureKey |
solutionFeatureKey
|
protected FeatureSpec |
solutionFeatureSpec
|
protected java.util.HashMap |
solValueToCount
|
Constructor Summary | |
---|---|
InformationTheory(Domain domain)
Creates a new instance of InformationTheory. |
|
InformationTheory(Domain domain,
java.util.HashSet allKeys)
Creates a new instance of InformationTheory |
Method Summary | |
---|---|
double |
calcEntropy(int numCases,
java.util.HashMap myValueToCount)
Calculate the entropy with the given value counts. |
protected void |
calcEntropyC()
Calculates the entropy over the solutions of all the cases. |
protected double |
calcEntropyOnSubset(FeatureKey key,
java.lang.String attributeValue,
java.util.LinkedList remainingCases)
Calculate the entropy of the set of cases where the attribute specified by key has value attributeValue. |
protected double |
calcGain(FeatureKey key)
|
protected double |
calcGainRatio(FeatureKey key)
|
protected void |
calcGainRatios()
|
protected void |
calcGains()
Calculates the gain for each problem attribute in the domain, as a HashMap mapping FeatureKey to the gain (a Double). |
protected double |
calcSplitInfo(FeatureKey key)
|
protected void |
eraseCalculations()
Destroy the old calculations. |
double |
getEntropy()
|
double |
getGain(FeatureKey key)
|
double |
getGainRatio(FeatureKey key)
|
java.util.HashMap |
getGainRatios()
|
java.util.HashMap |
getGains()
|
FeatureKey |
getMaxGainKey()
|
FeatureKey |
getMaxGainRatioKey()
|
protected void |
init(Domain domain,
java.util.HashSet allKeys)
|
protected void |
reinitCounts()
Reinitialize the counts of occurrences of attribute values, to handle a new list of cases. |
void |
setCases(java.util.ArrayList cases)
Reset the state of the InformationTheory object for a new list of cases. |
void |
setCases(java.util.ArrayList cases,
java.util.HashSet keysOfInterest)
Reset the state of the InformationTheory object for a new list of cases. |
java.lang.String |
toString()
|
protected void |
updateCounts()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Domain domain
protected FeatureKey solutionFeatureKey
protected FeatureSpec solutionFeatureSpec
protected java.util.HashSet allKeys
protected java.util.ArrayList cases
protected java.util.HashSet keysOfInterest
protected KeyToValueToDouble probKeyToCountMap
protected java.util.HashMap solValueToCount
protected double entropyC
protected java.util.HashMap keyToGain
protected java.util.HashMap keyToGainRatio
protected FeatureKey maxGainKey
protected FeatureKey maxGainRatioKey
Constructor Detail |
---|
public InformationTheory(Domain domain)
public InformationTheory(Domain domain, java.util.HashSet allKeys)
allKeys
- the maximal set of keys that will ever be consideredMethod Detail |
---|
protected void init(Domain domain, java.util.HashSet allKeys)
public void setCases(java.util.ArrayList cases, java.util.HashSet keysOfInterest)
keysOfInterest
- The FeatureKeys corresponding to problem features
to be considered.public void setCases(java.util.ArrayList cases)
public double getEntropy()
public java.util.HashMap getGains()
public double getGain(FeatureKey key)
public FeatureKey getMaxGainKey()
public java.util.HashMap getGainRatios()
public double getGainRatio(FeatureKey key)
public FeatureKey getMaxGainRatioKey()
protected void eraseCalculations()
protected void reinitCounts()
protected void updateCounts()
protected void calcEntropyC()
public double calcEntropy(int numCases, java.util.HashMap myValueToCount)
myValueToCount
- maps feature value (String) to count (Double)protected void calcGains()
protected double calcGain(FeatureKey key)
protected double calcEntropyOnSubset(FeatureKey key, java.lang.String attributeValue, java.util.LinkedList remainingCases)
protected void calcGainRatios()
protected double calcGainRatio(FeatureKey key)
protected double calcSplitInfo(FeatureKey key)
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 |