| pat_apriori | R Documentation |
Frequent itemsets and association rules using arules::apriori.
pat_apriori(
target = c("rules", "frequent itemsets"),
supp = 0.5,
conf = 0.9,
minlen = 2,
maxlen = 10,
lhs = NULL,
rhs = NULL,
include = NULL,
exclude = NULL,
quality_filter = NULL,
control = NULL
)
target |
mining target: |
supp |
minimum support threshold |
conf |
minimum confidence threshold for rules |
minlen |
minimum pattern length |
maxlen |
maximum pattern length |
lhs |
optional vector of items constrained to the left-hand side of rules |
rhs |
optional vector of items constrained to the right-hand side of rules |
include |
optional vector of items allowed in the discovered patterns |
exclude |
optional vector of items forbidden in the discovered patterns |
quality_filter |
optional quality filter created with |
control |
list of control parameters |
returns a pat_apriori object
if (requireNamespace("arules", quietly = TRUE)) {
data("AdultUCI", package = "arules")
trans <- suppressWarnings(methods::as(as.data.frame(AdultUCI), "transactions"))
utils <- patutils()
pm <- pat_apriori(
target = "rules",
supp = 0.2,
conf = 0.85,
minlen = 2,
maxlen = 3,
rhs = c("native-country=United-States"),
quality_filter = utils$quality_min(confidence = 0.9, lift = 1.03),
control = list(verbose = FALSE)
)
pm <- fit(pm, trans)
rules <- suppressWarnings(discover(pm, trans))
eval <- evaluate(pm, rules)
eval$metrics
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.