Wrapper for a configurable implementation of k-nearest neighbors. Supports both binomial and gaussian outcome distributions.
SL.kernelKnn(
Y,
X,
newX,
family,
k = 10,
method = "euclidean",
weights_function = NULL,
extrema = F,
h = 1,
...
)List with predictions and the original training data & hyperparameters.
Outcome variable
Training dataframe
Test dataframe
Gaussian or binomial
Number of nearest neighbors to use
Distance method, can be 'euclidean' (default), 'manhattan', 'chebyshev', 'canberra', 'braycurtis', 'pearson_correlation', 'simple_matching_coefficient', 'minkowski' (by default the order 'p' of the minkowski parameter equals k), 'hamming', 'mahalanobis', 'jaccard_coefficient', 'Rao_coefficient'
Weighting method for combining the nearest neighbors. Can be 'uniform' (default), 'triangular', 'epanechnikov', 'biweight', 'triweight', 'tricube', 'gaussian', 'cosine', 'logistic', 'gaussianSimple', 'silverman', 'inverse', 'exponential'.
if TRUE then the minimum and maximum values from the k-nearest-neighbors will be removed (can be thought as outlier removal).
the bandwidth, applicable if the weights_function is not NULL. Defaults to 1.0.
Any additional parameters