metadata
language: en
license: mit
tags:
- sklearn
- iris
- classification
- random-forest
🌸 Iris Flower Classifier
A simple Random Forest classifier trained on the classic Iris dataset.
Model Details
| Property | Value |
|---|---|
| Algorithm | Random Forest |
| n_estimators | 100 |
| Test Accuracy | 0.9000 |
| Train samples | 120 |
| Test samples | 30 |
Classes
The model predicts one of three Iris species:
setosaversicolorvirginica
Usage
import pickle, numpy as np
with open("model.pkl", "rb") as f: model = pickle.load(f)
with open("scaler.pkl", "rb") as f: scaler = pickle.load(f)
# sepal length, sepal width, petal length, petal width (all in cm)
X = np.array([[5.1, 3.5, 1.4, 0.2]])
X_scaled = scaler.transform(X)
prediction = model.predict(X_scaled)
print(prediction) # e.g. [0] → setosa
Per-class Metrics
| Class | Precision | Recall | F1-score |
|---|---|---|---|
| setosa | 1.0000 | 1.0000 | 1.0000 |
| versicolor | 0.8182 | 0.9000 | 0.8571 |
| virginica | 0.8889 | 0.8000 | 0.8421 |