|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbe.ac.ulg.montefiore.run.jahmm.ForwardBackwardCalculator
public class ForwardBackwardCalculator
This class can be used to compute the probability of a given observations sequence for a given HMM. Once the probability has been computed, the object holds various information such as the alpha (and possibly beta) array, as described in Rabiner and Juang.
Computing the beta array requires a O(1) access time to the observation sequence to get a theoretically optimal performance.
Nested Class Summary | |
---|---|
static class |
ForwardBackwardCalculator.Computation
Flags used to explain how the observation sequence probability should be computed (either forward, using the alpha array, or backward, using the beta array). |
Field Summary | |
---|---|
protected double[][] |
alpha
|
protected double[][] |
beta
|
protected double |
probability
|
Constructor Summary | |
---|---|
protected |
ForwardBackwardCalculator()
|
|
ForwardBackwardCalculator(java.util.List<? extends O> oseq,
Hmm<O> hmm)
Computes the probability of occurence of an observation sequence given a Hidden Markov Model. |
|
ForwardBackwardCalculator(java.util.List<? extends O> oseq,
Hmm<O> hmm,
java.util.EnumSet<ForwardBackwardCalculator.Computation> flags)
Computes the probability of occurence of an observation sequence given a Hidden Markov Model. |
Method Summary | ||
---|---|---|
double |
alphaElement(int t,
int i)
Returns an element of the alpha array. |
|
double |
betaElement(int t,
int i)
Returns an element of the beta array. |
|
protected
|
computeAlpha(Hmm<? super O> hmm,
java.util.List<O> oseq)
|
|
protected
|
computeAlphaInit(Hmm<? super O> hmm,
O o,
int i)
|
|
protected
|
computeAlphaStep(Hmm<? super O> hmm,
O o,
int t,
int j)
|
|
protected
|
computeBeta(Hmm<? super O> hmm,
java.util.List<O> oseq)
|
|
protected
|
computeBetaStep(Hmm<? super O> hmm,
O o,
int t,
int i)
|
|
double |
probability()
Return the probability of the sequence that generated this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected double[][] alpha
protected double[][] beta
protected double probability
Constructor Detail |
---|
protected ForwardBackwardCalculator()
public ForwardBackwardCalculator(java.util.List<? extends O> oseq, Hmm<O> hmm, java.util.EnumSet<ForwardBackwardCalculator.Computation> flags)
hmm
- A Hidden Markov Model;oseq
- An observation sequence.flags
- How the computation should be done. See the
Computation
enum.public ForwardBackwardCalculator(java.util.List<? extends O> oseq, Hmm<O> hmm)
alpha
array as a side effect.
ForwardBackwardCalculator(List, Hmm, EnumSet)
Method Detail |
---|
protected <O extends Observation> void computeAlpha(Hmm<? super O> hmm, java.util.List<O> oseq)
protected <O extends Observation> void computeAlphaInit(Hmm<? super O> hmm, O o, int i)
protected <O extends Observation> void computeAlphaStep(Hmm<? super O> hmm, O o, int t, int j)
protected <O extends Observation> void computeBeta(Hmm<? super O> hmm, java.util.List<O> oseq)
protected <O extends Observation> void computeBetaStep(Hmm<? super O> hmm, O o, int t, int i)
public double alphaElement(int t, int i)
t
- The temporal argument of the array (positive but strictly
smaller than the length of the sequence that helped generating
the array).i
- A state index of the HMM that helped generating the array.
{@link
- UnsupportedOperationException
UnsupportedOperationException} if alpha array has not been
computed.public double betaElement(int t, int i)
t
- The temporal argument of the array (positive but smaller than
the length of the sequence that helped generating the array).i
- A state index of the HMM that helped generating the array.
{@link
- UnsupportedOperationException
UnsupportedOperationException} if beta array has not been
computed.public double probability()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |