|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectDistribution
public class Distribution
For a given attribute, a Distribution object stores information about a probability distribution over the possible attribute values in two different ways: (i) frequencies -- how many times each attribute value was observed, and (ii) probabilities -- the probability that this attribute has each of the possible attribute values. A method is provided for translating frequencies into normalized probabilities.
Constructor Summary | |
---|---|
Distribution(Attribute attribute)
Create a distribution on the values of a particular attribute |
Method Summary | |
---|---|
void |
computeProbabilitiesFromFrequencies()
Take the observed frequencies and create normalized probabilities from them, which can later be obtained using getProbabilities(). |
double |
getEntropy()
Get the entropy of the probability distribution. |
java.lang.String |
getNameOfMaxFrequency()
Get the name of the most frequently-observed attribute value. |
java.lang.String |
getNameOfMaxProbability()
Get the name of the most probable attribute value. |
java.util.HashMap<java.lang.String,java.lang.Double> |
getProbabilities()
Get a HashMap of the probabilities in this distribution. |
int |
getTotalFrequencies()
Get the total number of observations. |
int |
getValueOfMaxFrequency()
Get the number of times the most frequently-observed value was observed. |
double |
getValueOfMaxProbability()
Get the probability of the most probable attribute value. |
void |
incrementFrequency(java.lang.String attributeValue)
Increment the observed frequency of the given value by 1. |
void |
printFrequencies()
Print out the table of observed frequencies. |
void |
printProbabilities()
Print out the table of probabilities. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Distribution(Attribute attribute)
attribute
- the attribute whose distribution this object recordsMethod Detail |
---|
public void incrementFrequency(java.lang.String attributeValue)
attributeValue
- the attribute value whose frequency will be incremented by 1public java.lang.String getNameOfMaxFrequency()
public int getValueOfMaxFrequency()
public java.lang.String getNameOfMaxProbability() throws DecisionTreeException
DecisionTreeException
- if the probabilities have not been computed via
computeProbabilitiesFromFrequencies()
public double getValueOfMaxProbability() throws DecisionTreeException
DecisionTreeException
- if the probabilities have not been computed via
computeProbabilitiesFromFrequencies()
public int getTotalFrequencies()
public double getEntropy() throws DecisionTreeException
DecisionTreeException
- if the probabilities have not been computed via
computeProbabilitiesFromFrequencies()
public void computeProbabilitiesFromFrequencies() throws DecisionTreeException
DecisionTreeException
public void printFrequencies()
public void printProbabilities() throws DecisionTreeException
DecisionTreeException
public java.util.HashMap<java.lang.String,java.lang.Double> getProbabilities() throws DecisionTreeException
DecisionTreeException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |