Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous
Class BayesianNetworkTrainSM

    java.lang.Object
      de.jstacs.sequenceScores.statisticalModels.trainable.AbstractTrainableStatisticalModel
          de.jstacs.sequenceScores.statisticalModels.trainable.discrete.DiscreteGraphicalTrainSM
              de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.InhomogeneousDGTrainSM
                  de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.DAGTrainSM
                      de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.BayesianNetworkTrainSM

All Implemented Interfaces:
  InstantiableFromParameterSet, SequenceScore, StatisticalModel, TrainableStatisticalModel, Storable, Cloneable

    public class BayesianNetworkTrainSM

extends DAGTrainSM

The class implements a Bayesian network ( `StructureLearner.ModelType.BN` ) of fixed order. It allows the user to specify some kinds of specializations of BNs including inhomogeneous Markov models ( `StructureLearner.ModelType.IMM` ) and permuted Markov models ( `StructureLearner.ModelType.PMM` ).

Author:
  Jens Keilwagen
See Also:
  `StructureLearner.ModelType`

Field Summary

Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.DAGTrainSM
`constraints`

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
`BayesianNetworkTrainSM(BayesianNetworkTrainSMParameterSet params)` Creates a new `BayesianNetworkTrainSM` from a given `BayesianNetworkTrainSMParameterSet`.
`BayesianNetworkTrainSM(StringBuffer representation)` The standard constructor for the interface `Storable`.

Method Summary
`BayesianNetworkTrainSM` | `clone()` Follows the conventions of `Object`'s `clone()`-method.
`protected int[]` | `count(int[][] structure, byte maxOrder)` Counts the occurrence of the different indegrees and checks if the conventions are met.
`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.
`byte` | `getMaximalMarkovOrder()` This method returns the maximal used Markov order, if possible.
`protected String` | `getXMLTag()` Returns the XML tag that is used for this model in `DiscreteGraphicalTrainSM.fromXML(StringBuffer)` and `DiscreteGraphicalTrainSM.toXML()`.
`protected void` | `set(DGTrainSMParameterSet parameter, 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.DAGTrainSM
`checkAcyclic, createConstraints, drawParameters, emitDataSet, estimateParameters, getFurtherModelInfos, getLogProbFor, getNumericalCharacteristics, getStructure, setFurtherModelInfos, toString`

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, train`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### BayesianNetworkTrainSM

    public BayesianNetworkTrainSM(BayesianNetworkTrainSMParameterSet params)
                           throws CloneNotSupportedException,
                                  IllegalArgumentException,
                                  NonParsableException

  Creates a new `BayesianNetworkTrainSM` from a given `BayesianNetworkTrainSMParameterSet`.

  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:
    `DAGTrainSM.DAGTrainSM(de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.parameters.IDGTrainSMParameterSet)`

### BayesianNetworkTrainSM

    public BayesianNetworkTrainSM(StringBuffer representation)
                           throws NonParsableException

  The standard constructor for the interface `Storable`. Creates a new `BayesianNetworkTrainSM` out of its XML representation.

  Parameters:
    `representation` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the `BayesianNetworkTrainSM` could not be reconstructed out of the XML representation (the `StringBuffer` could not be parsed)
  See Also:
    `Storable`, `DAGTrainSM.DAGTrainSM(StringBuffer)`

Method Detail

### clone

    public BayesianNetworkTrainSM clone()
                                 throws CloneNotSupportedException

  Description copied from class: `AbstractTrainableStatisticalModel`
  Follows the conventions of `Object`'s `clone()`-method.

  Specified by:
    `clone` in interface `SequenceScore`
  Specified by:
    `clone` in interface `TrainableStatisticalModel`
  Overrides:
    `clone` in class `DAGTrainSM`
  Returns:
    an object, that is a copy of the current `AbstractTrainableStatisticalModel` (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:
    1. `Object o = (X)super.clone();`
    2. all additional member variables of `o` defined by `X` that are not of simple data-types like `int`, `double`, ... have to be deeply copied
    3. `return o`
  Throws:
    `CloneNotSupportedException` - if something went wrong while cloning

### 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

### 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()`

### 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 sample 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 sample do not match)
  See Also:
    `DataSet.getElementAt(int)`, `DataSet.ElementEnumerator`

### getLogPriorTerm

    public double getLogPriorTerm()
                           throws Exception

  Description copied from interface: `StatisticalModel`
  Returns a value that is proportional to the log of the prior. For maximum likelihood (ML) 0 should be returned.

  Specified by:
    `getLogPriorTerm` in interface `StatisticalModel`
  Overrides:
    `getLogPriorTerm` in class `DAGTrainSM`
  Returns:
    a value that is proportional to the log of the prior
  Throws:
    `Exception` - if something went wrong

### getMaximalMarkovOrder

    public byte getMaximalMarkovOrder()

  Description copied from interface: `StatisticalModel`
  This method returns the maximal used Markov order, if possible.

  Specified by:
    `getMaximalMarkovOrder` in interface `StatisticalModel`
  Overrides:
    `getMaximalMarkovOrder` in class `AbstractTrainableStatisticalModel`
  Returns:
    maximal used Markov order

### count

    protected int[] count(int[][] structure,
                          byte maxOrder)

  Counts the occurrence of the different indegrees and checks if the conventions are met.

  Parameters:
    `structure` - the structure
    `maxOrder` - the maximal order
  Returns:
    an `int`-array containing the occurrence of indegrees

### set

    protected void set(DGTrainSMParameterSet parameter,
                       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:
    `parameter` - 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD