|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.biojava.bio.dp.SimpleMarkovModel
Constructor Summary | |
SimpleMarkovModel(int heads,
Alphabet emissionAlpha)
|
|
SimpleMarkovModel(int heads,
Alphabet emissionAlpha,
java.lang.String name)
|
Method Summary | |
void |
addState(State toAdd)
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. |
protected java.util.List |
getTransitionListeners()
|
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 |
registerWithTrainer(ModelTrainer modelTrainer)
Perform any registration that is necisary with mt. |
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 value)
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 class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SimpleMarkovModel(int heads, Alphabet emissionAlpha, java.lang.String name)
public SimpleMarkovModel(int heads, Alphabet emissionAlpha)
Method Detail |
protected java.util.List getTransitionListeners()
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 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 MagicalState magicalState()
public double getTransitionScore(State from, State to) throws IllegalSymbolException, IllegalTransitionException
from
- the State currently occupiedto
- the State to move topublic State sampleTransition(State from) throws IllegalSymbolException
This will give eroneous results if the scores are not log-probabilities.
from
- the starting statepublic void setTransitionScore(State from, State to, double value) throws IllegalSymbolException, IllegalTransitionException, 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 void createTransition(State from, State to) throws IllegalSymbolException, 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, 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 boolean containsTransition(State from, State to) throws IllegalSymbolException
from
- the State currently occupiedto
- the State to move topublic 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 toAdd) throws IllegalSymbolException
newState
- the state to addpublic void removeState(State toGo) throws IllegalSymbolException, IllegalTransitionException
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 registerWithTrainer(ModelTrainer modelTrainer) throws BioException
This may include registering handelers for transition or emission counts, or registering other Trainable objects with the ModelTrainer.
mt
- the ModelTrainer that encapsulates the training environmentpublic 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 |