|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.jstacs.models.AbstractModel de.jstacs.models.discrete.DiscreteGraphicalModel
public abstract class DiscreteGraphicalModel
This is the main class for all discrete graphical models (DGM).
DGMParameterSet
Field Summary | |
---|---|
protected DGMParameterSet |
params
The current parameter set of the model. |
protected boolean |
trained
Indicates whether the model is trained or not. |
Fields inherited from class de.jstacs.models.AbstractModel |
---|
alphabets, length |
Constructor Summary | |
---|---|
DiscreteGraphicalModel(DGMParameterSet params)
The default constructor. |
|
DiscreteGraphicalModel(StringBuffer representation)
The standard constructor for the interface Storable . |
Method Summary | |
---|---|
protected void |
check(Sequence sequence,
int startpos,
int endpos)
Checks some conditions on a Sequence . |
DiscreteGraphicalModel |
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 . |
DGMParameterSet |
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 |
isTrained()
Returns true if the model has been trained successfully,
false otherwise. |
protected void |
set(DGMParameterSet 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()
Should give a simple representation (text) of the model as String
. |
StringBuffer |
toXML()
This method returns an XML representation as StringBuffer of an
instance of the implementing class. |
Methods inherited from class de.jstacs.models.AbstractModel |
---|
emitSample, getAlphabetContainer, getCharacteristics, getLength, getLogProbFor, getLogProbFor, getLogProbFor, getLogProbFor, getLogProbFor, getMaximalMarkovOrder, getPriorTerm, getProbFor, getProbFor, set, setNewAlphabetContainerInstance, train |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.jstacs.models.Model |
---|
getInstanceName, getLogPriorTerm, getNumericalCharacteristics, getProbFor, train |
Field Detail |
---|
protected DGMParameterSet params
protected boolean trained
Constructor Detail |
---|
public DiscreteGraphicalModel(DGMParameterSet params) throws CloneNotSupportedException, IllegalArgumentException, NonParsableException
DiscreteGraphicalModel
from a given DGMParameterSet
.
params
- the given parameter set
CloneNotSupportedException
- if the parameter set could not be cloned
IllegalArgumentException
- if the parameter set is not instantiated
NonParsableException
- if the parameter set is not parsableAbstractModel.AbstractModel(de.jstacs.data.AlphabetContainer, int)
public DiscreteGraphicalModel(StringBuffer representation) throws NonParsableException
Storable
.
Creates a new DiscreteGraphicalModel
out of its XML
representation.
representation
- the XML representation as StringBuffer
NonParsableException
- if the DiscreteGraphicalModel
could not be
reconstructed out of the XML representation (the
StringBuffer
could not be parsed)Storable
,
AbstractModel.AbstractModel(StringBuffer)
Method Detail |
---|
public DiscreteGraphicalModel clone() throws CloneNotSupportedException
AbstractModel
Object
's clone()
-method.
clone
in interface Model
clone
in class AbstractModel
AbstractModel
(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
AbstractModel
. 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 o
CloneNotSupportedException
- if something went wrong while cloningpublic final DGMParameterSet getCurrentParameterSet() throws Exception
InstantiableFromParameterSet
InstanceParameterSet
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 InstantiableFromParameterSet
InstanceParameterSet
Exception
- if the InstanceParameterSet
could not be returnedpublic final String getDescription()
public final double getESS()
protected final void fromXML(StringBuffer representation) throws NonParsableException
AbstractModel
StringBuffer
. It is the counter part of Storable.toXML()
.
fromXML
in class AbstractModel
representation
- the XML representation of the model
NonParsableException
- if the StringBuffer
is not parsable or the
representation is conflictingAbstractModel.AbstractModel(StringBuffer)
public final boolean isTrained()
Model
true
if the model has been trained successfully,
false
otherwise.
isTrained
in interface Model
true
if the model has been trained successfully,
false
otherwisepublic String toString()
Model
String
.
toString
in interface Model
toString
in class Object
String
public final StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.
toXML
in interface Storable
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
.
sequence
- the Sequence
startpos
- the startpositionendpos
- the endposition
NotTrainedException
- if the model is not trained
IllegalArgumentException
- 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 format
NonParsableException
- if the StringBuffer
could not be parsedfromXML(StringBuffer)
protected void set(DGMParameterSet params, boolean trained) throws CloneNotSupportedException, NonParsableException
fromParameterSet
-methods.
params
- the new ParameterSet
trained
- indicates if the model is trained or not
CloneNotSupportedException
- if the parameter set could not be cloned
NonParsableException
- if the parameters of the model could not be parsed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |