Methods · Machine learning · Supervised learning basics

K-Nearest Neighbors (KNN)

K-nearest neighbors (KNN) is a nonparametric supervised learning method that predicts a case's class or value from the majority vote or average of the k most similar training cases.

K-최근접 이웃(KNN)은 학습 데이터에서 가장 유사한 k개 사례의 다수결 또는 평균으로 새 사례의 범주나 값을 예측하는 비모수 지도학습 방법이다.

How do I classify cases based on similarity to labelled examples?

레이블이 있는 사례와의 유사성으로 새 사례를 어떻게 분류하나요?

K-nearest neighbors finds the k training cases closest to a new case in feature space and predicts the most common class (classification) or the average outcome (regression). It fits small to medium datasets with few, scaled numeric features where similarity in feature space is meaningful.

When to use K-Nearest Neighbors (KNN)

When to use something else

Assumptions and requirements

What the analysis reports

How to report it

A k-nearest neighbors classifier (k = [value]) achieved a cross-validated accuracy of [value] (SD [value]).

Related methods

Run K-Nearest Neighbors (KNN) on Quorant

Data you need
a table (CSV or Excel) with an outcome variable and predictor (feature) columns
Price
400 credits for one analysis up to 10,000 rows (complexity level 3); larger or wider data costs more. Optional methodologist review: 1800 credits.
Checking
Python results are cross-checked against R reference outputs in every deployment
Before you pay
A free pre-analysis diagnosis checks your data and gives an exact quote; nothing is deducted until you approve it.

Method ID Q71015 · Reviewed 2026-10-25