Counts support for itemsets represented by an itemMatrix or an associations object in a transactions data set.
support(x, transactions, ...)# S4 method for itemMatrix
support(
x,
transactions,
type = c("relative", "absolute"),
method = c("ptree", "tidlists"),
reduce = FALSE,
weighted = FALSE,
verbose = FALSE,
...
)
# S4 method for associations
support(
x,
transactions,
type = c("relative", "absolute"),
method = c("ptree", "tidlists"),
reduce = FALSE,
weighted = FALSE,
verbose = FALSE,
...
)
An unnamed numeric vector of length length(x). Values are relative
supports when type = "relative" and counts or weight sums when
type = "absolute".
an itemMatrix or associations object containing the itemsets for which support is counted.
the transactions data set in which support is counted.
further arguments passed from the generic to a method.
return "relative" support or "absolute" counts (or summed
weights when weighted = TRUE).
support-counting method: "ptree" or "tidlists".
logical; remove unused items before prefix-tree counting?
logical; use transaction weights stored in the weight
column of transactionInfo()?
logical; report progress and timing information?
Michael Hahsler and Christian Buchta
Normally, the support of frequent itemsets is counted efficiently during the
mining process using a minimum support threshold.
However, if only the support for specific itemsets (maybe itemsets with very low support)
is needed, or the support of a set of itemsets needs to be recalculated on
different transactions than they were mined on, then support() can be used.
Several methods for support counting are available:
"ptree" (default method): The counters for the itemsets
are organized in a prefix tree. The transactions are sequentially processed
and the corresponding counters in the prefix tree are incremented (see
Hahsler et al, 2008). This method is used by default since it is typically
significantly faster than transaction ID list intersection.
"tidlists": Support is counted using
transaction ID list intersection which is used by several fast mining
algorithms (e.g., by Eclat). However, support is determined for each itemset
individually which is slow for a large number of long itemsets in dense
data.
The item coding of x and transactions is reconciled using item labels.
Items that occur only in transactions do not affect the count. With
reduce = TRUE, unused items are removed before prefix-tree counting.
Weighted support uses the numeric weight column in
transactionInfo(transactions). Absolute weighted support is the sum of the
weights of supporting transactions; relative weighted support divides this
value by the sum of all transaction weights.
Michael Hahsler, Christian Buchta, and Kurt Hornik. Selective association rule generation. Computational Statistics, 23(2):303-315, April 2008.
Other interest measures:
confint,
coverage(),
interestMeasure(),
is.redundant(),
is.significant()
data("Income")
## find and some frequent itemsets
itemsets <- eclat(Income)[1:5]
## inspect the support returned by eclat
inspect(itemsets)
## count support in the database
support(items(itemsets), Income)
support(itemsets, Income, type = "absolute")
Run the code above in your browser using DataLab