1. Home
  2. Sample Projects
  3. Predicting Flower Type

Predicting Flower Type

◷ Reading Time: 5 minutes

The example is about predicting the flower type with a custom-made algorithm using the PMML capability in FlexRule.

We have created a PMML file of a trained model using Python. Connect that to make predictions. These predictions can be used as a part of a DRD to make decisions.

You can use Python, R or any other language to create the PMML file of your model.

The data model was trained using a dataset similar to the following.

PMML File

The flow has only two steps.

  • Input data
  • Predict

Run the project

1. Once you open DRD.xml, click on Debug with JSON Composer to start running the project

2. Enter values to predict.

3. Click on the Stop Debugging button or keep pressing Next Step to complete running.

4. You will be able to see the final prediction in the Parameters window. You will also be able to see the probabilities of each possible option.

Video Tutorial

Steps to build the project

  1. Create a new FlexRule project.

2. Rename the PMML file extension to XML

3. Import the PMML file from the following:

Machine Learning --> PMML

Once the file is imported, the Fact Concept file will be created. You can provide a custom name for the Fact.

Automatically created Fact Concept file

You can create a new folder and drag and drop the two files to organise the models.

In Project Explorer, you can see both the PMML file and its Fact Concept file.

4. Create a DRD file.

5. Add an Input Node and edit its properties.

Properties

  • Name: Name of the input object
  • Assembly: Fact Concept file (Select from the drop-down menu)
  • Type: Fact name (Select from the window)

6. Add an output variable to copy the final prediction result.

7. Add a Decision node and edit its properties.

Properties

  • Copy Value To: Name of the variable we created in the previous step to copy the final prediction result
  • Uri: Path to the imported PMML file
  • Parameters: Add the input parameter

8. Connect the two nodes.

Download Sample Project

The sample project can be downloaded using the attachment at the end of the page.

Updated on April 28, 2021

Article Attachments

Was this article helpful?

Related Articles