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, ...)
"fcut"(x, breaks, name=NULL, type=c('triangle', 'raisedcos'), merge=1, parallel=FALSE, ...)
"fcut"(x, breaks, name=deparse(substitute(x)), type=c('triangle', 'raisedcos'), merge=1, parallel=FALSE, ...)
type='triangle'
), x
values lower than $i$-th break (and greater than
$(i+2)$-th break) would result in zero memberhsip degree, values equal to $(i+1)$-th
break would have membership degree equal 1 and values between them the appropriate membership
degree between 0 and 1.The resulting fuzzy sets would be named after the original data by adding dot (".") and a number $i$ of fuzzy set.
Unlike cut
, x
values, that are lower or greater than the given
break-points, will have all memberhsip degrees equal to zero.
For non-numeric data, this argument is ignored. For x
being a numeric vector, it must
be a vector of numeric values. For x
being a numeric matrix or data frame, it must
be a named list containing a numeric vector for each column - if not, the values are
repeated for each column.
x
is a vector. If x
is a matrix or data frame,
name
should be NULL because the fuzzy attribute names are taken from column names
of the argument x
.
'triangle'
or 'raisedcos'
may be used. The type
argument may be also a function of 4 arguments that from
the value of the first argument, and considering the boundaries given by the next 3
arguments, computes a membership degree. See e.g. triangle
or
raisedcos
for details on how such function should look like.
breaks
argument) into super-sets.
The argument is ignored for non-numeric data in x
. merge
may contain any integer number from 1
to length(breaks) - 2
.
Value 1
means that the elementary fuzzy sets should be present in the output.
Value 2
means that the two consecutive elementary fuzzy sets should be combined by
using the Lukasiewic t-conorm, value 3
causes combining three consecutive elementary
fuzzy sets etc.
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.
foreach
package. The parallel environment must be
set properly in advance, e.g. with the registerDoMC
function.
Currently this argument is applied only if x
is a matrix or data frame.
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 superset-hood of the merged
fuzzy sets. The function behaves diffently to the type of input x
.
If x
is a factor or a logical vector (or other non-numeric 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 break-points
specified in the breaks
argument with 1st, 2nd and 3rd break-point specifying the first
fuzzy set, 2nd, 3rd and 4th break-point 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 triangle
or raisedcos
functions for
details). Additionally, super-sets 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 t-conorm) to produce super-sets - 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.
lcut
,
farules
,
pbld
vars
,
specs
,
cbind.fsets
# fcut on non-numeric 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 0-1
# (the boundary triangles are right-angled)
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)))
Run the code above in your browser using DataLab