gov.sandia.cognition.learning.algorithm.hmm
Class ParallelBaumWelchAlgorithm<ObservationType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm
          extended by gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm<ResultType>
              extended by gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner<DataType,HiddenMarkovModel<ObservationType>>
                  extended by gov.sandia.cognition.learning.algorithm.hmm.AbstractBaumWelchAlgorithm<ObservationType,Collection<? extends ObservationType>>
                      extended by gov.sandia.cognition.learning.algorithm.hmm.BaumWelchAlgorithm<ObservationType>
                          extended by gov.sandia.cognition.learning.algorithm.hmm.ParallelBaumWelchAlgorithm<ObservationType>
Type Parameters:
ObservationType - Type of Observations handled by the HMM.
All Implemented Interfaces:
AnytimeAlgorithm<HiddenMarkovModel<ObservationType>>, IterativeAlgorithm, MeasurablePerformanceAlgorithm, ParallelAlgorithm, StoppableAlgorithm, AnytimeBatchLearner<Collection<? extends ObservationType>,HiddenMarkovModel<ObservationType>>, BatchLearner<Collection<? extends ObservationType>,HiddenMarkovModel<ObservationType>>, CloneableSerializable, Serializable, Cloneable

@PublicationReference(author="William Turin",
                      title="Unidirectional and Parallel Baum\u2013Welch Algorithms",
                      type=Journal,
                      publication="IEEE Transactions on Speech and Audio Processing",
                      year=1998,
                      url="http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=00725318")
public class ParallelBaumWelchAlgorithm<ObservationType>
extends BaumWelchAlgorithm<ObservationType>
implements ParallelAlgorithm

A Parallelized implementation of some of the methods of the Baum-Welch Algorithm.

Since:
3.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Nested Class Summary
protected static class ParallelBaumWelchAlgorithm.DistributionEstimatorTask<ObservationType>
          Re-estimates the PDF from the gammas.
 
Field Summary
protected  ArrayList<ParallelBaumWelchAlgorithm.DistributionEstimatorTask<ObservationType>> distributionEstimatorTasks
          Tasks for re-estimating the PDFs.
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.hmm.BaumWelchAlgorithm
multicollection, sequenceGammas
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.hmm.AbstractBaumWelchAlgorithm
DEFAULT_MAX_ITERATIONS, DEFAULT_REESTIMATE_INITIAL_PROBABILITY, distributionLearner, initialGuess, lastLogLikelihood, PERFORMANCE_NAME, reestimateInitialProbabilities, result
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner
data, keepGoing
 
Fields inherited from class gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm
maxIterations
 
Fields inherited from class gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm
DEFAULT_ITERATION, iteration
 
Constructor Summary
ParallelBaumWelchAlgorithm()
          Default constructor
ParallelBaumWelchAlgorithm(HiddenMarkovModel<ObservationType> initialGuess, BatchLearner<Collection<? extends WeightedValue<? extends ObservationType>>,? extends ComputableDistribution<ObservationType>> distributionLearner, boolean reestimateInitialProbabilities)
          Creates a new instance of ParallelBaumWelchAlgorithm
 
Method Summary
protected  ArrayList<ParallelBaumWelchAlgorithm.DistributionEstimatorTask<ObservationType>> createDistributionEstimatorTasks()
          Creates the DistributionEstimatorTask
 int getNumThreads()
          Gets the number of threads in the thread pool.
 ThreadPoolExecutor getThreadPool()
          Gets the thread pool for the algorithm to use.
protected  boolean initializeAlgorithm()
          Called to initialize the learning algorithm's state based on the data that is stored in the data field.
 void setThreadPool(ThreadPoolExecutor threadPool)
          Sets the thread pool for the algorithm to use.
