|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.classifier.sequencelearning.hmm.HmmEvaluator
public final class HmmEvaluator
The HMMEvaluator class offers several methods to evaluate an HMM Model. The following use-cases are covered: 1) Generate a sequence of output states from a given model (prediction). 2) Compute the likelihood that a given model generated a given sequence of output states (model likelihood). 3) Compute the most likely hidden sequence for a given model and a given observed sequence (decoding).
Method Summary | |
---|---|
static int[] |
decode(HmmModel model,
int[] observations,
boolean scaled)
Returns the most likely sequence of hidden states for the given model and observation |
static double |
modelLikelihood(HmmModel model,
int[] outputSequence,
boolean scaled)
Returns the likelihood that a given output sequence was produced by the given model. |
static double |
modelLikelihood(HmmModel model,
int[] outputSequence,
Matrix beta,
boolean scaled)
Computes the likelihood that a given output sequence was computed by a given model. |
static double |
modelLikelihood(Matrix alpha,
boolean scaled)
Computes the likelihood that a given output sequence was computed by a given model using the alpha values computed by the forward algorithm. |
static int[] |
predict(HmmModel model,
int steps)
Predict a sequence of steps output states for the given HMM model |
static int[] |
predict(HmmModel model,
int steps,
long seed)
Predict a sequence of steps output states for the given HMM model |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static int[] predict(HmmModel model, int steps)
model
- The Hidden Markov model used to generate the output sequencesteps
- Size of the generated output sequence
public static int[] predict(HmmModel model, int steps, long seed)
model
- The Hidden Markov model used to generate the output sequencesteps
- Size of the generated output sequenceseed
- seed to use for the RNG
public static double modelLikelihood(HmmModel model, int[] outputSequence, boolean scaled)
model
- Model to base the likelihood on.outputSequence
- Sequence to compute likelihood for.scaled
- Use log-scaled parameters for computation. This is computationally
more expensive, but offers better numerically stability in case of
long output sequences
public static double modelLikelihood(Matrix alpha, boolean scaled)
alpha
- Matrix of alpha valuesscaled
- Set to true if the alpha values are log-scaled.
public static double modelLikelihood(HmmModel model, int[] outputSequence, Matrix beta, boolean scaled)
model
- model to compute sequence likelihood for.outputSequence
- sequence to base computation on.beta
- beta parameters.scaled
- set to true if betas are log-scaled.
public static int[] decode(HmmModel model, int[] observations, boolean scaled)
model
- model to use for decoding.observations
- integer Array containing a sequence of observed state IDsscaled
- Use log-scaled computations, this requires higher computational
effort but is numerically more stable for large observation
sequences
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |