Learn R Programming

RoughSets (version 1.3-8)

BC.IND.relation.FRST: The indiscernibility relation based on fuzzy rough set theory

Description

This is a function used to implement a fundamental concept of FRST which is fuzzy indiscernibility relations. It is used for any fuzzy relations that determine the degree to which two objects are indiscernibility. The detailed description about basic concepts of FRST can be found in Introduction-FuzzyRoughSets.

Usage

BC.IND.relation.FRST(decision.table, attributes = NULL, control = list())

Value

A class "IndiscernibilityRelation" which contains

  • IND.relation: a matrix representing the 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.

Arguments

decision.table

a "DecisionTable" class representing a decision table. See SF.asDecisionTable.

attributes

a numerical vector expressing indexes of subset of attributes to be considered. The default value is NULL which means that all conditional attributes will be considered.

control

a list of other parameters consisting of the following parameters:

  • type.relation: a list containing string values that express the type of the fuzzy relation and its equation. The default value is type.relation = c("tolerance", "eq.1"). See in the Section Details.

  • type.aggregation: a list expressing type of aggregation. The default value is type.aggregation = c("t.tnorm", "lukasiewicz"). See in the Section Details.

Author

Lala Septem Riza

Details

Briefly, the indiscernibility relation is a relation that shows a degree of similarity among the objects. For example, \(R(x_i, x_j) = 0\) means the object \(x_i\) is completely different from \(x_j\), and otherwise if \(R(x_i, x_j) = 1\), while between those values we consider a degree of similarity. To calculate this relation, several methods have been implemented in this function which are approaches based on fuzzy tolerance, equivalence and \(T\)-equivalence relations. The fuzzy tolerance relations proposed by (Jensen and Shen, 2009) include three equations while (Hu, 2004) proposed five \(T_{cos}\)-transitive kernel functions as fuzzy \(T\)-equivalence relations. The simple algorithm of fuzzy equivalence relation is implemented as well. Furthermore, we facilitate users to define their own equation for similarity relation.

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 (Jensen and Shen, 2009). In order to represent the "tolerance" relation, we must set type.relation as follows:

    type.relation = c("tolerance", <chosen equation>)

    where the chosen equation called as t.similarity is one of the "eq.1", "eq.2", and "eq.3" equations which have been explained in Introduction-FuzzyRoughSets.

  • "transitive.kernel": It refers to the relations employing kernel functions (Genton, 2001). In order to represent the relation, we must set the type.relation parameter as follows.

    type.relation = c("transitive.kernel", <chosen equation>, <delta>)

    where the chosen equation is one of five following equations (called t.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\)

    and 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 the type.relation parameter as follows:

    type.relation = c("transitive.kernel", "gaussian", 0.2)

    If we omit the delta 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 set

    type.aggregation = c("t.tnorm", "t.cos").

  • "kernel.frst": It refers to \(T\)-equivalence relation proposed by (Hu, 2004). In order to represent the relation, we must set type.relation parameter as follows.

    type.relation = c("kernel.frst", <chosen equation>, <delta>)

    where the chosen equation is one of the kernel functions, but they have different names corresponding to previous ones: "gaussian.kernel", "exponential.kernel", "rational.kernel", "circular.kernel", and "spherical.kernel". And delta is a specified value. For example: let us assume we are going to use "gaussian.kernel" as its equation and the delta is 0.2. So, we assign the type.relation parameter as follows:

    type.relation = c("kernel.frst", "gaussian.kernel", 0.2)

    In this case, we do not need to define type of aggregation. Furthemore, regarding the distance used in the equations if objects \(x\) and \(y\) contains mixed values (nominal and continuous) then we use the Gower distance and we use the euclidean distance for continuous only.

  • "transitive.closure": It refers to similarity relation (also called fuzzy equivalence relation). 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,z), 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 (Naessens et al, 2002). Let "eq.1" be the \(R\) fuzzy relations, to define it as parameter is

    type.relation = c("transitive.closure", "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 parameter type.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 parameter FUN.relation.

    type.relation = c("custom", <FUN.relation>)

    The function FUN.relation should consist of three arguments which are decision.table, x, and y, where x and y represent two objects which we want to compare. It should be noted that the user must ensure that the values of this equation are always between 0 and 1. An example can be seen in Section Examples.

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", <t.tnorm operator>): It means we are using "t.tnorm" aggregation which is a triangular norm operator with a specified operator t.tnorm as follows:

    • "min": standard t-norm i.e., \(min(x_1, x_2)\).

    • "hamacher": hamacher product i.e., \((x_1 * x_2)/(x_1 + x_2 - x_1 * x_2)\).

    • "yager": yager class i.e., \(1 - min(1, ((1 - x_1) + (1 - x_2)))\).

    • "product": product t-norm i.e., \((x_1 * x_2)\).

    • "lukasiewicz": lukasiewicz's t-norm (default) i.e., \(max(x_2 + x_1 - 1, 0)\).

    • "t.cos": \(T_{cos}\)t-norm i.e., \(max(x_1 * x_2 - \sqrt{1 - x_1^2}\sqrt{1 - x_2^2, 0})\).

    • FUN.tnorm: It is a user-defined function for "t.tnorm". 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)

    The default value is type.aggregation = c("t.tnorm", "lukasiewicz").

  • type.aggregation = c("custom", <FUN.agg>): It is used to define our own function for a type of aggregations. <FUN.agg> 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: the number of object \(\times\) the 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 set type.aggregation as follows:

    type.aggregation = c("general.custom", <FUN.agg>). An example can be seen in Section Examples.

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.

