Class WeightedPairDistribution<T1,T2>

java.lang.Object
org.tribuo.util.infotheory.impl.WeightedPairDistribution<T1,T2>
Type Parameters:
T1 - Type of the first list.
T2 - Type of the second list.

public class WeightedPairDistribution<T1,T2> extends Object
Generates the counts for a pair of vectors. Contains the joint count and the two marginal counts.
  • Field Details

    • count

      public final long count
      The sample count.
  • Constructor Details

  • Method Details

    • getJointCounts

      Gets the joint distribution.
      Returns:
      The joint distribution.
    • getFirstCount

      Gets the first marginal distribution.
      Returns:
      The first marginal distribution.
    • getSecondCount

      Gets the second marginal distribution.
      Returns:
      The second marginal distribution.
    • constructFromLists

      public static <T1, T2> WeightedPairDistribution<T1,T2> constructFromLists(List<T1> first, List<T2> second, List<Double> weights)
      Generates the counts for two vectors. Returns a pair containing the joint count, and a pair of the two marginal counts.
      Type Parameters:
      T1 - Type of the first list.
      T2 - Type of the second list.
      Parameters:
      first - An list of values.
      second - Another list of values.
      weights - An list of per example weights.
      Returns:
      A WeightedPairDistribution.
    • constructFromMap

      public static <T1, T2> WeightedPairDistribution<T1,T2> constructFromMap(Map<CachedPair<T1,T2>,WeightCountTuple> jointCount)
      Generates a WeightedPairDistribution by generating the marginal distributions for the first and second elements. This assumes the weights have already been normalised.
      Type Parameters:
      T1 - Type of the first element.
      T2 - Type of the second element.
      Parameters:
      jointCount - The (normalised) input map.
      Returns:
      A WeightedPairDistribution