Training point (height = y) k nearest neighbors Query point → prediction
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

K-Nearest Neighbors Regression: Predicting by Local Averaging

Supervised learning splits into two jobs: classification (predict a category) and regression (predict a number). This simulator focuses on the regression side of k-nearest neighbors — instead of voting on a class, it averages the target values of the k closest labeled points in a 3D feature space to predict a continuous value at any query location. A translucent wireframe traces the true underlying function that generated the noisy training data, so you can watch the k-NN prediction surface hug it tightly at low k and flatten out as k grows, with live readouts for the predicted value, the ground truth, the pointwise error, and the RMSE across the whole domain.