In few words, give your substantive comment on Abadit's post below:
The K-Nearest Neighbor algorithm (KNN) is a popular supervised machine learning algorithm that can solve both classification and regression problems. One of the most popular software tools used to implement and test k-Nearest neighbor model is Python's scikit-learn library. Sklearn is an open source, powerful Python library used to implement machine learning models and statistical modeling. It has simple and efficient tools for data mining and data analysis. It features various classification, regression, and clustering algorithms including K-Nearest neighbor, support vector machines, random forests, and so on. It is built on top of NumPy, SciPy, and Matplotlib.
To implement KNN, we first need to import the necessary libraries like pandas, NumPy, and Matplotlib for data manipulation, computing, and visualization. Then we split the training and testing set to train the model and test its performance. If the datasets are in different scales, we need to apply feature scaling to bring them to the same scale using the StandardScaler class from the sklearn.preprocessing module. Finally, we train the K-NN model on the training set using the KNeighborsClassifier class from the sklearn.neighbors module and set the necessary parameters weights, n_neighbors, and metric.