public class DifferentiableStatisticalModelWrapperTrainSM extends AbstractTrainableStatisticalModel
DifferentiableStatisticalModel,
LogGenDisMixFunction| Modifier and Type | Field and Description |
|---|---|
protected DifferentiableStatisticalModel |
nsf
The internally used
DifferentiableStatisticalModel. |
alphabets, length| Constructor and Description |
|---|
DifferentiableStatisticalModelWrapperTrainSM(DifferentiableStatisticalModel nsf,
int threads,
byte algo,
AbstractTerminationCondition tc,
double lineps,
double startD)
The main constructor that creates an instance with the user given parameters and
CompositeLogPrior. |
DifferentiableStatisticalModelWrapperTrainSM(DifferentiableStatisticalModel nsf,
int threads,
byte algo,
AbstractTerminationCondition tc,
double lineps,
double startD,
LogPrior prior)
Constructor that creates an instance with the user given parameters.
|
DifferentiableStatisticalModelWrapperTrainSM(StringBuffer stringBuff)
The standard constructor for the interface
Storable. |
| Modifier and Type | Method and Description |
|---|---|
DifferentiableStatisticalModelWrapperTrainSM |
clone()
Follows the conventions of
Object's clone()-method. |
protected void |
fromXML(StringBuffer xml)
This method should only be used by the constructor that works on a
StringBuffer. |
DifferentiableStatisticalModel |
getFunction()
Returns a copy of the internally used
DifferentiableStatisticalModel. |
String |
getInstanceName()
Should return a short instance name such as iMM(0), BN(2), ...
|
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(). |
boolean |
isInitialized()
This method can be used to determine whether the instance is initialized.
|
void |
setOutputStream(OutputStream o)
Sets the OutputStream that is used e.g.
|
String |
toString(NumberFormat nf)
This method returns a
String representation of the instance. |
StringBuffer |
toXML()
This method returns an XML representation as
StringBuffer of an
instance of the implementing class. |
void |
train(DataSet data,
double[] weights)
Trains the
TrainableStatisticalModel object given the data as DataSet using
the specified weights. |
check, emitDataSet, getAlphabetContainer, getCharacteristics, getLength, getLogProbFor, getLogProbFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getMaximalMarkovOrder, toString, trainprotected DifferentiableStatisticalModel nsf
DifferentiableStatisticalModel.public DifferentiableStatisticalModelWrapperTrainSM(DifferentiableStatisticalModel nsf, int threads, byte algo, AbstractTerminationCondition tc, double lineps, double startD) throws CloneNotSupportedException
CompositeLogPrior.nsf - the DifferentiableStatisticalModel that should be usedthreads - the number of threads that should be used for optimizationalgo - the algorithm that should be used for the optimizationtc - the AbstractTerminationCondition for stopping the optimizationlineps - the line epsilon for stopping the line search in the optimizationstartD - the start distance that should be used initiallyCloneNotSupportedException - if nsf can not be clonedpublic DifferentiableStatisticalModelWrapperTrainSM(DifferentiableStatisticalModel nsf, int threads, byte algo, AbstractTerminationCondition tc, double lineps, double startD, LogPrior prior) throws CloneNotSupportedException
nsf - the DifferentiableStatisticalModel that should be usedthreads - the number of threads that should be used for optimizationalgo - the algorithm that should be used for the optimizationtc - the AbstractTerminationCondition for stopping the optimizationlineps - the line epsilon for stopping the line search in the optimizationstartD - the start distance that should be used initiallyprior - The prior on the parametersCloneNotSupportedException - if nsf can not be clonedpublic DifferentiableStatisticalModelWrapperTrainSM(StringBuffer stringBuff) throws NonParsableException
Storable.
Creates a new DifferentiableStatisticalModelWrapperTrainSM out of a StringBuffer.stringBuff - the StringBuffer to be parsedNonParsableException - is thrown if the StringBuffer could not be parsedpublic DifferentiableStatisticalModelWrapperTrainSM clone() throws CloneNotSupportedException
AbstractTrainableStatisticalModelObject's clone()-method.clone in interface SequenceScoreclone in interface TrainableStatisticalModelclone in class AbstractTrainableStatisticalModelAbstractTrainableStatisticalModel
(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 void train(DataSet data, double[] weights) throws Exception
TrainableStatisticalModelTrainableStatisticalModel object given the data as DataSet using
the specified weights. The weight at position i belongs to the element at
position i. So the array weight should have the number of
sequences in the data set as dimension. (Optionally it is possible to use
weight == null if all weights have the value one.)train(data1); train(data2)
should be a fully trained model over data2 and not over
data1+data2. All parameters of the model were given by the
call of the constructor.data - the given sequences as DataSetweights - the weights of the elements, each weight should be
non-negativeException - if the training did not succeed (e.g. the dimension of
weights and the number of sequences in the
data set do not match)DataSet.getElementAt(int),
DataSet.ElementEnumeratorpublic 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 double getLogPriorTerm()
throws Exception
StatisticalModelException - if something went wrongpublic String getInstanceName()
SequenceScorepublic boolean isInitialized()
SequenceScoreSequenceScore.getLogScoreFor(Sequence).true if the instance is initialized, false
otherwisepublic NumericalResultSet getNumericalCharacteristics() throws Exception
SequenceScoreSequenceScore.getCharacteristics().Exception - if some of the characteristics could not be definedpublic String toString(NumberFormat nf)
SequenceScoreString representation of the instance.nf - the NumberFormat for the String representation of parameters or probabilitiesString representation of the instanceprotected void fromXML(StringBuffer xml) throws NonParsableException
AbstractTrainableStatisticalModelStringBuffer. It is the counter part of Storable.toXML().fromXML in class AbstractTrainableStatisticalModelxml - the XML representation of the modelNonParsableException - if the StringBuffer is not parsable or the
representation is conflictingAbstractTrainableStatisticalModel.AbstractTrainableStatisticalModel(StringBuffer)public StringBuffer toXML()
StorableStringBuffer of an
instance of the implementing class.public final void setOutputStream(OutputStream o)
o=null, than nothing will be written.o - the OutputStreampublic DifferentiableStatisticalModel getFunction() throws CloneNotSupportedException
DifferentiableStatisticalModel.DifferentiableStatisticalModelCloneNotSupportedException - if the internal instance could not be cloned