protected  ArrayList<ProbabilityFunction<ObservationType>> updateProbabilityFunctions(ArrayList<Vector> sequenceGammas)
          Updates the probability function from the concatenated gammas from all sequences
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.hmm.BaumWelchAlgorithm
cleanupAlgorithm, clone, computeSequenceParameters, learn, step, updateInitialProbabilities, updateSequenceLogLikelihoods, updateTransitionMatrix
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.hmm.AbstractBaumWelchAlgorithm
getDistributionLearner, getInitialGuess, getLastLogLikelihood, getPerformance, getReestimateInitialProbabilities, getResult, setDistributionLearner, setInitialGuess, setReestimateInitialProbabilities
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner
getData, getKeepGoing, learn, setData, setKeepGoing, stop
 
Methods inherited from class gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm
getMaxIterations, isResultValid, setMaxIterations
 
Methods inherited from class gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 
Methods inherited from interface gov.sandia.cognition.algorithm.AnytimeAlgorithm
getMaxIterations, setMaxIterations
 
Methods inherited from interface gov.sandia.cognition.algorithm.IterativeAlgorithm
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
 
Methods inherited from interface gov.sandia.cognition.algorithm.StoppableAlgorithm
isResultValid
 

Field Detail

distributionEstimatorTasks

protected transient ArrayList<ParallelBaumWelchAlgorithm.DistributionEstimatorTask<ObservationType>> distributionEstimatorTasks
Tasks for re-estimating the PDFs.

Constructor Detail

ParallelBaumWelchAlgorithm

public ParallelBaumWelchAlgorithm()
Default constructor


ParallelBaumWelchAlgorithm

public ParallelBaumWelchAlgorithm(HiddenMarkovModel<ObservationType> initialGuess,
                                  BatchLearner<Collection<? extends WeightedValue<? extends ObservationType>>,? extends ComputableDistribution<ObservationType>> distributionLearner,
                                  boolean reestimateInitialProbabilities)
Creates a new instance of ParallelBaumWelchAlgorithm

Parameters:
initialGuess - Initial guess for the iterations.
distributionLearner - Learner for the Distribution Functions of the HMM.
reestimateInitialProbabilities - Flag to re-estimate the initial probability Vector.
Method Detail

getThreadPool

public ThreadPoolExecutor getThreadPool()
Description copied from interface: ParallelAlgorithm
Gets the thread pool for the algorithm to use.

Specified by:
getThreadPool in interface ParallelAlgorithm
Returns:
Thread pool used for parallelization.

setThreadPool

public void setThreadPool(ThreadPoolExecutor threadPool)
Description copied from interface: ParallelAlgorithm
Sets the thread pool for the algorithm to use.

Specified by:
setThreadPool in interface ParallelAlgorithm
Parameters:
threadPool - Thread pool used for parallelization.

getNumThreads

public int getNumThreads()
Description copied from interface: ParallelAlgorithm
Gets the number of threads in the thread pool.

Specified by:
getNumThreads in interface ParallelAlgorithm
Returns:
Number of threads in the thread pool

initializeAlgorithm

protected boolean initializeAlgorithm()
Description copied from class: AbstractAnytimeBatchLearner
Called to initialize the learning algorithm's state based on the data that is stored in the data field. The return value indicates if the algorithm can be run or not based on the initialization.

Overrides:
initializeAlgorithm in class BaumWelchAlgorithm<ObservationType>
Returns:
True if the learning algorithm can be run and false if it cannot.

updateProbabilityFunctions

protected ArrayList<ProbabilityFunction<ObservationType>> updateProbabilityFunctions(ArrayList<Vector> sequenceGammas)
Description copied from class: BaumWelchAlgorithm
Updates the probability function from the concatenated gammas from all sequences

Overrides:
updateProbabilityFunctions in class BaumWelchAlgorithm<ObservationType>
Parameters:
sequenceGammas - Concatenated gammas from all sequences
Returns:
Maximum Likelihood probability functions

createDistributionEstimatorTasks

protected ArrayList<ParallelBaumWelchAlgorithm.DistributionEstimatorTask<ObservationType>> createDistributionEstimatorTasks()
Creates the DistributionEstimatorTask

Returns:
DistributionEstimatorTask.