public class MutualInformationAccumulator
extends java.lang.Object
Accumulate mutual information over two discrete variables. Slightly incorrectly, this reports 0 as the entropy and mutual information of empty sets.
Constructor and Description |
---|
MutualInformationAccumulator(int n)
Construct a new accumulator with equal-sized event spaces.
|
MutualInformationAccumulator(int n1,
int n2)
Construct a new accumulator.
|
Modifier and Type | Method and Description |
---|---|
void |
count(int v1,
int v2)
Count an occurrence.
|
int |
getCount()
Get the number of events.
|
double |
getMutualInformation()
Get the mutual information.
|
double |
getV1Entropy()
Get the entropy of the first variable.
|
double |
getV2Entropy()
Get the entropy of the second variable.
|
void |
reset()
Reset to start accumulating again.
|
public MutualInformationAccumulator(int n1, int n2)
Construct a new accumulator.
n1
- The number of discrete values of the first variable.n2
- The number of discrete values of the second variable.public MutualInformationAccumulator(int n)
Construct a new accumulator with equal-sized event spaces.
n
- The number of discrete values of each variable.public void count(int v1, int v2)
Count an occurrence.
v1
- The value of the first variable.v2
- The value of the second variable.public double getMutualInformation()
Get the mutual information.
public double getV1Entropy()
Get the entropy of the first variable.
public double getV2Entropy()
Get the entropy of the second variable.
public int getCount()
Get the number of events.
public void reset()
Reset to start accumulating again.