|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mahout.classifier.sequencelearning.hmm.HmmTrainer
public final class HmmTrainer
Class containing several algorithms used to train a Hidden Markov Model. The three main algorithms are: supervised learning, unsupervised Viterbi and unsupervised Baum-Welch.
| Method Summary | |
|---|---|
static HmmModel |
trainBaumWelch(HmmModel initialModel,
int[] observedSequence,
double epsilon,
int maxIterations,
boolean scaled)
Iteratively train the parameters of the given initial model wrt the observed sequence using Baum-Welch training. |
static HmmModel |
trainSupervised(int nrOfHiddenStates,
int nrOfOutputStates,
int[] observedSequence,
int[] hiddenSequence,
double pseudoCount)
Create an supervised initial estimate of an HMM Model based on a sequence of observed and hidden states. |
static HmmModel |
trainSupervisedSequence(int nrOfHiddenStates,
int nrOfOutputStates,
Collection<int[]> hiddenSequences,
Collection<int[]> observedSequences,
double pseudoCount)
Create an supervised initial estimate of an HMM Model based on a number of sequences of observed and hidden states. |
static HmmModel |
trainViterbi(HmmModel initialModel,
int[] observedSequence,
double pseudoCount,
double epsilon,
int maxIterations,
boolean scaled)
Iteratively train the parameters of the given initial model wrt to the observed sequence using Viterbi training. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static HmmModel trainSupervised(int nrOfHiddenStates,
int nrOfOutputStates,
int[] observedSequence,
int[] hiddenSequence,
double pseudoCount)
nrOfHiddenStates - The total number of hidden statesnrOfOutputStates - The total number of output statesobservedSequence - Integer array containing the observed sequencehiddenSequence - Integer array containing the hidden sequencepseudoCount - Value that is assigned to non-occurring transitions to avoid zero
probabilities.
public static HmmModel trainSupervisedSequence(int nrOfHiddenStates,
int nrOfOutputStates,
Collection<int[]> hiddenSequences,
Collection<int[]> observedSequences,
double pseudoCount)
nrOfHiddenStates - The total number of hidden statesnrOfOutputStates - The total number of output stateshiddenSequences - Collection of hidden sequences to use for trainingobservedSequences - Collection of observed sequences to use for training associated with hidden sequences.pseudoCount - Value that is assigned to non-occurring transitions to avoid zero
probabilities.
public static HmmModel trainViterbi(HmmModel initialModel,
int[] observedSequence,
double pseudoCount,
double epsilon,
int maxIterations,
boolean scaled)
initialModel - The initial model that gets iteratedobservedSequence - The sequence of observed statespseudoCount - Value that is assigned to non-occurring transitions to avoid zero
probabilities.epsilon - Convergence criteriamaxIterations - The maximum number of training iterationsscaled - Use Log-scaled implementation, this is computationally more
expensive but offers better numerical stability for large observed
sequences
public static HmmModel trainBaumWelch(HmmModel initialModel,
int[] observedSequence,
double epsilon,
int maxIterations,
boolean scaled)
initialModel - The initial model that gets iteratedobservedSequence - The sequence of observed statesepsilon - Convergence criteriamaxIterations - The maximum number of training iterationsscaled - Use log-scaled implementations of forward/backward algorithm. This
is computationally more expensive, but offers better numerical
stability for long output sequences.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||