Learn R Programming

kerntools (version 1.2.0)

Acc: Accuracy

Description

`Acc()` computes the accuracy between the output of a classification model and the actual values of the target. It can also compute the weighted accuracy, which is useful in imbalanced classification problems. The weighting is applied according to the class frequencies in the target. In balanced problems, weighted Acc = Acc.

Usage

Acc(ct, weighted = FALSE)

Value

Accuracy of the model (a single value).

Arguments

ct

Confusion Matrix.

weighted

If TRUE, the weighted accuracy is returned. (Defaults: FALSE).

Examples

Run this code
y <- c(rep("a",3),rep("b",2))
y_pred <- c(rep("a",2),rep("b",3))
ct <- table(y,y_pred)
Acc(ct)
Acc(ct,weighted=TRUE)

Run the code above in your browser using DataLab