Learn R Programming

lfl (version 1.0)

lcut: Transform data into a set of linguistic fuzzy attributes

Description

This function creates a set of linguistic fuzzy attributes from crisp data. Numeric vectors, matrix or data frame columns are transformed into a set of fuzzy attributes, i.e. columns with membership degrees. Factors and other data types are transformed to fuzzy attributes by calling the fcut function.

Usage

lcut3(x, ...)
## S3 method for class 'matrix':
lcut3(x, ...)
## S3 method for class 'data.frame':
lcut3(x, 
     context=NULL,
     name=NULL,
     parallel=FALSE,
     ...)
## S3 method for class 'numeric':
lcut3(x, 
     context=NULL,
     defaultCenter=0.5,
     atomic=c("sm", "me", "bi"), 
     hedges=c("ex", "si", "ve", "ml", "ro", "qr", "vr"),
     name=NULL,
     parallel=FALSE,
     ...)

lcut5(x, ...) ## S3 method for class 'matrix': lcut5(x, ...) ## S3 method for class 'data.frame': lcut5(x, context=NULL, name=NULL, parallel=FALSE, ...) ## S3 method for class 'numeric': lcut5(x, context=NULL, defaultCenter=0.5, atomic=c('sm', 'lm', 'me', 'um', 'bi'), hedges=c("ex", "ve", "ml", "ro", "ty"), name=NULL, parallel=FALSE, ...)

Arguments

x
Data to be transformed: if it is a numeric vector, matrix, or data frame, then the creation of linguistic fuzzy attributes takes place. For other data types the fcut function is called.
context
A definition of context of a numeric attribute. Context determines how people understand the notions "small", "medium", or "big" with respect to that attribute. If x is a numeric vector then context should be a vector of 3 num

Value

  • An object of class "fsets" is returned, which is a numeric matrix with columns representing the fuzzy attributes. Each source columm of the x argument corresponds to multiple columns in the resulting matrix. Columns will have names derived from used $hedges$, atomic expression, and $name$ specified as the optional parameter.

    The resulting object would also have set the vars and specs properties with the former being created from original column names (if x is a matrix or data frame) or the name argument (if x is a numeric vector). The specs incidency matrix would be created to reflect the following order of the hedges: $"ex" < "si" < "ve" < "" < "ml" < "ro" < "qr" < "vr"$ and $"ty" < ""$. Fuzzy attributes created from the same source numeric vector (or column) would be ordered that way, with other fuzzy attributes (from the other source) being incomparable.

item

  • defaultCenter
  • atomic
  • me
  • bi
  • lm
  • me
  • um
  • bi
  • hedges
  • si
  • ve
  • ml
  • ro
  • qr
  • vr
  • ve
  • ml
  • ro
  • ty
  • name
  • parallel
  • ...

code

specs

eqn

$(max(x) - min(x)) * defaultCenter + min(x)$

itemize

  • ex

Details

The aim of this function is to transform numeric data into a set of fuzzy attributes. The resulting fuzzy attributes have direct linguistic interpretation. This is a unique variant of fuzzification that is suitable for the inference mechanism based on Perception-based Linguistic Description (PbLD) -- see pbld.

A numeric vector is transformed into a set of fuzzy attributes accordingly to the following scheme: $ $

where $$ is a linguistic expression "small" ("sm"), "lower medium" ("lm"), "medium" ("me"), "upper medium" ("um") or "big" ("bi") -- see the atomic argument. A $$ is a modifier that further concretizes the atomic expression. It can be empty ("") or some value of:

  • ty
{typically;} ex{extremely;} si{significantly;} ve{very;} ml{more or less;} ro{roughly;} qr{quite roughly;} vr{very roughly.}

References

V. Novak, A comprehensive theory of trichotomous evaluative linguistic expressions, Fuzzy Sets and Systems 159 (22) (2008) 2939--2969.

See Also

fcut, farules, pbld vars, specs, cbind.fsets

Examples

Run this code
# transform a single vector
x <- runif(10)
lcut3(x, name='age')
lcut5(x, name='age')


# transform single vector with custom context
lcut3(x, context=c(0, 0.2, 0.5), name='age')
lcut5(x, context=c(0, 0.2, 0.5), name='age')


# transform all columns of a data frame
# and do not use any hedges
data <- CO2[, c('conc', 'uptake')]
lcut3(data, hedges=NULL)
lcut5(data, hedges=NULL)


# definition of custom contexts for different columns 
# of a data frame while selecting only "ve" and "ro" hedges.
lcut3(data,
     context=list(conc=c(0, 500, 1000),
                  uptake=c(0, 25, 50)),
     hedges=c('ve', 'ro'))


# lcut on non-numeric data is the same as fcut()
ff <- factor(substring("statistics", 1:10, 1:10), levels = letters)
lcut3(ff)
lcut5(ff)

Run the code above in your browser using DataLab