if (FALSE) {
data(Adult)
# list available algorithms
fim4r()
# mine association rules with FPgrowth
r <- fim4r(Adult,
method = "fpgrowth",
target = "rules", supp = .7, conf = .8
)
r
inspect(head(r, by = "lift"))
# mine closed itemsets with Carpenter or IsTa
fim4r(Adult,
method = "carpenter",
target = "closed", supp = .7
)
fim4r(Adult,
method = "ista",
target = "closed", supp = .7
)
# mine frequent itemset of length 2 (zmin and zmax = 2)
freq_2 <- fim4r(Adult,
method = "relim", target = "frequent", supp = .7,
zmin = 2, zmax = 2
)
inspect(freq_2)
# mine maximal frequent itemsets
mfis <- fim4r(Adult, method = "sam", target = "maximal", supp = .7)
inspect(mfis)
# Examples for how to use item appearance with apriori, eclat,
# fpgrowth in fim4r. We first mine all rules.
inspect(fim4r(Adult,
method = "fpgrowth",
target = "rules", supp = .8
))
# ignore item "capital-gain=None"
inspect(fim4r(Adult,
method = "fpgrowth",
target = "rules", supp = .8,
appear = list(c("capital-gain=None"), c("-"))
))
# "capital-gain=None" cannot appear in consequent (antecedent only)
inspect(fim4r(Adult,
method = "fpgrowth",
target = "rules", supp = .8,
appear = list(c("capital-gain=None"), c("a"))
))
# "capital-gain=None" cannot appear in the antecedent
inspect(fim4r(Adult,
method = "fpgrowth",
target = "rules", supp = .8,
appear = list(c("capital-gain=None"), c("c"))
))
# restrict the consequent to the item "capital-gain=None".
# That is, "" = all items can only appear in the antecedent with the
# exception that "capital-gain=None" can only appear in the consequent.
inspect(fim4r(Adult,
method = "fpgrowth",
target = "rules", supp = .8,
appear = list(c("", "capital-gain=None"), c("a", "c"))
))
}
Run the code above in your browser using DataLab