rules-class

0th

Percentile

Class rules --- A Set of Rules

The rules class represents a set of rules.

Note that the class can also represent a multiset of rules with duplicated elements. Duplicated elements can be removed with unique.

Keywords
classes
Objects from the Class

Objects are the result of calling the function apriori. Objects can also be created by calls of the form new("rules", ...).

Slots

lhs:

Object of class '>itemMatrix; the left-hand-sides of the rules (antecedents)

rhs:

Object of class '>itemMatrix; the right-hand-sides of the rules (consequents)

quality:

a data.frame; typically contains measures like support, confidence and count (i.e., the absolute support count)

Extends

Class '>associations, directly.

Methods

% \item{[}{\code{signature(x = "rules")}; % extracts a subset of rules and the associated quality measures}
coerce

signature(from = "rules", to = "data.frame"); represents the set of rules as a data.frame

itemInfo

signature(object = "rules"); returns the whole item information data frame including item labels

itemLabels

signature(object = "rules"); returns the item labels used to encode the rules

items

signature(x = "rules"); returns for each rule the union of the items in the lhs and rhs (i.e., the itemsets which generated the rule) as an '>itemMatrix

generatingItemsets

signature(x = "rules"); returns a collection of the itemsets which generated the rules (one itemset for each rule). Note that the collection can be a multiset and contain duplicated elements. Use unique to remove duplicates and obtain a proper set.

labels

signature(object = "rules"); returns labels for the rules ("lhs => rhs") as a character vector. The representation can be customized using the additional parameter ruleSep and parameters for label defined in '>itemMatrix

itemLabels

signature(object = "rules"); returns the item labels as a character vector. The index for each label is the column index of the item in the binary matrix.

% \item{length}{\code{signature(x = "rules")}; % returns the number of rules stored in the the set}
lhs

signature(x = "rules"); returns the '>itemMatrix representing the left-hand-side of the rules (antecedents)

lhs<-

signature(x = "rules"); replaces the '>itemMatrix representing the left-hand-side of the rules (antecedents)

rhs

signature(x = "rules"); returns the '>itemMatrix representing the right-hand-side of the rules (consequents)

rhs<-

signature(x = "rules"); replaces the '>itemMatrix representing the right-hand-side of the rules (consequents)

%\item{subset}{\code{signature(x = "rules")}; % selects a subset using restrictions on the quality measures or on % the items present in the rules (see examples).}
summary

signature(object = "rules")

See Also

[-methods, apriori, c, duplicated, inspect, length, match, sets, size, subset, associations-class, itemMatrix-class,

Aliases
  • rules-class
  • rules
  • summary.rules-class
  • show,summary.rules-method
  • coerce,rules,data.frame-method
  • itemInfo,rules-method
  • itemLabels,rules-method
  • items,rules-method
  • generatingItemsets
  • generatingItemsets,rules-method
  • labels,rules-method
  • itemLabels,rules-method
  • lhs<-,rules-method
  • lhs,rules-method
  • rhs<-,rules-method
  • rhs,rules-method
  • lhs<-
  • lhs
  • rhs<-
  • rhs
  • summary,rules-method
  • initialize,rules-method
Examples
# NOT RUN {
data("Adult")

## Mine rules.
rules <- apriori(Adult, parameter = list(support = 0.4))

## Select a subset of rules using partial matching on the items 
## in the right-hand-side and a quality measure
rules.sub <- subset(rules, subset = rhs %pin% "sex" & lift > 1.3)

## Display the top 3 support rules
inspect(head(rules.sub, n = 3, by = "support"))

## Display the first 3 rules
inspect(rules.sub[1:3])

## Get labels for the first 3 rules
labels(rules.sub[1:3])
labels(rules.sub[1:3], itemSep = " + ", setStart = "", setEnd="", 
  ruleSep = " ---> ")
# }
Documentation reproduced from package arules, version 1.5-4, License: GPL-3

Community examples

Looks like there are no examples yet.