Learn R Programming

arules (version 1.3-1)

APappearance-class: Class ``APappearance'' --- Specifying the `appearance' Argument of apriori() to Implement Rule Templates

Description

Specifies the restrictions on the associations mined by apriori. These restrictions can implement certain aspects of rule templates described by Klemettinen (1994). Note that appearance is only supported by the implementation of apriori.

Arguments

References

Christian Borgelt (2004) Apriori --- Finding Association Rules/Hyperedges with the Apriori Algorithm. www.borgelt.net/apriori.html

M. Klemettinen, H. Mannila, P. Ronkainen, H. Toivonen and A. I. Verkamo (1994). Finding Interesting Rules from Large Sets of Discovered Association Rules. In Proceedings of the Third International Conference on Information and Knowledge Management, 401--407.

See Also

apriori

Examples

Run this code
data("Adult")

## find only frequent itemsets which do not contain  small or large income
is <- apriori(Adult, parameter = list(support= 0.1, target="frequent"), 
  appearance = list(none = c("income=small", "income=large"),
  default="both"))
itemFrequency(items(is))["income=small"]
itemFrequency(items(is))["income=large"]

## find itemsets that only contain small or large income and young age
is <- apriori(Adult, parameter = list(support= 0.1, target="frequent"), 
  appearance = list(items = c("income=small", "income=large", "age=Young"),
  default="none"))
inspect(head(is))
  
## find only rules with small or large income in the right-hand-side.
rules <- apriori(Adult, parameter = list(support=0.2, confidence = 0.5), 
  appearance = list(rhs = c("income=small", "income=large"),
  default="lhs"))
inspect(head(rules))

## for more complicated restrictions you have to mine all rules/itemsets and
## then filter the results afterwards

Run the code above in your browser using DataLab