View source: R/SOptim_ClassificationFunctions.R
predict.knn | R Documentation |
An auxiliary function used to predict the probabilistic outcome from the knn classifier for single or multi-class problems.
## S3 method for class 'knn'
predict(
object,
type = "response",
newdata = NULL,
traindata = NULL,
cl = NULL,
k = NULL,
balanceTrainData = FALSE,
balanceMethod = "ubOver",
...
)
object |
An object generated from knn function. |
type |
Type of response generated, if |
newdata |
A dataset used to predict the class labels. |
traindata |
Train data used to calibrate the knn classifier. |
cl |
Factor of true classifications of training set. |
k |
Number of neighbours considered. |
balanceTrainData |
Defines if data balancing is to be used (only available for single-class problems; default: TRUE). |
balanceMethod |
A character string used to set the data balancing method. Available methods are based on under-sampling
|
... |
Additional arguments passed to knn. |
A matrix object with knn output.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.