Загрузка...

What is K‑Nearest Neighbors (KNN)?

📌 AI Interview Question #24
What is K‑Nearest Neighbors (KNN)?
---

Definition
KNN is a simple, non‑parametric algorithm that classifies (or regresses) a data point based on the labels of its closest neighbors in feature space.
---

How It Works

1. Select K – the number of neighbors to consider.
2. Compute Distance – measure distance (e.g., Euclidean) between the new point and all training points.
3. Find Neighbors – pick the K points with smallest distance.
4. Vote/ Average – for classification, take the majority class; for regression, average their values.
---

Key Characteristics

Instance‑based: no explicit training step, all computation at inference.

Choice of K and distance metric (Euclidean, Manhattan) directly affect performance.

Uses: classification (spam detection, image recognition) and regression (predicting values).
---
Key Takeaway
KNN makes predictions by analogy—new examples are classified according to the majority label of their nearest neighbors.
---

Repeat, Understand, Apply.
Follow for more AI Interview Questions!

Видео What is K‑Nearest Neighbors (KNN)? канала Sharmistha Majumder (CS Quick Revision Shorts)
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять