https://github.com/njorogepaul-moghul/iris-flower-classification
This project predicts the species of an Iris flower (Setosa, Versicolor, Virginica) based on its sepal and petal measurements. We trained and evaluated multiple ML models β with Logistic Regression performing best at 93% accuracy. Finally, we deployed on streamlit:[app] (https://irisflowerapp-ripwlmfmctrzqphjapj97t.streamlit.app/)
https://github.com/njorogepaul-moghul/iris-flower-classification
iris-classification jupyter-notebook logistic-regression machine-learning python random-forest-classifier scikit-learn
Last synced: about 2 months ago
JSON representation
This project predicts the species of an Iris flower (Setosa, Versicolor, Virginica) based on its sepal and petal measurements. We trained and evaluated multiple ML models β with Logistic Regression performing best at 93% accuracy. Finally, we deployed on streamlit:[app] (https://irisflowerapp-ripwlmfmctrzqphjapj97t.streamlit.app/)
- Host: GitHub
- URL: https://github.com/njorogepaul-moghul/iris-flower-classification
- Owner: njorogepaul-moghul
- Created: 2025-09-30T12:12:16.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-30T13:23:50.000Z (9 months ago)
- Last Synced: 2025-09-30T14:46:29.563Z (9 months ago)
- Topics: iris-classification, jupyter-notebook, logistic-regression, machine-learning, python, random-forest-classifier, scikit-learn
- Language: Jupyter Notebook
- Homepage: https://github.com/njorogepaul-moghul/Titanic-survival-prediction.git
- Size: 462 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README..md
Awesome Lists containing this project
README
# πΈ Iris Flower Classification Project
## π Project Overview
This project aims to classify **Iris flower species** (*Setosa, Versicolor, Virginica*) based on their sepal and petal measurements.
We explored the dataset, engineered new features, trained multiple models, evaluated performance, and finally prepared the models for deployment.
## π Dataset
- **Source:** Iris dataset (Fisherβs dataset)
- **Features:**
- SepalLengthCm
- SepalWidthCm
- PetalLengthCm
- PetalWidthCm
- **Target:** Species (Setosa, Versicolor, Virginica)
## π¬ Feature Engineering
We created additional features to improve predictive power:
- `Petal ratio = PetalLengthCm / PetalWidthCm`
- `Sepal ratio = SepalLengthCm / SepalWidthCm`
- `Petal area = PetalLengthCm * PetalWidthCm`
- `Sepal area = SepalLengthCm * SepalWidthCm`
- `Petal_Sepal_length_Aspect ratio = PetalLengthCm / SepalLengthCm`
- `Compactness = (SepalWidthCm + PetalWidthCm) / (SepalLengthCm + PetalLengthCm)`
## βοΈ Models Trained
We trained and tested the following models:
1. Logistic Regression
2. Decision Tree
3. Random Forest
4. Support Vector Machine (SVM)
5. Gradient Boosting Classifier
## π Model Performance
| Model | Accuracy | Precision | Recall | F1-score |
|-----------------------|----------|-----------|--------|----------|
| Logistic Regression | 0.93 | 0.93 | 0.93 | 0.93 |
| Decision Tree | 0.88 | 0.88 | 0.88 | 0.88 |
| Random Forest | 0.91 | 0.91 | 0.91 | 0.91 |
| Support Vector Machine| 0.91 | 0.91 | 0.91 | 0.91 |
| Gradient Boosting | 0.88 | 0.88 | 0.88 | 0.88 |
β
**Logistic Regression performed best with 93% accuracy**.
## π Insights
- Strong positive correlations were found between:
- `PetalLengthCm` and `PetalWidthCm`
- `PetalLengthCm` and `SepalLengthCm`
- `PetalWidthCm` and `SepalLengthCm`
- Feature ranges:
- Sepal Length: 4.0 β 8.0 cm
- Sepal Width: 2.0 β 4.5 cm
- Petal Length: 1.0 β 7.0 cm
- Petal Width: 0.1 β 2.5 cm
## β
Conclusion
- We successfully trained ML models to predict Iris flower species.
- Logistic Regression was the best performer.
- Our models are now ready for **deployment**.
## π Next Steps
- Deploy the best models (Logistic Regression, Random Forest, SVM) in a **Streamlit web app**.
- Provide a user-friendly interface where users can input sepal & petal dimensions to predict species.
- [** click here to launch Iris flower app**](https://irisflowerapp-ripwlmfmctrzqphjapj97t.streamlit.app/)