knn_params | R Documentation |
knn_params()
creates an object, which lets the user specify values for
the weights, and the number of neighbors to use when selecting the
nearest neighbor.
knn_params(k, weights)
k |
A single integer specifying the number of neighbors to select from. |
weights |
a vector with length equal to |
# uniformly select from the 5 nearest neighbors
knn_params(5, rep(1/5, 5))
# select from 4 neigbors, with decreasing likelihood of being selected
knn_params(4, c(.4, .3, .2, .1))
# select the nearest neighbor
knn_params(1, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.