laur.dm.ar
Class AssociationsMiner

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--laur.tools.AbortableThread
              |
              +--laur.tools.MonitoredThread
                    |
                    +--laur.dm.ar.AssociationsMiner
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
AprioriRules, CoverRules, CoverRulesOpt

public abstract class AssociationsMiner
extends MonitoredThread

This abstract class must be extended by the algorithms that will look for associations.


Field Summary
protected  DBCacheReader cache_reader
          With this object we read from the cache
protected  Itemset is_ignored
          The items to ignore.
protected  Itemset is_in_antecedent
          The items required to be in antecedent.
protected  Itemset is_in_consequent
          The items required to be in consequent.
protected  int max_antecedent
          Maximum number of items allowed in antecedent.
protected  double min_confidence
          Minimum confidence value.
protected  int min_consequent
          Minimum number of items required in consequent.
protected  double min_support
          Minimum support value.
 
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
AssociationsMiner()
           
 
Method Summary
protected  void execute()
          Executes the findAssociations() method.
abstract  java.util.ArrayList findAssociations(DBCacheReader cacheReader, double minSupport, double minConfidence)
          Find association rules in a database, given the set of frequent itemsets.
abstract  java.util.ArrayList findAssociations(DBCacheReader cacheReader, double minSupport, double minConfidence, Itemset inAntecedent, Itemset inConsequent, Itemset ignored, int maxAntecedent, int minConsequent)
          Find association rules in a database, given the set of frequent itemsets and a set of restrictions.
 java.util.ArrayList getResult()
          Gets the value returned by findAssociations() after the thread completed its execution.
 void setParameters(ThreadMonitor monitor, DBCacheReader cacheReader, double minSupport, double minConfidence)
          Sets the parameters for the mining algorithm.
 void setParameters(ThreadMonitor monitor, DBCacheReader cacheReader, double minSupport, double minConfidence, Itemset inAntecedent, Itemset inConsequent, Itemset ignored, int maxAntecedent, int minConsequent)
          Sets the parameters for the mining algorithm.
 
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, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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
 

Field Detail

cache_reader

protected DBCacheReader cache_reader
With this object we read from the cache

min_support

protected double min_support
Minimum support value.

min_confidence

protected double min_confidence
Minimum confidence value.

is_in_antecedent

protected Itemset is_in_antecedent
The items required to be in antecedent.

is_in_consequent

protected Itemset is_in_consequent
The items required to be in consequent.

is_ignored

protected Itemset is_ignored
The items to ignore.

max_antecedent

protected int max_antecedent
Maximum number of items allowed in antecedent.

min_consequent

protected int min_consequent
Minimum number of items required in consequent.
Constructor Detail

AssociationsMiner

public AssociationsMiner()
Method Detail

findAssociations

public abstract java.util.ArrayList findAssociations(DBCacheReader cacheReader,
                                                     double minSupport,
                                                     double minConfidence)
Find association rules in a database, given the set of frequent itemsets.
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 abstract java.util.ArrayList findAssociations(DBCacheReader cacheReader,
                                                     double minSupport,
                                                     double minConfidence,
                                                     Itemset inAntecedent,
                                                     Itemset inConsequent,
                                                     Itemset ignored,
                                                     int maxAntecedent,
                                                     int minConsequent)
Find association rules in a database, given the set of frequent itemsets and a set of restrictions.
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

setParameters

public void setParameters(ThreadMonitor monitor,
                          DBCacheReader cacheReader,
                          double minSupport,
                          double minConfidence)
Sets the parameters for the mining algorithm. This method should be used before starting the thread.
Parameters:
monitor - an object that we should notify about important events
cacheReader - the object used to read from the cache
minSupport - the minimum support
minConfidence - the minimum confidence
Throws:
IllegalStateException - if the thread is already running

setParameters

public void setParameters(ThreadMonitor monitor,
                          DBCacheReader cacheReader,
                          double minSupport,
                          double minConfidence,
                          Itemset inAntecedent,
                          Itemset inConsequent,
                          Itemset ignored,
                          int maxAntecedent,
                          int minConsequent)
Sets the parameters for the mining algorithm. This method should be used before starting the thread.
Parameters:
monitor - an object that we should notify about important events
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
Throws:
IllegalStateException - if the thread is already running

execute

protected void execute()
Executes the findAssociations() method.
Overrides:
execute in class AbortableThread

getResult

public java.util.ArrayList getResult()
Gets the value returned by findAssociations() after the thread completed its execution.
Returns:
the rules discovered in the database
Throws:
IllegalStateException - if the thread is still running or if no result is available