generates the code to create the prediction of the k nearest neighbors model.
kkn_prediction(
data = "datos.prueba",
variable.pred = NULL,
model.var = "modelo.knn",
pred.var = "prediccion.knn"
)
the name of the test data.
the name of the variable to be predicted.
the name of the variable that stores the resulting model.
the name of the variable that stores the resulting prediction.
# NOT RUN {
library(kknn)
library(dplyr)
x <- kkn_model('iris', 'Petal.Length', model.var = 'model_knn')
exe(x)
print(model_knn)
x <- kkn_prediction('iris', 'Petal.Length', 'model_knn', 'my_prediction')
exe(x)
print(my_prediction)
# }
Run the code above in your browser using DataLab