View source: R/knn_params_default.R
| knn_params_default | R Documentation |
knn_params_default() creates a knn_params object based on the parameter
definitions in Nowak et al. (2010).
knn_params_default(n)
n |
The number of observations in the index data set |
Nowak et al. (2010) selects from k nearest neighbors, where k is equal to
the square root of the number of observations in the index data set. The
k neighbors use a weighting function that decreases based on distance.
The weights are equal to (1 / n) / sum(1 / i) where i goes from 1 to
k.
knn_params
# there are 100 observations
knn_params_default(100)
# there are 20 observations in the data
knn_params_default(20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.