Skip to content

Tosa-omokhoa/CodeAlpha_IrisClassification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Iris Flower Classification

CodeAlpha Data Science Internship — Task 1

Intern: Omokhoa Oshose Tosayoname
Intern ID: CA/DF1/71570
Duration: 20th May 2026 – 20th June 2026


Overview

This project trains and evaluates multiple machine learning classification models on the classic Iris dataset. The objective is to classify Iris flowers into three species based on four physical measurements.

Species:

  • Iris setosa
  • Iris versicolor
  • Iris virginica

Features used:

  • Sepal Length (cm)
  • Sepal Width (cm)
  • Petal Length (cm)
  • Petal Width (cm)

Project Structure

CodeAlpha_IrisClassification/
├── data/
│   └── Iris.csv                   # Dataset
├── notebooks/
│   └── iris_classification.ipynb  # Main notebook
├── requirements.txt
└── README.md

Models Trained

Model Description
K-Nearest Neighbours (KNN) Instance-based learner; K=5 default, tuned up to K=20
Support Vector Machine (SVM) RBF kernel; optimal for non-linear boundaries
Random Forest Ensemble of 100 decision trees
Logistic Regression Baseline linear classifier

Key Results

  • All four models achieved very high accuracy (above 93%) on the test set.
  • Petal Length and Petal Width are the most discriminative features.
  • Iris setosa is perfectly linearly separable from the other two species.
  • Iris versicolor and Iris virginica show slight overlap in sepal dimensions but are well separated by petal dimensions.

Visualisations Produced

  • Class distribution bar chart
  • Feature distributions by species (histograms)
  • Pairplot of all feature combinations
  • Correlation heatmap
  • Box plots per feature per species
  • Confusion matrices for all four models
  • Model performance comparison chart
  • Random Forest feature importance chart
  • KNN accuracy vs. K tuning curve
  • Decision boundary plots (KNN and SVM on petal features)

How to Run

  1. Clone this repository:

    git clone https://github.com/Tosa9/CodeAlpha_IrisClassification.git
    cd CodeAlpha_IrisClassification
  2. Install dependencies:

    pip install -r requirements.txt
  3. Launch the notebook:

    jupyter notebook notebooks/iris_classification.ipynb

Dependencies

See requirements.txt for the full list.


Dataset Source

Iris Dataset — Kaggle


CodeAlpha Data Science Internship | Task 1
#CodeAlpha #DataScience #MachineLearning #IrisClassification

About

Iris flower species classification using KNN, SVM, Random Forest, and Logistic Regression. Best model: SVM at 96.67% accuracy. Includes EDA, feature analysis, confusion matrices, decision boundaries, and feature importance. CodeAlpha Data Science Internship — Task 1.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors