knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(DRSA)
library(tibble)

Introduction

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 and intelligent data analysis, Pawlak, Information Sciences, 2002.

Creating the decision table

We start by creating the decision table row-by-row as in the paper.

# Define short-cuts:
L = "Low"
M = "Medium"
H = "High"

decisionTable = tribble(
  ~Fact, ~SolarEnergy, ~VolcanicActivity, ~ResidualCO2, ~Temperature, ~DaysCount,
  1, M, H, L, H, 20,
  2, H, H, H, H, 30,
  3, M, L, H, H, 90,
  4, L, L, L, L, 120,
  5, H, H, M, H, 70,
  6, M, L, H, L, 34
)

decisionTable$Fact = as.character(decisionTable$Fact)

decisionTable$SolarEnergy = factor(decisionTable$SolarEnergy, levels = c("Low", "Medium", "High"), ordered = TRUE)
decisionTable$VolcanicActivity = factor(decisionTable$VolcanicActivity, levels = c("Low", "Medium", "High"), ordered = TRUE)
decisionTable$ResidualCO2 = factor(decisionTable$ResidualCO2, levels = c("Low", "Medium", "High"), ordered = TRUE)
decisionTable$Temperature = factor(decisionTable$Temperature, levels = c("Low", "Medium", "High"), ordered = TRUE)

Creating the meta-data

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,
  'Fact', 'object', NA_real_, NA_real_,

  'SolarEnergy', 'dominance', NA_real_, NA_real_,
  'VolcanicActivity', 'dominance', NA_real_, NA_real_,
  'ResidualCO2', 'dominance', NA_real_, NA_real_,
  'Temperature', 'decision', NA_real_, NA_real_,

  'DaysCount',  'miscellaneous', NA_real_, NA_real_
)

Creating the information table

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.

globalWarmingIT = InformationTable$new(decisionTable, metaData)
save(globalWarmingIT, file = "../data/globalWarmingIT.RData")

Calculating the rough sets

The class unions look like as follows:

classUnions = globalWarmingIT$classUnions()
convertMatrixToList(classUnions$upward, globalWarmingIT$objects)
convertMatrixToList(classUnions$downward, globalWarmingIT$objects)

Rough sets:

P = c("SolarEnergy", "VolcanicActivity", "ResidualCO2")
roughtSets = globalWarmingIT$roughSets(P)
convertMatrixToList(roughtSets$upward_U, globalWarmingIT$objects)
convertMatrixToList(roughtSets$upward_L, globalWarmingIT$objects)
convertMatrixToList(roughtSets$downward_U, globalWarmingIT$objects)
convertMatrixToList(roughtSets$downward_L, globalWarmingIT$objects)

Boundary regions:

boundary = globalWarmingIT$boundaryRegions(roughtSets)
convertMatrixToList(boundary$upward, globalWarmingIT$objects)
convertMatrixToList(boundary$downward, globalWarmingIT$objects)

Running the DOMLEM algorithm

domlem = DOMLEM$new(it = globalWarmingIT, P = P)
domlem$main()
print(domlem$rules)


jaspeir/NIJ_Tabitha documentation built on June 3, 2020, 12:38 a.m.