public final class WeightedInformationTheory 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 |
WeightedInformationTheory.VariableSelector
Chooses which variable is the one with associated weights.
|
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,WeightCountTuple> |
calculateWeightedCountDist(ArrayList<T> vector,
ArrayList<Double> weights)
Generate the counts for a single vector.
|
static <T1,T2,T3> double |
conditionalMI(List<T1> first,
List<T2> second,
List<T3> condition,
List<Double> weights)
Calculates the discrete weighted conditional mutual information, using
histogram probability estimators.
|
static <T1,T2,T3> double |
conditionalMI(TripleDistribution<T1,T2,T3> rv,
Map<?,Double> weights,
WeightedInformationTheory.VariableSelector vs) |
static <T1,T2,T3> double |
conditionalMI(WeightedTripleDistribution<T1,T2,T3> tripleRV) |
static <T1,T2> double |
jointEntropy(ArrayList<T1> first,
ArrayList<T2> second,
ArrayList<Double> weights)
Calculates the Shannon/Guiasu weighted joint entropy of two arrays,
using histogram probability estimators.
|
static <T1,T2,T3> double |
jointMI(List<T1> first,
List<T2> second,
List<T3> target,
List<Double> weights)
Calculates the discrete weighted joint mutual information, using
histogram probability estimators.
|
static <T1,T2,T3> double |
jointMI(TripleDistribution<T1,T2,T3> rv,
Map<?,Double> weights,
WeightedInformationTheory.VariableSelector vs) |
static <T1,T2,T3> double |
jointMI(WeightedTripleDistribution<T1,T2,T3> tripleRV) |
static <T1,T2> double |
mi(ArrayList<T1> first,
ArrayList<T2> second,
ArrayList<Double> weights)
Calculates the discrete weighted mutual information, using histogram
probability estimators.
|
static <T1,T2> double |
mi(PairDistribution<T1,T2> pairDist,
Map<?,Double> weights,
WeightedInformationTheory.VariableSelector vs) |
static <T1,T2> double |
mi(WeightedPairDistribution<T1,T2> jointDist) |
static <T> void |
normaliseWeights(Map<T,WeightCountTuple> map)
Normalizes the weights in the map, i.e., divides each weight by it's count.
|
static <T1,T2> double |
weightedConditionalEntropy(ArrayList<T1> vector,
ArrayList<T2> condition,
ArrayList<Double> weights)
Calculates the discrete Shannon/Guiasu Weighted Conditional Entropy of
two arrays, using histogram probability estimators.
|
static <T> double |
weightedEntropy(ArrayList<T> vector,
ArrayList<Double> weights)
Calculates the discrete Shannon/Guiasu Weighted Entropy, using histogram
probability estimators.
|
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,T3> double jointMI(List<T1> first, List<T2> second, List<T3> target, List<Double> weights)
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.weights
- Array of weight values.public static <T1,T2,T3> double jointMI(WeightedTripleDistribution<T1,T2,T3> tripleRV)
public static <T1,T2,T3> double jointMI(TripleDistribution<T1,T2,T3> rv, Map<?,Double> weights, WeightedInformationTheory.VariableSelector vs)
public static <T1,T2,T3> double conditionalMI(List<T1> first, List<T2> second, List<T3> condition, List<Double> weights)
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.weights
- Array of weight values.public static <T1,T2,T3> double conditionalMI(WeightedTripleDistribution<T1,T2,T3> tripleRV)
public static <T1,T2,T3> double conditionalMI(TripleDistribution<T1,T2,T3> rv, Map<?,Double> weights, WeightedInformationTheory.VariableSelector vs)
public static <T1,T2> double mi(ArrayList<T1> first, ArrayList<T2> second, ArrayList<Double> weights)
Arrays must be the same length.
T1
- Type of the first arrayT2
- Type of the second arrayfirst
- An array of valuessecond
- Another array of valuesweights
- Array of weight values.public static <T1,T2> double mi(WeightedPairDistribution<T1,T2> jointDist)
public static <T1,T2> double mi(PairDistribution<T1,T2> pairDist, Map<?,Double> weights, WeightedInformationTheory.VariableSelector vs)
public static <T1,T2> double jointEntropy(ArrayList<T1> first, ArrayList<T2> second, ArrayList<Double> weights)
Arrays must be same length.
T1
- Type of the first array.T2
- Type of the second array.first
- An array of values.second
- Another array of values.weights
- Array of weight values.public static <T1,T2> double weightedConditionalEntropy(ArrayList<T1> vector, ArrayList<T2> condition, ArrayList<Double> weights)
Arrays must be the same length.
T1
- Type of the first array.T2
- Type of the second array.vector
- The main array of values.condition
- The array to condition on.weights
- Array of weight values.public static <T> double weightedEntropy(ArrayList<T> vector, ArrayList<Double> weights)
T
- Type of the array.vector
- The array of values.weights
- Array of weight values.public static <T> Map<T,WeightCountTuple> calculateWeightedCountDist(ArrayList<T> vector, ArrayList<Double> weights)
T
- The type inside the vector.vector
- An array of values.weights
- The array of weight values.public static <T> void normaliseWeights(Map<T,WeightCountTuple> map)
T
- The type of the variable that was counted.map
- The map to normalize.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.