ObservationType
- Type of Observations handled by the HMM.DataType
- Type of data (Collection of ObservationType, for instance)
sent to the learn method.public abstract class AbstractBaumWelchAlgorithm<ObservationType,DataType> extends AbstractAnytimeBatchLearner<DataType,HiddenMarkovModel<ObservationType>> implements MeasurablePerformanceAlgorithm
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_ITERATIONS
Default maximum number of iterations, 100.
|
static boolean |
DEFAULT_REESTIMATE_INITIAL_PROBABILITY
Default flag to re-estimate initial probabilities, true.
|
protected BatchLearner<java.util.Collection<? extends WeightedValue<? extends ObservationType>>,? extends ComputableDistribution<ObservationType>> |
distributionLearner
Learner for the Distribution Functions of the HMM.
|
protected HiddenMarkovModel<ObservationType> |
initialGuess
Initial guess for the iterations.
|
protected double |
lastLogLikelihood
Last Log Likelihood of the iterations
|
static java.lang.String |
PERFORMANCE_NAME
Name of the performance statistic, "Log Likelihood".
|
protected boolean |
reestimateInitialProbabilities
Flag to re-estimate the initial probability Vector.
|
protected HiddenMarkovModel<ObservationType> |
result
Result of the Baum-Welch Algorithm
|
data, keepGoing
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
AbstractBaumWelchAlgorithm(HiddenMarkovModel<ObservationType> initialGuess,
BatchLearner<java.util.Collection<? extends WeightedValue<? extends ObservationType>>,? extends ComputableDistribution<ObservationType>> distributionLearner,
boolean reestimateInitialProbabilities)
Creates a new instance of AbstractBaumWelchAlgorithm
|
Modifier and Type | Method and Description |
---|---|
AbstractBaumWelchAlgorithm<ObservationType,DataType> |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
BatchLearner<java.util.Collection<? extends WeightedValue<? extends ObservationType>>,? extends ComputableDistribution<ObservationType>> |
getDistributionLearner()
Getter for distributionLearner
|
HiddenMarkovModel<ObservationType> |
getInitialGuess()
Getter for initialGuess.
|
double |
getLastLogLikelihood()
Gets the log likelihood of the last completed step of the algorithm.
|
NamedValue<java.lang.Double> |
getPerformance()
Gets the name-value pair that describes the current performance of the
algorithm.
|
boolean |
getReestimateInitialProbabilities()
Getter for reestimateInitialProbabilities
|
HiddenMarkovModel<ObservationType> |
getResult()
Gets the current result of the algorithm.
|
void |
setDistributionLearner(BatchLearner<java.util.Collection<? extends WeightedValue<? extends ObservationType>>,? extends ComputableDistribution<ObservationType>> distributionLearner)
Setter for distributionLearner
|
void |
setInitialGuess(HiddenMarkovModel<ObservationType> initialGuess)
Setter for initialGuess.
|
void |
setReestimateInitialProbabilities(boolean reestimateInitialProbabilities)
Setter for reestimateInitialProbabilities
|
cleanupAlgorithm, getData, getKeepGoing, initializeAlgorithm, learn, setData, setKeepGoing, step, stop
getMaxIterations, isResultValid, setMaxIterations
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMaxIterations, setMaxIterations
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
isResultValid
public static final int DEFAULT_MAX_ITERATIONS
public static final boolean DEFAULT_REESTIMATE_INITIAL_PROBABILITY
public static final java.lang.String PERFORMANCE_NAME
protected BatchLearner<java.util.Collection<? extends WeightedValue<? extends ObservationType>>,? extends ComputableDistribution<ObservationType>> distributionLearner
protected HiddenMarkovModel<ObservationType> result
protected HiddenMarkovModel<ObservationType> initialGuess
protected double lastLogLikelihood
protected boolean reestimateInitialProbabilities
public AbstractBaumWelchAlgorithm(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 Distribution Functions of the HMM.reestimateInitialProbabilities
- Flag to re-estimate the initial probability Vector.public AbstractBaumWelchAlgorithm<ObservationType,DataType> clone()
AbstractCloneableSerializable
Object
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 CloneableSerializable
clone
in class AbstractAnytimeBatchLearner<DataType,HiddenMarkovModel<ObservationType>>
public NamedValue<java.lang.Double> getPerformance()
MeasurablePerformanceAlgorithm
getPerformance
in interface MeasurablePerformanceAlgorithm
public HiddenMarkovModel<ObservationType> getResult()
AnytimeAlgorithm
getResult
in interface AnytimeAlgorithm<HiddenMarkovModel<ObservationType>>
public HiddenMarkovModel<ObservationType> getInitialGuess()
public void setInitialGuess(HiddenMarkovModel<ObservationType> initialGuess)
initialGuess
- Initial guess for the iterations.public boolean getReestimateInitialProbabilities()
public void setReestimateInitialProbabilities(boolean reestimateInitialProbabilities)
reestimateInitialProbabilities
- Flag to re-estimate the initial probability Vector.public BatchLearner<java.util.Collection<? extends WeightedValue<? extends ObservationType>>,? extends ComputableDistribution<ObservationType>> getDistributionLearner()
public void setDistributionLearner(BatchLearner<java.util.Collection<? extends WeightedValue<? extends ObservationType>>,? extends ComputableDistribution<ObservationType>> distributionLearner)
distributionLearner
- Learner for the Distribution Functions of the HMM.public double getLastLogLikelihood()