Learn R Programming

lfl (version 2.2.0)

compose: Composition of Fuzzy Relations

Description

Composition of Fuzzy Relations

Usage

compose(
  x,
  y,
  e = NULL,
  alg = c("goedel", "goguen", "lukasiewicz"),
  type = c("basic", "sub", "super", "square"),
  quantifier = NULL,
  sorting = sort
)

Value

A matrix with \(v\) rows and \(w\) columns, where \(v\) is the number of rows of x and \(w\) is the number of columns of y.

Arguments

x

A first fuzzy relation to be composed. It must be a numeric matrix with values within the \([0,1]\) interval. The number of columns must match with the number of rows of the y matrix.

y

A second fuzzy relation to be composed. It must be a numeric matrix with values within the \([0,1]\) interval. The number of columns must match with the number of rows of the x matrix.

e

Deprecated. An excluding fuzzy relation. If not NULL, it must be a numeric matrix with dimensions equal to the y matrix.

alg

An algebra to be used for composition. It must be one of 'goedel' (default), 'goguen', or 'lukasiewicz', or an instance of class algebra (see algebra()).

type

A type of a composition to be performed. It must be one of 'basic' (default), 'sub', 'super', or 'square'.

quantifier

Deprecated. If not NULL, it must be a function taking a single argument, a vector of relative cardinalities, that would be translated into membership degrees. A result of the lingexpr() function is a good candidate for that. Note that the vector of relative cardinalities contains also two attributes, x and y, which carry the original R's data row (in x) and S's feature column (in y). These attributes are accessible using the standard base::attr() function. Find examples below that define some quantifiers.

sorting

Deprecated. Sorting function used within quantifier application. The given function must sort the membership degrees and allow the decreasing argument as in base::sort(). This function have to be explicitly specified typically if performing compositions that handle NA values.

Author

Michal Burda

Details

Function composes a fuzzy relation x (i.e. a numeric matrix of size \((u,v)\)) with a fuzzy relation y (i.e. a numeric matrix of size \((v,w)\)) and possibly with the deprecated use of an exclusion fuzzy relation e (i.e. a numeric matrix of size \((v,w)\)).

The style of composition is determined by the algebra alg, the composition type type, and possibly also by a deprecated quantifier.

This function performs four main composition types, the basic composition ( also known as direct product), the Bandler-Kohout subproduct (also subdirect product), the Bandler-Kohout superproduct (also supdirect product), and finally, the Bandler-Kohout square product. More complicated composition operations may be performed by using the mult() function and/or by combining multiple composition results with the algebra() operations.

See Also

[algebra(), mult(), lingexpr()

Examples

Run this code
    R <- matrix(c(0.1, 0.6, 1, 0, 0, 0,
                  0, 0.3, 0.7, 0.9, 1, 1,
                  0, 0, 0.6, 0.8, 1, 0,
                  0, 1, 0.5, 0, 0, 0,
                  0, 0, 1, 1, 0, 0), byrow=TRUE, nrow=5)

    S <- matrix(c(0.9, 1, 0.9, 1,
                  1, 1, 1, 1,
                  0.1, 0.2, 0, 0.2,
                  0, 0, 0, 0,
                  0.7, 0.6, 0.5, 0.4,
                  1, 0.9, 0.7, 0.6), byrow=TRUE, nrow=6)

    RS <- matrix(c(0.6, 0.6, 0.6, 0.6,
                   1, 0.9, 0.7, 0.6,
                   0.7, 0.6, 0.5, 0.4,
                   1, 1, 1, 1,
                   0.1, 0.2, 0, 0.2), byrow=TRUE, nrow=5)

    compose(R, S, alg='goedel', type='basic') # should be equal to RS

Run the code above in your browser using DataLab