public abstract class MEManager extends InhomogeneousDGTrainSM
| Modifier and Type | Field and Description |
|---|---|
protected MEM[] |
factors
The independent maximum entropy models.
|
DEFAULT_STREAM, sostreamparams, trainedalphabets, length| Constructor and Description |
|---|
MEManager(MEManagerParameterSet params)
Creates a new
MEManager from a given
MEManagerParameterSet. |
MEManager(StringBuffer stringBuff)
The standard constructor for the interface
Storable. |
| Modifier and Type | Method and Description |
|---|---|
MEManager |
clone()
Follows the conventions of
Object's clone()-method. |
DataSet |
emitDataSet(int n,
int... lengths)
This method returns a
DataSet object containing artificial
sequence(s). |
protected MEM[] |
getFactors(ArrayList<int[]> list,
boolean reduce,
ConstraintManager.Decomposition decomposition)
This method returns an array of independent maximum entropy models parsed from the given constraints.
|
protected MEM[] |
getFactors(String constraints,
boolean reduce,
ConstraintManager.Decomposition decomposition)
This method returns an array of independent maximum entropy models parsed from the given constraints.
|
protected StringBuffer |
getFurtherModelInfos()
Returns further model information as a
StringBuffer. |
double |
getLogPriorTerm()
Returns a value that is proportional to the log of the prior.
|
double |
getLogProbFor(Sequence sequence,
int startpos,
int endpos)
Returns the logarithm of the probability of (a part of) the given
sequence given the model.
|
NumericalResultSet |
getNumericalCharacteristics()
Returns the subset of numerical values that are also returned by
SequenceScore.getCharacteristics(). |
String |
getStructure()
Returns a
String representation of the underlying graph. |
protected void |
setFurtherModelInfos(StringBuffer xml)
This method replaces the internal model information with those from a
StringBuffer. |
String |
toString(NumberFormat nf)
This method returns a
String representation of the instance. |
protected void |
trainFactors(DataSet data,
double[] weights)
This method trains the internal
MEM array,
i.e., it optimizes the parameters of the underlying MEMConstraints. |
check, set, setOutputStreamfromXML, getCurrentParameterSet, getDescription, getESS, getXMLTag, isInitialized, toXMLgetAlphabetContainer, getCharacteristics, getLength, getLogProbFor, getLogProbFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getMaximalMarkovOrder, toString, trainequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waittraingetInstanceNameprotected MEM[] factors
public MEManager(MEManagerParameterSet params) throws CloneNotSupportedException, IllegalArgumentException, NonParsableException
MEManager from a given
MEManagerParameterSet.params - the given parameter setCloneNotSupportedException - if the parameter set could not be clonedIllegalArgumentException - if the parameter set is not instantiatedNonParsableException - if the parameter set is not parsableInhomogeneousDGTrainSM.InhomogeneousDGTrainSM(de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.parameters.IDGTrainSMParameterSet)public MEManager(StringBuffer stringBuff) throws NonParsableException
Storable.
Creates a new MEManager out of its XML representation.stringBuff - the XML representation as StringBufferNonParsableException - if the MEManager could not be reconstructed
out of the XML representation (the StringBuffer could
not be parsed)Storable,
InhomogeneousDGTrainSM.InhomogeneousDGTrainSM(StringBuffer)public MEManager clone() throws CloneNotSupportedException
AbstractTrainableStatisticalModelObject's clone()-method.clone in interface SequenceScoreclone in interface TrainableStatisticalModelclone in class InhomogeneousDGTrainSMAbstractTrainableStatisticalModel
(the member-AlphabetContainer isn't deeply cloned since
it is assumed to be immutable). The type of the returned object
is defined by the class X directly inherited from
AbstractTrainableStatisticalModel. Hence X's
clone()-method should work as:Object o = (X)super.clone(); o defined by
X that are not of simple data-types like
int, double, ... have to be deeply
copied return oCloneNotSupportedException - if something went wrong while cloningpublic DataSet emitDataSet(int n, int... lengths) throws NotTrainedException, Exception
StatisticalModelDataSet object containing artificial
sequence(s).
emitDataSet( int n, int l ) should return a data set with
n sequences of length l.
emitDataSet( int n, int[] l ) should return a data set with
n sequences which have a sequence length corresponding to
the entry in the given array l.
emitDataSet( int n ) and
emitDataSet( int n, null ) should return a data set with
n sequences of length of the model (
SequenceScore.getLength()).
Exception.emitDataSet in interface StatisticalModelemitDataSet in class AbstractTrainableStatisticalModeln - the number of sequences that should be contained in the
returned data setlengths - the length of the sequences for a homogeneous model; for an
inhomogeneous model this parameter should be null
or an array of size 0.DataSet containing the artificial sequence(s)NotTrainedException - if the model is not trained yetException - if the emission did not succeedDataSetpublic double getLogPriorTerm()
throws Exception
StatisticalModelException - if something went wrongpublic double getLogProbFor(Sequence sequence, int startpos, int endpos) throws NotTrainedException, Exception
StatisticalModelStatisticalModel.getLogProbFor(Sequence, int) by the fact, that the model could be
e.g. homogeneous and therefore the length of the sequences, whose
probability should be returned, is not fixed. Additionally, the end
position of the part of the given sequence is given and the probability
of the part from position startpos to endpos
(inclusive) should be returned.
length and the alphabets define the type of
data that can be modeled and therefore both has to be checked.sequence - the given sequencestartpos - the start position within the given sequenceendpos - the last position to be taken into accountNotTrainedException - if the model is not trained yetException - if the sequence could not be handled (e.g.
startpos > , endpos
> sequence.length, ...) by the modelpublic NumericalResultSet getNumericalCharacteristics()
SequenceScoreSequenceScore.getCharacteristics().public String getStructure() throws NotTrainedException
InhomogeneousDGTrainSMString representation of the underlying graph.getStructure in class InhomogeneousDGTrainSMString representation of the underlying graphNotTrainedException - if the structure is not set, this can only be the case if the
model is not trainedpublic String toString(NumberFormat nf)
SequenceScoreString representation of the instance.toString in interface SequenceScoretoString in class DiscreteGraphicalTrainSMnf - the NumberFormat for the String representation of parameters or probabilitiesString representation of the instanceprotected MEM[] getFactors(String constraints, boolean reduce, ConstraintManager.Decomposition decomposition)
constraints - the constraints to build the maximum entropy modelreduce - a switch whether redundant constraint should be removeddecomposition - a switch how to decompose the complete model if possibleprotected MEM[] getFactors(ArrayList<int[]> list, boolean reduce, ConstraintManager.Decomposition decomposition)
list - a list of positions arrays that build the constraintsreduce - a switch whether redundant constraint should be removeddecomposition - a switch how to decompose the complete model if possibleprotected StringBuffer getFurtherModelInfos()
DiscreteGraphicalTrainSMStringBuffer.getFurtherModelInfos in class DiscreteGraphicalTrainSMDiscreteGraphicalTrainSM.toXML()protected void trainFactors(DataSet data, double[] weights) throws Exception
MEM array,
i.e., it optimizes the parameters of the underlying MEMConstraints.data - the dataweights - the weights for the data, can be nullException - if some error occurs in the training processprotected void setFurtherModelInfos(StringBuffer xml) throws NonParsableException
DiscreteGraphicalTrainSMStringBuffer.setFurtherModelInfos in class DiscreteGraphicalTrainSMxml - contains the model information like parameters of the
distribution etc. in XML formatNonParsableException - if the StringBuffer could not be parsedDiscreteGraphicalTrainSM.fromXML(StringBuffer)