confuTab: Compute confusion tables for a confusion matrix.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/performance-analytics.R

Description

Given a n by n confusion matrix, the function returns a list of n 2 by 2 tables with false positives, false negatives, false positives and true negative for each initial variables.

Usage

1
confuTab(obj, naAs0. = FALSE)

Arguments

obj

An instance of class table. Must be square.

naAs0.

A logical, defining if NAs are to be replaced by 0s.

Value

A list of length nrow(obj) and names rownames(obj).

Author(s)

Laurent Gatto <lg390@cam.ac.uk>

See Also

The tp, tn, fp, fn, methods to extract the respective classification outcomes from a contingency matrix.

Examples

1
2
3
4
## the confusion matrix
cm <- table(iris$Species, sample(iris$Species))
## the 3 confusion tables
(ct <- confuTab(cm))

Example output

Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

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

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

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

    IQR, mad, sd, var, xtabs

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

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colMeans, colSums, colnames, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
    pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: annotate
Loading required package: AnnotationDbi
Loading required package: stats4
Loading required package: IRanges
Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid

Loading required package: XML
Loading required package: cluster
Warning message:
replacing previous import 'BiocGenerics::var' by 'stats::var' when loading 'MLInterfaces' 
$setosa
         known
predicted TRUE FALSE
    TRUE    24    26
    FALSE   26    74

$versicolor
         known
predicted TRUE FALSE
    TRUE    19    31
    FALSE   31    69

$virginica
         known
predicted TRUE FALSE
    TRUE    16    34
    FALSE   34    66

MLInterfaces documentation built on Nov. 8, 2020, 8:14 p.m.