de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous
Class FSMEManager

java.lang.Object
  extended by de.jstacs.sequenceScores.statisticalModels.trainable.AbstractTrainableStatisticalModel
      extended by de.jstacs.sequenceScores.statisticalModels.trainable.discrete.DiscreteGraphicalTrainSM
          extended by de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.InhomogeneousDGTrainSM
              extended by de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.MEManager
                  extended by de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.FSMEManager
All Implemented Interfaces:
InstantiableFromParameterSet, SequenceScore, StatisticalModel, TrainableStatisticalModel, Storable, Cloneable

public class FSMEManager
extends MEManager

This class can be used for any discrete fixed structure maximum entropy model (FSMEM).

Author:
Jens Keilwagen

Field Summary
 
Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.MEManager
factors
 
Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.InhomogeneousDGTrainSM
DEFAULT_STREAM, sostream
 
Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.DiscreteGraphicalTrainSM
params, trained
 
Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.AbstractTrainableStatisticalModel
alphabets, length
 
Constructor Summary
FSMEManager(FSMEMParameterSet params)
          Creates a new MEManager from a given MEManagerParameterSet.
FSMEManager(StringBuffer stringBuff)
          The standard constructor for the interface Storable.
 
Method Summary
 String getInstanceName()
          Should return a short instance name such as iMM(0), BN(2), ...
protected  String getXMLTag()
          Returns the XML tag that is used for this model in DiscreteGraphicalTrainSM.fromXML(StringBuffer) and DiscreteGraphicalTrainSM.toXML().
protected  void set(DGTrainSMParameterSet params, boolean trained)
          Sets the parameters as internal parameters and does some essential computations.
 void train(DataSet data, double[] weights)
          Trains the TrainableStatisticalModel object given the data as DataSet using the specified weights.
 
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.MEManager
clone, emitDataSet, getFactors, getFactors, getFurtherModelInfos, getLogPriorTerm, getLogProbFor, getNumericalCharacteristics, getStructure, setFurtherModelInfos, toString, trainFactors
 
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.InhomogeneousDGTrainSM
check, setOutputStream
 
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.DiscreteGraphicalTrainSM
fromXML, getCurrentParameterSet, getDescription, getESS, isInitialized, toXML
 
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.AbstractTrainableStatisticalModel
getAlphabetContainer, getCharacteristics, getLength, getLogProbFor, getLogProbFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getMaximalMarkovOrder, toString, train
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FSMEManager

public FSMEManager(FSMEMParameterSet params)
            throws CloneNotSupportedException,
                   IllegalArgumentException,
                   NonParsableException
Creates a new MEManager from a given MEManagerParameterSet.

Parameters:
params - the given parameter set
Throws:
CloneNotSupportedException - if the parameter set could not be cloned
IllegalArgumentException - if the parameter set is not instantiated
NonParsableException - if the parameter set is not parsable
See Also:
MEManager.MEManager(MEManagerParameterSet)

FSMEManager

public FSMEManager(StringBuffer stringBuff)
            throws NonParsableException
The standard constructor for the interface Storable. Creates a new FSMEManager out of its XML representation.

Parameters:
stringBuff - the XML representation as StringBuffer
Throws:
NonParsableException - if the FSMEManager could not be reconstructed out of the XML representation (the StringBuffer could not be parsed)
See Also:
Storable, MEManager.MEManager(StringBuffer)
Method Detail

getInstanceName

public String getInstanceName()
Description copied from interface: SequenceScore
Should return a short instance name such as iMM(0), BN(2), ...

Returns:
a short instance name

train

public void train(DataSet data,
                  double[] weights)
           throws Exception
Description copied from interface: TrainableStatisticalModel
Trains the TrainableStatisticalModel 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.)
This method should work non-incrementally. That means the result of the following series: 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.

Parameters:
data - the given sequences as DataSet
weights - the weights of the elements, each weight should be non-negative
Throws:
Exception - if the training did not succeed (e.g. the dimension of weights and the number of sequences in the data set do not match)
See Also:
DataSet.getElementAt(int), DataSet.ElementEnumerator

getXMLTag

protected String getXMLTag()
Description copied from class: DiscreteGraphicalTrainSM
Returns the XML tag that is used for this model in DiscreteGraphicalTrainSM.fromXML(StringBuffer) and DiscreteGraphicalTrainSM.toXML().

Specified by:
getXMLTag in class DiscreteGraphicalTrainSM
Returns:
the XML tag that is used in DiscreteGraphicalTrainSM.fromXML(StringBuffer) and DiscreteGraphicalTrainSM.toXML()
See Also:
DiscreteGraphicalTrainSM.fromXML(StringBuffer), DiscreteGraphicalTrainSM.toXML()

set

protected void set(DGTrainSMParameterSet params,
                   boolean trained)
            throws CloneNotSupportedException,
                   NonParsableException
Description copied from class: DiscreteGraphicalTrainSM
Sets the parameters as internal parameters and does some essential computations. Used in fromParameterSet-methods.

Overrides:
set in class InhomogeneousDGTrainSM
Parameters:
params - the new ParameterSet
trained - indicates if the model is trained or not
Throws:
CloneNotSupportedException - if the parameter set could not be cloned
NonParsableException - if the parameters of the model could not be parsed