This repository contains a complete example of classifying Iris flowers using the K-Nearest Neighbors (KNN) algorithm with scikit-learn. It includes data preprocessing, model training, prediction on new samples, and data visualization using PCA.
- Loads the famous Iris dataset
- Splits data into training and testing sets
- Scales features using
StandardScalerfor better KNN performance - Trains a KNN classifier with Euclidean distance
- Evaluates model accuracy and prints detailed classification report
- Predicts classes of new flower samples
- Visualizes the dataset in 2D using Principal Component Analysis (PCA)
- Clone the repository:
git clone https://https://github.com/NoorNick/Iris-Flower-Classification.git
cd Iris-Flower-Classification
2.Install dependencies:
pip install -r requirements.txt
- Run the notebook or script:
If you use Jupyter Notebook:
jupyter notebook
Then open Iris_flower_classification.ipynb and run the cells.
The notebook/script prints model accuracy, classification reports, predicted classes for new flowers, and shows a PCA scatter plot of the data.
Happy Flower Classifying! π·πΌπ»