confusion: Classification Confusion Matrix and Accuracy

Description Usage Arguments Value Author(s) Examples

View source: R/RandomKNN.R

Description

Compute classification confusion matrix and accuracy

Usage

1
2
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.

Author(s)

Shengqiao Li<[email protected]>

Examples

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

Example output

Loading required package: gmp

Attaching package: 'gmp'

The following objects are masked from 'package:base':

    %*%, apply, crossprod, matrix, tcrossprod

               
classified as-> 0 1
              0 3 2
              1 2 3
[1] 0.6

rknn documentation built on May 30, 2017, 3:33 a.m.