K Nearest Neighbors (KNN)


In pattern recognition, the k-nearest neighbors algorithm is a non-parametric method used for classification and regression. In both cases, the input consists of the k closest training examples in the feature space.

Overview

How kNN algorithm works
I describe how the k Nearest Neighbors algorithm works, and provide a simple example using 2-dimensional data and k = 3.
k-nearest-neighbors video tutorial

Tutorials

Develop k-Nearest Neighbors in Python From Scratch
In this tutorial you are going to learn about the k-Nearest Neighbors algorithm including how it works and how to implement it from scratch in Python.
k-nearest-neighbors python tutorial article

Libraries

General
Scikit-learn
Examples for all the different utilities within scikit-learn.
scikit-learn naive-bayes linear-regression logistic-regression
Table of Contents
Share a project
Share something you or the community has made with ML.
Topic experts
Share