public final class HmmTrainer extends Object
Modifier and Type | Method and Description |
---|---|
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.
|
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
sequencespublic 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.Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.