Description Usage Arguments Details Value Author(s) References Examples

Implement Samworth's optimal weighted nearest neighbor classification algorithm to predict the label of a new input using a training data set.

1 | ```
myownn(train, test, K)
``` |

`train` |
Matrix of training data sets. An n by (d+1) matrix, where n is the sample size and d is the dimension. The last column is the class label. |

`test` |
Vector of a test point. It also admits a matrix input with each row representing a new test point. |

`K` |
Number of nearest neighbors considered. |

The tuning parameter K can be tuned via cross-validation, see cv.tune function for the tuning procedure.

It returns the predicted class label of the new test point. If input is a matrix, it returns a vector which contains the predicted class labels of all the new test points.

Wei Sun, Xingye Qiao, and Guang Cheng

R.J. Samworth (2012), "Optimal Weighted Nearest Neighbor Classifiers," Annals of Statistics, 40:5, 2733-2763.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.