public final class HmmEvaluator extends Object
Modifier and Type | Method and Description |
---|---|
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
|
public static int[] predict(HmmModel model, int steps)
model
- The Hidden Markov model used to generate the output sequencesteps
- Size of the generated output sequencepublic 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 RNGpublic 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 sequencespublic 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
sequencesCopyright © 2008–2017 The Apache Software Foundation. All rights reserved.