Generic Template for Machine Learning Probabilistic models based on the EM algorithm.
More...
#include <xmmModelSingleClass.hpp>
Generic Template for Machine Learning Probabilistic models based on the EM algorithm.
xmm::SingleClassProbabilisticModel::SingleClassProbabilisticModel |
( |
std::shared_ptr< SharedParameters > |
p = NULL | ) |
|
Constructor.
- Parameters
-
p | pointer to a shared parameters object (owned by a Model) |
Copy Constructor.
- Parameters
-
xmm::SingleClassProbabilisticModel::SingleClassProbabilisticModel |
( |
std::shared_ptr< SharedParameters > |
p, |
|
|
Json::Value const & |
root |
|
) |
| |
|
explicit |
Constructor from Json.
- Parameters
-
p | pointer to a shared parameters object (owned by a Model) |
root | Json structure |
xmm::SingleClassProbabilisticModel::~SingleClassProbabilisticModel |
( |
| ) |
|
|
virtual |
std::string xmm::Writable::__str__ |
( |
| ) |
const |
|
inlineinherited |
"print" method for python => returns the results of write method
- Warning
- only defined if SWIGPYTHON is defined
virtual void xmm::SingleClassProbabilisticModel::allocate |
( |
| ) |
|
|
protectedpure virtual |
void xmm::SingleClassProbabilisticModel::cancelTraining |
( |
| ) |
|
Cancels the training process : sets a flag so that the training stops at the next possible exit in the training process.
- Warning
- the model is still training when this function returns. This function only requests the training process to cancel.
bool xmm::SingleClassProbabilisticModel::cancelTrainingIfRequested |
( |
| ) |
|
|
protected |
checks if a cancel request has been sent and accordingly cancels the training process
- Returns
- true if the training has been canceled.
void xmm::SingleClassProbabilisticModel::check_training |
( |
| ) |
const |
|
inlineprotected |
Checks if the model is still training.
- Exceptions
-
runtime_error | if the model is training. |
bool xmm::SingleClassProbabilisticModel::emAlgorithmHasConverged |
( |
int |
step, |
|
|
double |
log_prob, |
|
|
double |
old_log_prob |
|
) |
| const |
|
protected |
checks if the training has converged according to the object's EM stop criterion
- Parameters
-
step | index of the current step of the EM algorithm |
log_prob | log-likelihood returned by the EM update |
old_log_prob | log-likelihood returned by the EM update at the previous step |
virtual void xmm::SingleClassProbabilisticModel::emAlgorithmInit |
( |
TrainingSet * |
trainingSet | ) |
|
|
protectedpure virtual |
void xmm::SingleClassProbabilisticModel::emAlgorithmTerminate |
( |
| ) |
|
|
protectedvirtual |
virtual double xmm::SingleClassProbabilisticModel::emAlgorithmUpdate |
( |
TrainingSet * |
trainingSet | ) |
|
|
protectedpure virtual |
Update Method of the EM algorithm.
performs E and M steps of the EM algorithm.
- Returns
- likelihood of the training data given the current model parameters (before re-estimation).
Implemented in xmm::SingleClassHMM, and xmm::SingleClassGMM.
virtual double xmm::SingleClassProbabilisticModel::filter |
( |
std::vector< float > const & |
observation | ) |
|
|
pure virtual |
filters a incoming observation (performs recognition or regression)
the results of the inference process are stored in the results attribute
- Parameters
-
observation | observation vector |
- Returns
- likelihood of the observation
Implemented in xmm::SingleClassHMM, and xmm::SingleClassGMM.
virtual void xmm::SingleClassProbabilisticModel::fromJson |
( |
Json::Value const & |
root | ) |
|
|
pure virtual |
bool xmm::SingleClassProbabilisticModel::isTraining |
( |
| ) |
const |
Checks if the model is training.
- Returns
- true if the model is training
void xmm::Writable::readFile |
( |
char * |
fileName | ) |
|
|
inlineinherited |
read method for python wrapping ('read' keyword forbidden, name has to be different)
- Warning
- only defined if SWIGPYTHON is defined
void xmm::SingleClassProbabilisticModel::reset |
( |
| ) |
|
|
virtual |
Json::Value xmm::SingleClassProbabilisticModel::toJson |
( |
| ) |
const |
|
virtual |
void xmm::SingleClassProbabilisticModel::train |
( |
TrainingSet * |
trainingSet | ) |
|
Main training method based on the EM algorithm.
the method performs a loop over the pure virtual method emAlgorithmUpdate() until convergence. The emAlgorithmUpdate method computes both E and M steps of the EM algorithm.
- Parameters
-
trainingSet | Training Set to train the model. |
- See also
- emAlgorithmUpdate
void xmm::Writable::writeFile |
( |
char * |
fileName | ) |
const |
|
inlineinherited |
write method for python wrapping ('write' keyword forbidden, name has to be different)
- Warning
- only defined if SWIGPYTHON is defined
bool xmm::SingleClassProbabilisticModel::cancel_training_ |
|
protected |
defines if the model received a request to cancel training
bool xmm::SingleClassProbabilisticModel::is_training_ |
|
protected |
defines if the model is being trained.
std::string xmm::SingleClassProbabilisticModel::label |
label associated with the given model
CircularBuffer<double> xmm::SingleClassProbabilisticModel::likelihood_buffer_ |
|
protected |
Likelihood buffer used for smoothing.
std::shared_ptr<SharedParameters> xmm::SingleClassProbabilisticModel::shared_parameters |
Pointer to the shared parameters owned by a multi-class model.
Generator for events monitoring the training process.
std::mutex xmm::SingleClassProbabilisticModel::training_mutex_ |
|
protected |
Mutex used in Concurrent Mode.
TrainingEvent xmm::SingleClassProbabilisticModel::training_status |
Event containing information on the current status of the training process.
The documentation for this class was generated from the following files: