Skip to main content

Iris Classifier

Iris Classifier

On-Chain KNN Flower Prediction
Proof of conceptAI/ML

About Iris Classifier

The Iris Classifier is a proof-of-concept DApp developed by Locus Software in collaboration with Cartesi. The goal is to bring common Web2 concepts to Web3 using Cartesi Rollups technology. The Iris Classifier employs the KNN (k-nearest neighbors) supervised learning algorithm to predict the species of a flower based on user input.

Technical Details

Initially, the project involved classifying the Iris flower dataset using the KNN algorithm and implementing the classification with Python. The Cartesi API is employed for on-chain prediction and computation.

The classic Iris flower dataset is used, consisting of three classes with 50 instances each. Each class represents a species of the Iris flower. While one class is linearly separable from the other two, the latter two are not linearly separable from each other. The data used in this example can be found here.

During the application's launch, the k-NN classification algorithm is evaluated on the dataset using cross-validation to demonstrate the classifier's expected accuracy.

Once initiated, the DApp receives input samples and predicts their classification. Inputs should include the following Iris flower attributes:

  1. Sepal length in cm
  2. Sepal width in cm
  3. Petal length in cm
  4. Petal width in cm

Each input should be submitted as a JSON string, such as the following example:

"sl": 4.9,
"sw": 3.0,
"pl": 1.4,
"pw": 0.3

Where sl represents the sepal length, sw is the sepal width, pl is the petal length, and pw is the petal width.


The project's frontend demonstrates how to implement a web application UI that interacts with the Iris Classifier DApp, running locally and deployed on remote testnet networks. The UI is mainly implemented in TypeScript and uses the React.js library to build the user interface and the Ethers library to communicate with the rollups smart contracts.

Describe what could be next for your project?

This project is a foundation to creating similar pure python machine learning dapps.

Last updated: Nov 2, 2023
Anyone is free to submit information about their project. Do your own research and use your best judgment when using or interacting with any of the projects listed in this directory. Being listed in this directory is not an endorsement from the Cartesi Foundation or any other related entity.

Explore similar projects

Biometrics classifier
Proof of concept

Biometrics classifier

This DApp uses machine learning, computer vision, and feature extraction to perform a decentralized biometrics spoof detection on-chain. Beyond verifying who’s fingerprints were used, this program checks for spoofing.

Last updated: Oct 20, 2023
Hackathon Project


Decentralised & verifiable chat AI, backed by the blockchain: a port of Alpaca LLM model leveraging the Cartesi app-specific rollups

Last updated: Oct 20, 2023
Teach AI
Hackathon Project

Teach AI

The application helps to curate high-quality datasets by providing a framework to incentivize RLHF, with the LLM being fully verifiable and hosted on-chain.

Last updated: Oct 20, 2023