knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(DRSA) library(tibble)
In this vignette we give an introduction to using the DOMLEM algorithm for a small dataset from the literature. We consider a dataset from the following paper: Rough sets methodology for sorting problems in presence of multiple attributes and criteria, Greco et al., EJOR, 2002.
We start by creating the decision table row-by-row as in the paper.
decisionTable = tribble( ~Warehouse, ~A1, ~A2, ~A3, ~d, 'w1', 'Medium', 'A', 500, 'Loss', 'w2', 'Good', 'A', 400, 'Profit', 'w3', 'Medium', 'A', 450, 'Profit', 'w4', 'Good', 'B', 400, 'Loss', 'w5', 'Good', 'B', 475, 'Profit', 'w6', 'Medium', 'B', 425, 'Profit', 'w7', 'Medium', 'B', 350, 'Profit', 'w8', 'Medium', 'B', 350, 'Loss' ) decisionTable$A1 = factor(decisionTable$A1, levels = c("Medium", "Good"), ordered = TRUE) decisionTable$d = factor(decisionTable$d, levels = c("Loss", "Profit"), ordered = TRUE)
We continue by creating the meta-data of our dataset. It contains important details of the attributes in our dataset. The meta-data has to be provided as a data-frame containing one row for each attribute. With respect to A1, ‘‘good’’ is better than ‘‘medium’’, while with respect to A2 and A3 no preference is expressed on their domains. More- over, for attribute A2, the classical indiscernibility relation is considered, and for attribute A3, a similarity relation is defined such that alpha = 0.1, and beta = 0.0:
metaData = tribble( ~name, ~type, ~alpha, ~beta, 'Warehouse', 'object', NA, NA, 'A1', 'dominance', NA, NA, 'A2', 'indiscernibility', NA, NA, 'A3', 'similarity', 0.1, 0.0, 'd', 'decision', NA, NA )
Finally, we have everything we need to create an information table. We simply provide the decision table and the meta-data to the constructor of the InformationTable
class.
warehouseIT = InformationTable$new(decisionTable, metaData) save(warehouseIT, file = "../data/warehouseIT.RData")
The class unions look like as follows:
classUnions = warehouseIT$classUnions() convertMatrixToList(classUnions$upward, warehouseIT$objects) convertMatrixToList(classUnions$downward, warehouseIT$objects)
Rough sets:
P = c("A1", "A2", "A3") roughtSets = warehouseIT$roughSets(P) convertMatrixToList(roughtSets$upward_U, warehouseIT$objects) convertMatrixToList(roughtSets$upward_L, warehouseIT$objects) convertMatrixToList(roughtSets$downward_U, warehouseIT$objects) convertMatrixToList(roughtSets$downward_L, warehouseIT$objects)
Boundary regions:
boundary = warehouseIT$boundaryRegions(roughtSets) convertMatrixToList(boundary$upward, warehouseIT$objects) convertMatrixToList(boundary$downward, warehouseIT$objects)
domlem = DOMLEM$new(it = warehouseIT, P = P) domlem$main() print(domlem$rules)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.