general.indexes: general.indexes

Description Usage Arguments Value Examples

View source: R/general.indexes.R

Description

Calculates the confusion matrix, overall accuracy, overall error and the category accuracy

Usage

1
general.indexes(newdata, prediction, mc = NULL)

Arguments

newdata

matrix or data frame of test data.

prediction

a prmdt prediction object.

mc

(optional) a matrix for calculating the indices. If mc is entered as parameter newdata and prediction are not necessary.

Value

A list with the confusion matrix, overall accuracy, overall error and the category accuracy. The class of this list is indexes.prmdt

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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
general.indexes(data.test, prediccion)

PROMiDAT/trainR documentation built on Oct. 27, 2020, 8:33 p.m.