public final class InformationTheory extends Object
Defaults to log_2, so returns values in bits.
All functions expect that the element types have well defined equals and hashcode, and that equals is consistent with hashcode. The behaviour is undefined if this is not true.
Modifier and Type | Class and Description |
---|---|
static class |
InformationTheory.GTestStatistics
An immutable named tuple containing the statistics from a G test.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAP_SIZE |
static double |
LOG_2 |
static double |
LOG_BASE
Sets the base of the logarithm used in the information theoretic calculations.
|
static double |
LOG_E |
static double |
SAMPLES_RATIO |
Modifier and Type | Method and Description |
---|---|
static <T> Map<T,Long> |
calculateCountDist(List<T> vector)
Generate the counts for a single vector.
|
static double |
calculateEntropy(DoubleStream vector)
Calculates the discrete Shannon entropy of a stream, assuming each element of the stream is
an element of the same probability distribution.
|
static double |
calculateEntropy(Stream<Double> vector)
Calculates the discrete Shannon entropy of a stream, assuming each element of the stream is
an element of the same probability distribution.
|
static <T1,T2,T3> double |
cmi(List<T1> first,
List<T2> second,
Set<List<T3>> condition)
Calculates the conditional mutual information between first and second conditioned on the set.
|
static <T1,T2> double |
conditionalEntropy(List<T1> vector,
List<T2> condition)
Calculates the discrete Shannon conditional entropy of two arrays, using
histogram probability estimators.
|
static <T1,T2,T3> double |
conditionalMI(List<T1> first,
List<T2> second,
List<T3> condition)
Calculates the discrete Shannon conditional mutual information, using
histogram probability estimators.
|
static <T1,T2,T3> double |
conditionalMI(TripleDistribution<T1,T2,T3> rv)
Calculates the discrete Shannon conditional mutual information, using
histogram probability estimators.
|
static <T1,T2,T3> double |
conditionalMIFlipped(TripleDistribution<T1,T2,T3> rv)
Calculates the discrete Shannon conditional mutual information, using
histogram probability estimators.
|
static <T> double |
entropy(List<T> vector)
Calculates the discrete Shannon entropy, using histogram probability
estimators.
|
static <T1,T2,T3> InformationTheory.GTestStatistics |
gTest(List<T1> first,
List<T2> second,
Set<List<T3>> condition)
Calculates the GTest statistics for the input variables conditioned on the set.
|
static <T1,T2> double |
jointEntropy(List<T1> first,
List<T2> second)
Calculates the Shannon joint entropy of two arrays, using histogram
probability estimators.
|
static <T1,T2,T3> double |
jointMI(List<T1> first,
List<T2> second,
List<T3> target)
Calculates the discrete Shannon joint mutual information, using
histogram probability estimators.
|
static <T1,T2,T3> double |
jointMI(TripleDistribution<T1,T2,T3> rv)
Calculates the discrete Shannon joint mutual information, using
histogram probability estimators.
|
static <T1,T2> double |
mi(List<T1> first,
List<T2> second)
Calculates the discrete Shannon mutual information, using histogram
probability estimators.
|
static <T1,T2> double |
mi(PairDistribution<T1,T2> pairDist)
Calculates the discrete Shannon mutual information, using histogram
probability estimators.
|
static <T1,T2> double |
mi(Set<List<T1>> first,
Set<List<T2>> second)
Calculates the mutual information between the two sets of random variables.
|
public static final double SAMPLES_RATIO
public static final int DEFAULT_MAP_SIZE
public static final double LOG_2
public static final double LOG_E
public static double LOG_BASE
public static <T1,T2> double mi(Set<List<T1>> first, Set<List<T2>> second)
T1
- The first type.T2
- The second type.first
- The first set of random variables.second
- The second set of random variables.public static <T1,T2,T3> double cmi(List<T1> first, List<T2> second, Set<List<T3>> condition)
T1
- The first type.T2
- The second type.T3
- The third type.first
- A sample from the first random variable.second
- A sample from the second random variable.condition
- A sample from the conditioning set of random variables.public static <T1,T2,T3> InformationTheory.GTestStatistics gTest(List<T1> first, List<T2> second, Set<List<T3>> condition)
T1
- The first type.T2
- The second type.T3
- The third type.first
- A sample from the first random variable.second
- A sample from the second random variable.condition
- A sample from the conditioning set of random variables.public static <T1,T2,T3> double jointMI(List<T1> first, List<T2> second, List<T3> target)
T1
- Type contained in the first array.T2
- Type contained in the second array.T3
- Type contained in the target array.first
- An array of values.second
- Another array of values.target
- Target array of values.public static <T1,T2,T3> double jointMI(TripleDistribution<T1,T2,T3> rv)
T1
- Type contained in the first array.T2
- Type contained in the second array.T3
- Type contained in the target array.rv
- The random variable to calculate the joint mi ofpublic static <T1,T2,T3> double conditionalMI(List<T1> first, List<T2> second, List<T3> condition)
T1
- Type contained in the first array.T2
- Type contained in the second array.T3
- Type contained in the condition array.first
- An array of values.second
- Another array of values.condition
- Array to condition upon.public static <T1,T2,T3> double conditionalMI(TripleDistribution<T1,T2,T3> rv)
T1
- Type of the first variable.T2
- Type of the second variable.T3
- Type of the condition variable.rv
- The triple random variable of the three inputs.public static <T1,T2,T3> double conditionalMIFlipped(TripleDistribution<T1,T2,T3> rv)
T1
- Type of the first variable.T2
- Type of the condition variable.T3
- Type of the second variable.rv
- The triple random variable of the three inputs.public static <T1,T2> double mi(List<T1> first, List<T2> second)
T1
- Type of the first arrayT2
- Type of the second arrayfirst
- An array of valuessecond
- Another array of valuespublic static <T1,T2> double mi(PairDistribution<T1,T2> pairDist)
T1
- Type of the first variableT2
- Type of the second variablepairDist
- PairDistribution for the two variables.public static <T1,T2> double jointEntropy(List<T1> first, List<T2> second)
T1
- Type of the first array.T2
- Type of the second array.first
- An array of values.second
- Another array of values.public static <T1,T2> double conditionalEntropy(List<T1> vector, List<T2> condition)
T1
- Type of the first array.T2
- Type of the second array.vector
- The main array of values.condition
- The array to condition on.public static <T> double entropy(List<T> vector)
T
- Type of the array.vector
- The array of values.public static <T> Map<T,Long> calculateCountDist(List<T> vector)
T
- The type inside the vector.vector
- An array of values.public static double calculateEntropy(Stream<Double> vector)
vector
- The probability distribution.public static double calculateEntropy(DoubleStream vector)
vector
- The probability distribution.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.