Back to GalleryK-Nearest Neighbors
K-Nearest Neighbors is a non-parametric, instance-based classifier. It makes predictions by finding the K closest training instances to a query point in the feature space and determining the output based on their majority class. No explicit training phase is required — the dataset itself functions as the model.
Key Parameters & Visual Influence:
• K (Neighbors): Controls boundary complexity. A low K fits local noise (high variance), creating jagged boundaries, while a high K smooths the decision boundaries (high bias).
• Distance Metric: Euclidean measures straight-line distance, while Manhattan calculates grid-like taxicab distance.
• Distance Weighted: When enabled, closer neighbors exert more influence on the final vote than distant ones.
Dataset Studio
CSV format: Headers in first row, last column = label/target. All values must be numeric.
Example: x1, x2, label