Probabilistic machine learning model for multiclass recognition and regression. More...
#include <xmmModel.hpp>
Public Member Functions | |
| Model (bool bimodal=false) | |
| Constructor. More... | |
| Model (Model< SingleClassModel, ModelType > const &src) | |
| Copy Constructor. More... | |
| Model (Json::Value const &root) | |
| Constructor from Json Structure. More... | |
| Model< SingleClassModel, ModelType > & | operator= (Model< SingleClassModel, ModelType > const &src) |
| Assignment. More... | |
| virtual | ~Model () |
| Destructor. More... | |
Class Manipulation | |
| unsigned int | size () const |
| Get the number of classes in the model. More... | |
| bool | hasClass (std::string const &label) const |
| Checks if a class exists. More... | |
| int | getIndex (std::string const &label) const |
| Checks if a class exists. More... | |
| virtual void | removeClass (std::string const &label) |
| Remove a specific class by label. More... | |
| virtual void | clear () |
| Remove all classes. More... | |
Training | |
| bool | trained () const |
| Checks if the model is trained (training finished and not empty) More... | |
| bool | training () const |
| Checks if the model is still training. More... | |
| virtual void | train (TrainingSet *trainingSet) |
| Train all classes from the training set passed in argument. More... | |
| virtual void | train (TrainingSet *trainingSet, std::string const &label) |
| Train a specific class from the training set passed in argument. More... | |
| void | cancelTraining () |
| Cancels the training of all models. More... | |
| void | cancelTraining (std::string const &label) |
| Cancels the training of a given class. More... | |
Performance | |
| virtual void | reset () |
| Resets the fitering process (recognition or regression) More... | |
| virtual void | filter (std::vector< float > const &observation) |
| filters a incoming observation (performs recognition or regression) More... | |
Json I/O | |
| virtual Json::Value | toJson () const |
| Write the object to a JSON Structure. More... | |
| void | fromJson (Json::Value const &root) |
| Read the object from a JSON Structure. More... | |
Python File I/O | |
| void | writeFile (char *fileName) const |
| write method for python wrapping ('write' keyword forbidden, name has to be different) More... | |
| void | readFile (char *fileName) |
| read method for python wrapping ('read' keyword forbidden, name has to be different) More... | |
| std::string | __str__ () const |
| "print" method for python => returns the results of write method More... | |
Public Attributes | |
| std::shared_ptr< SharedParameters > | shared_parameters |
| Set of Parameters shared among classes. More... | |
| Configuration< ModelType > | configuration |
| Configuration (default and class-specific parameters) More... | |
| EventGenerator< TrainingEvent > | training_events |
| Generator for training process events. More... | |
| std::map< std::string, SingleClassModel > | models |
| models stored in a map. Each Model is associated with a label More... | |
Protected Member Functions | |
| virtual void | joinTraining () |
| Finishes the background training process by joining threads and deleting the models which training failed. More... | |
| void | onTrainingEvent (TrainingEvent const &e) |
| Monitors the training of each Model of the group. More... | |
| void | checkTraining () const |
| Checks if the Model is still training. More... | |
| void | checkConfigurationChanges () const |
| Look for configuration changes and throws an exception if the model is not up to date. More... | |
| virtual void | addModelForClass (std::string const &label) |
| Update training set for a specific label. More... | |
Protected Attributes | |
| std::map< std::string, std::thread > | training_threads_ |
| Training Threads. More... | |
| std::atomic< bool > | cancel_required_ |
| locks the Model while the models are training Used in cancel method More... | |
| std::atomic< bool > | is_training_ |
| locks the Model while the models are training Used in cancel method More... | |
| std::atomic< bool > | is_joining_ |
| specifies if a thread for joining the training process has been launched. More... | |
| unsigned int | models_still_training_ |
| Number of models that are still training. More... | |
| std::mutex | event_mutex_ |
| Mutex that prevents concurrent calls to onEvent() More... | |
Probabilistic machine learning model for multiclass recognition and regression.
| SingleClassModel | Type of the associated Single-class Model |
| ModelType | Model Type Name |
|
inline |
Constructor.
| bimodal | use true for a use with Regression / Generation. |
|
inline |
Copy Constructor.
| src | Source Model |
|
inlineexplicit |
Constructor from Json Structure.
| root | Json Value |
|
inlinevirtual |
Destructor.
|
inlineinherited |
"print" method for python => returns the results of write method
|
inlineprotectedvirtual |
Update training set for a specific label.
| label | label of the sub-training set to update |
| out_of_range | if the label does not exist |
Reimplemented in xmm::HierarchicalHMM.
|
inline |
Cancels the training of all models.
|
inline |
Cancels the training of a given class.
| label | label of the class to cancel |
|
inlineprotected |
Look for configuration changes and throws an exception if the model is not up to date.
|
inlineprotected |
Checks if the Model is still training.
| runtime_error | if the Model is training. |
|
inlinevirtual |
Remove all classes.
Reimplemented in xmm::HierarchicalHMM.
|
inlinevirtual |
filters a incoming observation (performs recognition or regression)
the results of the inference process are stored in the results attribute
| observation | observation vector |
Reimplemented in xmm::HierarchicalHMM, and xmm::GMM.
|
inlinevirtual |
Read the object from a JSON Structure.
| root | JSON value containing the object's information |
| JsonException | if the JSON value has a wrong format |
Implements xmm::Writable.
|
inline |
Checks if a class exists.
| label | class label |
|
inline |
Checks if a class exists.
| label | class label |
|
inlineprotectedvirtual |
Finishes the background training process by joining threads and deleting the models which training failed.
Reimplemented in xmm::HierarchicalHMM.
|
inlineprotected |
Monitors the training of each Model of the group.
|
inline |
Assignment.
| src | Source Model |
|
inlineinherited |
read method for python wrapping ('read' keyword forbidden, name has to be different)
|
inlinevirtual |
Remove a specific class by label.
| label | label of the class to remove |
Reimplemented in xmm::HierarchicalHMM.
|
inlinevirtual |
Resets the fitering process (recognition or regression)
Reimplemented in xmm::HierarchicalHMM, and xmm::GMM.
|
inline |
Get the number of classes in the model.
|
inlinevirtual |
Write the object to a JSON Structure.
Implements xmm::Writable.
Reimplemented in xmm::HierarchicalHMM.
|
inlinevirtual |
Train all classes from the training set passed in argument.
| trainingSet | Training Set |
|
inlinevirtual |
Train a specific class from the training set passed in argument.
| trainingSet | Training Set |
| label | label of the class to train |
| out_of_range | if the label does not exist |
| runtime_error | if the dimensions of the training set don't match the dimensions of the current model |
|
inline |
Checks if the model is trained (training finished and not empty)
|
inline |
Checks if the model is still training.
|
inlineinherited |
write method for python wrapping ('write' keyword forbidden, name has to be different)
|
protected |
locks the Model while the models are training Used in cancel method
| Configuration<ModelType> xmm::Model< SingleClassModel, ModelType >::configuration |
Configuration (default and class-specific parameters)
|
protected |
Mutex that prevents concurrent calls to onEvent()
|
protected |
specifies if a thread for joining the training process has been launched.
|
protected |
locks the Model while the models are training Used in cancel method
| std::map<std::string, SingleClassModel> xmm::Model< SingleClassModel, ModelType >::models |
models stored in a map. Each Model is associated with a label
|
protected |
Number of models that are still training.
| std::shared_ptr<SharedParameters> xmm::Model< SingleClassModel, ModelType >::shared_parameters |
Set of Parameters shared among classes.
| EventGenerator<TrainingEvent> xmm::Model< SingleClassModel, ModelType >::training_events |
Generator for training process events.
|
protected |
Training Threads.