de.jstacs.scoringFunctions.directedGraphicalModels.structureLearning.measures
Class InhomogeneousMarkov

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

public class InhomogeneousMarkov
extends Measure

Class for a network structure of a BayesianNetworkScoringFunction 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 know as position weight matrix (PWM), a Markov model of order 1 is also known as weight array matrix (WAM) model.

Author:
Jan Grau

Constructor Summary
InhomogeneousMarkov(int order)
          Creates the structure of an inhomogeneous Markov model of order order.
InhomogeneousMarkov(StringBuffer buf)
          Re-creates an InhomogeneousMarkov structure from its XML-representation as returned by toXML().
 
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(Sample fg, Sample bg, double[] weightsFg, double[] weightsBg, int length)
          Returns the optimal parents for the given data and weights.
 boolean isShiftable()
          Indicates if Measure supports shifts.
 StringBuffer toXML()
          This method returns an XML-representation of an instance of the implementing class.
 
Methods inherited from class de.jstacs.scoringFunctions.directedGraphicalModels.structureLearning.measures.Measure
fillTensor, fillTensor, getCMI, getCMI, getEAR, getEAR, getMI, getMI, getStatistics, getStatisticsOrderTwo, sum, toParents, 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)
Creates the structure of an inhomogeneous Markov model of order order.

Parameters:
order - the order

InhomogeneousMarkov

public InhomogeneousMarkov(StringBuffer buf)
                    throws NonParsableException
Re-creates an InhomogeneousMarkov structure from its XML-representation as returned by toXML().

Parameters:
buf - the XML-representation
Throws:
NonParsableException - is thrown 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

getParents

public int[][] getParents(Sample fg,
                          Sample 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 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 parents
Throws:
Exception - thrown 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

toXML

public StringBuffer toXML()
Description copied from interface: Storable
This method returns an XML-representation of an instance of the implementing class.

Returns:
the XML-representation