Skip to content

Training and running

lamipaul edited this page Jul 25, 2018 · 8 revisions

Train a model

Evaluating the xmm-model object in your patch will train a HHMM model with the data and parameters set at the inputs. Training can take a while if there is a big amount of data or if the number of hidden states is high.

See in the console when the model is done training.

Example patch of training a model from a wav file

Run a model

Once your model is trained, you can use it to classify new unlabelled data, using the run-model function. Block the xmm-model box to avoid retraining at each prediction.

The HHMM takes account of the past states and results to classify observations. Set the reset option to 0 if you want to keep the past states of your model, or 1 (default) to reset the model to original state.

Inputs

Plug the trained xmm-model object's self output into the model input of the run-model function. The data input expects the same format as in the samples for training (dataset input), without the label (only the list of descriptors). The number of descriptors (first dimension of the matrix) must be the same as in the training data.

Output

When you evaluate the run-model function, it outputs the label (as a string) corresponding to the likeliest class for the data in input.

Export / Import JSON files

If you'd like to share or reuse a trained model you are satisfied with, you can export it to a JSON file, using the export-json function.

This function takes a trained model and a path as inputs.

You can then import your model to any other patch using the import-json function, specifying a path and pluging in an empty xmm-model. See the imported labels in the mini-view.

Keep in mind that your data to be classified must have the same dimensions as the training data!