knn_params_default: The default knn parameters

View source: R/knn_params_default.R

knn_params_defaultR Documentation

The default knn parameters

Description

knn_params_default() creates a knn_params object based on the parameter definitions in Nowak et al. (2010).

Usage

knn_params_default(n)

Arguments

n

The number of observations in the index data set

Details

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.

See Also

knn_params

Examples

# there are 100 observations
knn_params_default(100)
# there are 20 observations in the data
knn_params_default(20)


rabutler-usbr/knnstdisagg documentation built on Sept. 14, 2023, 2:47 p.m.