| pat_dara | R Documentation |
Rank attribute values whose ordering diverges between the dataset and discovered rules.
pat_dara(
data,
rules,
rhs_attr,
rhs_value = NULL,
attributes = NULL,
rule_weight = NULL
)
data |
Reference data frame. |
rules |
Tidy rule data frame produced by |
rhs_attr |
Right-hand-side attribute used by the mined rules. |
rhs_value |
Optional right-hand-side value used to restrict |
attributes |
Optional attributes to compare. Defaults to common columns in |
rule_weight |
Optional numeric column in |
DARA compares two value-frequency orderings for each explanatory attribute:
the ordering in a reference dataset, optionally restricted to a right-hand-side
value, and the ordering in a table of association rules. The right-hand-side
attribute is required so it can be excluded from explanatory divergence.
The returned counter c increases for values that are more prominent in rules
than in the reference data and decreases for values that are less prominent in
rules.
A list of per-attribute data frames with columns value, dataset, rules, and c.
Baroni, L., Salles, R., Salles, S., Guedes, G., Porto, F., Bezerra, E., Barcellos, C., Pedroso, M., & Ogasawara, E. (2020). An analysis of malaria in the Brazilian Legal Amazon using divergent association rules. Journal of Biomedical Informatics, 108, 103512.
The canonical implementation is maintained in the Python pydaltoolbox port; this is a
backport of it.
if (requireNamespace("arules", quietly = TRUE)) {
data("AdultUCI", package = "arules")
data <- as.data.frame(AdultUCI)
data <- data[, c("workclass", "education", "marital-status", "occupation", "income")]
pm <- fit(pat_apriori(target = "rules", supp = 0.05, conf = 0.6, rhs = "income=small"), data)
rules <- pat_rules_tidy(discover(pm, data), transactions = data, item_columns = colnames(data))
ranking <- pat_dara(data, rules, rhs_attr = "income", rhs_value = "small")
ranking[["marital-status"]]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.