Machine Learning Model block

The Machine Learning Model block allows one to deploy a pre-trained Machine Learning (ML) or Artificial Intelligence (AI) model as a block inside a blueprint, to perform time series forecasting of targets. To allow for ML framework interoperability this block supports the Open Neural Network Exchange (ONNX) format for pre-trained models.

Return to Overview of blocks

Description

ML and AI are powerful tools to model time series data due to it being able to handle non-linear data. The Machine Learning Model block adds this capability to blueprints by allowing one to load pre-trained ONNX models.

The ONNX format is an open, and widely supported, model format that is supported by many ML and AI frameworks. The support for the ONNX format enables one to deploy an ML model pre-trained in most popular frameworks, if the model can be converted to the ONNX format.

When executed, the Machine Learning Model block passes the input parameters to an inference engine to evaluate and predict the outputs based on the loaded ONNX model. The elements of the model inputs are mapped from selected field values on the block input port, according to the block configuration. Once a prediction is made, the model outputs are mapped to the block output fields, according to the loaded model.

 

Machine Learning Model block

Block Type

Rules and Models

Input ports

The block has only one input port. The input port can accept any number and any type of fields. The mapping of input fields to the model inputs are configured in the block configuration.

Output port

The block has only one output port. The number of output fields are determined by the loaded model. The output fields will always be of type double.

Functions performed on tags

Value, quality, and timestamp behavior is as follows:

  • On the Values: The input values are sent through the ONNX model and the predicted output value(s) of the model are placed in the output fields.
    Any input value will be converted internally to the input type required by the model input. Refer to the Machine Learning Model block: Advanced Topics for supported model input types.
    Input field values will always be sampled on the input on each block execute, even if the input field value or timestamp did not change.

  • On the Quality: Output field qualities are controlled by the quality configuration of the block. Output field qualities are set to Good if a valid model output is available for the given execution.
    Output fields qualities will be set to Bad in the case where the block is still building up a history window, as needed by the loaded model, before predictions can be made.
    Based on the configuration, the block will either set output quality to Bad if the history window contains Bad Quality data or the block will stop execution.

  • On the Timestamp: Output field timestamps are set to execute time. The output timestamp will always be updated on each block execution, even if the model did not produce a valid prediction.

Runnability

The minimum requirements for runnability on the Machine Learning Model block are:

  • An ONNX Model is loaded.

  • All of the ONNX Model inputs are mapped to block input fields.

Data Input Quality and Rate

The Machine Learning Model block has the following requirements on the block input values:

  • On the Quality: Input values must have God quality if the block is configured to stop execution on Input Quality Bad. The Quality Encoder block can be used to set up quality behavior for specific fields.
    If configured to set Output Quality Bad on Input Quality Bad, the block will produce Bad quality outputs for as long as there are Bad quality values in the History Window of the block.

  • On the Rate: Input values must be supplied at the same sampling rate that the model was trained on. The Resampler block can be used to produce a fixed sampling rate on values that are not sampled at a fixed rate.
    The block will resample the inputs on each execute and if this not desired this should be controlled by the Resampler block.

Return to top


Related topics:

  

CSense 2023- Last updated: June 24,2025