public class VariableLengthWrapperTrainSM extends AbstractTrainableStatisticalModel
Sequences with variable length if each individual length is at least
SequenceScore.getLength(). All other methods are piped to the internally used
|Constructor and Description|
The standard constructor for the interface
This is the main constructor that creates an instance from any
|Modifier and Type||Method and Description|
Follows the conventions of
This method should only be used by the constructor that works on a
Should return a short instance name such as iMM(0), BN(2), ...
Returns a value that is proportional to the log of the prior.
Returns the logarithm of the probability of (a part of) the given sequence given the model.
Returns the subset of numerical values that are also returned by
This method can be used to determine whether the instance is initialized.
This method returns a
This method returns an XML representation as
check, emitDataSet, getAlphabetContainer, getCharacteristics, getLength, getLogProbFor, getLogProbFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getMaximalMarkovOrder, toString, train
public VariableLengthWrapperTrainSM(TrainableStatisticalModel m) throws CloneNotSupportedException
m- the model
CloneNotSupportedException- if the mode
mcould not be cloned
public VariableLengthWrapperTrainSM(StringBuffer stringBuff) throws NonParsableException
Storable. Creates a new
VariableLengthWrapperTrainSMout of a
public VariableLengthWrapperTrainSM clone() throws CloneNotSupportedException
AlphabetContainerisn't deeply cloned since it is assumed to be immutable). The type of the returned object is defined by the class
Xdirectly inherited from
clone()-method should work as:
Object o = (X)super.clone();
Xthat are not of simple data-types like
double, ... have to be deeply copied
CloneNotSupportedException- if something went wrong while cloning
protected void fromXML(StringBuffer xml) throws NonParsableException
StringBuffer. It is the counter part of
xml- the XML representation of the model
NonParsableException- if the
StringBufferis not parsable or the representation is conflicting
public StringBuffer toXML()
StringBufferof an instance of the implementing class.
public String getInstanceName()
public double getLogPriorTerm() throws Exception
Exception- if something went wrong
public NumericalResultSet getNumericalCharacteristics() throws Exception
Exception- if some of the characteristics could not be defined
public double getLogProbFor(Sequence sequence, int startpos, int endpos) throws NotTrainedException, Exception
StatisticalModel.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
endpos(inclusive) should be returned.
alphabetsdefine the type of data that can be modeled and therefore both has to be checked.
sequence- the given sequence
startpos- the start position within the given sequence
endpos- the last position to be taken into account
NotTrainedException- if the model is not trained yet
Exception- if the sequence could not be handled (e.g.
endpos > sequence.length, ...) by the model
public boolean isInitialized()
trueif the instance is initialized,
TrainableStatisticalModelobject given the data as
DataSetusing the specified weights. The weight at position i belongs to the element at position i. So the array
weightshould have the number of sequences in the data set as dimension. (Optionally it is possible to use
weight == nullif all weights have the value one.)
train(data2)should be a fully trained model over
data2and not over
data1+data2. All parameters of the model were given by the call of the constructor.
data- the given sequences as
weights- the weights of the elements, each weight should be non-negative
Exception- if the training did not succeed (e.g. the dimension of
weightsand the number of sequences in the data set do not match)