Description Details Author(s) References Examples
This part contains global explanations about the implementation and use of the RoughSets
package.
The package RoughSets
attempts to provide a complete tool to model and analyze
information systems based on rough set theory (RST) and fuzzy rough set theory (FRST).
From fundamental point of view, this package allows to construct rough sets by defining lower and upper approximations.
Furthermore, recent methods for tackling common tasks in data mining, such as data preprocessing (e.g., discretization, feature selection, missing value completion,
and instance selection), rule induction, and prediction classes or decision values of new datasets
are available as well.
There are two main parts considered in this package which are RST and FRST.
RST was introduced by (Pawlak, 1982; Pawlak, 1991) which provides sophisticated mathematical tools to model
and analyze information systems that involve uncertainty and imprecision. By employing indiscernibility relation among objects, RST does not require
additional parameters to extract information.
The detailed explanation about fundamental concepts of RST can be read in Section A.IntroductionRoughSets
. Secondly, FRST, an extension of
RST, was introduced by (Dubois and Prade, 1990) as a combination between
fuzzy sets proposed by (Zadeh, 1965) and RST. This concept allows to analyze continuous attributes without
performing discretization on data first. Basic concepts of FRST
can be seen in B.IntroductionFuzzyRoughSets
.
Based on the above concepts, many methods have been proposed and applied for dealing with several different domains. In order to solve the problems, methods employ the indiscernibility relation and lower and upper approximation concepts. All methods that have been implemented in this package will be explained by grouping based on their domains. The following is a list of domains considered in this package:
Basic concepts: This part, we can divide into four different tasks which are
indiscernibility relation, lower and upper approximations, positive region and discernibility matrix.
All of those tasks have been explained briefly in Section A.IntroductionRoughSets
and
B.IntroductionFuzzyRoughSets
.
Discretization: It is used to convert realvalued attributes into nominal/symbolic ones in an information system. In RST point of view, this task attempts to maintain the discernibility between objects.
Feature selection: It is a process for finding a subset of features which have the same quality as the complete feature set.
In other words, its purpose is to select the significant features and eliminate the dispensible ones.
It is a useful and necessary process when we are facing datasets containing large numbers of features. From RST and FRST perspective,
feature selection refers to searching superreducts and reducts. The detailed information about reducts can be read in
A.IntroductionRoughSets
and B.IntroductionFuzzyRoughSets
.
Instance selection: This process is aimed to remove noisy, superfluous, or inconsistent instances from training datasets but retain consistent ones. In other words, good accuracy of classification is achieved by removing instances which do not give positive contributions.
Prediction/classification: This task is used to predict decision values of a new dataset (test data). We consider implementing some methods to perform this task, such as fuzzyrough nearest neighbor approaches, etc.
Rule induction: This task refers to generate IF  THEN rules. The rule represents knowledge which is contained in a dataset. One advantage of building rules is that naturally the model is easy to interpret. Then, predicted values over new datasets can be determined by considering the rules.
As we mentioned before, we have embedded many wellknown algorithms or techniques for handling the above domains. The algorithms were considered
since experimentally it has been proven that they were able to tackle complex tasks. They are implemented as functions that were organized
to work with the same data structures. So, users can perform various approaches for a particular task easily and then compare their results.
In order to be recognized quickly, generally we have chosen the names of the functions with some conventions. The names contain three parts
which are prefix
, suffix
, and middle
that are separated by a point. The following is a description of each
part.
prefix
: There are some different prefixes for names of functions expressing a kind of task to be performed.
The function names with prefix BC
refer to basic concepts which means that the functions are created for
implementing the basic concepts of RST and FRST.
While prefix D
refers to discretization, FS
, IS
, RI
, MV
, and C
refer to feature selection,
instance selection, rule induction, missing value completion, and classifier based on nearest neighbor domains. Furthermore, SF
and X
mean that
functions are used as supporting functions which are not related directly with RST and FRST and auxiliary functions which are called as a parameter.
suffix
: It is located at the end of names. There are two types available: RST
and FRST
. RST
represents rough set theory
while FRST
shows that the function is applied to fuzzy rough set theory. Additionally, some functions that do not have
RST
or FRST
suffix are used for both theories.
middle
: All other words in the middle of the names are used to express the actual name of a particular method/algorithm or functionality.
In this case, it could consist of more than one word separated by points.
For instance, the function BC.IND.relation.RST
is used to calculate the indiscernibility relation which is one of the basic concepts of RST.
Other functions that have names not based on the above rules are S3 functions e.g., summary
and predict
which are
used to summarize objects and predict new data, respectively.
The following description explains domains and their algorithms implemented in the package:
The implementations of RST: This part outlines some considered algorihtms/methods based on RST. The approaches can be classified based on their tasks as follows:
The basic concepts: The following is a list showing tasks and their implementations as functions.
Indiscernibility relation: It is a relation determining whether two objects are indiscernible by some attributes.
It is implemented in BC.IND.relation.RST
.
Lower and upper approximations: These approximations show whether objects can be classified with certainty or not.
It is implemented in BC.LU.approximation.RST
.
Positive region: It is used to determine objects that are included in positive region and the degree of dependency.
It is implemented in BC.positive.reg.RST
.
Discernibility matrix: It is used to create a discernibility matrix showing attributes that discern each pair of objects.
It is implemented in BC.discernibility.mat.RST
.
Discretization: There are a few methods included in the package:
D.global.discernibility.heuristic.RST
: It implements the global discernibility algorithm
which is computing globally semioptimal cuts using the maximum discernibility heuristic.
D.discretize.quantiles.RST
: It is a function used for computing cuts of the "quantilebased" discretization into n intervals.
D.discretize.equal.intervals.RST
: It is a function used for computing cuts of the "equal interval size" discretization into n intervals.
The output of these functions is a list of cut values which are the values for converting real to nominal values.
So, in order to generate a new decision table according to the cut values, we need to call SF.applyDecTable
.
Additionally, we have implemented D.discretization.RST
as a wrapper function collecting all methods considered to perform discretization tasks.
Feature selection: According to its output, it can be classified into the following groups:
Feature subset: It refers to a superreduct which is not necessarily minimal. In other words, the methods in this group might generate just a subset of attributes.
QuickReduct algorithm: It has been implemented in FS.quickreduct.RST
.
Superreduct generation: It is based on some criteria: entropy, gini index, discernibility measure, size of positive region.
It is implemented in FS.greedy.heuristic.superreduct.RST
.
Furthermore, we provide a wrapper function FS.feature.subset.computation
in order to give a user interface for many methods of RST and FRST that are included in this group.
Reduct: The following are methods that produce a single decision reduct:
Reduct generation based on criteria: It is based on different criteria which are
entropy, gini index, discernibility measure, size of positive region.
It has been implemented in FS.greedy.heuristic.reduct.RST
.
Permutation reduct: It is based on a permutation schema over all attributes.
It has been implemented in FS.permutation.heuristic.reduct.RST
.
Furthermore, we provide a wrapper function FS.reduct.computation
in order to give a user interface toward many methods of RST and FRST that are included in this group.
All reducts: In order to generate all reducts, we execute FS.all.reducts.computation
. However,
before doing that, we need to call BC.discernibility.mat.RST
for
constructing a decisionrelative discernibility matrix
It should be noted that the outputs of the functions are decision reducts. So, for generating a new decision table according to the decision reduct,
we need to call SF.applyDecTable
.
Rule induction: We provide several functions used to generate rules, as follows:
The function RI.indiscernibilityBasedRules.RST
: This function requires the output of the feature selection functions.
The function RI.CN2Rules.RST
: It is a rule induction method based on the CN2 algorithm.
The function RI.LEM2Rules.RST
: It implements a rule induction method based on the LEM2 algorithm.
The function RI.AQRules.RST
: It is a rule induction based on the AQstyle algorithm.
After obtaining the rules, we execute predict.RuleSetRST
considering our rules and given newdata/testing data to obtain predicted values/classes.
The implementations of FRST: As in the RST
part, this part contains several algorithms that can be classified into several groups based on their purpose.
The following is a description of all methods that have been implemented in functions:
Basic concepts: The following is a list showing tasks and their implementations:
Indiscernibility relations: they are fuzzy relations determining to which degree two objects are similar.
This package provides several types of relations which are implemented in a single function
called BC.IND.relation.FRST
. We consider several types of relations e.g.,
fuzzy equivalence, tolerance, and Tsimilarity relations. These relations can be chosen by
assigning type.relation
. Additionally, in this function, we provide several options to
calculate aggregation e.g., triangular norm operators (e.g., "lukasiewicz"
, "min"
, etc)
and userdefined operators.
Lower and upper approximations: These approximations show to what extent objects can be classified with certainty or not. This task has been implemented in
BC.LU.approximation.FRST
. There are many approaches available in this package that can be selected by assigning the parameter type.LU
.
The considered methods are
implication/tnorm, βprecision fuzzy rough sets (βPFRS), vaguely quantified rough sets (VQRS), fuzzy variable precision rough sets (FVPRS), ordered weighted average (OWA),
soft fuzzy rough sets (SFRS), and robust fuzzy rough sets (RFRS). Furthermore, we provide a facility, which is "custom"
, where users can create their own approximations by
defining functions to calculate lower and upper approximations. Many options to calculate implicator and triangular norm are also available.
Positive region: It is used to determine the membership degree of each object to the positive region and the degree of dependency.
It is implemented in BC.positive.reg.FRST
.
Discernibility matrix: It is used to construct the decisionrelative discernibility matrix. There are some approaches to construct the matrix,
e.g., based on standard approach, Gaussian reduction, alpha reduction, and minimal element in discernibility matrix. They have been implemented
in BC.discernibility.mat.FRST
.
Feature selection: According to the output of functions, we may divide them into three groups: those that produce a superreduct, a set of reducts, or a single reduct. The following is a description of functions based on their types:
Feature subset: It refers to methods which produce a superreduct which is not necessarily a reduct. In other words methods in this group might generate just a subset of attributes. The following is a complete list of methods considered in this package:
positive region based algorithms: It refers to
positive regions, as a way to evaluate attributes to be selected. They are implemented in FS.quickreduct.FRST
.
Furthermore, we provide several different measures based on the positive region in this function.
All methods included in this part employ the QuickReduct algorithm to obtain selected features.
In order to choose a particular algorithm, we need to assign parameter type.method
in FS.quickreduct.FRST
.
boundary region based algorithm: This algorithm is based on the membership degree to the fuzzy boundary region.
This algorithm has been implemented in FS.quickreduct.FRST
.
Furthermore, we provide a wrapper function FS.feature.subset.computation
in order to give a user interface for many methods of RST and FRST.
Reduct: It refers to a method that produces a single decision reduct. We provide one algorithm which is the nearoptimal reduction proposed by Zhao et al.
It is implemented in FS.nearOpt.fvprs.FRST
.
Furthermore, we provide a wrapper function FS.reduct.computation
in order to provide a user interface toward many methods of RST and FRST.
All reducts: In order to get all decision reducts, we execute FS.all.reducts.computation
. However, before doing that, we firstly execute the BC.discernibility.mat.FRST
function for
constructing a decisionrelative discernibility matrix.
The output of the above methods is a class containing a decision reduct/feature subset and other descriptions.
For generating a new decision table according to the decision reduct, we provide the function SF.applyDecTable
.
Rule induction: It is a task used to generate rules representing knowledge of a decision table. Commonly, this process is called learning phase in machine learning. The following methods are considered to generate rules:
RI.hybridFS.FRST
: It combines fuzzyrough rule induction
and feature selection.
RI.GFRS.FRST
: It refers to rule induction based on generalized fuzzy rough sets (GFRS).
After generating rules, we can use them to predict decision values/classes of new data
by executing the S3 function predict.RuleSetFRST
.
Instance selection: The following functions select instances to improve accuracy by removing noisy, superfluous or inconsistent ones from training datasets.
IS.FRIS.FRST
: It refers to the fuzzy rough instance selection (FRIS). It evaluates the degree of membership to the positive region of each instance.
If an instance's membership degree is less than the threshold, then the instance can be removed.
IS.FRPS.FRST
: It refers to the fuzzyrough prototype selection (FRPS). It employs prototype selection (PS) to improve the accuracy of the $k$nearest neighbor (kNN) method.
We provide the function SF.applyDecTable
that is used to generate a new decision table according to the output of instance selection functions.
Fuzzyrough nearest neighbors: This part provides methods based on nearest neighbors for predicting decision values/classes of new datasets. In other words, by supplying a decision table as training data we can predict decision values of new data at the same time. We have considered the following methods:
C.FRNN.FRST
: It refers to the fuzzyrough nearest neighbors based on Jensen and Cornelis' technique.
C.FRNN.O.FRST
: It refers to the fuzzyrough ownership nearest neighbor algorithm based on Sarkar's method.
C.POSNN.FRST
: The positive region based fuzzyrough nearest neighbor algorithm based on Verbiest et al's technique.
Furthermore, we provide an additional feature which is missing value completion. Even though algorithms, included in this feature, are not based on RST and FRST, they will be usefull to do data analysis. The following is a list of functions implemented for handling missing values in the data preprocessing step:
MV.deletionCases
: it refers to the approach deleting instances.
MV.mostCommonValResConcept
: it refers to the approach based on the most common value or mean of an attribute restricted to a concept.
MV.mostCommonVal
: it refers to the approach replacing missing attribute values by the attribute mean or common values.
MV.globalClosestFit
: it refers to the approach based on the global closest fit approach.
MV.conceptClosestFit
: it refers to the approach based on the concept closest fit approach.
Additionally, we provide a wrapper function which is MV.missingValueCompletion
in order to give a user interface for the methods.
To get started with the package, the user can have a look at the examples included in the documentation on each function. Additionally, to show general usage of the package briefly, we also provide some examples showing general usage in this section.
If you have problems using the package, find a bug, or have suggestions, please contact the package maintainer by email, instead of writing to the general R lists or to other internet forums and mailing lists.
There are many demos that ship with the package. To get a list of them, type:
demo()
Then, to start a demo, type demo(<demo_name_here>)
. All the demos are presented as
R scripts in the package sources in the "demo" subdirectory.
Currently, there are the following demos available:
Basic concepts of RST and FRST:
demo(BasicConcept.RST)
,
demo(BasicConcept.FRST)
,
demo(DiscernibilityMatrix.RST)
,
demo(DiscernibilityMatrix.FRST)
.
Discretization based on RST:
demo(D.local.discernibility.matrix.RST)
,
demo(D.max.discernibility.matrix.RST)
,
demo(D.global.discernibility.heuristic.RST)
,
demo(D.discretize.quantiles.RST)
,
demo(D.discretize.equal.intervals.RST)
.
Feature selection based on RST:
demo(FS.permutation.heuristic.reduct.RST)
,
demo(FS.quickreduct.RST)
,
demo(FS.greedy.heuristic.reduct.RST)
,
demo(FS.greedy.heuristic.reduct.RST)
.
Feature selection based on FRST:
demo(FS.QuickReduct.FRST.Ex1)
,
demo(FS.QuickReduct.FRST.Ex2)
,
demo(FS.QuickReduct.FRST.Ex3)
,
demo(FS.QuickReduct.FRST.Ex4)
,
demo(FS.QuickReduct.FRST.Ex5)
,
demo(FS.nearOpt.fvprs.FRST)
.
Instance selection based on FRST:
demo(IS.FRIS.FRST)
,
demo(IS.FRPS.FRST)
Classification using the Iris dataset:
demo(FRNN.O.iris)
,
demo(POSNN.iris)
,
demo(FRNN.iris)
.
Rule induction based on RST:
demo(RI.indiscernibilityBasedRules.RST)
.
Rule induction based on FRST:
demo(RI.classification.FRST)
,
demo(RI.regression.FRST)
.
Missing value completion:
demo(MV.simpleData)
.
Some decision tables have been embedded in this package which can be seen in
RoughSetData
.
Finally, you may visit the package webpage http://sci2s.ugr.es/dicits/software/RoughSets, where we provide a more extensive introduction as well as additional explanations of the procedures.
Lala Septem Riza [email protected]i.ugr.es,
Andrzej Janusz [email protected],
Chris Cornelis [email protected],
Francisco Herrera [email protected],
Dominik Slezak [email protected],
and Jose Manuel Benitez [email protected]
DiCITS Lab, SCI2S group, CITICUGR, DECSAI, University of Granada,
http://dicits.ugr.es, http://sci2s.ugr.es
Institute of Mathematics, University of Warsaw.
D. Dubois and H. Prade, "Rough Fuzzy Sets and Fuzzy Rough Sets", International Journal of General Systems, vol. 17, p. 91  209 (1990).
L.A. Zadeh, "Fuzzy Sets", Information and Control, vol. 8, p. 338  353 (1965).
Z. Pawlak, "Rough Sets", International Journal of Computer and Information System, vol. 11, no. 5, p. 341  356 (1982).
Z. Pawlak, "Rough Sets: Theoretical Aspects of Reasoning About Data, System Theory, Knowledge Engineering and Problem Solving", vol. 9, Kluwer Academic Publishers, Dordrecht, Netherlands (1991).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171  ##############################################################
## A.1 Example: Basic concepts of rough set theory
##############################################################
## Using hiring data set, see RoughSetData
data(RoughSetData)
decision.table < RoughSetData$hiring.dt
## define considered attributes which are first, second, and
## third attributes
attr.P < c(1,2,3)
## compute indiscernibility relation
IND < BC.IND.relation.RST(decision.table, feature.set = attr.P)
## compute lower and upper approximations
roughset < BC.LU.approximation.RST(decision.table, IND)
## Determine regions
region.RST < BC.positive.reg.RST(decision.table, roughset)
## The decisionrelative discernibility matrix and reduct
disc.mat < BC.discernibility.mat.RST(decision.table, range.object = NULL)
##############################################################
## A.2 Example: Basic concepts of fuzzy rough set theory
##############################################################
## Using pima7 data set, see RoughSetData
data(RoughSetData)
decision.table < RoughSetData$pima7.dt
## In this case, let us consider the first and second attributes
conditional.attr < c(1, 2)
## We are using the "lukasiewicz" tnorm and the "tolerance" relation
## with "eq.1" as fuzzy similarity equation
control.ind < list(type.aggregation = c("t.tnorm", "lukasiewicz"),
type.relation = c("tolerance", "eq.1"))
## Compute fuzzy indiscernibility relation
IND.condAttr < BC.IND.relation.FRST(decision.table, attributes = conditional.attr,
control = control.ind)
## Compute fuzzy lower and upper approximation using type.LU : "implicator.tnorm"
## Define index of decision attribute
decision.attr = c(9)
## Compute fuzzy indiscernibility relation of decision attribute
## We are using "crisp" for type of aggregation and type of relation
control.dec < list(type.aggregation = c("crisp"), type.relation = "crisp")
IND.decAttr < BC.IND.relation.FRST(decision.table, attributes = decision.attr,
control = control.dec)
## Define control parameter containing type of implicator and tnorm
control < list(t.implicator = "lukasiewicz", t.tnorm = "lukasiewicz")
## Compute fuzzy lower and upper approximation
FRST.LU < BC.LU.approximation.FRST(decision.table, IND.condAttr, IND.decAttr,
type.LU = "implicator.tnorm", control = control)
## Determine fuzzy positive region and its degree of dependency
fuzzy.region < BC.positive.reg.FRST(decision.table, FRST.LU)
###############################################################
## B Example : Data analysis based on RST and FRST
## In this example, we are using wine dataset for both RST and FRST
###############################################################
## Load the data
## Not run: data(RoughSetData)
dataset < RoughSetData$wine.dt
## Shuffle the data with set.seed
set.seed(5)
dt.Shuffled < dataset[sample(nrow(dataset)),]
## Split the data into training and testing
idx < round(0.8 * nrow(dt.Shuffled))
wine.tra <SF.asDecisionTable(dt.Shuffled[1:idx,],
decision.attr = 14, indx.nominal = 14)
wine.tst < SF.asDecisionTable(dt.Shuffled[
(idx+1):nrow(dt.Shuffled), ncol(dt.Shuffled)])
## DISCRETIZATION
cut.values < D.discretization.RST(wine.tra,
type.method = "global.discernibility")
d.tra < SF.applyDecTable(wine.tra, cut.values)
d.tst < SF.applyDecTable(wine.tst, cut.values)
## FEATURE SELECTION
red.rst < FS.feature.subset.computation(d.tra,
method="quickreduct.rst")
fs.tra < SF.applyDecTable(d.tra, red.rst)
## RULE INDUCTION
rules < RI.indiscernibilityBasedRules.RST(d.tra,
red.rst)
## predicting newdata
pred.vals < predict(rules, d.tst)
#################################################
## Examples: Data analysis using the wine dataset
## 2. Learning and prediction using FRST
#################################################
## FEATURE SELECTION
reduct < FS.feature.subset.computation(wine.tra,
method = "quickreduct.frst")
## generate new decision tables
wine.tra.fs < SF.applyDecTable(wine.tra, reduct)
wine.tst.fs < SF.applyDecTable(wine.tst, reduct)
## INSTANCE SELECTION
indx < IS.FRIS.FRST(wine.tra.fs,
control = list(threshold.tau = 0.2, alpha = 1))
## generate a new decision table
wine.tra.is < SF.applyDecTable(wine.tra.fs, indx)
## RULE INDUCTION (Rulebased classifiers)
control.ri < list(
type.aggregation = c("t.tnorm", "lukasiewicz"),
type.relation = c("tolerance", "eq.3"),
t.implicator = "kleene_dienes")
decRules.hybrid < RI.hybridFS.FRST(wine.tra.is,
control.ri)
## predicting newdata
predValues.hybrid < predict(decRules.hybrid,
wine.tst.fs)
#################################################
## Examples: Data analysis using the wine dataset
## 3. Prediction using fuzzy nearest neighbor classifiers
#################################################
## using FRNN.O
control.frnn.o < list(m = 2,
type.membership = "gradual")
predValues.frnn.o < C.FRNN.O.FRST(wine.tra.is,
newdata = wine.tst.fs, control = control.frnn.o)
## Using FRNN
control.frnn < list(type.LU = "implicator.tnorm",k=20,
type.aggregation = c("t.tnorm", "lukasiewicz"),
type.relation = c("tolerance", "eq.1"),
t.implicator = "lukasiewicz")
predValues.frnn < C.FRNN.FRST(wine.tra.is,
newdata = wine.tst.fs, control = control.frnn)
## calculating error
real.val < dt.Shuffled[(idx+1):nrow(dt.Shuffled),
ncol(dt.Shuffled), drop = FALSE]
err.1 < 100*sum(pred.vals!=real.val)/nrow(pred.vals)
err.2 < 100*sum(predValues.hybrid!=real.val)/
nrow(predValues.hybrid)
err.3 < 100*sum(predValues.frnn.o!=real.val)/
nrow(predValues.frnn.o)
err.4 < 100*sum(predValues.frnn!=real.val)/
nrow(predValues.frnn)
cat("The percentage error = ", err.1, "\n")
cat("The percentage error = ", err.2, "\n")
cat("The percentage error = ", err.3, "\n")
cat("The percentage error = ", err.4, "\n")
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.