NanoEdge AI Emulator for extrapolation (E)

1. What is NanoEdge AI Library for extrapolation (regression models)?

NanoEdge™ AI Library is an Artificial Intelligence (AI) static library originally developed by Cartesiam, for embedded C software running on Arm® Cortex® microcontrollers.

When embedded on microcontrollers, it gives them the ability to easily "predict" target values from sensor patterns, by themselves, without the need for the user to have additional skills in Mathematics, Machine Learning, or data science.

The NanoEdge AI static library for extrapolation is the code that contains an AI model (for example, as a bundle of signal treatment, Machine Learning model, and optimally tuned hyperparameters) designed to extrapolate / estimate / predict a target value from a sensor pattern. The predicted values (target values) used to fit the model are defined by the user in NanoEdge AI Studio (NanoEdgeAIStudio), also called the Studio, and are used during the training process of the AI model.

2. Purpose of NanoEdge AI Emulator for extrapolation

With NanoEdge AI Emulator, you can emulate the behavior of your NanoEdge AI Library (from the command line, or the interface provided through NanoEdge AI Studio), and start testing it as if it was running on your embedded application.

The emulator comes with each library created by the Studio. It has been compiled using the same algorithm. This means that for one library, there is one emulator. Using this tool, you can estimate target values as you would do in your embedded application.

3. NanoEdge AI Emulator functions

3.1. Classification (inference)

There are two options to run the extrapolation process: using an input file, or a sequence of values.

3.1.1. Extrapolation by file

Usage:

  • By default all signals in input files are used:
./NanoEdgeAI_Extrapolation_Emulator neai_extrapolation --knowledge_path knowledge.dat --file extrapolation_file.csv         (Linux®)
NanoEdgeAI_Extrapolation_Emulator.exe neai_extrapolation --knowledge_path knowledge.dat --file extrapolation_file.csv       (Windows®)
  • But you can restrict the number of signals used (for instance, here, 10-14):
./NanoEdgeAI_Extrapolation_Emulator neai_extrapolation --knowledge_path knowledge.dat --file extrapolation_file.csv --begin 10 --end 14         (Linux®)
NanoEdgeAI_Extrapolation_Emulator.exe neai_extrapolation --knowledge_path knowledge.dat --file extrapolation_file.csv --begin 10 --end 14       (Windows®)

Arguments:

--knowledge_path:    path to the binary file containing the knowledge
--file:              path to the file containing data to extrapolate
--begin:             number of the first data line in file (>= 1) (or of the first line to use)
--end:               number of the last data line in file (<= number of last line) (or of the last line to use)

Response:

{
	"status": "extrapolation_detection",
	"lib_id": "5d5fd41ec8e0327c934",
	"input": "extrapolation_file.csv",
	"results": [
		{"signal": 1, "line": 10, "predicted_value": 17.631325},
		{"signal": 2, "line": 11, "predicted_value": 18.244184},
		{"signal": 3, "line": 12, "predicted_value": 20.047394},
		{"signal": 4, "line": 13, "predicted_value": 21.446915},
		{"signal": 5, "line": 14, "predicted_value": 18.731506}
	]
}

If an argument is missing, the following error message is returned:

Error: missing or not valid argument in NanoEdge AI extrapolation function call !
Valid NanoEdge AI extrapolation function calls by file are:
	neai_extrapolation --knowledge_path path/knowledgefile --file path/testfile --begin line --end line
	neai_extrapolation --knowledge_path path/knowledgefile --file path/testfile
	neai_extrapolation --knowledge_path path/knowledgefile --array value1 value2 ... valueN (where value1 to valueN are the values of the input buffer)
Refer to NanoEdge AI Extrapolation Emulator documentation for more details.
Warning white.png Warning

Your input file must have valid separators (, or ; or : or a single space or a single tab). If it is not the case, modify your input file. You can easily do so by first importing your file in NanoEdge AI Studio, then selecting the separator that you are currently using, and finally downloading it again by clicking NanoEdgeAI download icon.svg.

Also make sure to use periods (.) for decimal values, and NOT commas (,).

3.1.2. Extrapolation by a sequence of values

Usage:

./NanoEdgeAI_Extrapolation_Emulator neai_extrapolation --knowledge_path knowledge.dat --array value1 value2 ... valueN       (Linux®)
NanoEdgeAI_Extrapolation_Emulator.exe neai_extrapolation --knowledge_path knowledge.dat --array value1 value2 ... valueN     (Windows®)

Arguments:

--array value1 value2 ... valueN       buffer composed of N numerical values, from *value1* to *valueN*

Response:

{
	"status": "extrapolation_detection",
	"lib_id": "5d5fd41ec8e0327c934",
	"input": "extrapolation_file.csv",
	"results": [
		{"signal": 1, "line": "null", "predicted_value": 17.631325}
	]
}

3.1.3. Remarks

  • The two extrapolation modes (by file and by sequence of values) can be combined.
  • The binary file knowledge.dat is provided in the .zip file that you download by clicking Compile in NanoEdge AI Studio (on the "Deploy" screen which follows the "Optimize and Benchmark" and "Emulator" screens).
  • The header results shows the result of the extrapolation process for each signal.

4. Resources

Documentation
All NanoEdge AI Studio documentation is available here.

Tutorials
Step-by-step tutorials to use NanoEdge AI Studio to build a smart device from A to Z.