|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.jstacs.scoringFunctions.directedGraphicalModels.structureLearning.measures.Measure
public abstract class Measure
Class for structure measures that derive an optimal structure with respect to some criterion within a class of possible structures from data.
Constructor Summary | |
---|---|
Measure()
|
Method Summary | |
---|---|
Measure |
clone()
|
protected static void |
fillTensor(Tensor t,
double[][] weights)
Fills a Tensor t with the weights defined in
weights . |
protected static void |
fillTensor(Tensor t,
double[][][] weights)
Fills a Tensor t with the weights defined in
weights . |
protected static double[][][] |
getCMI(double[][][][][][] fgStats,
double[][][][][][] bgStats,
double n)
Computes the conditional mutual information from fgStats and
bgStats counted on sequences with a total weight of
n . |
protected static double[][] |
getCMI(double[][][][] fgStats,
double[][][][] bgStats,
double n,
double nFg,
double nBg)
Computes the conditional mutual information from fgStats and
bgStats counted on sequences with a total weight of
nFg and nBg , respectively. |
static double[][][] |
getEAR(double[][][][][][] fgStats,
double[][][][][][] bgStats,
double nFg,
double nBg)
Computes the explaining away residual from fgStats and
bgStats counted on sequences with a total weight of
nFg and nBg , respectively. |
protected static double[][] |
getEAR(double[][][][] fgStats,
double[][][][] bgStats,
double nFg,
double nBg)
Computes the explaining away residual from fgStats and
bgStats counted on sequences with a total weight of
nFg and nBg , respectively. |
abstract String |
getInstanceName()
Returns the name of the Measure and possibly some additional
information about the current instance. |
protected static double[][][] |
getMI(double[][][][][][] counts,
double n)
Computes the mutual information from counts counted on
sequences with a total weight of n . |
protected static double[][] |
getMI(double[][][][] counts,
double n)
Computes the mutual information from counts counted on
sequences with a total weight of n . |
abstract int[][] |
getParents(Sample fg,
Sample bg,
double[] weightsFg,
double[] weightsBg,
int length)
Returns the optimal parents for the given data and weights. |
protected static double[][][][] |
getStatistics(Sample s,
double[] weights,
int length,
double ess)
Counts the occurrences of symbols of the AlphabetContainer of
Sample s using weights . |
protected static double[][][][][][] |
getStatisticsOrderTwo(Sample s,
double[] weights,
int length,
double ess)
Counts the occurrences of symbols of the AlphabetContainer of
Sample s using weights . |
boolean |
isShiftable()
Indicates if Measure supports shifts. |
protected static double |
sum(double[] ar)
Computes the sum of all elements in the array ar . |
protected static int[][] |
toParents(int[] o,
byte order)
Creates a new parent structure as defined by getParents(Sample, Sample, double[], double[], int) from an
order and a topological ordering of positions. |
protected static double[] |
union(double[][] ar)
Linearizes the arrays in the two-dimensional array ar to
form a new, one-dimensional array. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.jstacs.Storable |
---|
toXML |
Methods inherited from interface de.jstacs.InstantiableFromParameterSet |
---|
getCurrentParameterSet |
Constructor Detail |
---|
public Measure()
Method Detail |
---|
public abstract String getInstanceName()
Measure
and possibly some additional
information about the current instance.
Measure
public abstract int[][] getParents(Sample fg, Sample bg, double[] weightsFg, double[] weightsBg, int length) throws Exception
p
at each position i
is build
as follows:
p[i][p.length - 1]
contains the index i
itselfp[i][p.length - 2]
contains the "most
important" parentp[i][0]
contains the "least important" parent
fg
- the data of the current (foreground) classbg
- the data of the negative (background) classweightsFg
- the weights for the sequences of fg
weightsBg
- the weights for the sequences of bg
length
- the length of the model, must be equal to the length of the
sequences
p
with the optimal parents
Exception
- if the lengths do not match or other problems concerning the
data occurpublic Measure clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
protected static int[][] toParents(int[] o, byte order)
getParents(Sample, Sample, double[], double[], int)
from an
order and a topological ordering of positions.
o
- the topological orderingorder
- the order
protected static void fillTensor(Tensor t, double[][] weights)
Tensor
t
with the weights defined in
weights
.
t
- the Tensor
to be filledweights
- the weightsprotected static void fillTensor(Tensor t, double[][][] weights)
Tensor
t
with the weights defined in
weights
.
t
- the Tensor
to be filledweights
- the weightsprotected static double[][][] getMI(double[][][][][][] counts, double n)
counts
counted on
sequences with a total weight of n
.
counts
- the counts as returned by
getStatisticsOrderTwo(Sample, double[], int, double)
n
- the total weight
protected static double[][][] getCMI(double[][][][][][] fgStats, double[][][][][][] bgStats, double n)
fgStats
and
bgStats
counted on sequences with a total weight of
n
.
fgStats
- the counts in the foreground sequences as returned by
getStatisticsOrderTwo(Sample, double[], int, double)
bgStats
- the counts in the foreground sequences as returned by
getStatisticsOrderTwo(Sample, double[], int, double)
n
- the total weight
public static double[][][] getEAR(double[][][][][][] fgStats, double[][][][][][] bgStats, double nFg, double nBg)
fgStats
and
bgStats
counted on sequences with a total weight of
nFg
and nBg
, respectively.
fgStats
- the counts in the foreground sequences as returned by
getStatisticsOrderTwo(Sample, double[], int, double)
bgStats
- the counts in the foreground sequences as returned by
getStatisticsOrderTwo(Sample, double[], int, double)
nFg
- the total weight in the foregroundnBg
- the total weight in the background
protected static double[][][][][][] getStatisticsOrderTwo(Sample s, double[] weights, int length, double ess) throws Exception
AlphabetContainer
of
Sample
s
using weights
. The array
counts
is indexed as follows:counts[first index][second index][third index][symbol at first index][symbol at second index][symbol at third index]
.
s
- the dataweights
- the weightslength
- the length of the sequencesess
- the equivalent sample size
counts
with the symbol occurrences
Exception
- if the lengths do not match or other problems concerning the
data occurprotected static double[][][][] getStatistics(Sample s, double[] weights, int length, double ess) throws Exception
AlphabetContainer
of
Sample
s
using weights
. The array
counts
is indexed as follows:counts[first index][second index][symbol at first index][symbol at second index]
.
s
- the dataweights
- the weightslength
- the length of the sequencesess
- the equivalent sample size
counts
with the symbol occurrences
Exception
- if the lengths do not match or other problems concerning the
data occurprotected static double[][] getMI(double[][][][] counts, double n)
counts
counted on
sequences with a total weight of n
.
counts
- the counts as defined in
getStatistics(Sample, double[], int, double)
.n
- the total weight
protected static double[][] getCMI(double[][][][] fgStats, double[][][][] bgStats, double n, double nFg, double nBg)
fgStats
and
bgStats
counted on sequences with a total weight of
nFg
and nBg
, respectively.
fgStats
- the counts as defined in
getStatistics(Sample, double[], int, double)
on the
foregroundbgStats
- the counts as defined in
getStatistics(Sample, double[], int, double)
on the
backgroundn
- the total weightnFg
- the total weight in the foregroundnBg
- the total weight in the background
protected static double[][] getEAR(double[][][][] fgStats, double[][][][] bgStats, double nFg, double nBg)
fgStats
and
bgStats
counted on sequences with a total weight of
nFg
and nBg
, respectively.
fgStats
- the counts as defined in
getStatistics(Sample, double[], int, double)
on the
foregroundbgStats
- the counts as defined in
getStatistics(Sample, double[], int, double)
on the
backgroundnFg
- the total weight in the foregroundnBg
- the total weight in the background
protected static double sum(double[] ar)
ar
.
ar
- the array
protected static double[] union(double[][] ar)
ar
to
form a new, one-dimensional array.
ar
- the two-dimensional array
public boolean isShiftable()
Measure
supports shifts.
Measure
supports shifts
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |