wpi.associations.arminer
Class AprioriRules
java.lang.Object
wpi.associations.arminer.AprioriRules
- All Implemented Interfaces:
- AssociationsFinder
- public class AprioriRules
- extends java.lang.Object
- implements AssociationsFinder
AprioriRules.java
This class implements the Apriori algorithm
for finding association rules.
(see "Fast Algorithms for Mining Association Rules"
by Rakesh Agrawal and Ramakrishnan Srikant
from IBM Almaden Research Center 1994)
Method Summary |
private void |
ap_genrules_constraint(ARMinerItemset is_frequent,
java.util.Vector consequents)
|
private void |
ap_genrules_constraint(ARMinerItemset is_frequent,
java.util.Vector consequents,
java.util.Vector antecedentAttributes,
java.util.Vector consequentAttributes)
|
private void |
ap_genrules(ARMinerItemset is_frequent,
java.util.Vector consequents)
|
private java.util.Vector |
apriori_gen(java.util.Vector itemsets)
|
java.util.Vector |
findAssociations(DBCacheReader cacheReader,
float minSupport,
float minConfidence)
Find association rules in a database, given the set of
frequent itemsets. |
java.util.Vector |
findAssociations(DBCacheReader cacheReader,
float minSupport,
float minConfidence,
ARMinerItemset inAntecedent,
ARMinerItemset inConsequent,
ARMinerItemset ignored,
int maxAntecedent,
int minConsequent)
Find association rules in a database, given the set of
frequent itemsets and a set of restrictions. |
java.util.Vector |
findAssociations(DBCacheReader cacheReader,
float minSupport,
float minConfidence,
java.util.Vector antecedentAttributes,
java.util.Vector consequentAttributes,
int maxAntecedent,
int minConsequent)
------------------------WEKA VERSION!!!-----------------------
Find association rules in a database, given the set of
frequent itemsets and a set of restrictions. |
private void |
initializeSupports(DBCacheReader cacheReader)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
supports
private SET supports
rules
private java.util.Vector rules
min_support
private float min_support
min_confidence
private float min_confidence
is_in_antecedent
private ARMinerItemset is_in_antecedent
is_in_consequent
private ARMinerItemset is_in_consequent
is_ignored
private ARMinerItemset is_ignored
max_antecedent
private int max_antecedent
min_consequent
private int min_consequent
AprioriRules
public AprioriRules()
initializeSupports
private void initializeSupports(DBCacheReader cacheReader)
findAssociations
public java.util.Vector findAssociations(DBCacheReader cacheReader,
float minSupport,
float minConfidence)
- Find association rules in a database, given the set of
frequent itemsets.
- Specified by:
findAssociations
in interface AssociationsFinder
- Parameters:
cacheReader
- the object used to read from the cacheminSupport
- the minimum supportminConfidence
- the minimum confidence
- Returns:
- a Vector containing all association rules found
ap_genrules
private void ap_genrules(ARMinerItemset is_frequent,
java.util.Vector consequents)
apriori_gen
private java.util.Vector apriori_gen(java.util.Vector itemsets)
findAssociations
public java.util.Vector findAssociations(DBCacheReader cacheReader,
float minSupport,
float minConfidence,
ARMinerItemset inAntecedent,
ARMinerItemset inConsequent,
ARMinerItemset 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 interface AssociationsFinder
- Parameters:
cacheReader
- the object used to read from the cacheminSupport
- the minimum supportminConfidence
- the minimum confidenceinAntecedent
- the items that must appear in the antecedent
of each rule, if null then this constraint is ignoredinConsequent
- the items that must appear in the consequent
of each rule, if null then this constraint is ignoredignored
- the items that should be ignored,
if null then this constraint is ignoredmaxAntecedent
- the maximum number of items that can appear
in the antecedent of each rule, if 0 then this constraint is ignoredminConsequent
- the minimum number of items that should appear
in the consequent of each rule, if 0 then this constraint is ignored
- Returns:
- a Vector containing all association rules found
findAssociations
public java.util.Vector findAssociations(DBCacheReader cacheReader,
float minSupport,
float minConfidence,
java.util.Vector antecedentAttributes,
java.util.Vector consequentAttributes,
int maxAntecedent,
int minConsequent)
- ------------------------WEKA VERSION!!!-----------------------
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 cacheminSupport
- the minimum supportminConfidence
- the minimum confidenceantecedentAttributes
- a vector of ARMinerItemsets
that each contains only items in a single
attribute used to restrict which attributes
must appear in the antecedent, ignored if nullconsequentAttributes
- a vector of ARMinerItemsets
that each contains only items in a single
attribute used to restrict which attributes
must appear in the consequent, ignored if nullmaxAntecedent
- the maximum number of items that can appear
in the antecedent of each rule, if 0 then this
constraint is ignoredminConsequent
- the minimum number of items that should appear
in the consequent of each rule, if 0 then this
constraint is ignored
- Returns:
- a Vector containing all association rules found
ap_genrules_constraint
private void ap_genrules_constraint(ARMinerItemset is_frequent,
java.util.Vector consequents,
java.util.Vector antecedentAttributes,
java.util.Vector consequentAttributes)
ap_genrules_constraint
private void ap_genrules_constraint(ARMinerItemset is_frequent,
java.util.Vector consequents)