A machine learning project that predicts the species of Iris flowers using Logistic Regression. This project uses the classic Iris dataset to classify flowers into three species: Setosa, Versicolor, and Virginica.
This project demonstrates the implementation of a Logistic Regression classifier to predict Iris flower species based on four features:
- Sepal Length
- Sepal Width
- Petal Length
- Petal Width
The model achieves perfect accuracy in classifying the three Iris species, making it an excellent introductory project for machine learning beginners.
Developed using Google Colab - No local setup required! You can run this project directly in your browser.
The project uses the famous Iris Dataset from the UCI Machine Learning Repository.
Dataset Characteristics:
Total Samples: 150 Features: 4 (all numeric) Classes: 3 (Setosa, Versicolor, Virginica) Samples per Class: 50
Features:
- Sepal Length (cm)
- Sepal Width (cm)
- Petal Length (cm)
- Petal Width (cm)
- Google Colab (Recommended - Cloud-based Jupyter notebook environment)
- Python 3.x
- NumPy (Numerical computations)
- Pandas (Data manipulation and analysis)
- Matplotlib (Data visualization)
- Seaborn (Statistical visualizations)
- scikit-learn (Machine learning implementation)
No installation needed! Simply click the badge below to open the notebook directly in Google Colab:
All required libraries are pre-installed in Google Colab. This is the easiest and recommended way to run this project!
- Click the "Open in Colab" badge above
- Sign in with your Google account
- Click Runtime → Run all to execute all cells
- The notebook will:
- Load and explore the dataset
- Visualize the data
- Train the Logistic Regression model
- Evaluate model performance
- Make predictions
The Logistic Regression model demonstrates perfect performance on the Iris dataset:
Accuracy: 100% Precision: 1.00 across all three classes Recall: 1.00 across all three classes F1-Score: 1.00 (perfect balance)
precision recall f1-score support
Iris-setosa 1.00 1.00 1.00 7
Iris-versicolor 1.00 1.00 1.00 12
Iris-virginica 1.00 1.00 1.00 11
accuracy 1.00 30
macro avg 1.00 1.00 1.00 30
weighted avg 1.00 1.00 1.00 30
1. Feature Importance:
- Petal length and petal width are the most discriminative features
- Sepal measurements provide additional classification support
2. Class Separability:
- Iris Setosa is linearly separable from other species
- Versicolor and Virginica are well-distinguished by the model
3. Model Performance:
- Perfect 100% accuracy on test data
- No misclassifications
- Model generalizes excellently to unseen data
- Suitable for real-world classification tasks
- UCI Machine Learning Repository for the Iris dataset
- Ronald A. Fisher for creating the original dataset
- scikit-learn community for excellent documentation
- Google Colab for providing free cloud computing resources