Acc_rnd: Accuracy of a random model

View source: R/performance_measures.R

Acc_rndR Documentation

Accuracy of a random model

Description

'Acc_rnd()' computes the expected accuracy of a random classifier based on the class frequencies of the target. This measure can be used as a benchmark when contrasted to the accuracy (in test) of a given prediction model.

Usage

Acc_rnd(target, freq = FALSE)

Arguments

target

A character vector or a factor. Alternatively, a numeric vector (see below).

freq

TRUE if 'target' contains the frequencies of the classes (in this case, 'target' should be numeric), FALSE otherwise. (Defaults: FALSE).

Value

Expected accuracy of a random classification model (a single value).

Examples

# Expected accuracy of a random model:
target <- c(rep("a",5),rep("b",2))
Acc_rnd(target)
# This is the same than:
freqs <- c(5/7,2/7)
Acc_rnd(freqs,freq=TRUE)

kerntools documentation built on April 3, 2025, 7:52 p.m.