de.jstacs.sequenceScores.statisticalModels.differentiable.directedGraphicalModels.structureLearning.measures
Class InhomogeneousMarkov

java.lang.Object
  extended by de.jstacs.sequenceScores.statisticalModels.differentiable.directedGraphicalModels.structureLearning.measures.Measure
      extended by de.jstacs.sequenceScores.statisticalModels.differentiable.directedGraphicalModels.structureLearning.measures.InhomogeneousMarkov
All Implemented Interfaces:
InstantiableFromParameterSet, Storable, Cloneable

public class InhomogeneousMarkov
extends Measure

Class for a network structure of a BayesianNetworkDiffSM that is an inhomogeneous Markov model. The order of the Markov model can be defined by the user. A Markov model of order 0 is also known as position weight matrix (PWM), a Markov model of order 1 is also known as weight array matrix (WAM) model.

Author:
Jan Grau

Nested Class Summary
static class InhomogeneousMarkov.InhomogeneousMarkovParameterSet
          Class for an InstanceParameterSet that defines the parameters of an InhomogeneousMarkov structure Measure.
 
Nested classes/interfaces inherited from class de.jstacs.sequenceScores.statisticalModels.differentiable.directedGraphicalModels.structureLearning.measures.Measure
Measure.MeasureParameterSet
 
Field Summary
 
Fields inherited from class de.jstacs.sequenceScores.statisticalModels.differentiable.directedGraphicalModels.structureLearning.measures.Measure
parameters
 
Constructor Summary
InhomogeneousMarkov(InhomogeneousMarkov.InhomogeneousMarkovParameterSet parameters)
          Creates a new InhomogeneousMarkov from the corresponding InstanceParameterSet parameters.
InhomogeneousMarkov(int order)
          Creates the structure of an inhomogeneous Markov model of order order.
InhomogeneousMarkov(StringBuffer buf)
          The standard constructor for the interface Storable.
 
Method Summary
 InhomogeneousMarkov clone()
           
 String getInstanceName()
          Returns the name of the Measure and possibly some additional information about the current instance.
 int getOrder()
          Returns the order of the Markov model as defined in the constructor
 int[][] getParents(DataSet fg, DataSet bg, double[] weightsFg, double[] weightsBg, int length)
          Returns the optimal parents for the given data and weights.
 String getXMLTag()
          Returns the XML-tag for storing this measure
 boolean isShiftable()
          Indicates if Measure supports shifts.
 
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.differentiable.directedGraphicalModels.structureLearning.measures.Measure
fillTensor, fillTensor, getCMI, getCMI, getCurrentParameterSet, getEAR, getEAR, getMI, getMI, getStatistics, getStatisticsOrderTwo, sum, toParents, toXML, union
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InhomogeneousMarkov

public InhomogeneousMarkov(int order)
                    throws SimpleParameter.IllegalValueException,
                           CloneNotSupportedException
Creates the structure of an inhomogeneous Markov model of order order.

Parameters:
order - the order
Throws:
CloneNotSupportedException - if the parameters could not be cloned
SimpleParameter.IllegalValueException - if the order is not allowed

InhomogeneousMarkov

public InhomogeneousMarkov(InhomogeneousMarkov.InhomogeneousMarkovParameterSet parameters)
                    throws CloneNotSupportedException
Creates a new InhomogeneousMarkov from the corresponding InstanceParameterSet parameters.

Parameters:
parameters - the corresponding parameters
Throws:
CloneNotSupportedException - if the parameters could not be cloned

InhomogeneousMarkov

public InhomogeneousMarkov(StringBuffer buf)
                    throws NonParsableException
The standard constructor for the interface Storable. Recreates an InhomogeneousMarkov structure from its XML representation as returned by Measure.toXML().

Parameters:
buf - the XML representation as StringBuffer
Throws:
NonParsableException - if the XML code could not be parsed
Method Detail

getOrder

public int getOrder()
Returns the order of the Markov model as defined in the constructor

Returns:
the order

clone

public InhomogeneousMarkov clone()
                          throws CloneNotSupportedException
Overrides:
clone in class Measure
Throws:
CloneNotSupportedException

getInstanceName

public String getInstanceName()
Description copied from class: Measure
Returns the name of the Measure and possibly some additional information about the current instance.

Specified by:
getInstanceName in class Measure
Returns:
the name of the Measure

getParents

public int[][] getParents(DataSet fg,
                          DataSet bg,
                          double[] weightsFg,
                          double[] weightsBg,
                          int length)
                   throws Exception
Description copied from class: Measure
Returns the optimal parents for the given data and weights. The returned array of parents p at each position i is build as follows:

Specified by:
getParents in class Measure
Parameters:
fg - the data of the current (foreground) class
bg - the data of the negative (background) class
weightsFg - the weights for the sequences of fg
weightsBg - the weights for the sequences of bg
length - the length of the model, must be equal to the length of the sequences
Returns:
the the array p with the optimal parents
Throws:
Exception - if the lengths do not match or other problems concerning the data occur

isShiftable

public boolean isShiftable()
Description copied from class: Measure
Indicates if Measure supports shifts.

Overrides:
isShiftable in class Measure
Returns:
if Measure supports shifts

getXMLTag

public String getXMLTag()
Description copied from class: Measure
Returns the XML-tag for storing this measure

Specified by:
getXMLTag in class Measure
Returns:
the tag