local.knn | R Documentation |
Predict the ranking of a group of judges based on a training dataset with rankings and covariates. First, for each judge, the k-nearest neighbors (by Euclidean distance) are selected. Second, the prediction of rankings are done based on the rankings of these neighbors. Users can chooce two methods of prediction: by mean rank or by Luce model.
local.knn(dset,covariate.test,covariate,knn.k=1,method="mean")
dset |
a ranking dataset for training the k-nearest neighbor. |
covariate.test |
the covariates of the judges to be predicted. |
covariate |
the covariates of the rankings. |
knn.k |
the number of nearest neighbors to be included. The default value is 1. |
method |
the prediction method. mean : mean rank, pl : Luce model |
Paul H. Lee and Philip L. H. Yu
Cheng, W., Dembczynski, K., Hullermeier, E. (2010). Label ranking methods based on the Plackett-Luce model. Proceedings of ICML 2010.
local.knn.cv
## create an artificial dataset X1 <- c(1,1,2,2,3,3) X2 <- c(2,3,1,3,1,2) X3 <- c(3,2,3,1,2,1) co <- c(6,5,4,3,2,1) co.test <- 1.2 train <- data.frame(X1,X2,X3) ## local k-nearest neighbor method of the artificial dataset ## local.knn(train,co.test,co)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.