|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.classifier.sequencelearning.hmm.HmmUtils
public final class HmmUtils
A collection of utilities for handling HMMModel objects.
Method Summary | |
---|---|
static List<String> |
decodeStateSequence(HmmModel model,
int[] sequence,
boolean observed,
String defaultValue)
Decodes a given collection of state IDs into the corresponding state names registered in a given model. |
static int[] |
encodeStateSequence(HmmModel model,
Collection<String> sequence,
boolean observed,
int defaultValue)
Encodes a given collection of state names by the corresponding state IDs registered in a given model. |
static Vector |
getCumulativeInitialProbabilities(HmmModel model)
Compute the cumulative distribution of the initial hidden state probabilities for the given HMM model. |
static Matrix |
getCumulativeOutputMatrix(HmmModel model)
Compute the cumulative output probability matrix for the given HMM model. |
static Matrix |
getCumulativeTransitionMatrix(HmmModel model)
Compute the cumulative transition probability matrix for the given HMM model. |
static void |
normalizeModel(HmmModel model)
Function used to normalize the probabilities of a given HMM model |
static HmmModel |
truncateModel(HmmModel model,
double threshold)
Method to reduce the size of an HMMmodel by converting the models DenseMatrix/DenseVectors to sparse implementations and setting every value < threshold to 0 |
static void |
validate(HmmModel model)
Validates an HMM model set |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Matrix getCumulativeTransitionMatrix(HmmModel model)
model
- The HMM model for which the cumulative transition matrix should be
computed
public static Matrix getCumulativeOutputMatrix(HmmModel model)
model
- The HMM model for which the cumulative output matrix should be
computed
public static Vector getCumulativeInitialProbabilities(HmmModel model)
model
- The HMM model for which the cumulative initial state probabilities
should be computed
public static void validate(HmmModel model)
model
- model to sanity check.public static int[] encodeStateSequence(HmmModel model, Collection<String> sequence, boolean observed, int defaultValue)
model
- Model to provide the encoding forsequence
- Collection of state namesobserved
- If set, the sequence is encoded as a sequence of observed states,
else it is encoded as sequence of hidden statesdefaultValue
- The default value in case a state is not known
public static List<String> decodeStateSequence(HmmModel model, int[] sequence, boolean observed, String defaultValue)
model
- model to use for retrieving state namessequence
- int array of state IDsobserved
- If set, the sequence is encoded as a sequence of observed states,
else it is encoded as sequence of hidden statesdefaultValue
- The default value in case a state is not known
public static void normalizeModel(HmmModel model)
model
- model to normalizepublic static HmmModel truncateModel(HmmModel model, double threshold)
model
- model to truncatethreshold
- minimum value a model entry must have to be retained.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |