ObservationType - Type of Observations handled by the HMM.@PublicationReference(author="Lawrence R. Rabiner", title="A tutorial on hidden Markov models and selected applications in speech recognition", type=Journal, year=1989, publication="Proceedings of the IEEE", pages={257,286}, url="http://www.cs.ubc.ca/~murphyk/Bayes/rabiner.pdf", notes="Rabiner\'s transition matrix is transposed from mine.") public class BaumWelchAlgorithm<ObservationType> extends AbstractBaumWelchAlgorithm<ObservationType,java.util.Collection<? extends ObservationType>>
| Modifier and Type | Field and Description |
|---|---|
protected MultiCollection<? extends ObservationType> |
multicollection
The multi-collection of sequences
|
protected java.util.ArrayList<Vector> |
sequenceGammas
The list of all gammas from each sequence
|
DEFAULT_MAX_ITERATIONS, DEFAULT_REESTIMATE_INITIAL_PROBABILITY, distributionLearner, initialGuess, lastLogLikelihood, PERFORMANCE_NAME, reestimateInitialProbabilities, resultdata, keepGoingmaxIterationsDEFAULT_ITERATION, iteration| Constructor and Description |
|---|
BaumWelchAlgorithm()
Creates a new instance of BaumWelchAlgorithm
|
BaumWelchAlgorithm(HiddenMarkovModel<ObservationType> initialGuess,
BatchLearner<java.util.Collection<? extends WeightedValue<? extends ObservationType>>,? extends ComputableDistribution<ObservationType>> distributionLearner,
boolean reestimateInitialProbabilities)
Creates a new instance of BaumWelchAlgorithm
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
cleanupAlgorithm()
Called to clean up the learning algorithm's state after learning has
finished.
|
BaumWelchAlgorithm<ObservationType> |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
protected Pair<java.util.ArrayList<java.util.ArrayList<Vector>>,java.util.ArrayList<Matrix>> |
computeSequenceParameters()
Computes the gammas and A matrices for each sequence.
|
protected boolean |
initializeAlgorithm()
Called to initialize the learning algorithm's state based on the
data that is stored in the data field.
|
HiddenMarkovModel<ObservationType> |
learn(MultiCollection<ObservationType> data)
Allows the algorithm to learn against multiple sequences of data.
|
protected boolean |
step()
Called to take a single step of the learning algorithm.
|
protected Vector |
updateInitialProbabilities(java.util.ArrayList<Vector> firstGammas)
Updates the initial probabilities from sequenceGammas
|
protected java.util.ArrayList<ProbabilityFunction<ObservationType>> |
updateProbabilityFunctions(java.util.ArrayList<Vector> sequenceGammas)
Updates the probability function from the concatenated gammas from
all sequences
|
protected double |
updateSequenceLogLikelihoods(HiddenMarkovModel<ObservationType> hmm)
Updates the internal sequence likelihoods for the given HMM
|
protected Matrix |
updateTransitionMatrix(java.util.ArrayList<Matrix> sequenceTransitionMatrices)
Computes an updated transition matrix from the scaled estimates
|
getDistributionLearner, getInitialGuess, getLastLogLikelihood, getPerformance, getReestimateInitialProbabilities, getResult, setDistributionLearner, setInitialGuess, setReestimateInitialProbabilitiesgetData, getKeepGoing, learn, setData, setKeepGoing, stopgetMaxIterations, isResultValid, setMaxIterationsaddIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListenersequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMaxIterations, setMaxIterationsaddIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListenerisResultValidprotected transient MultiCollection<? extends ObservationType> multicollection
protected transient java.util.ArrayList<Vector> sequenceGammas
public BaumWelchAlgorithm()
public BaumWelchAlgorithm(HiddenMarkovModel<ObservationType> initialGuess, BatchLearner<java.util.Collection<? extends WeightedValue<? extends ObservationType>>,? extends ComputableDistribution<ObservationType>> distributionLearner, boolean reestimateInitialProbabilities)
initialGuess - Initial guess for the iterations.distributionLearner - Learner for the Probability Functions of the HMM.reestimateInitialProbabilities - Flag to re-estimate the initial probability Vector.public BaumWelchAlgorithm<ObservationType> clone()
AbstractCloneableSerializableObject class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone() to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone() as the basis for your implementation.clone in interface CloneableSerializableclone in class AbstractBaumWelchAlgorithm<ObservationType,java.util.Collection<? extends ObservationType>>public HiddenMarkovModel<ObservationType> learn(MultiCollection<ObservationType> data)
data - Multiple sequences of data against which to train.protected boolean initializeAlgorithm()
AbstractAnytimeBatchLearnerinitializeAlgorithm in class AbstractAnytimeBatchLearner<java.util.Collection<? extends ObservationType>,HiddenMarkovModel<ObservationType>>protected boolean step()
AbstractAnytimeBatchLearnerstep in class AbstractAnytimeBatchLearner<java.util.Collection<? extends ObservationType>,HiddenMarkovModel<ObservationType>>protected void cleanupAlgorithm()
AbstractAnytimeBatchLearnercleanupAlgorithm in class AbstractAnytimeBatchLearner<java.util.Collection<? extends ObservationType>,HiddenMarkovModel<ObservationType>>protected Pair<java.util.ArrayList<java.util.ArrayList<Vector>>,java.util.ArrayList<Matrix>> computeSequenceParameters()
protected java.util.ArrayList<ProbabilityFunction<ObservationType>> updateProbabilityFunctions(java.util.ArrayList<Vector> sequenceGammas)
sequenceGammas - Concatenated gammas from all sequencesprotected Matrix updateTransitionMatrix(java.util.ArrayList<Matrix> sequenceTransitionMatrices)
sequenceTransitionMatrices - Scaled estimates from each sequenceprotected Vector updateInitialProbabilities(java.util.ArrayList<Vector> firstGammas)
firstGammas - The first gamma of the each sequenceprotected double updateSequenceLogLikelihoods(HiddenMarkovModel<ObservationType> hmm)
hmm - Hidden Markov model to consider