|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbe.ac.ulg.montefiore.run.jahmm.Hmm<O>
public class Hmm<O extends Observation>
Main Hmm class; it implements an Hidden Markov Model. An HMM is composed of:
Important objects extensively used with HMMs are Observation
s, observation sequences and set of observation sequences.
An observation sequence is simply a List
of
Observation
s (in the right order, the i-th element of
the vector being the i-th element of the sequence). A set of observation
sequences is a List
of such sequences.
Constructor Summary | |
---|---|
|
Hmm(double[] pi,
double[][] a,
java.util.List<? extends Opdf<O>> opdfs)
Creates a new HMM. |
protected |
Hmm(int nbStates)
Creates a new HMM. |
|
Hmm(int nbStates,
OpdfFactory<? extends Opdf<O>> opdfFactory)
Creates a new HMM. |
Method Summary | |
---|---|
Hmm<O> |
clone()
|
double |
getAij(int i,
int j)
Returns the probability associated with the transition going from state i to state j (ai,j). |
Opdf<O> |
getOpdf(int stateNb)
Returns the opdf associated with a given state. |
double |
getPi(int stateNb)
Returns the pi value associated with a given state. |
double |
lnProbability(java.util.List<? extends O> oseq)
Returns the neperian logarithm of observation sequence's probability given this HMM. |
int[] |
mostLikelyStateSequence(java.util.List<? extends O> oseq)
Returns an array containing the most likely state sequence matching an observation sequence given this HMM. |
int |
nbStates()
Returns the number of states of this HMM. |
double |
probability(java.util.List<? extends O> oseq)
Returns the probability of an observation sequence given this HMM. |
double |
probability(java.util.List<? extends O> oseq,
int[] sseq)
Returns the probability of an observation sequence along a state sequence given this HMM. |
void |
setAij(int i,
int j,
double value)
Sets the probability associated to the transition going from state i to state j (Ai,j). |
void |
setOpdf(int stateNb,
Opdf<O> opdf)
Sets the opdf associated with a given state. |
void |
setPi(int stateNb,
double value)
Sets the pi value associated with a given state. |
java.lang.String |
toString()
Gives a description of this HMM. |
java.lang.String |
toString(java.text.NumberFormat nf)
Gives a description of this HMM. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Hmm(int nbStates, OpdfFactory<? extends Opdf<O>> opdfFactory)
nbStates
- The (strictly positive) number of states of the HMM.opdfFactory
- A pdf generator that is used to build the
pdfs associated to each state.public Hmm(double[] pi, double[][] a, java.util.List<? extends Opdf<O>> opdfs)
pi
- The initial probability values. pi[i]
is the
initial probability of state i
. This array is
copied.a
- The state transition probability array. a[i][j]
is the probability of going from state i
to state
j
. This array is copied.opdfs
- The observation distributions. opdfs.get(i)
is the observation distribution associated with state
i
. The distributions are not copied.protected Hmm(int nbStates)
null
specified and must be set using the appropriate
methods.
nbStates
- The (strictly positive) number of states of the HMM.Method Detail |
---|
public int nbStates()
public double getPi(int stateNb)
stateNb
- A state number such that
0 ≤ stateNb < nbStates()
stateNb
.public void setPi(int stateNb, double value)
stateNb
- A state number such that
0 ≤ stateNb < nbStates()
.value
- The pi value to associate to state number
stateNb
public Opdf<O> getOpdf(int stateNb)
stateNb
- A state number such that
0 ≤ stateNb < nbStates()
.
stateNb
.public void setOpdf(int stateNb, Opdf<O> opdf)
stateNb
- A state number such that
0 ≤ stateNb < nbStates()
.opdf
- An observation probability function.public double getAij(int i, int j)
i
- The first state number such that
0 ≤ i < nbStates()
.j
- The second state number such that
0 ≤ j < nbStates()
.
i
to state j
.public void setAij(int i, int j, double value)
i
- The first state number such that
0 ≤ i < nbStates()
.j
- The second state number such that
0 ≤ j < nbStates()
.value
- The value of Ai,j.public int[] mostLikelyStateSequence(java.util.List<? extends O> oseq)
I
maximizes the probability of P[I|O,Model]
where
O
is the observation sequence and Model
this
HMM model.
oseq
- A non-empty observation sequence.
public double probability(java.util.List<? extends O> oseq)
oseq
- A non-empty observation sequence.
public double lnProbability(java.util.List<? extends O> oseq)
oseq
- A non-empty observation sequence.
public double probability(java.util.List<? extends O> oseq, int[] sseq)
oseq
- A non-empty observation sequence.sseq
- An array containing a sequence of state numbers. The length
of this array must be equal to the length of
oseq
public java.lang.String toString(java.text.NumberFormat nf)
nf
- A number formatter used to print numbers (e.g. Aij values).
public java.lang.String toString()
toString
in class java.lang.Object
public Hmm<O> clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |