itemsets-class {arules}R Documentation

Class itemsets — A Set of Itemsets

Description

The itemsets class represents a set of itemsets and the associated quality measures.

Usage

itemsets(items, itemLabels = NULL, quality = data.frame())

## S4 method for signature 'itemsets'
summary(object, ...)

## S4 method for signature 'itemsets'
length(x)

## S4 method for signature 'itemsets'
nitems(x)

## S4 method for signature 'itemsets'
labels(object, ...)

## S4 method for signature 'itemsets'
itemLabels(object)

## S4 replacement method for signature 'itemsets'
itemLabels(object) <- value

## S4 method for signature 'itemsets'
itemInfo(object)

## S4 method for signature 'itemsets'
items(x)

## S4 replacement method for signature 'itemsets'
items(x) <- value

## S4 method for signature 'itemsets'
tidLists(x)

Arguments

items

an itemMatrix or an object that can be converted using encode().

itemLabels

item labels used for encode().

quality

a data.frame with quality information (one row per itemset).

object, x

the object

...

further argments

value

replacement value

Details

Itemsets are usually created by calling an association rule mining algorithm like apriori(). To create itemsets manually, the itemMatrix for the items of the itemsets can be created using itemCoding. An example is in the Example section below.

Mined itemsets sets contain several interest measures accessible with the quality() method. Additional measures can be calculated via interestMeasure().

Functions

Slots

items

an itemMatrix object representing the itemsets.

tidLists

a tidLists or NULL.

quality

a data.frame with quality information

info

a list with mining information.

Objects from the Class

Objects are the result of calling the functions apriori() (e.g., with target = "frequent itemsets" in the parameter list) or eclat().

Objects can also be created by calls of the form new("itemsets", ...) or by using the constructor function itemsets().

Coercions

Author(s)

Michael Hahsler

See Also

Superclass: associations

Other associations functions: abbreviate(), associations-class, c(), duplicated(), extract, inspect(), is.closed(), is.generator(), is.maximal(), is.redundant(), is.significant(), is.superset(), match(), rules-class, sample(), sets, size(), sort(), unique()

Examples

data("Adult")

## Mine frequent itemsets with Eclat.
fsets <- eclat(Adult, parameter = list(supp = 0.5))

## Display the 5 itemsets with the highest support.
fsets.top5 <- sort(fsets)[1:5]
inspect(fsets.top5)

## Get the itemsets as a list
as(items(fsets.top5), "list")

## Get the itemsets as a binary matrix
as(items(fsets.top5), "matrix")

## Get the itemsets as a sparse matrix, a ngCMatrix from package Matrix.
## Warning: for efficiency reasons, the ngCMatrix you get is transposed
as(items(fsets.top5), "ngCMatrix")

## Manually create itemsets with the item coding in the Adult dataset
## and calculate some interest measures
twoitemsets <- itemsets(
  items = list(
    c("age=Young", "relationship=Unmarried"),
    c("age=Old")
  ), itemLabels = Adult)

quality(twoitemsets) <- data.frame(support = interestMeasure(twoitemsets,
  measure = c("support"), transactions = Adult))

inspect(twoitemsets)

[Package arules version 1.7-7 Index]