| support | R Documentation |
Counts support for itemsets represented by an itemMatrix or an associations object in a transactions data set.
support(x, transactions, ...)
## S4 method for signature 'itemMatrix'
support(
x,
transactions,
type = c("relative", "absolute"),
method = c("ptree", "tidlists"),
reduce = FALSE,
weighted = FALSE,
verbose = FALSE,
...
)
## S4 method for signature 'associations'
support(
x,
transactions,
type = c("relative", "absolute"),
method = c("ptree", "tidlists"),
reduce = FALSE,
weighted = FALSE,
verbose = FALSE,
...
)
x |
an itemMatrix or associations object containing the itemsets for which support is counted. |
transactions |
the transactions data set in which support is counted. |
... |
further arguments passed from the generic to a method. |
type |
return |
method |
support-counting method: |
reduce |
logical; remove unused items before prefix-tree counting? |
weighted |
logical; use transaction weights stored in the |
verbose |
logical; report progress and timing information? |
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.
An unnamed numeric vector of length length(x). Values are relative
supports when type = "relative" and counts or weight sums when
type = "absolute".
Michael Hahsler and Christian Buchta
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.