public class ConstraintManager extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ConstraintManager.Decomposition
This enum defines the different possible types of decomposition of a model.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
computeFreqs(double ess,
Constraint... constr)
This method computes the (smoothed) relative frequencies.
|
static double |
countInhomogeneous(AlphabetContainer alphabets,
int length,
DataSet data,
double[] weights,
boolean reset,
Constraint... constr)
Fills the (inhomogeneous)
constr with the weighted absolute frequency of the DataSet
data and computes the frequencies will not be computed. |
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 MEM[] |
disconnect(AbstractList<int[]> list,
int[] alphabetLength,
ConstraintManager.Decomposition decomposition)
This method tries to disconnect the constraints and create the models.
|
static void |
drawFreqs(double ess,
InhCondProb... constr)
This method draws relative frequencies.
|
static ArrayList<int[]> |
extract(int length,
String encoded)
Extracts the constraint of a String and returns an ArrayList of int[].
|
static double |
getEntropy(Constraint c)
Tries to compute the entropy as exact as possible.
|
static double |
getLogGammaSum(Constraint c,
double ess)
Computes the sum of differences of the logarithmic values of the prior knowledge and all counts.
|
static void |
reduce(AbstractList<int[]> list)
This method tries to find and remove subconstraints that are already fulfilled by a bigger one.
|
public static void computeFreqs(double ess,
Constraint... constr)
throws IllegalArgumentException
ess=0 no smoothing is done.ess - the ESS, if ESS is zero than MLE otherwise MAPEconstr - the constraints, should be fill with absolute frequenciesIllegalArgumentException - if the ess is negativepublic static double countInhomogeneous(AlphabetContainer alphabets, int length, DataSet data, double[] weights, boolean reset, Constraint... constr) throws WrongAlphabetException, IllegalArgumentException
constr with the weighted absolute frequency of the DataSet
data and computes the frequencies will not be computed.alphabets - the alphabets over which the constraints are definedlength - the length for which the constraints are defineddata - the sequencesweights - the weights for the sequences,
weights==null or
weights.length = data.getNumberOfElements(), for all i:weights[i]<=0
reset - whether the constraints should be resetedconstr - constraints to fillWrongAlphabetException - if the alphabet of the data is not correctIllegalArgumentException - if the weights array has wrong dimension or the element length of the data is not correctpublic static void drawFreqs(double ess,
InhCondProb... constr)
throws IllegalArgumentException
ess - the ESS (additional pseudocount)constr - the constraints (can be fill with absolute frequencies)IllegalArgumentException - if the ess is negativepublic static ArrayList<int[]> extract(int length, String encoded) throws IllegalArgumentException
length - the sequence respectively the model lengthencoded - constraints encoded in a String
IllegalArgumentException - if the constraints can not be parsed correctlypublic static double getEntropy(Constraint c)
c - the constraintpublic static double getLogGammaSum(Constraint c, double ess)
\sum_i [\ln \Gamma(\alpha_i) - \ln \Gamma(\alpha_i + N_i)]c - the constraintess - the ESSpublic static void reduce(AbstractList<int[]> list)
list - the list of all constraintspublic 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 alpahebtLength for each positionindices - the positions used in this part of the modelpublic static MEMConstraint[] createConstraints(AbstractList<int[]> list, int[] alphabetLength)
list - the list of all cliques, each clique is used for one constraintalphabetLength - the array of alpahebtLength for each positionpublic static MEM[] disconnect(AbstractList<int[]> list, int[] alphabetLength, ConstraintManager.Decomposition decomposition)
list - the list of all constraintsalphabetLength - the length of the alphabets at the specific positionsdecomposition - the choice how to disconnect the constraintsMEMConstraintManager.Decomposition.DECOMPOSE_LESS_CONNECTED,
ConstraintManager.Decomposition.DECOMPOSE_UNCONNECTED,
ConstraintManager.Decomposition.DECOMPOSE_NOTHING