Skip to content

Latest commit

 

History

History
55 lines (31 loc) · 4.19 KB

File metadata and controls

55 lines (31 loc) · 4.19 KB
title url category weight tags
Logistic Regression Example
/refguide/machine-learning-kit/using-ml-kit/logistic-regression/
Using ML Kit
20
studio pro
machine learning
ml kit
models
integration
example
logistic regression

1 Introduction

This document walks through the steps an example of a logistic regression model, its netron.app schema and the component display, along with the ML Mapping. Usage section of Using ML Kit lists the steps you need to get started with integrating machine learning models into Studio Pro.

{{% alert color="info" %}}Access the ONNX file, Jupyter notebook, and the Java files for the logistic regressor example in the Mendix ML Kit Demo Repository.{{% /alert %}}

2 Importing and Configuring the Model

The image below is the netron.app schema of a logistic regression model:

{{< figure src="/attachments/refguide/modeling/integration/ml-kit/ml-kit/logistic-regression/ml-model-created-entities.png" alt="Example of the logistic regression netron.app schema." class="no-border" >}}

To integrate this in a Mendix app with the Mendix Machine Learning Kit, do the following:

  1. Import the ONNX file into Studio Pro by going to Add other > ML model mapping.

  2. This creates a model mapping, as displayed in this image:

    {{< figure src="/attachments/refguide/modeling/integration/ml-kit/ml-kit/logistic-regression/output-type.png" alt="Example of a logistic regression." class="no-border" >}}

  3. Resolve any errors by configuring dynamic tensor shapes.

3 Using the Model

Once you have imported the model, you can start working with it by calling it in microflows.

  1. Use the Call ML model activity to call it in a microflow:

    {{< figure src="/attachments/refguide/modeling/integration/ml-kit/ml-kit/logistic-regression/call-ml-mapping.png" class="no-border" >}}

  2. Create pre-processed inputs with Create object activity for inference inside your Mendix app. This activity is used for the first part in order to transfer entities from the domain model to the ML model input object:

    {{< figure src="/attachments/refguide/modeling/integration/ml-kit/ml-kit/logistic-regression/create-object.png" alt="Details of the log message in a microflow example." class="no-border" >}}

  3. You can then consume the inference output with microflow expressions, using a Create variable activity:

    {{< figure src="/attachments/refguide/modeling/integration/ml-kit/ml-kit/logistic-regression/create-variable.png" alt="Details of the log message in a microflow example." class="no-border" >}}

The complete microflow for making the inference is below:

{{< figure src="/attachments/refguide/modeling/integration/ml-kit/ml-kit/logistic-regression/make-inference-microflow.png" class="no-border" >}}

The complete microflow to predict the IRIS flower classification using logistic regression is below:

{{< figure src="/attachments/refguide/modeling/integration/ml-kit/ml-kit/logistic-regression/predict-iris-class-microflow.png" class="no-border" >}}

{{% alert color="info" %}}Access the ONNX file, Jupyter notebook, and the Java files for the logistic regressor example in the Mendix ML Kit Demo Repository.{{% /alert %}}