This repository contains a MATLAB implementation of the K-Nearest Neighbors (KNN) algorithm for supervised classification.
The objective of the project is to implement and evaluate a KNN classifier by assigning class labels based on the nearest training samples in the feature space using the Euclidean distance metric.
- Data loading and preprocessing
- KNN classifier implementation
- Euclidean distance computation
- Prediction based on majority voting
- Hyperparameter analysis (number of neighbors, k)
- Performance evaluation using confusion matrices
- Classification accuracy assessment
The implemented workflow consists of:
- Loading and preprocessing the dataset.
- Splitting the data into training and test sets.
- Computing Euclidean distances between samples.
- Selecting the k nearest neighbors.
- Assigning class labels through majority voting.
- Evaluating classifier performance using confusion matrices and accuracy metrics.
The project aims to study instance-based learning techniques and evaluate the effectiveness of the KNN algorithm for classification problems, analyzing the impact of the number of neighbors on model performance.