dragon.ml.seqmodel.model
Class AbstractModel

java.lang.Object
  |
  +--dragon.ml.seqmodel.model.AbstractModel
All Implemented Interfaces:
ModelGraph
Direct Known Subclasses:
CompleteModel, GenericModel, NestedModel, NoEdgeModel

public abstract class AbstractModel
extends java.lang.Object
implements ModelGraph

Abstract class for model graph

Copyright: Copyright (c) 2005

Company: IST, Drexel University

Version:
1.0
Author:
Davis Zhou

Field Summary
protected  java.lang.String name
           
protected  int numLabels
           
 
Constructor Summary
AbstractModel(int labelNum, java.lang.String name)
           
 
Method Summary
 int getLabelNum()
          Gets the number of unique labels.
 int getMarkovOrder()
          Gets the order of the markov chain.
static ModelGraph getNewModelGraph(int numLabels, java.lang.String modelSpecs)
           
 int getOriginalLabelNum()
          Gets the number of original unique labels no matter what order the markov chain is.
 int getStateNum()
          Gets the number of states.
 boolean mapLabelToState(DataSequence seq)
          Maps labels to states.
 boolean mapLabelToState(DataSequence data, int len, int start)
          This method is used by inner model only
 boolean mapStateToLabel(DataSequence seq)
          Maps states to labels.
 void printGraph()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface dragon.ml.seqmodel.model.ModelGraph
getEdgeIterator, getEdgeNum, getEndState, getEndStateNum, getLabel, getStartState, getStartStateNum, isEndState, isStartState
 

Field Detail

numLabels

protected int numLabels

name

protected java.lang.String name
Constructor Detail

AbstractModel

public AbstractModel(int labelNum,
                     java.lang.String name)
Method Detail

getLabelNum

public int getLabelNum()
Description copied from interface: ModelGraph
Gets the number of unique labels. If there are 4 original labels and the markov chain is of the second order, this method returns 16.

Specified by:
getLabelNum in interface ModelGraph
Returns:
the number of unique labels.

getStateNum

public int getStateNum()
Description copied from interface: ModelGraph
Gets the number of states. It is always equal to the number of labels except for the nested model.

Specified by:
getStateNum in interface ModelGraph
Returns:
the number of states

getOriginalLabelNum

public int getOriginalLabelNum()
Description copied from interface: ModelGraph
Gets the number of original unique labels no matter what order the markov chain is. It is always equal to the number of labels unless markov is not the first order.

Specified by:
getOriginalLabelNum in interface ModelGraph
Returns:
the number of original unique labels

getMarkovOrder

public int getMarkovOrder()
Description copied from interface: ModelGraph
Gets the order of the markov chain. It is always equal to one except for the complete model.

Specified by:
getMarkovOrder in interface ModelGraph
Returns:
the order of the markov chain.

mapStateToLabel

public boolean mapStateToLabel(DataSequence seq)
Description copied from interface: ModelGraph
Maps states to labels. It does nothing unless nested model

Specified by:
mapStateToLabel in interface ModelGraph
Parameters:
seq - the sequence for mapping
Returns:
true if mapping successfully

mapLabelToState

public boolean mapLabelToState(DataSequence seq)
Description copied from interface: ModelGraph
Maps labels to states. It does nothing unless nested model.

Specified by:
mapLabelToState in interface ModelGraph
Parameters:
seq - the sequence for mapping
Returns:
true if mapping successfully

mapLabelToState

public boolean mapLabelToState(DataSequence data,
                               int len,
                               int start)
Description copied from interface: ModelGraph
This method is used by inner model only

Specified by:
mapLabelToState in interface ModelGraph
Parameters:
data - the sequence for mapping
len - the number of tokens for mapping
start - the position of the starting token
Returns:
true if mapping successfully

printGraph

public void printGraph()

getNewModelGraph

public static ModelGraph getNewModelGraph(int numLabels,
                                          java.lang.String modelSpecs)