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.

public class WeightedTripleDistribution<T1,T2,T3> extends Object
Generates the counts for a triplet of vectors. Contains the joint count, the three pairwise counts, and the three marginal counts.
  • Field Details

    • DEFAULT_MAP_SIZE

      public static final int DEFAULT_MAP_SIZE
      The default map size.
      See Also:
    • count

      public final long count
      The sample count.
  • Constructor Details

  • Method Details

    • getJointCount

      public Map<CachedTriple<T1,T2,T3>,WeightCountTuple> getJointCount()
      The joint distribution over the three variables.
      Returns:
      The joint distribution.
    • getABCount

      public Map<CachedPair<T1,T2>,WeightCountTuple> getABCount()
      The joint distribution over the first and second variables.
      Returns:
      The joint distribution over A and B.
    • getACCount

      public Map<CachedPair<T1,T3>,WeightCountTuple> getACCount()
      The joint distribution over the first and third variables.
      Returns:
      The joint distribution over A and C.
    • getBCCount

      public Map<CachedPair<T2,T3>,WeightCountTuple> getBCCount()
      The joint distribution over the second and third variables.
      Returns:
      The joint distribution over B and C.
    • getACount

      public Map<T1,WeightCountTuple> getACount()
      The marginal distribution over the first variable.
      Returns:
      The marginal distribution for A.
    • getBCount

      public Map<T2,WeightCountTuple> getBCount()
      The marginal distribution over the second variable.
      Returns:
      The marginal distribution for B.
    • getCCount

      public Map<T3,WeightCountTuple> getCCount()
      The marginal distribution over the third variable.
      Returns:
      The marginal distribution for C.
    • constructFromLists

      public static <T1, T2, T3> WeightedTripleDistribution<T1,T2,T3> constructFromLists(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, T3> WeightedTripleDistribution<T1,T2,T3> constructFromMap(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.