| pat_apriori | R Documentation |
Frequent itemsets and association rules using arules::apriori.
pat_apriori(
target = c("rules", "frequent itemsets"),
supp = 0,
conf = 0,
support_strategy = pat_support_threshold("curvature"),
confidence_strategy = pat_confidence_threshold(),
minlen = 2,
maxlen = 10,
lhs = NULL,
rhs = NULL,
include = NULL,
exclude = NULL,
quality_filter = NULL,
rule_filter = pat_rule_filter_none(),
control = NULL
)
target |
mining target: |
supp |
minimum support threshold. If |
conf |
minimum confidence threshold for rules. If |
support_strategy |
support threshold strategy created with |
confidence_strategy |
confidence threshold strategy created with |
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 |
rule_filter |
rule filter created with |
control |
list of control parameters |
returns a pat_apriori object
Agrawal, R. and Srikant, R. (1994). Fast Algorithms for Mining Association Rules in Large Databases. Proceedings of the 20th International Conference on Very Large Data Bases (VLDB), 487-499.
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,
conf = 0,
support_strategy = pat_support_threshold("curvature"),
confidence_strategy = pat_confidence_threshold("rhs_baseline", margin = 0.1),
minlen = 2,
maxlen = 3,
rhs = c("native-country=United-States"),
quality_filter = utils$quality_min(confidence = 0.9, lift = 1.03),
rule_filter = pat_rule_filter_interest(lift_min = 1),
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.