arules v1.5-4

0

Monthly downloads

0th

Percentile

Mining Association Rules and Frequent Itemsets

Provides the infrastructure for representing, manipulating and analyzing transaction data and patterns (frequent itemsets and association rules). Also provides interfaces to C implementations of the association mining algorithms Apriori and Eclat by C. Borgelt.

Readme

arules --- Mining Association Rules and Frequent Itemsets with R

CRAN version Rdoc CRAN RStudio mirror downloads Travis-CI Build Status AppVeyor Build Status

The arules package for R provides the infrastructure for representing, manipulating and analyzing transaction data and patterns (frequent itemsets and association rules). Also provides interfaces to C implementations of the association mining algorithms Apriori and Eclat.

arules core packages:

  • arules: arules base package with data structures, mining algorithms (APRIORI and ECLAT), interest measures.
  • arulesViz: Visualization of association rules.
  • arulesCBA: Classification algorithms based on association rules (includes CBA).
  • arulesSequences: Mining frequent sequences (cSPADE).

Additional mining algorithms

  • arulesNBMiner: Mining NB-frequent itemsets and NB-precise rules.
  • opusminer: OPUS Miner algorithm for filtered top-k association discovery.
  • RKEEL: Interface to KEEL's association rule mining algorithm.
  • RSarules: Mining algorithm which randomly samples association rules with one pre-chosen item as the consequent from a transaction dataset.

In-database analytics

  • ibmdbR: IBM in-database analytics for R can calculate association rules from a database table.
  • rfml: Mine frequent itemsets or association rules using a MarkLogic server.

Interface

  • rattle: Provides a graphical user interface for association rule mining.
  • pmml: Generates PMML (predictive model markup language) for association rules.

Classification

  • arc: Alternative CBA implementation.
  • rCBA: Alternative CBA implementation.
  • sblr: Scalable Bayesian rule lists algorithm for classification.

Recommendation/Prediction

  • recommenerlab: Supports creating predictions using association rules.

Installation

Stable CRAN version: install from within R with

install.packages("arules")

Current development version: Download package from AppVeyor or install from GitHub (needs devtools).

library("devtools")
install_github("mhahsler/arules")

Usage

Load package and mine some association rules.

library("arules")
data("Adult")

rules <- apriori(Adult, parameter = list(supp = 0.5, conf = 0.9, target = "rules"))
Parameter specification:
 confidence minval smax arem  aval originalSupport support minlen maxlen target   ext
        0.9    0.1    1 none FALSE            TRUE     0.5      1     10  rules FALSE

Algorithmic control:
 filter tree heap memopt load sort verbose
    0.1 TRUE TRUE  FALSE TRUE    2    TRUE

Absolute minimum support count: 24421 

apriori - find association rules with the apriori algorithm
version 4.21 (2004.05.09)        (c) 1996-2004   Christian Borgelt
set item appearances ...[0 item(s)] done [0.00s].
set transactions ...[115 item(s), 48842 transaction(s)] done [0.03s].
sorting and recoding items ... [9 item(s)] done [0.00s].
creating transaction tree ... done [0.03s].
checking subsets of size 1 2 3 4 done [0.00s].
writing ... [52 rule(s)] done [0.00s].
creating S4 object  ... done [0.01s].

Show basic statistics.

summary(rules)
set of 52 rules

rule length distribution (lhs + rhs):
 1  2  3  4 
 2 13 24 13 

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  1.000   2.000   3.000   2.923   3.250   4.000 

summary of quality measures:
    support         confidence          lift       
 Min.   :0.5084   Min.   :0.9031   Min.   :0.9844  
 1st Qu.:0.5415   1st Qu.:0.9155   1st Qu.:0.9937  
 Median :0.5974   Median :0.9229   Median :0.9997  
 Mean   :0.6436   Mean   :0.9308   Mean   :1.0036  
 3rd Qu.:0.7426   3rd Qu.:0.9494   3rd Qu.:1.0057  
 Max.   :0.9533   Max.   :0.9583   Max.   :1.0586  

mining info:
  data ntransactions support confidence
 Adult         48842     0.5        0.9

Inspect rules with the highest lift.

inspect(head(rules, by = "lift"))
    lhs                               rhs                              support confidence     lift
[1] {sex=Male,                                                                                    
     native-country=United-States} => {race=White}                   0.5415421  0.9051090 1.058554
[2] {sex=Male,                                                                                    
     capital-loss=None,                                                                           
     native-country=United-States} => {race=White}                   0.5113632  0.9032585 1.056390
