◷ 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.
The data model was trained using a dataset similar to the following.
The flow has only two steps.
- Input data
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.
Steps to build the project
- Create a new FlexRule project.
2. Rename the PMML file extension to XML
3. Import the PMML file from the following:
Document --> PMML
Once the file is imported, the Fact Concept file will be created. You can provide a custom name for the Fact.
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.
- 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.
- 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 (PredictFlower.zip) at the end of the page.