operators: And (conjunction) operators

Description Usage Arguments Value Author(s) References See Also Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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))
)

softclassval documentation built on May 2, 2019, 2:06 a.m.