References

M. Genton, "Classes of Kernels for Machine Learning: a Statistics Perspective", J. Machine Learning Research, vol. 2, p. 299 - 312 (2001).

H. Naessens, H. De Meyer, and B. De Baets, "Algorithms for the Computation of T-Transitive Closures", IEEE Trans. on Fuzzy Systems, vol. 10, No. 4, p. 541 - 551 (2002).

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).

See Also

BC.LU.approximation.FRST, BC.IND.relation.RST, BC.LU.approximation.RST,

and BC.positive.reg.FRST

Examples

Run this code
###########################################################
## 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, 
      indx.nominal = c(1: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, attributes = 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")
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.1 <- 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.1) 

## Calculate fuzzy indiscernibility relation: transitive.kernel
control.2 <- 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.2) 

## Calculate fuzzy indiscernibility relation: kernel.frst 
control.3 <- list(type.relation = c("kernel.frst", "gaussian.kernel", 0.2))
IND.3 <- BC.IND.relation.FRST(decision.table, attributes = attributes, 
                              control = control.3) 

## calculate fuzzy transitive closure
control.4 <- list(type.aggregation = c("t.tnorm", "lukasiewicz"), 
                    type.relation = c("transitive.closure", "eq.1"))
IND.4 <- BC.IND.relation.FRST(decision.table, attributes = attributes, 
                              control = control.4) 

## 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.5 <- list(type.aggregation = c("t.tnorm", "lukasiewicz"), 
                     type.relation = c("custom", FUN.relation))
IND.5 <- BC.IND.relation.FRST(decision.table, attributes = attributes, 
                              control = control.5) 

## In this case, we calculate aggregation as average of all objects 
## by executing the Reduce function
FUN.average <- function(data){
  	 return(Reduce("+", data)/length(data))
}
control.6 <- list(type.aggregation = c("custom", FUN.average), 
                     type.relation = c("tolerance", "eq.1"))
IND.6 <- BC.IND.relation.FRST(decision.table, attributes = attributes, 
                              control = control.6)

## 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.7 <- list(type.aggregation = c("t.tnorm", FUN.tnorm), 
                    type.relation = c("tolerance", "eq.1"))
IND.7 <- BC.IND.relation.FRST(decision.table, attributes = attributes, 
                              control = control.7) 

## Calculate fuzzy indiscernibility relation: kernel fuzzy rough set 
control.8 <- list(type.relation = c("kernel.frst", "gaussian.kernel", 0.2))
IND.8 <- BC.IND.relation.FRST(decision.table, attributes = attributes, 
                              control = control.8) 						   
##################################################################
## 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.9 <- list(type.aggregation = c("t.tnorm", "lukasiewicz"),
                    type.relation = c("tolerance", "eq.1"))
IND.9 <- BC.IND.relation.FRST(decision.table, attributes = attributes, control = control.9) 

Run the code above in your browser using DataLab