This project is part of the CodeAlpha Data Science Internship (Task 1).
The objective is to classify iris flowers into three species (Setosa, Versicolor, Virginica) using their sepal and petal measurements,
and deploy the trained model as an interactive Streamlit web app.
- Project Structure
- Setup & Installation
- Project Workflow
- Exploratory Data Analysis (EDA)
- Preprocessing
- Model Training & Evaluation
- Model Saving
- Streamlit Integration
- Project Summary
- Tech Stack
- App Preview
TASK_1_Iris_Flower_Classification/ │── .venv/ # Virtual environment │── archive/ # archive folder (Iris.csv from Kaggle) │── models/ # (Will be used to save trained models) │── results/ # (Will be used to save results & plots) │── Iris_Flower.ipynb # Main Jupyter Notebook │── requirements.txt # Project dependencies │── README.md # Project documentation
-
Clone / Download Repository
git clone <repo-link> cd TASK_1_Iris_Flower_Classification
-
Download Dataset
- Download the Iris.csv dataset from Kaggle.
- Place it inside the
archive/folder of this project.
-
Create Virtual Environment
python -m venv .venv
-
Windows (PowerShell)
-
.venv\Scripts\activate
-
Linux/Mac
-
source .venv/bin/activate
- pip install -r requirements.txt
- jupyter notebook
- Environment Setup ✅
- Created
.venv(virtual environment). - Installed required libraries from
requirements.txt. - Added custom Jupyter kernel for this project.
- Data Loading ✅
- Loaded dataset from Kaggle (
Iris.csv). - Verified 150 rows × 6 columns with no missing values.
- Exploratory Data Analysis (EDA) ✅
- Dataset Overview (info, describe).
- Checked for missing/null values → none found.
- Species distribution → Balanced (50 samples each).
- Pairplot → Setosa is clearly separable, Versicolor & Virginica overlap.
- Correlation Heatmap → Petal Length & Petal Width strongly correlated (~0.96).
- Conclusion: Petal features are the most informative.
- Preprocessing ✅
- Dropped
Idcolumn. - Encoded
Specieslabels into numeric (0 = Setosa, 1 = Versicolor, 2 = Virginica). - Split dataset into 80% Training / 20% Testing.
- Standardized features using
StandardScaler.
- Model Training & Evaluation ✅
- Trained Logistic Regression, Decision Tree, Random Forest.
- Evaluated with Accuracy, Confusion Matrix, Classification Report.
- Results:
- Logistic Regression → 93.3% accuracy (best).
- Decision Tree → 90% accuracy.
- Random Forest → 90% accuracy.
- All models classified Setosa perfectly. Minor misclassifications between Versicolor & Virginica.
- Model Saving ✅
- Saved trained models (.pkl) inside /models/.
- Saved StandardScaler for preprocessing.
- Ensures reusability for deployment without retraining.
- Streamlit Integration ✅
- Created app.py with Streamlit.
- Loaded Logistic Regression model + Scaler.
- On prediction → displayed species (Setosa / Versicolor / Virginica).
- Final app runs with:
- streamlit run app.py
- This project built a complete ML pipeline for Iris Flower Classification:
- Data → Preprocessing → Model Training → Evaluation → Model Saving → Streamlit Deployment
- Achieved 93% accuracy with Logistic Regression.
- Delivered an interactive web app for real-time flower classification.
- ✅ With this, Task 1 is fully completed and deployment-ready 🚀
- Language: Python
- Libraries: pandas, numpy, matplotlib, seaborn, scikit-learn
- Environment: VS Code, Jupyter Notebook
- Version Control: GitHub
⚡ Umer, ab ye README.md GitHub pe bilkul professional lagega → jaise ek real-world project ka documentation hota hai ✅
Chaho to mai tumhe ek checklist for GitHub upload bhi bana dun?



