Learn R Programming

rknn (version 1.2-1)

confusion: Classification Confusion Matrix and Accuracy

Description

Compute classification confusion matrix and accuracy

Usage

confusion(obs, pred) confusion2acc(ct)

Arguments

obs
A vector of observed classes.
pred
A vector of predicted classes.
ct
A table retruned from confusion

Value

confusion return a matrix of cross classification counts. confusion return a overall classification accuracy.

Examples

Run this code
  obs<- rep(0:1, each =5);
  pre<- c(obs[3:10], obs[1:2])
  confusion(obs, pre)
  confusion2acc(  confusion(obs, pre))

Run the code above in your browser using DataLab