Class InformationTheoryDemo

java.lang.Object
org.tribuo.util.infotheory.example.InformationTheoryDemo

public class InformationTheoryDemo extends Object
Demo showing how to calculate various mutual informations and entropies.
  • Constructor Details

    • InformationTheoryDemo

      public InformationTheoryDemo()
  • Method Details

    • generateUniform

      public static List<Integer> generateUniform(int length, int alphabetSize)
      Generates a sample from a uniform distribution over the integers.
      Parameters:
      length - The number of samples.
      alphabetSize - The alphabet size (i.e., the number of unique values).
      Returns:
      A sample from a uniform distribution.
    • generateXOR

      public static CachedTriple<List<Integer>,List<Integer>,List<Integer>> generateXOR(int length)
      Generates a sample from a three variable XOR function.

      Each list is a binary variable, and the third is the XOR of the first two.

      Parameters:
      length - The number of samples.
      Returns:
      A sample from an XOR function.
    • generateCorrelated

      public static CachedTriple<List<Integer>,List<Integer>,List<Integer>> generateCorrelated(int length, int alphabetSize, double xyCorrelation, double xzCorrelation)
      These correlations don't map to mutual information values, as if xyDraw is above xyCorrelation then the draw is completely random.

      To make it generate correlations of a specific mutual information then it needs to specify the full joint distribution and draw from that.

      Parameters:
      length - The number of samples.
      alphabetSize - The alphabet size (i.e., the number of unique values).
      xyCorrelation - Value between 0.0 and 1.0 specifying how likely it is that Y has the same value as X.
      xzCorrelation - Value between 0.0 and 1.0 specifying how likely it is that Z has the same value as X.
      Returns:
      A triple of samples drawn from correlated random variables.
    • main

      public static void main(String[] args)
      Runs a simple demo of the information theory functions.
      Parameters:
      args - The CLI arguments.