confusion.matrix: confusion.matrix

View source: R/confusion.matrix.R

confusion.matrixR 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)


PROMiDAT/trainR documentation built on Sept. 13, 2022, 7:26 a.m.