external.modified
Class AprioriRules

java.lang.Object
  extended by java.lang.Thread
      extended by laur.tools.AbortableThread
          extended by laur.tools.MonitoredThread
              extended by laur.dm.ar.AssociationsMiner
                  extended by external.modified.AprioriRules
All Implemented Interfaces:
java.lang.Runnable

public class AprioriRules
extends laur.dm.ar.AssociationsMiner

This class implements the Apriori ap_genrules algorithm for finding association rules.

(see "Fast Algorithms for Mining Association Rules" by Rakesh Agrawal and Ramakrishnan Srikant from IBM Almaden Research Center 1994) We also implement a variant of ap_genrules that generates only rules having the user specified characteristics. The class is a modified version of the FPgrowth class version 1.2 found in laur.dm.ar created by Lurentiu Cristofor. Modifications are marked in the source. Formatting is also slightly changed to follow the java code convention closer.

Author:
Laurentiu Cristofor

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class laur.dm.ar.AssociationsMiner
cache_reader, is_ignored, is_in_antecedent, is_in_consequent, max_antecedent, min_confidence, min_consequent, min_support
 
Fields inherited from class laur.tools.MonitoredThread
monitor
 
Fields inherited from class laur.tools.AbortableThread
bAbort, isRunning
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AprioriRules()
           
 
Method Summary
 java.util.ArrayList findAssociations(java.util.ArrayList itemsets, double minSupport, double minConfidence)
          MOD: New interface to class needed, as TTM Testbench does not use cacheReader.
 java.util.ArrayList findAssociations(laur.dm.ar.DBCacheReader cacheReader, double minSupport, double minConfidence)
          Find association rules in a database, given the set of frequent itemsets.
 java.util.ArrayList findAssociations(laur.dm.ar.DBCacheReader cacheReader, double minSupport, double minConfidence, laur.dm.ar.Itemset inAntecedent, laur.dm.ar.Itemset inConsequent, laur.dm.ar.Itemset ignored, int maxAntecedent, int minConsequent)
          Find association rules in a database, given the set of frequent itemsets and a set of restrictions.
 
Methods inherited from class laur.dm.ar.AssociationsMiner
execute, getResult, setParameters, setParameters
 
Methods inherited from class laur.tools.MonitoredThread
terminationHook
 
Methods inherited from class laur.tools.AbortableThread
abort, checkAbort, run
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AprioriRules

public AprioriRules()
Method Detail

findAssociations

public java.util.ArrayList findAssociations(java.util.ArrayList itemsets,
                                            double minSupport,
                                            double minConfidence)
MOD: New interface to class needed, as TTM Testbench does not use cacheReader. The method is a copy of findAssociations(DBCacheReader, double, double), where the DBCacheReader code is modified. Find association rules in a database, given the set of frequent itemsets.

Parameters:
itemsets - the object used to read from the cache
minSupport - the minimum support
minConfidence - the minimum confidence
Returns:
an ArrayList containing all association rules found

findAssociations

public java.util.ArrayList findAssociations(laur.dm.ar.DBCacheReader cacheReader,
                                            double minSupport,
                                            double minConfidence)
Find association rules in a database, given the set of frequent itemsets.

Specified by:
findAssociations in class laur.dm.ar.AssociationsMiner
Parameters:
cacheReader - the object used to read from the cache
minSupport - the minimum support
minConfidence - the minimum confidence
Returns:
an ArrayList containing all association rules found

findAssociations

public java.util.ArrayList findAssociations(laur.dm.ar.DBCacheReader cacheReader,
                                            double minSupport,
                                            double minConfidence,
                                            laur.dm.ar.Itemset inAntecedent,
                                            laur.dm.ar.Itemset inConsequent,
                                            laur.dm.ar.Itemset ignored,
                                            int maxAntecedent,
                                            int minConsequent)
Find association rules in a database, given the set of frequent itemsets and a set of restrictions.

Specified by:
findAssociations in class laur.dm.ar.AssociationsMiner
Parameters:
cacheReader - the object used to read from the cache
minSupport - the minimum support
minConfidence - the minimum confidence
inAntecedent - the items that must appear in the antecedent of each rule, if null then this constraint is ignored
inConsequent - the items that must appear in the consequent of each rule, if null then this constraint is ignored
ignored - the items that should be ignored, if null then this constraint is ignored
maxAntecedent - the maximum number of items that can appear in the antecedent of each rule, if 0 then this constraint is ignored
minConsequent - the minimum number of items that should appear in the consequent of each rule, if 0 then this constraint is ignored
Returns:
an ArrayList containing all association rules found