12#ifndef MLPACK_METHODS_HMM_HMM_MODEL_HPP
13#define MLPACK_METHODS_HMM_HMM_MODEL_HPP
56 if (type == HMMType::DiscreteHMM)
58 else if (type == HMMType::GaussianHMM)
60 else if (type == HMMType::GaussianMixtureModelHMM)
62 else if (type == HMMType::DiagonalGaussianMixtureModelHMM)
74 if (type == HMMType::DiscreteHMM)
77 else if (type == HMMType::GaussianHMM)
80 else if (type == HMMType::GaussianMixtureModelHMM)
82 else if (type == HMMType::DiagonalGaussianMixtureModelHMM)
89 discreteHMM(other.discreteHMM),
90 gaussianHMM(other.gaussianHMM),
92 diagGMMHMM(other.diagGMMHMM)
94 other.type = HMMType::DiscreteHMM;
96 other.gaussianHMM = NULL;
98 other.diagGMMHMM = NULL;
118 if (type == HMMType::DiscreteHMM)
121 else if (type == HMMType::GaussianHMM)
124 else if (type == HMMType::GaussianMixtureModelHMM)
126 else if (type == HMMType::DiagonalGaussianMixtureModelHMM)
145 template<
typename ActionType,
146 typename ExtraInfoType>
149 if (type == HMMType::DiscreteHMM)
150 ActionType::Apply(*discreteHMM, x);
151 else if (type == HMMType::GaussianHMM)
152 ActionType::Apply(*gaussianHMM, x);
153 else if (type == HMMType::GaussianMixtureModelHMM)
154 ActionType::Apply(*gmmHMM, x);
155 else if (type == HMMType::DiagonalGaussianMixtureModelHMM)
156 ActionType::Apply(*diagGMMHMM, x);
160 template<
typename Archive>
163 ar & BOOST_SERIALIZATION_NVP(type);
166 if (Archive::is_loading::value)
179 if (type == HMMType::DiscreteHMM)
180 ar & BOOST_SERIALIZATION_NVP(discreteHMM);
181 else if (type == HMMType::GaussianHMM)
182 ar & BOOST_SERIALIZATION_NVP(gaussianHMM);
183 else if (type == HMMType::GaussianMixtureModelHMM)
184 ar & BOOST_SERIALIZATION_NVP(gmmHMM);
189 if (type == HMMType::DiagonalGaussianMixtureModelHMM)
190 ar & BOOST_SERIALIZATION_NVP(diagGMMHMM);
A serializable HMM model that also stores the type.
HMM< gmm::GMM > * GMMHMM()
HMMModel(const HMMType type=HMMType::DiscreteHMM)
Construct a model of the given type.
HMM< distribution::GaussianDistribution > * GaussianHMM()
HMMModel(HMMModel &&other)
Take ownership of another model.
void serialize(Archive &ar, const unsigned int version)
Serialize the model.
void PerformAction(ExtraInfoType *x)
Given a functor type, perform that functor with the optional extra info on the HMM.
HMM< distribution::DiscreteDistribution > * DiscreteHMM()
Accessor methods for discreteHMM, gaussianHMM, gmmHMM, and diagGMMHMM.
HMMModel(const HMMModel &other)
Copy another model.
HMM< gmm::DiagonalGMM > * DiagGMMHMM()
HMMModel & operator=(const HMMModel &other)
Copy assignment operator.
A class that represents a Hidden Markov Model with an arbitrary type of emission distribution.
BOOST_CLASS_VERSION(mlpack::hmm::HMMModel, 1)
Set the serialization version of the HMMModel class.
@ DiagonalGaussianMixtureModelHMM
@ GaussianMixtureModelHMM
Linear algebra utility functions, generally performed on matrices or vectors.