|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.models.discrete.ConstraintManager
public class ConstraintManager
This class manipulates and manages some constraints.
| Method Summary | |
|---|---|
static void |
computeFreqs(double ess,
Constraint... constr)
This method computes the (smoothed) relative frequencies. |
static double |
countInhomogeneous(AlphabetContainer alphabets,
int length,
Sample data,
double[] weights,
boolean reset,
Constraint... constr)
Fills the (inhomogeneous) Constraint constr with the
weighted absolute frequencies of the Sample data. |
static MEMConstraint[] |
createConstraints(AbstractList<int[]> list,
int[] alphabetLength)
Creates the constraints of a model. |
static MEMConstraint[] |
createConstraints(AbstractList<int[]> list,
int[] alphabetLength,
int[] indices)
Creates the constraints for a part of a model. |
static void |
drawFreqs(double ess,
InhCondProb... constr)
This method draws relative frequencies for the constraints in constr. |
static ArrayList<int[]> |
extract(int length,
String encoded)
Extracts the constraints of a String and returns an
ArrayList of int[]. |
static double |
getEntropy(Constraint c)
Tries to compute the entropy of a Constraint as exact as
possible. |
static double |
getLogGammaSum(Constraint c,
double ess)
Computes the sum of the differences between the logarithmic values of the prior knowledge and all counts of a Constraint c. |
static void |
reduce(AbstractList<int[]> list)
This method tries to find and remove subconstraints that are already fulfilled by a bigger one. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void computeFreqs(double ess,
Constraint... constr)
throws IllegalArgumentException
ess - the ess (equivalent sample size), if the
ess is zero then MLE (maximum likelihood
estimation) otherwise MAPE (maximum a
posteriori estimation)constr - the constraints, should be filled with absolute frequencies
IllegalArgumentException - if the ess is negative
public static double countInhomogeneous(AlphabetContainer alphabets,
int length,
Sample data,
double[] weights,
boolean reset,
Constraint... constr)
throws WrongAlphabetException,
IllegalArgumentException
Constraint constr with the
weighted absolute frequencies of the Sample data.
The relative frequencies will not be computed, for this task use
computeFreqs(double, Constraint...)
alphabets - the alphabets over which the constraints are definedlength - the length for which the constraints are defineddata - the Sampleweights - the weights for the Sequences in the Sample:
weights == null or
weights.length = data.getNumberOfElements(),
for all i: weights[i] >= 0
reset - indicates whether the constraints should be resetedconstr - the (inhomogeneous) constraints to be filled
WrongAlphabetException - if the alphabet of the data is not correct
IllegalArgumentException - if the weights array has wrong dimension or the element
length of the data is not correct
public static void drawFreqs(double ess,
InhCondProb... constr)
throws IllegalArgumentException
constr.
ess - the ess (equivalent sample size,
additional pseudocount)constr - the constraints (can be filled with absolute frequencies)
IllegalArgumentException - if the ess is negativeInhCondProb.drawParameters(double)
public static ArrayList<int[]> extract(int length,
String encoded)
throws IllegalArgumentException
String and returns an
ArrayList of int[]. This can be used to create
constraints.
length - the sequence/model lengthencoded - constraints encoded in a String
ArrayList of int[]
IllegalArgumentException - if something is wrong with the length or the
encoded Stringpublic static double getEntropy(Constraint c)
Constraint as exact as
possible.
c - the constraint
public static double getLogGammaSum(Constraint c,
double ess)
Constraint c.
![$\sum_i \left[\log \Gamma(\alpha_i) - \log \Gamma(\alpha_i + N_i)\right]$](images/ConstraintManager_LaTeXilb7_1.png)
c - the constraintess - the ess (equivalent sample size)
public static void reduce(AbstractList<int[]> list)
list - the list of all constraints
public static MEMConstraint[] createConstraints(AbstractList<int[]> list,
int[] alphabetLength,
int[] indices)
list - the list of all cliques, each clique is used for one
constraintalphabetLength - the array of alphabet lengths for each positionindices - the positions used in this part of the model
extract(int, String),
createConstraints(AbstractList, int[])
public static MEMConstraint[] createConstraints(AbstractList<int[]> list,
int[] alphabetLength)
list - the list of all cliques, each clique is used for one
constraintalphabetLength - the array of alphabet lengths for each position
extract(int, String),
createConstraints(AbstractList, int[], int[])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||