performance-analytics {MLInterfaces} | R Documentation

## Assessing classifier performance

### Description

Methods to calculate the number of true positives (`tp`), true negatives (`tn`), false negatives (`fn`), false positive (`fp`), accuracy (`acc`), `precision`, `recall` (same as `sensitivity`), `specificity`, `F1` and `macroF1` scores.

Each method also accepts an `naAs0` argument definiting if `NAs` should be replaced by `0` (default is `FALSE`).

### Methods

Methods `tp`, `tn`, `fp`, `fn`, `F1`, `acc` and `specificity`:

`signature(obj = "table")`

Methods `recall` (`sensitivity`), `precision` and `macroF1`:

`signature(obj = "classifierOutput", type = "character")`
`signature(obj = "classifierOutput", type = "missing")`
`signature(obj = "classifierOutput", type = "numeric")`
`signature(obj = "table")`

### Examples

    ## the confusion matrix
    cm <- table(iris$Species, sample(iris$Species))
    tp(cm)
    tn(cm)
    fp(cm)
    fn(cm)
    acc(cm)
    precision(cm)
    recall(cm)
    F1(cm)
    macroF1(cm)

[Package MLInterfaces version 1.58.1 Index]