Machine Learning Classification

See how algorithms learn to separate data into categories

What is Classification?

Classification is a type of machine learning where an algorithm learns to assign labels to data points. Given examples of different categories (like "spam" vs "not spam"), the algorithm finds patterns to classify new, unseen data.

In this demo, you'll create data points of two classes and watch different algorithms try to draw decision boundaries between them.

K-Nearest Neighbors (KNN)

KNN classifies a point based on the majority vote of its K nearest neighbors. It doesn't learn a boundary—it memorizes all training data and looks up neighbors at prediction time.

Try it: Adjust K to see how it affects the decision boundary. Low K = complex boundary, High K = smoother boundary.

Select Class to Add

Algorithm

Actions

Data Points

0
Class A
0
Class B

Decision Boundary

The line (or curve) that separates different classes. Points on one side get labeled Class A, points on the other side get Class B.

Overfitting

When a model is too complex and fits the training data perfectly but fails on new data. Low K in KNN can cause overfitting.

Underfitting

When a model is too simple to capture the pattern. A linear classifier underfits if the true boundary is curved.

Bias-Variance Tradeoff

Simple models have high bias (assumptions), complex models have high variance (sensitive to data). Finding balance is key.