From 72740a11639c20b9f322090f58db3462f855b0af Mon Sep 17 00:00:00 2001 From: Isabelle Viktoria Maciohsek Date: Tue, 29 Dec 2020 16:31:16 +0200 Subject: [PATCH] Update kNearestNeighbors.md --- snippets/kNearestNeighbors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/kNearestNeighbors.md b/snippets/kNearestNeighbors.md index 5924f2249..3b789b4b8 100644 --- a/snippets/kNearestNeighbors.md +++ b/snippets/kNearestNeighbors.md @@ -3,7 +3,7 @@ title: kNearestNeighbors tags: algorithm,array,advanced --- -Classifies a data point relative to a labelled data set using the k-nearest neighbors algorithm. +Classifies a data point relative to a labelled data set, using the [k-nearest neighbors](https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm) algorithm. - Use `Array.prototype.map()` to map the `data` to objects containing the euclidean distance of each element from `point`, calculated using `Math.hypot()`, `Object.keys()` and its `label`. - Use `Array.prototype.sort()` and `Array.prototype.slice()` to get the `k` nearest neighbors of `point`.