K-Nearest Neighbors Algorithm
The K-Nearest Neighbors Algorithm is used to place data into a category for example in recommendation applications used for recommending products on Amazon, articles on Medium, movies on Netflix, or videos on YouTube. It returns results based on the nearest training data points to the sample datapoint, also called nearest neighbors.
The K-Nearest Neighbors algorithm is used for classification and regression problems. For classification problems the most frequent label of the nearest neighbors is returned. For regression problems the average of the nearest neighbors is returned. K-Nearest Neighbours algorithm was developed in the early 1950s.
- AWS docs: https://docs.aws.amazon.com/sagemaker/latest/dg/k-nearest-neighbors.html
- https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm
Attributes
Problem attribute | Description |
Data types and format | Tabular |
Learning paradigm or domain | Supervised Learning |
Problem type | Binary/multi-class classification, Regression |
Use case examples | Predict a numeric/continuous value; Predict if an item belongs to a category |
Training
Training data formats are:
- CSV
- x-recordio-protobuf
Model artifacts and inference
Description | Artifacts |
Learning paradigm | Supervised Learning |
Request format | CSV JSON JSON Lines x-recordio-protobuf |
Response format | CSV JSON JSON Lines x-recordio-protobuf |
Processing environment
Training: CPU, or GPU
Inference: CPU, GPU for larger batches
Credits
Hands photo by Clay Banks on Unsplash