strong {softclassval}R Documentation

And (conjunction) operators

Description

And operators for the soft performance calculation. The predefined operators are:

Name Definition dev? postproc? hard? Explanation
gdl pmin (r, p) FALSE FALSE the Gödel-operator (weak conjunction)
luk pmax (r + p - 1, 0) FALSE FALSE Łukasiewicz-operator (strong conjunction)
prd r * p FALSE FALSE product operator
and r * p FALSE TRUE Boolean conjunction: accepts only 0 or 1, otherwise yields NA
wMAE r * abs (r - p) TRUE FALSE for weighted mean absolute error
wRMAE r * abs (r - p) TRUE sqrt FALSE for weighted root mean absolute error (bound for RMSE)
##' wMSE r * (r - p)^2 TRUE FALSE for weighted mean squared error
wRMSE r * (r - p)^2 TRUE sqrt FALSE for root weighted mean squared error

Usage

strong(r, p)

luk(r, p)

weak(r, p)

gdl(r, p)

prd(r, p)

and(r, p)

wMAE(r, p)

wRMAE(r, p)

wMSE(r, p)

wRMSE(r, p)

Arguments

r

reference vector, matrix, or array with numeric values in [0, 1], for and in {0, 1}

p

prediction vector, matrix, or array with numeric values in [0, 1], for and in {0, 1}

Value

numeric of the same size as p

Author(s)

Claudia Beleites

References

see the literature in citation ("softclassval")

See Also

Performance measures: sens

Examples

ops <- c ("luk", "gdl", "prd", "and", "wMAE", "wRMAE", "wMSE", "wRMSE")

## make a nice table


lastline <- function (f){
  body <- body (get (f))    ## function body
  body <- deparse (body)
  body [length (body) - 1]  ## last line is closing brace
}

data.frame (source = sapply (ops, lastline),
            dev = sapply (ops, function (f) dev (get (f))),
            hard = sapply (ops, function (f) hard (get (f))),
            postproc = I (lapply (ops, function (f) postproc (get (f))))
            )

x <- softclassval:::v
x

luk (0.7, 0.8)

## The behaviour of the operators
## op (x, 1)
cbind (x, sapply (c ("luk", "gdl", "prd", "wMAE", "wRMAE", "wMSE", "wRMSE"),
                  function (op, x) get (op) (x, 1), x))

## op (x, 0)
cbind (x, sapply (c ("luk", "gdl", "prd", "wMAE", "wRMAE", "wMSE", "wRMSE"),
                  function (op, x) get (op) (x, 0), x))

## op (x, x)
cbind (x, sapply (c ("luk", "gdl", "prd", "wMAE", "wRMAE", "wMSE", "wRMSE"),
                  function (op, x) get (op) (x, x), x))


## Note that the deviation operators are not commutative
## (due to the weighting by reference)
zapsmall (
cbind (sapply (c ("luk", "gdl", "prd", "wMAE", "wRMAE", "wMSE", "wRMSE"),
                  function (op, x) get (op) (1, x), x)) -
cbind (sapply (c ("luk", "gdl", "prd", "wMAE", "wRMAE", "wMSE", "wRMSE"),
                  function (op, x) get (op) (x, 1), x))
)



[Package softclassval version 1.0-20160527 Index]