Implement KNN in PyTorch

Easyclassical-mlauto-graded

Build k-nearest neighbors classification using vectorized distance computation and top-k selection on tensors.

Solve it

Check your answer

The grader verifies properties of your implementation, so a correct solution written differently from ours still passes.

pip install torchleet

from torchleet import check
check("knn", knn_predict)

Company tags

How these tags are sourced