confusion.matrix {traineR} | R Documentation |
confusion.matrix
Description
create the confusion matrix.
Usage
confusion.matrix(newdata, prediction)
Arguments
newdata |
matrix or data frame of test data. |
prediction |
a prmdt prediction object. |
Value
A matrix with predicted and actual values.
Examples
data("iris")
n <- seq_len(nrow(iris))
.sample <- sample(n, length(n) * 0.75)
data.train <- iris[.sample,]
data.test <- iris[-.sample,]
modelo.knn <- train.knn(Species~., data.train)
modelo.knn
prob <- predict(modelo.knn, data.test, type = "prob")
prob
prediccion <- predict(modelo.knn, data.test, type = "class")
prediccion
confusion.matrix(data.test, prediccion)
[Package traineR version 2.2.0 Index]