Using the ML Partners Plugin with SensiML
Objective
This guide covers the usage of the ML Partners Plugin with our design partner, SensiML. From the ML Partners Plugin, it is possible to save data to a CSV file that is formatted for import in the SensiML's Data Capture Lab (DCL). The DCL is the entry point for a new SensiML project, and it is where project data is labeled in preparation for model development.
Reference Materials
Procedure
This section contains instructions for using the ML Partners Plugin with SensiML. It will cover the process of saving data captured with Data Visualizer to a CSV file for use with SensiML. To learn more about how to use the SensiML Analytics Toolkit to create machine learning solutions, check out our example application "Gesture Recognition with SensiML".
Saving Data for Import into the Data Capture Lab
Saving to CSV
Logging data to a CSV file is the primary flow from the ML Partners Plugin to the SensiML Analytics Toolkit. To do this, press Save to CSV, and then complete the Save Data Snapshot dialog by selecting the desired data sources and then saving. After importing the data into the Data Capture Lab, there is full-featured support for labeling, segmenting, and otherwise preparing data for use in model development.
The file format in the Save Data Snapshot dialog is preset to SensiML CSV when saving in this manner, so there is no need to adjust any settings in this menu.
Once the data is saved to a CSV you are ready to import the data into SensiML's Data Capture Lab. The next section covers the optional step of generating a DCLI file, which allows for the pre-labeling of data before importing it to the Data Capture Lab.
Generating a DCLI File
The ML Partners Plugin also supports the generation of a DCLI file, which is used to label segment data before import into the Data Capture Lab. This is useful when all of the data marked in the time window is of a single event type. When generating the DCLI file, it will be saved with the same name as the CSV file, and it will be saved in the same location. Then the data can be imported to the Data Capture Lab via the DCLI file.
In the cases where all the selected data is of a single event type, the DCLI file can be used to label the data as well as segment it, if that is desired. There is an option to use window segmentation to regularize the size of the data that will be used during model training. The window size should be determined by the signal type as well as the length and nature of the event that is to be detected. If discrete events need to be segmented from the selected data, then this must be done in the Data Capture Lab, so it is advised to disable the window segmentation option if manual segmentation is required.
The Data Capture Lab supports labeling sessions to simplify the process of iterating on different labeling strategies. By default, this value is set to MPLAB DV Session to indicate the source, but feel free to modify this as you see fit.
Figure 3 shows the SensiML menu when a 10s window is selected within the ML Partners Plugin. Since the sensor sampling rate is set at 100 Hz, there are 1000 samples marked within Data Visualizer. With the setting configured as shown, the DCLI file will denote a single segment that spans from index 0 to index 999 of the selected data. Notice that the window offset slider is disabled. This is because the window size is set to the maximum value - meaning that the segmentation window is the same size as the marked window in Data Visualizer, so there is not enough data to implement a sliding window.
When the window size is reduced to at least half of the max value, multiple segments will be sliced from the selected data. The next figure shows an example of slicing 3s segments from the marked data with no overlap since window offset equals window size. This will produce the following three segments: [0,299], [300,599], [600,899].
It is also possible to configure overlap between consecutive windows. The next figure shows an example of slicing 3s segments with 1.5s overlap between consecutive windows. This will produce the following five segments: [0,299], [150,449], [300,599], [450, 749], [600,899].
Overlapping windows can be helpful in increasing the size of the training dataset by slicing a greater number of unique segments from the selected data. The window overlap should be considered with respect to the data and the target application.
Window segmentation can also be done later on in the development process within SensiML's Analytics Studio. During the AutoML-based model selection step, the windowing segmenter can be selected and the window size can be specified.
Importing Data into the SensiML Data Capture Lab
Once you've generated your CSV or DCLI file, visit the "Importing External Sensor Data" guide in the SensiML documentation to learn how to import your data into Data Capture Lab. You may also want to check out the "Gesture Recognition with SensiML" guide for an example of importing a DCLI file.
Results
After saving your data and importing it into the Data Capture Lab, it can be used to build an ML pipeline in either the Analytics Studio or the Python Client. The final Knowledge Pack can be deployed directly within the embedded application as demonstrated in the SensiML Gestures Demo Application.