---
title: "How to use AutoML in Platform with Iris dataset?"
canonical: "https://onesaitplatform.refined.site/space/DOCT/3568599049/How%20to%20use%20AutoML%20in%20Platform%20with%20Iris%20dataset%3F"
format: markdown
---
> Macro (toc)

# Introduction

Lets run through a quick example of using the well known Iris dataset to train a predictor with the AutoML capabilities in Plataform (based on MindsDB).

To follow the guide, you will need an ANALYTICS role.

# Create the entity

First of all, you are going to import the attached CSV which contains the Iris dataset about flowers:

with the Platform’s utility **Dev Tools> Data to Ontology Import Tools:**


![image](media://283ae0eb-c9c4-401e-8afc-f2940fadada6)

Load the file, press **Generate JSON Schema:**

![image](media://62ee2401-87ac-45c5-ba8b-5c3aae15cdff)

Let’s call the Ontology ‘**iris_data**’, indicating that it should be stored in MONGO.

![image](media://6d27157b-55c6-440b-a3c8-8b95ae3c45de)

If all goes well, 150 instances should be imported during the process.

Run the next native query to remove contextData from the instances:  

```
db.iris_data.update({}, {$unset: {contextData: 1}}, {multi: true})
```

![image](media://ebd55f89-49f7-45a3-9f38-58f753d29e86)

# Create the predictor

Next, you have to create the predictor from the entity you have just created.

Go to **Analytics tools>Predictors:**

![image](media://f814e7ae-b5c1-47e4-b2db-486f2bafc510)

Click on **Create **:plus:

Call it **iris_class_predictor**, and select **iris_data **as the entity.

> ℹ️ Bear in mind that the predictor (**iris_class_predictor**) is another Platform Ontology/Entity, so it can be treated as another Entity (can be queried, painted, apified,...).

Then, select all fields as input and only the class field as target (prediction).

![image](media://3fd657c7-a141-4f41-8e2e-bda9594bbf97)

Then click on “**Create**”.

The model will go through the ‘**generating**’ and ‘**training**’ phases:

![image](media://9b93ce4f-b989-44dc-88c2-52590fff26f2)

![image](media://3cce9b66-11ed-4dc9-b00d-84de0d648ee1)

Once they both finish, the model will be available for predictions and you can see its accuracy on the table, as well as the winning algorithm.

![image](media://4bb838e9-7b12-48b6-a6bc-f98e8f10744c)

By clicking on the predictor detail, you will see all the information:

![image](media://7d80fd79-e8a2-4c9c-927d-7c1978991eca)

# Make predictions

Finally, when your model is ready to be used, you can predict the class of the flower by providing the other four attributes. 

This can be done by using SQL-like syntax:

```
SELECT * FROM iris_class_predictor where when_data='{"sepal_length":5.1, "sepal_width":3.5, "petal_length": 1.4, "petal_width":0.2}'
```

![image](media://88316194-cdb6-4f94-887e-5483841009d0)

# APIfication & Prediction

As we have said, the prediction (**iris_class_predictor**) is another Platform Entity and therefore we can also create a REST API from the predictor to make predictions via HTTP.

If you choose to create an API from a predictor, only one operation will be available: **predict.**

![image](media://5b4f57ad-597a-4e56-8ff6-5ad6a77d83ef)

![image](media://a6cdfaee-4c60-4468-bd7c-0282dda25b53)

![image](media://2406e4f1-8d83-4795-99ca-ddf67b2e7d0c)