K-Nearest Neighbors (KNN) for Anomaly Detection

Gabriel Pierobon
13 min readAug 28, 2023

A carefully generated, thoroughly engineered resource for Data Scientists.

Chapter 09 from the Guide to Machine Learning for Anomaly Detection

Warning! Before you continue reading this article and all the articles that compose this guide, you must understand this was in part generated using OpenAI’s GPT 4 model. It started as a self learning project and I soon enough realized this could be really valuable to fellow data scientists. Because of this, I will release the entire guide for free alongside every chapter so you can directly go read the guide from the document so you don’t even need to give me reading time if you don’t want to.

Guide Index

0: About the generation of this guide
1: Introduction to Anomaly Detection
2: Statistical Techniques for Anomaly Detection (Part 1)
2: Statistical Techniques for Anomaly Detection (Part 2)
3: Introduction to M. Learning for Anomaly Detection (Part 1)
3: Introduction to M. Learning for Anomaly Detection (Part 2)
4: Dealing with Imbalanced Classes in Supervised Learning
5: K-Means Clustering for Anomaly detection
6: DBSCAN for Anomaly detection
7: Isolation Forest for Anomaly Detection
8: One-Class SVM for Anomaly Detection
>>>>> 9: K-Nearest Neighbors (KNN) for Anomaly Detection <<<<<
10: Principal Graph and Structure Learning (PGSL)

--

--