fcut  R Documentation 
fsets
S3 class using shapes derived from
triangles or raised cosinesThis function creates a set of fuzzy attributes from crisp data. Factors,
numeric vectors, matrix or data frame columns are transformed into a set of
fuzzy attributes, i.e. columns with membership degrees. Unlike
lcut()
, for transformation is not used the linguistic linguistic
approach, but partitioning using regular shapes of the fuzzy sets (such as
triangle, raised cosine).
fcut(x, ...) ## Default S3 method: fcut(x, ...) ## S3 method for class 'factor' fcut(x, name = deparse(substitute(x)), ...) ## S3 method for class 'logical' fcut(x, name = deparse(substitute(x)), ...) ## S3 method for class 'numeric' fcut( x, breaks, name = deparse(substitute(x)), type = c("triangle", "raisedcos"), merge = 1, parallel = FALSE, ... ) ## S3 method for class 'data.frame' fcut( x, breaks = NULL, name = NULL, type = c("triangle", "raisedcos"), merge = 1, parallel = FALSE, ... ) ## S3 method for class 'matrix' fcut(x, ...)
x 
Data to be transformed: a vector, matrix, or data frame. Nonnumeric data are allowed. 
... 
Other parameters to some methods. 
name 
A name to be added as a suffix to the created fuzzy attribute
names. This parameter can be used only if 
breaks 
This argument determines the breakpoints of the positions of
the fuzzy sets (see also I.e. the minimum number of breakspoints is 3; n2 elementary fuzzy sets would be created for n breakpoints. If considering an ith fuzzy set (of The resulting fuzzy sets would be named after the original data by adding dot (".") and a number i of fuzzy set. Unlike For nonnumeric data, this argument is ignored. For 
type 
The type of fuzzy sets to create. Currently,

merge 
This argument determines whether to derive additional fuzzy
sets by merging the elementary fuzzy sets (whose position is determined with
the
The names of the derived (merged) fuzzy sets is derived from the names of the original elementary fuzzy sets by concatenating them with the "" (pipe) separator. 
parallel 
Whether the processing should be run in parallel or not.
Parallelization is implemented using the 
The aim of this function is to transform numeric data into a set of fuzzy attributes. The result is in the form of the object of class "fsets", i.e. a numeric matrix whose columns represent fuzzy sets (fuzzy attributes) with values being the membership degrees.
The function behaves differently to the type of input x
.
If x
is a factor or a logical vector (or other nonnumeric data) then
for each distinct value of an input, a fuzzy set is created, and data would
be transformed into crisp membership degrees 0 or 1 only.
If x
is a numeric vector then fuzzy sets are created accordingly to
breakpoints specified in the breaks
argument with 1st, 2nd and 3rd
breakpoint specifying the first fuzzy set, 2nd, 3rd and 4th breakpoint
specifying th second fuzzy set etc. The shape of the fuzzy set is determined
by the type
argument that may be equal either to a string
'triangle'
or 'raisedcos'
or it could be a function that
computes the membership degrees for itself (see triangular()
or
raisedcosine()
functions for details). Additionally, supersets of
these elementary sets may be created by specifying the merge
argument. Values of this argument specify how many consecutive fuzzy sets
should be combined (by using the Lukasiewic's tconorm) to produce
supersets  see the description of merge
above.
If a matrix (resp. data frame) is provided to this function instead of
single vector, all columns are processed separately as described above and
the result is combined with the cbind.fsets()
function.
The function sets up properly the vars()
and specs()
properties of the result.
An object of class "fsets" is returned, which is a numeric matrix
with columns representing the fuzzy attributes. Each source column of the
x
argument corresponds to multiple columns in the resulting matrix.
Columns have names that indicate the name of the source as well as a index
i of fuzzy set(s) – see the description of arguments breaks
and merge
above.
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 supersethood of the merged
fuzzy sets.
Michal Burda
lcut()
, equidist()
, farules()
, pbld()
, vars()
, specs()
,
cbind.fsets()
# fcut on nonnumeric data ff < factor(substring("statistics", 1:10, 1:10), levels = letters) fcut(ff) # transform a single vector into a single fuzzy set x < runif(10) fcut(x, breaks=c(0, 0.5, 1), name='age') # transform single vector into a partition of the interval 01 # (the boundary triangles are rightangled) fcut(x, breaks=c(0, 0, 0.5, 1, 1), name='age') # also create supersets fcut(x, breaks=c(0, 0, 0.5, 1, 1), name='age', merge=c(1, 2)) # transform all columns of a data frame # with different breakpoints data < CO2[, c('conc', 'uptake')] fcut(data, breaks=list(conc=c(95, 95, 350, 1000, 1000), uptake=c(7, 7, 28.3, 46, 46))) # using a custom 3argument function (a function factory): f < function(a, b, c) { return(function(x) ifelse(a <= x & x <= b, 1, 0)) } fcut(x, breaks=c(0, 0.5, 1), name='age', type=f) # using a custom 4argument function: f < function(x, a, b, c) { return(ifelse(a <= x & x <= b, 1, 0)) } fcut(x, breaks=c(0, 0.5, 1), name='age', type=f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.