View source: R/confusion.matrix.R
confusion.matrix | R Documentation |
create the confusion matrix.
confusion.matrix(newdata, prediction)
newdata |
matrix or data frame of test data. |
prediction |
a prmdt prediction object. |
A matrix with predicted and actual values.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.