lojix/learning/src/main/com/thesett/aima/math/InformationTheory.java
public static double[][] pForJointDistribution(int[][] counts)
    {
        double[][] results = new double[counts.length][];

        // Loop over all the symbols of A
        for (int i = 0; i < counts.length; i++)
        {
            // Extract the next distribution array of the symbols of G given A.
            int[] countsGgivenA = counts[i];

            // Convert the frequency distribution into a probability distribution and add it to the results.
            results[i] = pForDistribution(countsGgivenA);
        }

        return results;
    }
public static double[][] pForJointDistribution(int[][] counts)
    {
        double[][] results = new double[counts.length][];

        // Loop over all the symbols of A
        for (int i = 0; i < counts.length; i++)
        {
            // Extract the next distribution array of the symbols of G given A.
            int[] countsGgivenA = counts[i];

            // Convert the frequency distribution into a probability distribution and add it to the results.
            results[i] = pForDistribution(countsGgivenA);
        }

        return results;
    }
Supposing a stream generates pairs of symbols. Let the first be A and the second be G. A ranges over a set of
symbols, {h1, ... , hv} and G ranges over a set of symbols, {g1, ..., gn}.

<p>This function estimates p(g|h), the probability of a symbol g (of G) occuring given a symbol h (of A), over
all the symbols g and h from statistics gathered about the frequency of occurence of these symbols.

@param  counts the counts of the occurence of the symbols of G given a particular symbol of A. This will be an
array of size n by v (v arrays of size n, array is indexed as [v][n]).

@return an estimate of the probability distribution of the symbols of G given a particular symbol of A. This will
be an array of size n by v (v arrays of size n, array is indexed as [v][n]).