|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A markov model.
All probablities are in log space.
This interface models a subset of hidden markov models with an explicit start and end state. In principle, these can be combined together, so that a state within one model may be an entire model in its own right, wired via container->start and end->container. For the sample methods to work, the log scores must be probabilities (sum to 1).
Method Summary | |
void |
addState(State newState)
Adds a state to the model. |
void |
addTransitionListener(TransitionListener tl)
Register a TransitionListener with the model. |
boolean |
containsTransition(State from,
State to)
Returns whether a transition is possible in the model. |
void |
createTransition(State from,
State to)
Makes a transition between two states legal. |
void |
destroyTransition(State from,
State to)
Breaks a transition between two states legal. |
Alphabet |
emissionAlphabet()
Alphabet that is emitted by the emission states. |
double |
getTransitionScore(State from,
State to)
Probability of the transition between from and to. |
int |
heads()
The number of heads on this model. |
MagicalState |
magicalState()
The MagicalState for this model. |
void |
removeState(State toGo)
Remove a state from the model. |
void |
removeTransitionListener(TransitionListener tl)
Unregister a TransitionListener with the model. |
State |
sampleTransition(State from)
Sample a transition from the distribution of transitions. |
void |
setTransitionScore(State from,
State to,
double score)
Set the transition score associated with a transition. |
FiniteAlphabet |
stateAlphabet()
FiniteAlphabet of the states. |
java.util.Set |
transitionsFrom(State from)
Returns a Set of all legal transitions from a state. |
java.util.Set |
transitionsTo(State to)
Returns a Set of all legal transitions to a state. |
Methods inherited from interface org.biojava.bio.dp.Trainable |
registerWithTrainer |
Method Detail |
public Alphabet emissionAlphabet()
public FiniteAlphabet stateAlphabet()
We are modeling a finite-state-machine, so there will be a finite set of states.
The MagicalState returned by getMagicalState is always contained within this as the start/end state.
public MagicalState magicalState()
public int heads()
Each head consumes a single SymbolList. A single-head model just consumes/ emits a single sequence. A two-head model performs alignment between two sequences (e.g. smith-waterman). Models with more heads do more interesting things.
public double getTransitionScore(State from, State to) throws IllegalSymbolException, IllegalTransitionException
from
- the State currently occupiedto
- the State to move topublic boolean containsTransition(State from, State to) throws IllegalSymbolException
from
- the State currently occupiedto
- the State to move topublic void createTransition(State from, State to) throws IllegalSymbolException, java.lang.UnsupportedOperationException, ModelVetoException
This should inform each TransitionListener that a transition is to be created using preCreateTransition, and if none of the listeners fire a ModelVetoException, it should create the transition, and then inform each TransitionListener with postCreateTransition.
from
- the State currently occupiedto
- the State to move topublic void destroyTransition(State from, State to) throws IllegalSymbolException, java.lang.UnsupportedOperationException, ModelVetoException
This should inform each TransitionListener that a transition is to be broken using preDestroyTransition, and if none of the listeners fire a ModelVetoException, it should break the transition, and then inform each TransitionListener with postDestroyTransition.
from
- the State currently occupiedto
- the State to move topublic void setTransitionScore(State from, State to, double score) throws IllegalSymbolException, IllegalTransitionException, java.lang.UnsupportedOperationException, ModelVetoException
This method should inform each TransitionListener that the score is to be changed by calling preChangeTransitionScore, and if the change is not vetoed, it should update the score and then call postChangeTransitionScore on each listener.
from
- the source Stateto
- the destination Statescore
- the new score for the transitionpublic State sampleTransition(State from) throws IllegalSymbolException
This will give eroneous results if the scores are not log-probabilities.
from
- the starting statepublic java.util.Set transitionsFrom(State from) throws IllegalSymbolException
from
- the starting statepublic java.util.Set transitionsTo(State to) throws IllegalSymbolException
from
- the destination statepublic void addState(State newState) throws java.lang.UnsupportedOperationException, IllegalSymbolException, ModelVetoException
newState
- the state to addpublic void removeState(State toGo) throws java.lang.UnsupportedOperationException, IllegalTransitionException, IllegalSymbolException, ModelVetoException
States should not be removed untill they are involved in no transitions. This is to avoid producing corrupted models by accident.
toGo
- the state to removepublic void addTransitionListener(TransitionListener tl)
tl
- a TransitionListener to notify when transitions are created,
destroyed or the probabilities changedpublic void removeTransitionListener(TransitionListener tl)
tl
- a TransitionListener to no longer notify when transitions are
created, destroyed or the probabilities changed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |