public abstract class DiscreteGraphicalTrainSM extends AbstractTrainableStatisticalModel implements InstantiableFromParameterSet
DGTrainSMParameterSet| Modifier and Type | Field and Description |
|---|---|
protected DGTrainSMParameterSet |
params
The current parameter set of the model.
|
protected boolean |
trained
Indicates whether the model is trained or not.
|
alphabets, length| Constructor and Description |
|---|
DiscreteGraphicalTrainSM(DGTrainSMParameterSet params)
The default constructor.
|
DiscreteGraphicalTrainSM(StringBuffer representation)
The standard constructor for the interface
Storable. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
check(Sequence sequence,
int startpos,
int endpos)
Checks some conditions on a
Sequence. |
DiscreteGraphicalTrainSM |
clone()
Follows the conventions of
Object's clone()-method. |
protected void |
fromXML(StringBuffer representation)
This method should only be used by the constructor that works on a
StringBuffer. |
DGTrainSMParameterSet |
getCurrentParameterSet()
Returns the
InstanceParameterSet that has been used to
instantiate the current instance of the implementing class. |
String |
getDescription()
Returns a short description of the model that was given by the user in
the parameter set.
|
double |
getESS()
This method returns the ess (equivalent sample size)
that is used in this model.
|
protected abstract StringBuffer |
getFurtherModelInfos()
Returns further model information as a
StringBuffer. |
protected abstract String |
getXMLTag()
Returns the XML tag that is used for this model in
fromXML(StringBuffer) and toXML(). |
boolean |
isInitialized()
This method can be used to determine whether the instance is initialized.
|
protected void |
set(DGTrainSMParameterSet params,
boolean trained)
Sets the parameters as internal parameters and does some essential
computations.
|
protected abstract 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. |
StringBuffer |
toXML()
This method returns an XML representation as
StringBuffer of an
instance of the implementing class. |
emitDataSet, getAlphabetContainer, getCharacteristics, getLength, getLogProbFor, getLogProbFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getMaximalMarkovOrder, toString, trainequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waittraingetLogPriorTerm, getLogProbForgetInstanceName, getNumericalCharacteristicsprotected DGTrainSMParameterSet params
protected boolean trained
public DiscreteGraphicalTrainSM(DGTrainSMParameterSet params) throws CloneNotSupportedException, IllegalArgumentException, NonParsableException
DiscreteGraphicalTrainSM
from a given DGTrainSMParameterSet.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 parsableAbstractTrainableStatisticalModel.AbstractTrainableStatisticalModel(de.jstacs.data.AlphabetContainer, int)public DiscreteGraphicalTrainSM(StringBuffer representation) throws NonParsableException
Storable.
Creates a new DiscreteGraphicalTrainSM out of its XML
representation.representation - the XML representation as StringBufferNonParsableException - if the DiscreteGraphicalTrainSM could not be
reconstructed out of the XML representation (the
StringBuffer could not be parsed)Storable,
AbstractTrainableStatisticalModel.AbstractTrainableStatisticalModel(StringBuffer)public DiscreteGraphicalTrainSM 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 final DGTrainSMParameterSet getCurrentParameterSet() throws Exception
InstantiableFromParameterSetInstanceParameterSet that has been used to
instantiate the current instance of the implementing class. If the
current instance was not created using an InstanceParameterSet,
an equivalent InstanceParameterSet should be returned, so that an
instance created using this InstanceParameterSet would be in
principle equal to the current instance.getCurrentParameterSet in interface InstantiableFromParameterSetInstanceParameterSetException - if the InstanceParameterSet could not be returnedpublic final String getDescription()
public final double getESS()
protected final void fromXML(StringBuffer representation) throws NonParsableException
AbstractTrainableStatisticalModelStringBuffer. It is the counter part of Storable.toXML().fromXML in class AbstractTrainableStatisticalModelrepresentation - the XML representation of the modelNonParsableException - if the StringBuffer is not parsable or the
representation is conflictingAbstractTrainableStatisticalModel.AbstractTrainableStatisticalModel(StringBuffer)public final boolean isInitialized()
SequenceScoreSequenceScore.getLogScoreFor(Sequence).isInitialized in interface SequenceScoretrue if the instance is initialized, false
otherwisepublic String toString(NumberFormat nf)
SequenceScoreString representation of the instance.toString in interface SequenceScorenf - the NumberFormat for the String representation of parameters or probabilitiesString representation of the instancepublic final StringBuffer toXML()
StorableStringBuffer of an
instance of the implementing class.protected void check(Sequence sequence, int startpos, int endpos) throws NotTrainedException, IllegalArgumentException
Sequence. These are in general
conditions on the AlphabetContainer of a (sub)
Sequence between startpos und endpos.check in class AbstractTrainableStatisticalModelsequence - the Sequencestartpos - the startpositionendpos - the endpositionNotTrainedException - if the model is not trainedIllegalArgumentException - if some constraints are not fulfilledprotected abstract StringBuffer getFurtherModelInfos()
StringBuffer.toXML()protected abstract String getXMLTag()
fromXML(StringBuffer) and toXML().fromXML(StringBuffer) and
toXML()fromXML(StringBuffer),
toXML()protected abstract void setFurtherModelInfos(StringBuffer xml) throws NonParsableException
StringBuffer.xml - contains the model information like parameters of the
distribution etc. in XML formatNonParsableException - if the StringBuffer could not be parsedfromXML(StringBuffer)protected void set(DGTrainSMParameterSet params, boolean trained) throws CloneNotSupportedException, NonParsableException
fromParameterSet-methods.params - the new ParameterSettrained - indicates if the model is trained or notCloneNotSupportedException - if the parameter set could not be clonedNonParsableException - if the parameters of the model could not be parsed