Package org.tribuo.util.infotheory.impl
Class PairDistribution<T1,T2>
java.lang.Object
org.tribuo.util.infotheory.impl.PairDistribution<T1,T2>
- Type Parameters:
T1
- The type of the first elementT2
- The type of the second element
A count distribution over
CachedPair
objects.-
Field Summary
Modifier and TypeFieldDescriptionfinal long
The number of samples this distribution has seen.The first marginal distribution.final Map<CachedPair<T1,
T2>, com.oracle.labs.mlrg.olcut.util.MutableLong> The joint distribution.The second marginal distribution. -
Constructor Summary
ConstructorDescriptionPairDistribution
(long count, LinkedHashMap<CachedPair<T1, T2>, com.oracle.labs.mlrg.olcut.util.MutableLong> jointCounts, LinkedHashMap<T1, com.oracle.labs.mlrg.olcut.util.MutableLong> firstCount, LinkedHashMap<T2, com.oracle.labs.mlrg.olcut.util.MutableLong> secondCount) Constructs a pair distribution.PairDistribution
(long count, Map<CachedPair<T1, T2>, com.oracle.labs.mlrg.olcut.util.MutableLong> jointCounts, Map<T1, com.oracle.labs.mlrg.olcut.util.MutableLong> firstCount, Map<T2, com.oracle.labs.mlrg.olcut.util.MutableLong> secondCount) Constructs a pair distribution. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T1,
T2> PairDistribution<T1, T2> constructFromLists
(List<T1> first, List<T2> second) Generates the counts for two vectors.static <T1,
T2> PairDistribution<T1, T2> constructFromMap
(Map<CachedPair<T1, T2>, com.oracle.labs.mlrg.olcut.util.MutableLong> jointCount) Constructs a distribution from a joint count.static <T1,
T2> PairDistribution<T1, T2> constructFromMap
(Map<CachedPair<T1, T2>, com.oracle.labs.mlrg.olcut.util.MutableLong> jointCount, int aSize, int bSize) Constructs a distribution from a joint count.static <T1,
T2> PairDistribution<T1, T2> constructFromMap
(Map<CachedPair<T1, T2>, com.oracle.labs.mlrg.olcut.util.MutableLong> jointCount, Map<T1, com.oracle.labs.mlrg.olcut.util.MutableLong> aCount, Map<T2, com.oracle.labs.mlrg.olcut.util.MutableLong> bCount) Constructs a joint distribution from the counts.
-
Field Details
-
count
public final long countThe number of samples this distribution has seen. -
jointCounts
The joint distribution. -
firstCount
The first marginal distribution. -
secondCount
The second marginal distribution.
-
-
Constructor Details
-
PairDistribution
public PairDistribution(long count, Map<CachedPair<T1, T2>, com.oracle.labs.mlrg.olcut.util.MutableLong> jointCounts, Map<T1, com.oracle.labs.mlrg.olcut.util.MutableLong> firstCount, Map<T2, com.oracle.labs.mlrg.olcut.util.MutableLong> secondCount) Constructs a pair distribution.- Parameters:
count
- The total sample count.jointCounts
- The joint counts.firstCount
- The first variable count.secondCount
- The second variable count.
-
PairDistribution
public PairDistribution(long count, LinkedHashMap<CachedPair<T1, T2>, com.oracle.labs.mlrg.olcut.util.MutableLong> jointCounts, LinkedHashMap<T1, com.oracle.labs.mlrg.olcut.util.MutableLong> firstCount, LinkedHashMap<T2, com.oracle.labs.mlrg.olcut.util.MutableLong> secondCount) Constructs a pair distribution.- Parameters:
count
- The total sample count.jointCounts
- The joint counts.firstCount
- The first variable count.secondCount
- The second variable count.
-
-
Method Details
-
constructFromLists
Generates the counts for two vectors. Returns a PairDistribution containing the joint count, and the two marginal counts.- Type Parameters:
T1
- Type of the first array.T2
- Type of the second array.- Parameters:
first
- An array of values.second
- Another array of values.- Returns:
- The joint counts and the two marginal counts.
-
constructFromMap
public static <T1,T2> PairDistribution<T1,T2> constructFromMap(Map<CachedPair<T1, T2>, com.oracle.labs.mlrg.olcut.util.MutableLong> jointCount) Constructs a distribution from a joint count.- Type Parameters:
T1
- The type of the first variable.T2
- The type of the second variable.- Parameters:
jointCount
- The joint count.- Returns:
- A pair distribution.
-
constructFromMap
public static <T1,T2> PairDistribution<T1,T2> constructFromMap(Map<CachedPair<T1, T2>, com.oracle.labs.mlrg.olcut.util.MutableLong> jointCount, int aSize, int bSize) Constructs a distribution from a joint count.- Type Parameters:
T1
- The type of the first variable.T2
- The type of the second variable.- Parameters:
jointCount
- The joint count.aSize
- The initial size of the first marginal hash map.bSize
- The initial size of the second marginal hash map.- Returns:
- A pair distribution.
-
constructFromMap
public static <T1,T2> PairDistribution<T1,T2> constructFromMap(Map<CachedPair<T1, T2>, com.oracle.labs.mlrg.olcut.util.MutableLong> jointCount, Map<T1, com.oracle.labs.mlrg.olcut.util.MutableLong> aCount, Map<T2, com.oracle.labs.mlrg.olcut.util.MutableLong> bCount) Constructs a joint distribution from the counts.- Type Parameters:
T1
- The type of the first variable.T2
- The type of the second variable.- Parameters:
jointCount
- The joint count.aCount
- The first marginal count.bCount
- The second marginal count.- Returns:
- A pair distribution.
-