Skip to content

Latest commit

ย 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒธ Iris Flower Classification

My first Machine Learning project โ€” built to understand the end-to-end ML workflow from raw data to model evaluation.

๐ŸŽฏ Objective

Classify Iris flowers into three species โ€” Setosa, Versicolor, or Virginica โ€” based on sepal and petal measurements, using supervised learning.

๐Ÿ› ๏ธ Tech Stack

Python โ€” Jupyter Notebook

Pandas โ€” data loading and manipulation

Matplotlib โ€” visualizations

Scikit-learn โ€” preprocessing, models, evaluation

๐Ÿ“Š Dataset

The classic Iris dataset (built into Scikit-learn): 150 samples, 3 classes, 4 features. Features include Sepal Length (cm), Sepal Width (cm), Petal Length (cm), and Petal Width (cm).

EDA finding: Petal measurements create far cleaner clusters than sepal measurements. Setosa is almost perfectly separable; Versicolor and Virginica overlap slightly.

๐Ÿง  Models

K-Nearest Neighbors (K=3) achieved 100% accuracy. Logistic Regression achieved 100% accuracy.

Both models achieved 100% on the 30-sample test set. This is expected โ€” the Iris dataset is small, clean, and has very distinct class boundaries. Real-world datasets rarely behave this cleanly.

๐Ÿ”ฌ K-Value Experiment

Tested KNN across every K from 1 to 20 to observe how accuracy changes.

Result: Accuracy held at 100% across all K values.

Why? The dataset's class boundaries are so linearly separable that even a K=20 majority vote never misclassifies. A flat curve here isn't boring โ€” it's informative about the nature of the data.

๐Ÿ“ Key Concepts I Learned

Train/Test Split โ€” Never evaluate on training data. I used 80/20 split with random_state=42 for reproducibility.

StandardScaler โ€” KNN is distance-based, so feature scaling matters. Critical distinction: fit_transform on training data only; transform (no re-fit) on test data. Re-fitting on test data causes data leakage.

Confusion Matrix โ€” Accuracy alone can mislead. The matrix confirmed no off-diagonal errors โ€” the model wasn't accidentally correct.

Model Comparison โ€” Running two algorithms side by side showed that for linearly separable data, a simple Logistic Regression matches a more complex KNN. Model choice matters more on harder problems.

๐Ÿš€ Run It Yourself

git clone https://github.com/Ira9181/iris-classification.git cd iris-classification pip install numpy pandas matplotlib scikit-learn jupyter jupyter notebook

Open iris.ipynb and run all cells.

๐Ÿ“ Structure

The iris-classification folder contains iris.ipynb (Full notebook โ€” EDA, models, K-value experiment) and README.md.

๐Ÿ”ฎ What's Next

This project established the pipeline. Next goals: Work with a messier, real-world dataset, explore cross-validation for more robust evaluation, try decision trees and random forests, and start working with unstructured data (text/images).

About

Built as a foundational project for learning Machine Learning workflows.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages