Function or value | Description |
Full Usage:
predict distance labeledPoints k x
Parameters:
Distance<'a>
-
the distance function, e.g. `euclidean`
labeledPoints : ('a * 'l) array
-
the array of classified (or labeled) points [in the format (point, label)],
used for the classification
k : int
-
The _positive_ number of nearest neighbors from x to look for.
x : 'a
-
The point to classify
Returns: 'l option
The most common label from the k nearest neighbors for x.
Modifiers: inline Type parameters: 'a, 'l |
The [k-nearest neighbors algorithm (KNN)](https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm) to classify a new data point into the target class, depending on the features of its neighboring data points. May mutate the order of `labeledPoints`.
Example
|