[3] {race=White}                   => {native-country=United-States} 0.7881127  0.9217231 1.027076
[4] {race=White,                                                                                  
     capital-loss=None}            => {native-country=United-States} 0.7490480  0.9205626 1.025783
[5] {race=White,                                                                                  
     sex=Male}                     => {native-country=United-States} 0.5415421  0.9204803 1.025691
[6] {race=White,                                                                                  
     capital-gain=None}            => {native-country=United-States} 0.7194628  0.9202807 1.025469

References

Functions in arules

Name Description
ASparameter-classes Classes ASparameter, APparameter, ECparameter --- Specifying the parameter Argument of apriori() and eclat()
Adult Adult Data Set
DATAFRAME Data.frame Representation for arules Objects
Epub Epub Data Set
LIST List Representation for Objects Based on Class itemMatrix
Mushroom Mushroom Data Set
Groceries Groceries Data Set
Income Income Data Set
APappearance-class Class APappearance --- Specifying the appearance Argument of Apriori to Implement Rule Templates
AScontrol-classes Classes AScontrol, APcontrol, ECcontrol --- Specifying the control Argument of apriori() and eclat()
combine Combining Objects
coverage Calculate coverage for rules
apriori Mining Associations with Apriori
associations-class Class associations - A Set of Associations
interestMeasure Calculate Additional Interest Measures
is.closed Find Closed Itemsets
abbreviate Abbreviate function for item labels in transactions, itemMatrix and associations
addComplement Add Complement-items to Transactions
image Visual Inspection of Binary Incidence Matrices
affinity Computing Affinity Between Items
hierarchy Support for Item Hierarchies
crossTable Cross-tabulate joint occurrences across pairs of items
discretize Convert a Continuous Variable into a Categorical Variable
dissimilarity Dissimilarity Computation
duplicated Find Duplicated Elements
is.significant Find Significant Rules
is.superset Find Super and Subsets
SunBai The SunBai Data Set
[-methods Methods for "[": Extraction or Subsetting in Package 'arules'
eclat Mining Associations with Eclat
hits Computing Transaction Weights With HITS
itemFrequencyPlot Creating a Item Frequencies/Support Bar Plot
inspect Display Associations and Transactions in Readable Form
itemsets-class Class itemsets --- A Set of Itemsets
length Getting the Number of Elements
read.transactions Read Transaction Data
ruleInduction Rule Induction from Itemsets
subset Subsetting Itemsets, Rules and Transactions
support Support Counting for Itemsets
weclat Mining Associations from Weighted Transaction Data with Eclat (WARM)
write Write Transactions or Associations to a File
is.maximal Find Maximal Itemsets
is.redundant Find Redundant Rules
match Value Matching
rules-class Class rules --- A Set of Rules
sample Random Samples and Permutations
setOperations Set Operations
merge Adding Items to Data
transactions-class Class transactions --- Binary Incidence Matrix for Transactions
unique Remove Duplicated Elements from a Collection
itemMatrix-class Class itemMatrix --- Sparse Binary Incidence Matrix to Represent Sets of Items
read.PMML Read and Write PMML
predict Model Predictions
supportingTransactions Supporting Transactions
itemCoding Item Coding --- Handling Item Labels and Column IDs
itemFrequency Getting Frequency/Support for Single Items
proximity-classes Classes dist, ar\_cross\_dissimilarity and ar\_similarity --- Proximity Matrices
random.transactions Simulate a Random Transaction Data Set
itemSetOperations Itemwise Set Operations
size Number of Items
sort Sort Associations
tidLists-class Class tidLists --- Transaction ID Lists for Items/Itemsets
No Results!

Vignettes of arules

Name
arules-classes.pdf
arules-classes.zargo
arules.Rnw
arules.bib
misc.bib
No Results!

Last month downloads

Details

Date 2017-10-12
Classification/ACM G.4, H.2.8, I.5.1
URL https://github.com/mhahsler/arules, http://lyle.smu.edu/IDA/arules
BugReports https://github.com/mhahsler/arules
License GPL-3
Copyright The code for apriori and eclat in src/rapriori.c was obtained from http://www.borgelt.net/ and is Copyright (C) 1996-2003 Christian Borgelt. All other code is Copyright (C) Michael Hahsler, Christian Buchta, Bettina Gruen and Kurt Hornik.
NeedsCompilation yes
Packaged 2017-10-12 05:03:00 UTC; hahsler
Repository CRAN
Date/Publication 2017-10-12 19:27:26 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/arules)](http://www.rdocumentation.org/packages/arules)