Skip to content

Mining NB-Frequent Itemsets and NB-Precise Rules - R Package

Notifications You must be signed in to change notification settings

mhahsler/arulesNBMiner

Repository files navigation

R package stream - Infrastructure for Data Stream Mining

CRAN version stream r-universe status CRAN RStudio mirror downloads

This R package extends package arules with NBMiner, an implementation of the model-based mining algorithm for mining NB-frequent itemsets presented in “Michael Hahsler. A model-based frequency constraint for mining associations from transaction data. Data Mining and Knowledge Discovery, 13(2):137-166, September 2006.” In addition an extension for NB-precise rules is implemented.

Installation

Stable CRAN version: Install from within R with

install.packages("stream")

Current development version: Install from r-universe.

install.packages("stream", repos = "https://mhahsler.r-universe.dev")

Usage

Estimate NBD model parameters for the Agrawal data set.

library(arulesNBMiner)
data("Agrawal")

param <- NBMinerParameters(Agrawal.db, pi = 0.99, theta = 0.5, maxlen = 5, minlen = 1,
    trim = 0, verb = TRUE, plot = TRUE)
## using Expectation Maximization for missing zero class
## iteration = 1 , zero class = 3 , k = 0.99 , m = 278 
## iteration = 2 , zero class = 3 , k = 0.99 , m = 278 
## total items =  719

Mine NB-frequent itemsets

itemsets_NB <- NBMiner(Agrawal.db, parameter = param, control = list(verb = TRUE,
    debug = FALSE))
## 
## parameter specification:
##    pi theta   n    k      a minlen maxlen rules
##  0.99   0.5 719 0.99 0.0014      1      5 FALSE
## 
## algorithmic control:
##  verbose debug
##     TRUE FALSE

Inspect some itemsets with the highest precision.

inspect(head(itemsets_NB, by = "precision"))
##     items                                        precision
## [1] {item220, item956, item964}                  1        
## [2] {item510, item667, item885}                  1        
## [3] {item452, item956, item964}                  1        
## [4] {item60, item173, item417, item440, item831} 1        
## [5] {item258, item452, item956}                  1        
## [6] {item149, item231, item611}                  1

References

About

Mining NB-Frequent Itemsets and NB-Precise Rules - R Package

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published