algebra: Algebra for Fuzzy Sets

Description Usage Arguments Details Value Author(s) Examples

View source: R/algebra.R

Description

Compute triangular norms (t-norms), triangular conorms (t-conorms), residua, bi-residua, and negations.

Usage

 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
## a t-norm from concatenated arguments:
goedel.tnorm(..., na.rm=FALSE)
lukas.tnorm(..., na.rm=FALSE)
goguen.tnorm(..., na.rm=FALSE)

## a t-norm in a parallel (element-wise) manner:
pgoedel.tnorm(..., na.rm=FALSE)
plukas.tnorm(..., na.rm=FALSE)
pgoguen.tnorm(..., na.rm=FALSE)

## a t-conorm from concatenated arguments:
goedel.tconorm(..., na.rm=FALSE)
lukas.tconorm(..., na.rm=FALSE)
goguen.tconorm(..., na.rm=FALSE)

## a t-conorm in a parallel (element-wise) manner:
pgoedel.tconorm(..., na.rm=FALSE)
plukas.tconorm(..., na.rm=FALSE)
pgoguen.tconorm(..., na.rm=FALSE)

## compute a residuum (implication) 
goedel.residuum(x, y)
lukas.residuum(x, y)
goguen.residuum(x, y)

## compute a bi-residuum (equivalence) 
goedel.biresiduum(x, y)
lukas.biresiduum(x, y)
goguen.biresiduum(x, y)

## compute a negation
invol.neg(x)
strict.neg(x)

## algebra-related functions
algebra(name, stdneg=FALSE, ...)
is.algebra(a)

Arguments

...

For t-norms and t-conorms, these arguments are numeric vectors of values to compute t-norms or t-conorms from. Values outside the [0,1] interval cause an error. NA values are also permitted.

For the algebra() function, these arguments are passed to the factory functions that create the algebra. (Reserved for future use).

na.rm

whether to ignore NA values: TRUE means that NA's are ignored, i.e. the computation is performed as if such values were not present in the arguments; FALSE means that the NA's in arguments are taken into considerations, details below.

x

Numeric vector of values to compute a residuum or bi-residuum from. Values outside the [0,1] interval cause an error. NA values are also permitted.

y

Numeric vector of values to compute a residuum or bi-residuum from. Values outside the [0,1] interval cause an error. NA values are also permitted.

name

The name of the algebra to be created. Must be one of: "goedel", "lukasiewicz", "goguen" (or an unambiguous abbreviation).

stdneg

If TRUE the use of a "standard" negation (i.e. involutive negation) is forced. Otherwise, the appropriate negation is used in the algebra (e.g. strict negation in Goedel and Goguen algebra and involutive negation in Lukasiewicz algebra).

a

An object to be checked if it is a valid algebra (i.e. a list returned by the algebra function).

Details

goedel.tnorm, lukas.tnorm, and goguen.tnorm compute the Goedel, Lukasiewicz, and Goguen triangular norm (t-norm) from all values in the arguments. If the arguments are vectors they are combined together firstly so that a numeric vector of length 1 is returned.

pgoedel.tnorm, plukas.tnorm, and pgoguen.tnorm compute the same t-norms, but in a parallel manner (element-wisely). I.e. the values with indices 1 of all arguments are used to compute the t-norm, then the second values (while recycling the vectors if they do not have the same size) so that the result is a vector of values.

goedel.tconorm, lukas.tconorm, goguen.tconorm, are similar to the previously mentioned functions, exept that they compute triangular conorms (t-conorms). pgoedel.tconorm, plukas.tconorm, and pgoguen.tconorm are their parallel (i.e. element-wise) alternatives.

goedel.residuum, lukas.residuum, and goguen.residuum compute residua (i.e. implications) and goedel.biresiduum, lukas.biresiduum, and goguen.biresiduum compute bi-residua.

invol.neg and strict.neg compute the involutive and strict negation, respectively.

Let a, b be values from the interval [0, 1]. Here are mathematical definitions of the realized functions:

Bi-residuum B is derived from t-norm T and residuum R as follows:

B(a, b) = T(R(a, b), R(b, a)).

The arguments have to be numbers from the interval [0, 1]. Values outside that range cause an error. Also NaN causes an error.

If na.rm=TRUE then missing values (NA) are ignored. Otherwise, they are treated as unknown values accordingly to Kleene logic. See the examples below.

algebra returns a named list of functions that together form Goedel, Goguen, or Lukasiewicz algebra:

is.algebra tests whether the given a argument is a valid algebra, i.e. a list returned by the algebra function.

Value

Functions for t-norms and t-conorms (such as goedel.tnorm) return a numeric vector of size 1 that is the result of the appropriate t-norm or t-conorm applied on all values of all arguments.

Parallel versions of t-norms and t-conorms (such as pgoedel.tnorm) return a vector of results after applying the appropriate t-norm or t-conorm on argument in an element-wise (i.e. parallel, by indices) way. The resulting vector is of length of the longest argument (shorter arguments are recycled).

Residua and bi-residua functions return a numeric vector of length of the longest argument (shorter argument is recycled).

strict.neg and invol.neg compute negations and return a numeric vector of the same size as the argument x.

algebra returns a list of functions of the requested algebra: "n" (negation), "t" (t-norm), "pt" (parallel, i.e. element-wise, t-norm), "c" (t-conorm), "pc" (parallel t-conorm), "r" (residuum), and "b" (bi-residuum).

Author(s)

Michal Burda

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
    # direct and parallel version of functions
    goedel.tnorm(c(0.3, 0.2, 0.5), c(0.8, 0.1, 0.5))  # 0.1
    pgoedel.tnorm(c(0.3, 0.2, 0.5), c(0.8, 0.1, 0.5)) # c(0.3, 0.1, 0.5)

    # handling of missing values
    goedel.tnorm(c(0.3, 0, NA), na.rm=TRUE)    # 0
    goedel.tnorm(c(0.3, 0.7, NA), na.rm=TRUE)  # 0.3

    goedel.tnorm(c(0.3, 0, NA), na.rm=FALSE)   # 0
    goedel.tnorm(c(0.3, 0.7, NA), na.rm=FALSE) # NA

    goedel.tconorm(c(0.3, 1, NA), na.rm=TRUE)    # 1
    goedel.tconorm(c(0.3, 0.7, NA), na.rm=TRUE)  # 0.7

    goedel.tconorm(c(0.3, 1, NA), na.rm=FALSE)   # 1
    goedel.tconorm(c(0.3, 0.7, NA), na.rm=FALSE) # NA

    # algebras
    x <- runif(10)
    y <- runif(10)
    a <- algebra('goedel')
    a$n(x)     # negation
    a$t(x, y)  # t-norm
    a$pt(x, y) # parallel t-norm
    a$c(x, y)  # t-conorm
    a$pc(x, y) # parallel t-conorm
    a$r(x, y)  # residuum
    a$b(x, y)  # bi-residuum

    is.algebra(a) # TRUE

lfl documentation built on May 29, 2017, 10:53 a.m.