B.Introduction-FuzzyRoughSets
.BC.IND.relation.FRST(decision.table, attributes = NULL,
control = list())
"DecisionTable"
class
representing a decision table. See
SF.asDecisionTable
.NULL
which means that all conditional
attributes will be considered.type.relation
: a vector containing string values
that express the type of the fuzzy relation and its
equation. The default value istype.relation =
c("t
"IndiscernibilityRelation"
which contains
IND.relation
: a matrix
representing indiscernibility relation over all objects.type.relation
: a vector representing the
type of relation.type.aggregation
: a
vector representing the type of aggregation operator.type.model
: a string showing the type of
model which is used. In this case it is"FRST"
which means fuzzy rough set theory. To calculate a particular relation, we should pay
attention to several components in the parameter
control
. The main component in the control
parameter is type.relation
that defines what kind
of approach we are going to use. The detailed explanation
about the parameters and their equations is as follows:
"tolerance"
: It refers to fuzzy
tolerance relations proposed by (R. Jensen and Q. Shen,
2009). In order to represent the"tolerance"
relation, we must settype.relation
as follows.type.relation = c("tolerance", )
where the chosen equation called ast.similarity
is one of"eq.1"
,"eq.2"
, and"eq.3"
equations which have been explained inB.Introduction-FuzzyRoughSets
."transitive.kernel"
: It refers to$T$-equivalence relation proposed by (Q. Hu et al,
2004). In order to represent the relation, we must settype.relation
parameter as follows.type.relation = c("transitive.kernel", , )
where the chosen equation is one of five following
equations (calledt.similarity
):"gaussian"
: It means gaussian kernel which is$R_G(x,y) = \exp (-\frac{|x - y|^2}{\delta})$"exponential"
: It means exponential kernel which
is$R_E(x,y) = \exp(-\frac{|x - y|}{\delta})$"rational"
: It means rational quadratic kernel
which is$R_R(x,y) = 1 - \frac{|x - y|^2}{|x - y|^2 +
\delta}$"circular"
: It means circular
kernel which is if$|x - y| < \delta$,$R_C(x,y)
= \frac{2}{\pi}\arccos(\frac{|x - y|}{\delta}) -
\frac{2}{\pi}\frac{|x - y|}{\delta}\sqrt{1 - (\frac{|x -
y|}{\delta})^2}$"spherical"
: It means
spherical kernel which is if$|x - y| < \delta$,$R_S(x,y) = 1 - \frac{3}{2}\frac{|x - y|}{\delta} +
\frac{1}{2}(\frac{|x - y|}{\delta})^3$delta
is a specified value. For example: let us assume we are
going to use"transitive.kernel"
as the fuzzy
relation,"gaussian"
as its equation and the delta
is 0.2. So, we assign thetype.relation
parameter
as follows:type.relation = c("transitive.kernel", "gaussian",
0.2)
If we omit thedelta
parameter then we are using"gaussian"
defined as$R_E(x,y) =
\exp(-\frac{|x - y|}{2\sigma^2})$, where$sigma$is
the variance. Furthermore, when using this relation,
usually we settype.aggregation = c("t.tnorm", "t.cos")
."transitive.closure"
: It refers to
similarity relation (also called fuzzy equivalence
relation). In this package, we consider a simple
algorithm to calculate this relation as follows.Input: a fuzzy relation R
Output: a min-transitive fuzzy relation$R^m$Algorithm:
1. For every x, y: compute$R'(x,y) = max(R(x,y), max_{z \in U}min(R(x,y),
R(z,y)))$2. If$R' \not= R$, then$R \gets R'$and go to
1, else$R^m \gets R'$For interested readers, other algorithms can be seen in
(H. Naessens et al, 2002). Let"eq.1"
be the$R$fuzzy relations, to define it as parameter istype.relation = c("transitive.closure", "eq.1")
.
Instead of"eq.1"
, we can also use other equations
that have been explained in"tolerance"
and"transitive.kernel"
.
"crisp"
: It uses crisp equality for all
attributes and we set the parametertype.relation =
"crisp"
. In this case, we only have$R(x_i, x_j) =
0$which means the object$x_i$is completely
different from$x_j$, and otherwise if$R(x_i,
x_j) = 1$."custom"
: this value means that we define
our own equation for the indiscernibility relation. The
equation should be defined in parameterFUN.relation
.type.relation = c("custom", )
The customized function should consist of three arguments
which aredecision.table
,x
, andy
,
wherex
andy
represent two objects which
we want to compare. It should be noted that the user
must ensure that the values of this equation are alwayas
between 0 and 1. Furthermore, the function must have a
return value. An example can be seen in SectionExamples
. Beside the above type.relation
, we provide several
options of values for the type.aggregation
parameter. The following is a description about it.
type.aggregation = c("crisp")
: It
uses crisp equality for all attributes.type.aggregation = c("t.tnorm", )
: It means we are using"t.tnorm"
aggregation which is a triangular norm operator with a
specified operatort.tnorm
as follows:"min"
: standard t-norm which is$min(x_1, x_2)$."hamacher"
: hamacher
product which is$(x_1 * x_2)/(x_1 + x_2 - x_1 *
x_2)$."yager"
: yager class which is$1
- min(1, ((1 - x_1) + (1 - x_2)))$."product"
: product t-norm which is$(x_1 *
x_2)$."lukasiewicz"
: lukasiewicz's t-norm
(default) which is$max(x_2 + x_1 - 1, 0)$."t.cos"
:$T_{cos}$t-norm which is$max(x_1
* x_2 - \sqrt{1 - x_1^2}\sqrt{1 - x_2^2, 0})$.FUN.tnorm
: It is a user-defined function. It has
to have two arguments, for example:FUN.tnorm <- function(left.side, right.side)
if ((left.side + right.side) > 1)
return(min(left.side, right.side))
else return(0)
type.aggregation = c("t.tnorm", "lukasiewicz")
.type.aggregation = c("custom", )
:
It is quite similar to the previous one but using this
option users have more possibilities to define their own
functions.
is a function having one
argument representing data that is produced by fuzzy
similarity equation calculation. The data is a list of
one or many matrices which depend on the number of
considered attributes and has dimension number of object
x number of object. For example:FUN.agg <- function(data) return(Reduce("+",
data)/length(data))
which is a function to calculate average along all
attributes. Then, we can settype.aggregation
as
follows:type.aggregation = c("general.custom", )
.
Another example can be seen in SectionExamples
.
As we mentioned before, this option gives more
flexibility to define functions since we do not need to
consider the associative rule. Furthermore, the use of this function has been
illustrated in Section Examples
. Finally, this
function is important since it is a basic function needed
by other functions, such as
BC.LU.approximation.FRST
and
BC.positive.reg.FRST
for calculating lower
and upper approximation and determining positive regions.
R. Jensen and Q. Shen, "New Approaches to Fuzzy-Rough Feature Selection", IEEE Trans. on Fuzzy Systems, vol. 19, no. 4, p. 824 - 838 (2009).
Q. Hu, D. Yu, W. Pedrycz, and D. Chen, "Kernelized Fuzzy Rough Sets and Their Applications", IEEE Trans. Knowledge Data Eng., vol. 23, no. 11, p. 1649 - 1471 (2011).
BC.LU.approximation.FRST
,
BC.IND.relation.RST
,
BC.LU.approximation.RST
,###########################################################
## Example 1: Dataset containing nominal values for
## all attributes.
###########################################################
## Decision table is represented as data frame
dt.ex1 <- data.frame(c(1,0,2,1,1,2,2,0), c(0, 1,0, 1,0,2,1,1),
c(2,1,0,0,2,0,1,1), c(2,1,1,2,0,1,1,0), c(0,2,1,2,1,1,2,1))
colnames(dt.ex1) <- c("aa", "bb", "cc", "dd", "ee")
decision.table <- SF.asDecisionTable(dataset = dt.ex1, decision.attr = 5)
## In this case, we only consider the second and third attributes.
attributes <- c(2, 3)
#### calculate fuzzy indiscernibility relation ####
## in this case, we are using "crisp" as a type of relation and type of aggregation
control.ind <- list(type.relation = c("crisp"), type.aggregation = c("crisp"))
IND <- BC.IND.relation.FRST(decision.table, attribute = attributes, control = control.ind)
###########################################################
## Example 2: Dataset containing real-valued attributes
###########################################################
dt.ex2 <- data.frame(c(-0.4, -0.4, -0.3, 0.3, 0.2, 0.2),
c(-0.3, 0.2, -0.4, -0.3, -0.3, 0),
c(-0.5, -0.1, -0.3, 0, 0, 0),
c("no", "yes", "no", "yes", "yes", "no"))
colnames(dt.ex2) <- c("a", "b", "c", "d")
desc.attributes <- list(a = c(-0.4, 0.3), b = c(-0.4, 0.2),
c = c(-0.5, 0), d = c("no", "yes"))
decision.table <- SF.asDecisionTable(dataset = dt.ex2, decision.attr = 4)
## in this case, we only consider the first and second attributes
attributes <- c(1, 2)
#### Calculate fuzzy indiscernibility relation ####
## in this case, we choose "tolerance" relation and "eq.1" as similarity equation
## and "lukasiewicz" as t-norm of type of aggregation
control.ind <- list(type.aggregation = c("t.tnorm", "lukasiewicz"),
type.relation = c("tolerance", "eq.1"))
IND.1 <- BC.IND.relation.FRST(decision.table, attributes = attributes,
control = control.ind)
#### Calculate fuzzy indiscernibility relation: gaussian kernel ####
control.ind <- list(type.aggregation = c("t.tnorm", "t.cos"),
type.relation = c("transitive.kernel", "gaussian", 0.2))
IND.2 <- BC.IND.relation.FRST(decision.table, attributes = attributes,
control = control.ind)
#### calculate fuzzy transitive closure ####
control.ind <- list(type.aggregation = c("t.tnorm", "lukasiewicz"),
type.relation = c("transitive.closure", "eq.1"))
IND.3 <- BC.IND.relation.FRST(decision.table, attributes = attributes,
control = control.ind)
#### Calculate fuzzy indiscernibility relation: using user-defined relation #####
## The customized function should have three arguments which are : decision.table
## and object x, and y.
## This following example shows that we have an equation for similarity equation:
## 1 - abs(x - y) where x and y are two objects that will be compared.
## In this case, we do not consider decision.table in calculation.
FUN.relation <- function(decision.table, x, y) {
return(1 - (abs(x - y)))
}
control.ind <- list(type.aggregation = c("t.tnorm", "lukasiewicz"),
type.relation = c("custom", FUN.relation))
IND.4 <- BC.IND.relation.FRST(decision.table, attributes = attributes,
control = control.ind)
#### The other example using "custom"
## In this case, we calculate aggregation as average of all objects
FUN.average <- function(data){
return(Reduce("+", data)/length(data))
}
control.ind <- list(type.aggregation = c("custom", FUN.average),
type.relation = c("tolerance", "eq.1"))
IND.5 <- BC.IND.relation.FRST(decision.table, attributes = attributes,
control = control.ind)
#### Calculate fuzzy indiscernibility relation: using user-defined tnorms ####
FUN.tnorm <- function(left.side, right.side) {
if ((left.side + right.side) > 1)
return(min(left.side, right.side))
else return(0)}
control.ind <- list(type.aggregation = c("t.tnorm", FUN.tnorm),
type.relation = c("tolerance", "eq.1"))
IND.6 <- BC.IND.relation.FRST(decision.table, attributes = attributes,
control = control.ind)
##################################################################
## Example 3: Dataset containing continuous and nominal attributes
## Note. we only consider type.relation = c("tolerance", "eq.1")
## but other approaches have the same way.
##################################################################
data(RoughSetData)
decision.table <- RoughSetData$housing7.dt
## in this case, we only consider the attribute: 1, 2, 3, 4
attributes <- c(1,2,3,4)
#### Calculate fuzzy indiscernibility relation ####
control.ind <- list(type.aggregation = c("t.tnorm", "lukasiewicz"),
type.relation = c("tolerance", "eq.1"))
IND.6 <- BC.IND.relation.FRST(decision.table, attributes = attributes, control = control.ind)
Run the code above in your browser using DataLab