cancel
Showing results for 
Search instead for 
Did you mean: 

Discover MLC expert mode in ST AIoT Craft

Denise SANFILIPPO
ST Employee

Introduction

In this article, we explore one of the new features of ST AIoT Craft v1.1: machine learning core (MLC) expert mode. It offers advanced customization of the decision tree classifier in the MEMS sensor, and improved algorithm accuracy.

1. Overview of the MLC expert mode

MLC expert mode enables you to set all parameters of the machine learning core engine, namely: 

  • Filters and features:
    Filters in the MLC are used to process input data from the sensor to remove noise or to focus on specific aspects of the data. 
    Features are statistical parameters calculated from the sensor data within a specified time window. These features help in identifying patterns and making decisions, for example in activity recognition in sports. 
  • Output data rate (ODR) and window length:
    MLC ODR is the rate at which the machine learning core processes and outputs data. MLC ODR must be lower than or equal to the acquisition ODR.
    Window length refers to the number of samples over which features are calculated.

2. Automatic parameter extractor

With MLC expert mode, you can fully leverage on the automatic parameter extractor. You can automatically generate window length and the most suitable filters and features for the dataset used in that model.

2.1 Filters

It is possible to choose between two filtered search modes: basic and exhaustive.

Basic search is faster but may be inaccurate on flat signals without significant peaks. Exhaustive search is a more computationally expensive method but identifies one filter on norm (V) for each class.

2.2 Features

You can select one among the following five extraction methods:

  • Analysis of Variance (ANOVA): compares means to find the degree of linear dependency among data variables
  • Ada Boost (ADA): trains one decision tree on the dataset and then fits decision tree copies with weights applied to false predictions
  • Random Forest (RF): combines the results of multiple decision trees built from various subsets of a dataset to improve accuracy and avoid overfitting
  • Recursive Feature Elimination (RFE): repeatedly removes the least important feature from the initial set until the desired number of features is reached, thereby identifying the best set
  • Sequential Feature Selection (SFS): adds or removes features one at a time to find which features are most relevant and improve the model the most

If you are not familiar with extraction methods, you can choose one of the predefined presets:

  • Best (RFE+SFS): provides features with the highest accuracy but generating them can take a long time
  • Fastest (ANOVA+ADA+RF): reduces generation time, but accuracy may be lower
  • Default (ANOVA+ADA+RF+RFE): a compromise between the other two presets

The set of features is generated up to the maximum number of features which you can configure.

A standard set is built from six features; mean, energy, variance, peak to peak, minimum, maximum.

You can extend it by including the following features with threshold: zero-crossing, positive zero-crossing, negative zero-crossing, peak detector, positive peak detector, and negative peak detector. 

For selected sensors, it is possible to include recursive features. Recursive features have an infinite window (infinite impulse response) and provide a valid value for every MLC ODR. They allow better detection of short events and simplify the coexistence of different algorithms.

The recursive features are divided into two groups:

  • mean, rms, variance
  • max, min, peak to peak

Selecting any additional features might add significant generation time depending on the size of the dataset.

3. Manual parameters setting

Apart from using the automatic parameters extractor, you can also set window length, filters, and features manually.

Figure 1. Add new filters and features manually by clicking on the blue buttonsFigure 1. Add new filters and features manually by clicking on the blue buttons

All parameters must be selected carefully so that the requirement of minimum number of samples in each file is satisfied.
Files within the dataset were acquired with certain output data rate (ODR). If it was acquired with a rate higher than MLC ODR, the data is sampled down to the value of MLC ODR. There must be enough samples in each file to have at least one window of data.

The number of samples in one window is calculated according to the equation below:

Samples = max(Oa, Og) / Om * wl

  • Oa stands for accelerometer ODR.
  • Og stands for gyroscope ODR (if gyroscope data are used for model training)
  • Om stands for MLC ODR
  • wl stands for window length

3.1 Filters

Figure 2. Filters can be added with Add new filter button and deleted with Remove button for respective filterFigure 2. Filters can be added with Add new filter button and deleted with Remove button for respective filter

There are four types of filters:

  • HP (High-Pass): to remove low-frequency components, allow high-frequency signals to pass;
  • BP (Band-Pass): to allow signals within a certain frequency range to pass through;
  • IIR1 (first order infinite impulse response): a type of digital filter used for various filtering tasks with a single stage;
  • IIR2 (second order infinite impulse response): a type of digital filter used for various filtering tasks with two stages, more complex filtering capabilities than IIR.

Each filter must have one of the following inputs: Acc_XYZ, Acc_V, Acc_V2 and Gyr_XYZ, Gyr_V, Gyr_V2 that are only available when gyroscope is selected as the input data source.

Filters with inputs ending with "_XYZ" are calculated from individual axes, with inputs ending with "_V" being calculated from norm and with inputs ending with "_V2" calculated from norm squared.

3.2 Features

Figure 3. Features can be added with Add new feature button and deleted with Remove button for respective featureFigure 3. Features can be added with Add new feature button and deleted with Remove button for respective feature

There are 12 types of basic features: mean, variance, energy, peak to peak, zero-crossing, positive zero-crossing, negative zero-crossing, peak detector, positive peak detector, negative peak detector, minimum, maximum.

Features can be computed either from raw sensor input data.
In that case, each feature must have one of the following inputs: Acc_X, Acc_Y, Acc_Z, Acc_V, Acc_V2 and Gyr_X, Gyr_Y, Gyr_Z, Gyr_V, Gyr_V2, which are only available when gyroscope is selected as input data source.
Additionally, features can be computed from filtered data. In that case, there are also possible following inputs:

  • Acc_{axis}_filter_{filterIdx}
  • Gyr_{axis}_filter_{filterIdx}

For example, input Acc_X_filter_3 means that there is an applied filter with index 3 on X axis of accelerometer. Filter 3 must be declared with Acc_XYZ input.

4. From auto mode to expert mode

When activating the expert mode, parameters are loaded. If the auto mode is executed as well, its results are also loaded. You can either modify the parameters together with the auto mode results or define a new MLC configuration from scratch.

When switching back from expert mode to auto mode, parameters are automatically set. Therefore, the previously set MLC configuration might be rewritten.

Conclusion

In this article you have discovered one of the new features implemented inside ST AIoT Craft v1.1: MLC expert mode for advanced decision tree customization in MEMS sensors. It is based on the setting of MLC filters and features.

Additional resources

Version history
Last update:
‎2025-05-08 6:34 AM
Updated by: