Learn R Programming

arulesNBMiner (version 0.1-8)

NBMiner: NBMiner: Mine NB-Frequent Itemsets or NB-Precise Rules

Description

Calls the Java implementation of the depth first search algorithm described in the paper in the references section to mine NB-frequent itemsets of NB-precise rules.

Usage

NBMiner(data, parameter, control = NULL)

Arguments

data

object of class transactions.

parameter

a list of parameters (automatically converted into an object of class NBMinerParameter). Reasonable parameters can be obtained using NBMinerParameters (see details section).

control

a list of control options (automatically converted into an object of class NBMinerControl). Currently only "verbose" and "debug" (both logical) are available.

Value

An object of class itemsets or rules (depending on the rules entry in parameter). The estimated precision is stored in the quality slot.

Details

The parameters can be estimated from the data using NBMinerParameters.

References

Michael Hahsler. A model-based frequency constraint for mining associations from transaction data. Data Mining and Knowledge Discovery, 13(2):137-166, September 2006. 10.1007/s10618-005-0026-2

See Also

NBMinerParameters, transactions-class, itemsets-class, rules-class

Examples

Run this code
# NOT RUN {
data("Agrawal")

## mine
param <- NBMinerParameters(Agrawal.db, pi=0.99, theta=0.5, maxlen=5,
    minlen=1, trim = 0, verb = TRUE, plot=TRUE) 
itemsets_NB <- NBMiner(Agrawal.db, parameter = param, 
    control = list(verb = TRUE, debug=FALSE))

inspect(head(itemsets_NB))

## remove patterns of length 1 (noise)
i_NB <- itemsets_NB[size(itemsets_NB)>1]
patterns <- Agrawal.pat[size(Agrawal.pat)>1]

## how many found itemsets are subsets of the patterns used in the db?
table(rowSums(is.subset(i_NB,patterns))>0)

## compare with the same number of the most frequent itemsets
itemsets_supp <-  eclat(Agrawal.db, parameter=list(supp=0.001))
i_supp <- itemsets_supp[size(itemsets_supp) >1]
i_supp <- head(sort(i_supp, by = "support"), length(i_NB))
table(rowSums(is.subset(i_supp,patterns))>0)

## mine NB-precise rules
param <- NBMinerParameters(Agrawal.db, pi=0.99, theta=0.5, maxlen=5,
    rules=TRUE, minlen=1, trim = 0) 
rules_NB <- NBMiner(Agrawal.db, parameter = param, 
    control = list(verb = TRUE, debug=FALSE))

inspect(head(rules_NB))
# }

Run the code above in your browser using DataLab