K-Nearest Neighbors Regression: Predicting by Local Averaging
Watch k-nearest neighbors regression predict a value by averaging the labels of the closest training points in 3D feature space — tune k and distance weighting and see the fit go from noisy to over-smoothed.
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.
Watch k-nearest neighbors regression predict a continuous value by averaging the labels of the closest training points in a 3D feature space — tune k and switch between uniform and distance-weighted voting to see the fit swing from noisy to over-smoothed.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install