calhoun.analysis.crf
Class BeanModel

java.lang.Object
  extended by calhoun.analysis.crf.AbstractFeatureManager
      extended by calhoun.analysis.crf.CompositeFeatureManager
          extended by calhoun.analysis.crf.BeanModel
All Implemented Interfaces:
FeatureManager, FeatureManagerEdge, FeatureManagerEdgeExplicitLength, FeatureManagerNode, FeatureManagerNodeExplicitLength, ModelManager, java.io.Serializable
Direct Known Subclasses:
Interval13Model, Interval29Model, ZeroOrderModel

public class BeanModel
extends CompositeFeatureManager
implements ModelManager

a useful base class for creating model beans. Defines internal Node and Edge class that can be used to define a hidden state model for the CRF. The actual state diagram could be implemented through a derived class or through setup of the model in the XML model file. Because XML configuration of a state model is verbose and because the state diagram is central to most models, we recommend using a derived class to set up the model, as we have done with gene calling.

See Also:
Serialized Form

Nested Class Summary
static class BeanModel.Edge
          an edge in the hidden state diagram.
static class BeanModel.Node
          a hidden state.
 
Constructor Summary
BeanModel()
           
 
Method Summary
 DenseBooleanMatrix2D getLegalTransitions()
          returns a boolean matrix where each (row, column) entry contains true if the model has a legal transition between state row and state column.
 int getNumStates()
          the number of hidden states.
 int getStateIndex(java.lang.String name)
          looks up a hidden state's index given it's human readable name.
 java.lang.String getStateName(int state)
          looks up the human readable name of a hidden state given it's index.
 void setEdges(java.util.List<BeanModel.Edge> edges)
          sets the list of legal state transitions in this model.
 void setNodes(java.util.List<BeanModel.Node> nodes)
          sets the list of hidden states in this model.
 
Methods inherited from class calhoun.analysis.crf.CompositeFeatureManager
addFeatureManager, addFeatureManager, evaluateEdge, evaluateEdgeLength, evaluateNode, evaluateNodeLength, getCacheStrategy, getComponentFeatures, getFeatureName, getFeatureOffset, getNumFeatures, setComponentFeatures, train
 
Methods inherited from class calhoun.analysis.crf.AbstractFeatureManager
getInputComponent, setInputComponent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface calhoun.analysis.crf.FeatureManagerEdge
evaluateEdge
 
Methods inherited from interface calhoun.analysis.crf.FeatureManager
getCacheStrategy, getFeatureName, getInputComponent, getNumFeatures, setInputComponent, train
 
Methods inherited from interface calhoun.analysis.crf.FeatureManagerNode
evaluateNode
 
Methods inherited from interface calhoun.analysis.crf.FeatureManager
getCacheStrategy, getFeatureName, getInputComponent, getNumFeatures, setInputComponent, train
 
Methods inherited from interface calhoun.analysis.crf.FeatureManagerEdgeExplicitLength
evaluateEdgeLength
 
Methods inherited from interface calhoun.analysis.crf.FeatureManager
getCacheStrategy, getFeatureName, getInputComponent, getNumFeatures, setInputComponent, train
 
Methods inherited from interface calhoun.analysis.crf.FeatureManagerNodeExplicitLength
evaluateNodeLength
 
Methods inherited from interface calhoun.analysis.crf.FeatureManager
getCacheStrategy, getFeatureName, getInputComponent, getNumFeatures, setInputComponent, train
 

Constructor Detail

BeanModel

public BeanModel()
Method Detail

setNodes

public void setNodes(java.util.List<BeanModel.Node> nodes)
sets the list of hidden states in this model. This will usually be called by a derived class or by the Spring configuration.

Parameters:
nodes - the list of hidden states in the model

setEdges

public void setEdges(java.util.List<BeanModel.Edge> edges)
sets the list of legal state transitions in this model. This will usually be called by a derived class or by the Spring configuration.

Parameters:
edges - the list of valid state transitions in the model

getNumStates

public int getNumStates()
Description copied from interface: ModelManager
the number of hidden states.

Specified by:
getNumStates in interface ModelManager
Returns:
the number of hidden states

getStateName

public java.lang.String getStateName(int state)
Description copied from interface: ModelManager
looks up the human readable name of a hidden state given it's index.

Specified by:
getStateName in interface ModelManager
Returns:
string name of the state with this index.

getStateIndex

public int getStateIndex(java.lang.String name)
Description copied from interface: ModelManager
looks up a hidden state's index given it's human readable name.

Specified by:
getStateIndex in interface ModelManager
Returns:
index of the state with this name.

getLegalTransitions

public DenseBooleanMatrix2D getLegalTransitions()
Description copied from interface: ModelManager
returns a boolean matrix where each (row, column) entry contains true if the model has a legal transition between state row and state column. A ModelManager may safely return null if all transitions are legal.

Specified by:
getLegalTransitions in interface ModelManager
Returns:
a boolean matrix containing the legal transitions.