public abstract class AbstractHmm extends Object implements HiddenMarkovModel
AbstractHmm is an abstract implementation of a
hidden Markov model which manages a symbol table and defines the
basic methods in terms of the symbolic linear probability methods.
Specifically, the following four methods must be implemented by
subclasses:
For efficiency, the log- and identifier-based versions of these methods may also be overridden. The symbol table is provided to the constructor and managed by this class.
Abstract Methods to Implement startProb(String)endProb(String)transitProb(String,String)emitProb(String,CharSequence)
| Constructor and Description |
|---|
AbstractHmm(SymbolTable stateSymbolTable)
Construct an HMM with the specified symbol table.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addState(String state)
Adds the state with the specified name to this hidden Markov
model.
|
double |
emitLog2Prob(int stateId,
CharSequence emission)
Return the log (base 2) of the emission estimate.
|
double |
emitLog2Prob(String state,
CharSequence emission)
Returns the log (base 2) of the emission estimate.
|
double |
emitProb(int stateId,
CharSequence emission)
Return an estimate of the likelihood of the state with the
specified identifier to emit the specified string.
|
abstract double |
emitProb(String state,
CharSequence emission)
Returns an estimate the emission of the specified string
by the state with the specified label.
|
double |
endLog2Prob(int stateId)
Returns the log (base 2) of the end probability for the
state with the specified identifier.
|
double |
endLog2Prob(String state)
Returns the log (base 2) of the end probability for the
specified state.
|
double |
endProb(int stateId)
Returns the end probability for the state with the specified
identifier.
|
abstract double |
endProb(String state)
Returns the end probability for the specified state.
|
double |
startLog2Prob(int stateId)
Returns the log (base 2) of the start probability for the
state with the specified identifier.
|
double |
startLog2Prob(String state)
Returns the log (base 2) of the start probability for the
specified state.
|
double |
startProb(int stateId)
Returns the start probability for the state with the specified
identifier.
|
abstract double |
startProb(String state)
Returns the start probability for the specified state.
|
SymbolTable |
stateSymbolTable()
Return the symbol table for the states for this HMM.
|
double |
transitLog2Prob(int sourceId,
int targetId)
Returns the log (base 2) of the transition estimate.
|
double |
transitLog2Prob(String source,
String target)
Returns the log (base 2) estimate of a transition probability.
|
double |
transitProb(int sourceId,
int targetId)
Return an estimate of the transition likelihood from the source
state with the specified identifier to the target state with the
specified identifier.
|
abstract double |
transitProb(String source,
String target)
Returns an estimate of a transition from the source state with
the specified name to the target state with the specified
label.
|
public AbstractHmm(SymbolTable stateSymbolTable)
stateSymbolTable - Symbol table for the HMM.public boolean addState(String state)
state - Name of state to add.true if the state was not already a state
in this HMM.public SymbolTable stateSymbolTable()
stateSymbolTable in interface HiddenMarkovModelpublic abstract double startProb(String state)
startProb in interface HiddenMarkovModelstate - HMM state.public double startProb(int stateId)
This method is implemented in terms of stateSymbolTable()
and startProb(String).
startProb in interface HiddenMarkovModelstateId - Identifier of state.public double startLog2Prob(String state)
This method is implemented in terms of Math.log2(double) and startProb(String).
startLog2Prob in interface HiddenMarkovModelstate - HMM State.public double startLog2Prob(int stateId)
This method is implemented in terms of Math.log2(double) and startProb(int).
startLog2Prob in interface HiddenMarkovModelstateId - Identifier of state.public abstract double endProb(String state)
endProb in interface HiddenMarkovModelstate - HMM state.public double endProb(int stateId)
This method is implemented with stateSymbolTable() and
and endProb(String).
endProb in interface HiddenMarkovModelstateId - Identifier of state.public double endLog2Prob(String state)
This method is implemented in terms of Math.log2(double) and endProb(String)
endLog2Prob in interface HiddenMarkovModelstate - HMM State.public double endLog2Prob(int stateId)
This method is implemented in terms of Math.log2(double) and endProb(int)
endLog2Prob in interface HiddenMarkovModelstateId - Identifier of state.public abstract double transitProb(String source, String target)
transitProb in interface HiddenMarkovModelsource - Label of source state.target - Label of target state.public double transitProb(int sourceId,
int targetId)
This method is implemented in terms of stateSymbolTable()
and transitProb(String,String).
transitProb in interface HiddenMarkovModelsourceId - Source state identifier.targetId - Target state identifier.public double transitLog2Prob(String source, String target)
transitProb(String,String) for more information.
This method is implemented in terms of Math.log2(double) and transitProb(String,String).
transitLog2Prob in interface HiddenMarkovModelsource - Label of source state.target - Label of target state.public double transitLog2Prob(int sourceId,
int targetId)
transitProb(int,int) for more information.
This method is implemented in terms of Math.log2(double) and transitProb(int,int)
transitLog2Prob in interface HiddenMarkovModelsourceId - Source state identifier.targetId - Target state identifier.public abstract double emitProb(String state, CharSequence emission)
emitProb in interface HiddenMarkovModelstate - Label of state.emission - Character sequence emitted.public double emitProb(int stateId,
CharSequence emission)
This method is implemented in terms of emitProb(String,CharSequence).
emitProb in interface HiddenMarkovModelstateId - State identifier.emission - Character sequence emitted.public double emitLog2Prob(int stateId,
CharSequence emission)
emitProb(int,CharSequence) for more details.
This method is implemented in terms of Math.log2(double) and emitProb(int,CharSequence).
emitLog2Prob in interface HiddenMarkovModelstateId - State identifier.emission - Character sequence emitted.public double emitLog2Prob(String state, CharSequence emission)
emitProb(String,CharSequence) for more information.
This method is implemented in terms of Math.log2(double) and emitProb(String,CharSequence).
emitLog2Prob in interface HiddenMarkovModelstate - Label of state.emission - Character sequence emitted.Copyright © 2016 Alias-i, Inc.. All rights reserved.