powered by
How to bootstrap with kNN
BootKNN(data, classes, sub="none", nsam=4, nboot=1000, misclass=TRUE)
Data frame to classify
Character vector of class names
Subsample to use (see example)
Number of training items from each level of grouping factor, default 4
Number of iterations
Calculate misclassification table?
Returns all predictions as character matrix, each boot is a column
This is an example of how to bootstrap with 'class::knn1()'.
Samples equal numbers ('nsam') of training items from each level of grouping factor.
Allows to use subset of data which will be used for subsampling of training data.
class::knn1, Dev
class::knn1
Dev
# NOT RUN { iris.sub <- 1:nrow(iris) %in% seq(1, nrow(iris), 5) iris.bootknn <- BootKNN(iris[, -5], iris[, 5], sub=iris.sub) # }
Run the code above in your browser using DataLab