public abstract class Measure extends Object implements Cloneable, Storable, InstantiableFromParameterSet
| Modifier and Type | Class and Description |
|---|---|
static class |
Measure.MeasureParameterSet
This class is the super class of any
ParameterSet that can be used to instantiate a Measure. |
| Modifier and Type | Field and Description |
|---|---|
protected Measure.MeasureParameterSet |
parameters
The parameters of this measure
|
| Modifier | Constructor and Description |
|---|---|
protected |
Measure(Measure.MeasureParameterSet parameters)
Creates a new
Measure from its Measure.MeasureParameterSet. |
protected |
Measure(StringBuffer xml)
Creates a new
Measure from its XML-representation. |
| Modifier and Type | Method and Description |
|---|---|
Measure |
clone() |
protected static void |
fillTensor(Tensor t,
double[][] weights)
|
protected static void |
fillTensor(Tensor t,
double[][][] 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. |
InstanceParameterSet<Measure> |
getCurrentParameterSet()
Returns the
InstanceParameterSet that has been used to
instantiate the current instance of the implementing class. |
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 double[][] |
getMatrixForKruskal(double[][] fullMatrix)
Prepares a matrix of pairwise association measures for the implementation of Kruskal's algorithm.
|
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(DataSet fg,
DataSet bg,
double[] weightsFg,
double[] weightsBg,
int length)
Returns the optimal parents for the given data and weights.
|
protected static double[][][][] |
getStatistics(DataSet s,
double[] weights,
int length,
double ess)
|
protected static double[][][][][][] |
getStatisticsOrderTwo(DataSet s,
double[] weights,
int length,
double ess)
|
abstract String |
getXMLTag()
Returns the XML-tag for storing this measure
|
boolean |
isShiftable()
Indicates if
Measure supports shifts. |
protected int[][] |
reStructure(int[][] structure,
int length)
Helper method that converts the structure returned by
MST.kruskal(double[][])
to that returned by the getParents(DataSet, DataSet, double[], double[], int) method |
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(DataSet, DataSet, double[], double[], int) from an
order and a topological ordering of positions. |
StringBuffer |
toXML()
This method returns an XML representation as
StringBuffer of an
instance of the implementing class. |
protected static double[] |
union(double[][] ar)
Linearizes the arrays in the two-dimensional array
ar to
form a new, one-dimensional array. |
protected Measure.MeasureParameterSet parameters
protected Measure(StringBuffer xml) throws NonParsableException
Measure from its XML-representation.xml - the XML-representationNonParsableException - the the XML could not be parsedprotected Measure(Measure.MeasureParameterSet parameters) throws CloneNotSupportedException
Measure from its Measure.MeasureParameterSet.parameters - the parametersCloneNotSupportedException - if the parameters could not be clonedpublic abstract String getXMLTag()
public StringBuffer toXML()
StorableStringBuffer of an
instance of the implementing class.public final InstanceParameterSet<Measure> getCurrentParameterSet() throws Exception
InstantiableFromParameterSetInstanceParameterSet that has been used to
instantiate the current instance of the implementing class. If the
current instance was not created using an InstanceParameterSet,
an equivalent InstanceParameterSet should be returned, so that an
instance created using this InstanceParameterSet would be in
principle equal to the current instance.getCurrentParameterSet in interface InstantiableFromParameterSetInstanceParameterSetException - if the InstanceParameterSet could not be returnedpublic abstract String getInstanceName()
Measure and possibly some additional
information about the current instance.Measurepublic abstract int[][] getParents(DataSet fg, DataSet 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" parentfg - the data of the current (foreground) classbg - the data of the negative (background) classweightsFg - the weights for the sequences of fgweightsBg - the weights for the sequences of bglength - the length of the model, must be equal to the length of the
sequencesp with the optimal parentsException - if the lengths do not match or other problems concerning the
data occurpublic Measure clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionprotected double[][] getMatrixForKruskal(double[][] fullMatrix)
fullMatrix - the full matrixMST.kruskal(double[][])protected int[][] reStructure(int[][] structure,
int length)
MST.kruskal(double[][])
to that returned by the getParents(DataSet, DataSet, double[], double[], int) methodstructure - the original structurelength - the length of sequencesprotected static int[][] toParents(int[] o,
byte order)
getParents(DataSet, DataSet, double[], double[], int) from an
order and a topological ordering of positions.o - the topological orderingorder - the orderprotected static void fillTensor(Tensor t, double[][] weights)
t - the Tensor to be filledweights - the weightsprotected static void fillTensor(Tensor t, double[][][] 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(DataSet, double[], int, double)n - the total weightprotected 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(DataSet, double[], int, double)bgStats - the counts in the foreground sequences as returned by
getStatisticsOrderTwo(DataSet, double[], int, double)n - the total weightpublic 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(DataSet, double[], int, double)bgStats - the counts in the foreground sequences as returned by
getStatisticsOrderTwo(DataSet, double[], int, double)nFg - the total weight in the foregroundnBg - the total weight in the backgroundprotected static double[][][][][][] getStatisticsOrderTwo(DataSet s, double[] weights, int length, double ess) throws Exception
AlphabetContainer of
DataSet 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 sizecounts with the symbol occurrencesException - if the lengths do not match or other problems concerning the
data occurprotected static double[][][][] getStatistics(DataSet s, double[] weights, int length, double ess) throws Exception
AlphabetContainer of
DataSet 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 sizecounts with the symbol occurrencesException - 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(DataSet, double[], int, double).n - the total weightprotected 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(DataSet, double[], int, double) on the
foregroundbgStats - the counts as defined in
getStatistics(DataSet, double[], int, double) on the
backgroundn - the total weightnFg - the total weight in the foregroundnBg - the total weight in the backgroundprotected 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(DataSet, double[], int, double) on the
foregroundbgStats - the counts as defined in
getStatistics(DataSet, double[], int, double) on the
backgroundnFg - the total weight in the foregroundnBg - the total weight in the backgroundprotected static double sum(double[] ar)
ar.ar - the arrayprotected static double[] union(double[][] ar)
ar to
form a new, one-dimensional array.ar - the two-dimensional array