Package org.tribuo.util.infotheory.impl
Class WeightedTripleDistribution<T1,T2,T3>
java.lang.Object
org.tribuo.util.infotheory.impl.WeightedTripleDistribution<T1,T2,T3>
- Type Parameters:
T1
- Type of the first list.T2
- Type of the second list.T3
- Type of the third list.
Generates the counts for a triplet of vectors. Contains the joint
count, the three pairwise counts, and the three marginal counts.
-
Field Summary
Modifier and TypeFieldDescriptionfinal long
The sample count.static final int
The default map size. -
Constructor Summary
ConstructorDescriptionWeightedTripleDistribution
(long count, Map<CachedTriple<T1, T2, T3>, WeightCountTuple> jointCount, Map<CachedPair<T1, T2>, WeightCountTuple> abCount, Map<CachedPair<T1, T3>, WeightCountTuple> acCount, Map<CachedPair<T2, T3>, WeightCountTuple> bcCount, Map<T1, WeightCountTuple> aCount, Map<T2, WeightCountTuple> bCount, Map<T3, WeightCountTuple> cCount) Constructs a weighted triple distribution from the supplied values. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T1,
T2, T3> WeightedTripleDistribution<T1, T2, T3> Constructs a WeightedTripleDistribution from three lists of the same length and a list of weights of the same length.static <T1,
T2, T3> WeightedTripleDistribution<T1, T2, T3> constructFromMap
(Map<CachedTriple<T1, T2, T3>, WeightCountTuple> jointCount) Constructs a WeightedTripleDistribution by marginalising the supplied joint distribution.The joint distribution over the first and second variables.The joint distribution over the first and third variables.The marginal distribution over the first variable.The joint distribution over the second and third variables.The marginal distribution over the second variable.The marginal distribution over the third variable.The joint distribution over the three variables.
-
Field Details
-
DEFAULT_MAP_SIZE
public static final int DEFAULT_MAP_SIZEThe default map size.- See Also:
-
count
public final long countThe sample count.
-
-
Constructor Details
-
WeightedTripleDistribution
public WeightedTripleDistribution(long count, Map<CachedTriple<T1, T2, T3>, WeightCountTuple> jointCount, Map<CachedPair<T1, T2>, WeightCountTuple> abCount, Map<CachedPair<T1, T3>, WeightCountTuple> acCount, Map<CachedPair<T2, T3>, WeightCountTuple> bcCount, Map<T1, WeightCountTuple> aCount, Map<T2, WeightCountTuple> bCount, Map<T3, WeightCountTuple> cCount) Constructs a weighted triple distribution from the supplied values.- Parameters:
count
- The sample count.jointCount
- The ABC joint distribution.abCount
- The AB joint distribution.acCount
- The AC joint distribution.bcCount
- The BC joint distribution.aCount
- The A marginal distribution.bCount
- The B marginal distribution.cCount
- The C marginal distribution.
-
-
Method Details
-
getJointCount
The joint distribution over the three variables.- Returns:
- The joint distribution.
-
getABCount
The joint distribution over the first and second variables.- Returns:
- The joint distribution over A and B.
-
getACCount
The joint distribution over the first and third variables.- Returns:
- The joint distribution over A and C.
-
getBCCount
The joint distribution over the second and third variables.- Returns:
- The joint distribution over B and C.
-
getACount
The marginal distribution over the first variable.- Returns:
- The marginal distribution for A.
-
getBCount
The marginal distribution over the second variable.- Returns:
- The marginal distribution for B.
-
getCCount
The marginal distribution over the third variable.- Returns:
- The marginal distribution for C.
-
constructFromLists
public static <T1,T2, WeightedTripleDistribution<T1,T3> T2, constructFromListsT3> (List<T1> first, List<T2> second, List<T3> third, List<Double> weights) Constructs a WeightedTripleDistribution from three lists of the same length and a list of weights of the same length.If they are not the same length it throws IllegalArgumentException.
- Type Parameters:
T1
- The first type.T2
- The second type.T3
- The third type.- Parameters:
first
- The first list.second
- The second list.third
- The third list.weights
- The weight list.- Returns:
- The WeightedTripleDistribution.
-
constructFromMap
public static <T1,T2, WeightedTripleDistribution<T1,T3> T2, constructFromMapT3> (Map<CachedTriple<T1, T2, T3>, WeightCountTuple> jointCount) Constructs a WeightedTripleDistribution by marginalising the supplied joint distribution.- Type Parameters:
T1
- The type of A.T2
- The type of B.T3
- The type of C.- Parameters:
jointCount
- The joint distribution.- Returns:
- A WeightedTripleDistribution.
-