|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--mark.core.math.Cube
Assume a sampling process, where each sample determines three discrete random variables, X1, X2, and X3. The range of Xi is the integers in [0, l(Xi) - 1], where l(Xi) is the number of elements Xi can assume. A NumberBox maintains joint counts of X1, X2, and X3. Counts may be doubles, meaning that a count of 0.5, for example, is legal.
| Constructor Summary | |
Cube(double[][][] a)
Initializes all counts with the values in the given array. |
|
Cube(int X1Length,
int X2Length,
int X3Length)
Initializes all counts to zero. |
|
Cube(int X1Length,
int X2Length,
int X3Length,
boolean laplace)
Initializes all counts to zero if not laplace and to one if laplace. |
|
| Method Summary | |
java.lang.Object |
clone()
Clones the Cube. |
boolean |
equals(java.lang.Object rhs)
Returns whether the Cube is equivalent to the given Cube. |
void |
inc(int x1,
int x2,
int x3)
Increments #(X1 = x1, X2 = x2, X = x3). |
void |
inc(int x1,
int x2,
int x3,
double c)
Increments #(X1 = x1, X2 = x2, X = x3) by the given count. |
static void |
main(java.lang.String[] a)
Tests the class. |
double |
mutualInformationX1X2GivenX3()
Returns the mutual information of (X1, X2) given X3: I((X1;X2)|X3). |
void |
normalizeCounts()
Divides each count by the sum of the counts. |
double |
num()
Returns the total number of samples. |
double |
numX1(int x1)
Returns #(X1 = x1). |
double |
numX1X2(int x1,
int x2)
Returns #(X1 = x1, X2 = x2). |
double |
numX1X2X3(int x1,
int x2,
int x3)
Returns #(X1 = x1, X2 = x2, X3 = x3). |
double |
numX1X3(int x1,
int x3)
Returns #(X1 = x1, X3 = x3). |
double |
numX2(int x2)
Returns #(X2 = x2). |
double |
numX2X3(int x2,
int x3)
Returns #(X1 = x2, X3 = x3). |
double |
numX3(int x3)
Returns #(X3 = x3). |
double |
pointwiseMutualInformationX1X2GivenX3(int x1,
int x3)
Returns the pointwise mutual information of (X1, X2) given X3: I((X1;X2)|X3). |
double |
prob()
Returns 1.0. |
double |
probX1(int x1)
Returns p(X1 = x1). |
double |
probX1X2(int x1,
int x2)
Returns p(X1 = x1, X2 = x2). |
double |
probX1X2X3(int x1,
int x2,
int x3)
Returns p(X1 = x1, X2 = x2, X3 = x3). |
double |
probX1X3(int x1,
int x3)
Returns p(X1 = x1, X3 = x3). |
double |
probX2(int x2)
Returns p(X2 = x2). |
double |
probX2X3(int x2,
int x3)
Returns p(X2 = x2, X3 = x3). |
double |
probX3(int x3)
Returns p(X3 = x3). |
void |
reset(boolean laplace)
Resets all counts to zero if not laplace and to one if laplace. |
void |
set(int x1,
int x2,
int x3,
double c)
Sets #(X1 = x1, X2 = x2, X3 = x3). |
double[][][] |
toDoubleArray()
Returns a representation as a double[][][]. |
java.lang.String |
toString()
Returns a string representation of the table. |
int |
X1Length()
Returns the number of values X1 can assume. |
int |
X2Length()
Returns the number of values X2 can assume. |
int |
X3Length()
Returns the number of values X3 can assume. |
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Cube(int X1Length,
int X2Length,
int X3Length)
X1Length - l(X1), the number of values X1 can assume.X2Length - l(X2), the number of values X2 can assume.X3Length - l(X3), the number of values X3 can assume.
public Cube(int X1Length,
int X2Length,
int X3Length,
boolean laplace)
X1Length - l(X1), the number of values X1 can assume.X2Length - l(X2), the number of values X2 can assume.X3Length - l(X3), the number of values X3 can assume.laplace - whether to use laplace smoothing.public Cube(double[][][] a)
a - the array.| Method Detail |
public java.lang.Object clone()
clone in class java.lang.Objectpublic boolean equals(java.lang.Object rhs)
equals in class java.lang.Objectrhs - the given Cube.
public java.lang.String toString()
toString in class java.lang.Objectpublic double[][][] toDoubleArray()
public void reset(boolean laplace)
laplace - whether to use laplace smoothing.public int X1Length()
public int X2Length()
public int X3Length()
public double numX1X2X3(int x1,
int x2,
int x3)
x1 - the X1 value.
public double numX1X2(int x1,
int x2)
x1 - the X1 value.
public double numX1X3(int x1,
int x3)
x1 - the X1 value.x3 - the X3 value.
public double numX2X3(int x2,
int x3)
x2 - the X2 value.x3 - the X3 value.
public double numX1(int x1)
x1 - the X1 value.
public double numX2(int x2)
x2 - the X2 value.
public double numX3(int x3)
x3 - the X3 value.
public double num()
public double probX1X2X3(int x1,
int x2,
int x3)
x1 - the X1 value.x2 - the X2 value.x3 - the X3 value.
public double probX1X2(int x1,
int x2)
x1 - the X1 value.x2 - the X2 value.
public double probX1X3(int x1,
int x3)
x1 - the X1 value.x3 - the X3 value.
public double probX2X3(int x2,
int x3)
x2 - the X2 value.x3 - the X3 value.
public double probX1(int x1)
x1 - the X1 value.
public double probX2(int x2)
x2 - the X2 value.
public double probX3(int x3)
x3 - the X3 value.
public double prob()
public void set(int x1,
int x2,
int x3,
double c)
x1 - the X1 value.x2 - the X2 value.x3 - the X3 value.c - the count.
public void inc(int x1,
int x2,
int x3)
x1 - the X1 value.
public void inc(int x1,
int x2,
int x3,
double c)
x1 - the X1 value.x2 - the X2 value.x3 - the X3 value.c - the count.public void normalizeCounts()
public static void main(java.lang.String[] a)
throws java.lang.Exception
a - ignored.
java.lang.Exceptionpublic double mutualInformationX1X2GivenX3()
public double pointwiseMutualInformationX1X2GivenX3(int x1,
int x3)
x1 - the X1 value.x3 - the X3 value.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||