This repository contains a simple implementation of the k-Nearest Neighbors (k-NN) algorithm in Python, a popular machine learning method for classification and regression tasks.
The k-NN algorithm works by analyzing the distances between data points to make predictions based on the majority vote of the k-nearest neighbors. This implementation includes functions for calculating various distance measures (Euclidean, Manhattan, and cosine distance) and finding the k-nearest neighbors for a given data point.
- Simple implementation of the k-Nearest Neighbors algorithm
- Distance calculation using Euclidean, Manhattan, and cosine distance measures
- Data preprocessing functions for MinMax scaling and standard scaling
- Train and test dataset splitting
- Data visualization through scatter plot matrices
- NumPy
- pandas
- Matplotlib
- scikit-learn (only for loading the example dataset)
- Clone the repository
- Install the required dependencies
- Import the necessary functions and libraries
- Load your dataset and preprocess it (if necessary)
- Apply the k-Nearest Neighbors algorithm to your dataset