fcaR
library(arules)
library(fcaR)
data("Mushroom", package = "arules")
head(Mushroom)
## transactions in sparse format with
## 6 transactions (rows) and
## 114 items (columns)
fc_planets <- FormalContext$new(planets)
fc <- FormalContext$new(Mushroom)
fc
## FormalContext with 8124 objects and 114 attributes.
## Class=edible Class=poisonous CapShape=bell CapShape=conical CapShape=flat
## 1 X
## 2 X
## 3 X X
## 4 X
## 5 X
## 6 X
## 7 X X
## 8 X X
## 9 X
## 10 X X
## Other attributes are: CapShape=knobbed, CapShape=sunken, CapShape=convex,
## CapSurf=fibrous, CapSurf=grooves, CapSurf=smooth, ...
fc_planets$to_transactions()
## transactions in sparse format with
## 9 transactions (rows) and
## 7 items (columns)
mushroom_rules <- apriori(Mushroom, parameter = list(conf = 1),
control = list(verbose = FALSE))
fc$implications$add(mushroom_rules)
fc_planets$find_implications()
fc_planets$implications$to_arules(quality = TRUE)
## set of 10 rules
