|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.associations.Associator
weka.associations.Apriori
Class implementing an Apriori-type algorithm. Iteratively reduces the minimum support until it finds the required number of rules with the given minimum confidence.
Reference: R. Agrawal, R. Srikant (1994). Fast algorithms for mining association rules in large databases . Proc International Conference on Very Large Databases, pp. 478-499. Santiage, Chile: Morgan Kaufmann, Los Altos, CA.
Valid options are:
-N required number of rules
The required number of rules (default: 10).
-T type of metric by which to sort rules
0 = confidence | 1 = lift | 2 = leverage | 3 = Conviction.
-C minimum confidence of a rule
The minimum confidence of a rule (default: 0.9).
-D delta for minimum support
The delta by which the minimum support is decreased in
each iteration (default: 0.05).
-U upper bound for minimum support
The upper bound for minimum support. Don't explicitly look for
rules with more than this level of support.
-M lower bound for minimum support
The lower bound for the minimum support (default = 0.1).
-S significance level
If used, rules are tested for significance at
the given level. Slower (default = no significance testing).
-R
If set then columns that contain all missing values are removed from
the data.
-I
If set the itemsets found are also output (default = no).
Field Summary | |
protected static int |
CONFIDENCE
Metric types. |
protected static int |
CONVICTION
|
protected static int |
LEVERAGE
|
protected static int |
LIFT
|
protected FastVector[] |
m_allTheRules
The list of all generated rules. |
protected int |
m_cycles
Number of cycles used before required number of rules was one. |
protected double |
m_delta
Delta by which m_minSupport is decreased in each iteration. |
protected FastVector |
m_hashtables
The same information stored in hash tables. |
protected Instances |
m_instances
The instances (transactions) to be used for generating the association rules. |
protected double |
m_lowerBoundMinSupport
The lower bound for the minimum support. |
protected FastVector |
m_Ls
The set of all sets of itemsets L. |
protected int |
m_metricType
The selected metric type. |
protected double |
m_minMetric
The minimum metric score. |
protected double |
m_minSupport
The minimum support. |
protected int |
m_numRules
The maximum number of rules that are output. |
protected boolean |
m_outputItemSets
Output itemsets found? |
protected boolean |
m_removeMissingCols
|
protected double |
m_significanceLevel
Significance level for optional significance test. |
protected double |
m_upperBoundMinSupport
The upper bound on the support |
protected boolean |
m_verbose
Report progress iteratively |
static Tag[] |
TAGS_SELECTION
|
Constructor Summary | |
Apriori()
Constructor that allows to sets default values for the minimum confidence and the maximum number of rules the minimum confidence. |
Method Summary | |
void |
buildAssociations(Instances instances)
Method that generates all large itemsets with a minimum support, and from these all association rules with a minimum confidence. |
java.lang.String |
deltaTipText()
Returns the tip text for this property |
private void |
findLargeItemSets(Instances instances)
Method that finds all large itemsets for the given set of instances. |
private void |
findRulesBruteForce()
Method that finds all association rules and performs significance test. |
private void |
findRulesQuickly()
Method that finds all association rules. |
double |
getDelta()
Get the value of delta. |
double |
getLowerBoundMinSupport()
Get the value of lowerBoundMinSupport. |
SelectedTag |
getMetricType()
Get the metric type |
double |
getMinMetric()
Get the value of minConfidence. |
int |
getNumRules()
Get the value of numRules. |
java.lang.String[] |
getOptions()
Gets the current settings of the Apriori object. |
boolean |
getRemoveAllMissingCols()
Returns whether columns containing all missing values are to be removed |
double |
getSignificanceLevel()
Get the value of significanceLevel. |
double |
getUpperBoundMinSupport()
Get the value of upperBoundMinSupport. |
java.lang.String |
globalInfo()
Returns a string describing this associator |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
java.lang.String |
lowerBoundMinSupportTipText()
Returns the tip text for this property |
static void |
main(java.lang.String[] options)
Main method for testing this class. |
java.lang.String |
metricTypeTipText()
Returns the tip text for this property |
java.lang.String |
minMetricTipText()
Returns the tip text for this property |
java.lang.String |
numRulesTipText()
Returns the tip text for this property |
java.lang.String |
removeAllMissingColsTipText()
Returns the tip text for this property |
private Instances |
removeMissingColumns(Instances instances)
Removes columns that are all missing from the data |
void |
resetOptions()
Resets the options to the default values. |
void |
setDelta(double v)
Set the value of delta. |
void |
setLowerBoundMinSupport(double v)
Set the value of lowerBoundMinSupport. |
void |
setMetricType(SelectedTag d)
Set the metric type for ranking rules |
void |
setMinMetric(double v)
Set the value of minConfidence. |
void |
setNumRules(int v)
Set the value of numRules. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setRemoveAllMissingCols(boolean r)
Remove columns containing all missing values. |
void |
setSignificanceLevel(double v)
Set the value of significanceLevel. |
void |
setUpperBoundMinSupport(double v)
Set the value of upperBoundMinSupport. |
java.lang.String |
significanceLevelTipText()
Returns the tip text for this property |
java.lang.String |
toString()
Outputs the size of all the generated sets of itemsets and the rules. |
java.lang.String |
upperBoundMinSupportTipText()
Returns the tip text for this property |
Methods inherited from class weka.associations.Associator |
forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected double m_minSupport
protected double m_upperBoundMinSupport
protected double m_lowerBoundMinSupport
protected static final int CONFIDENCE
protected static final int LIFT
protected static final int LEVERAGE
protected static final int CONVICTION
public static final Tag[] TAGS_SELECTION
protected int m_metricType
protected double m_minMetric
protected int m_numRules
protected double m_delta
protected double m_significanceLevel
protected int m_cycles
protected FastVector m_Ls
protected FastVector m_hashtables
protected FastVector[] m_allTheRules
protected Instances m_instances
protected boolean m_outputItemSets
protected boolean m_removeMissingCols
protected boolean m_verbose
Constructor Detail |
public Apriori()
Method Detail |
public java.lang.String globalInfo()
public void resetOptions()
private Instances removeMissingColumns(Instances instances) throws java.lang.Exception
instances
- the instances
java.lang.Exception
public void buildAssociations(Instances instances) throws java.lang.Exception
buildAssociations
in class Associator
instances
- the instances to be used for generating the associations
java.lang.Exception
- if rules can't be built successfullypublic java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-N required number of rules
The required number of rules (default: 10).
-T type of metric by which to sort rules
0 = confidence | 1 = lift | 2 = leverage | 3 = Conviction.
-C minimum metric score of a rule
The minimum confidence of a rule (default: 0.9).
-D delta for minimum support
The delta by which the minimum support is decreased in
each iteration (default: 0.05).
-U upper bound for minimum support
The upper bound for minimum support. Don't explicitly look for
rules with more than this level of support.
-M lower bound for minimum support
The lower bound for the minimum support (default = 0.1).
-S significance level
If used, rules are tested for significance at
the given level. Slower (default = no significance testing).
-I
If set the itemsets found are also output (default = no).
-V
If set then progress is reported iteratively during execution.
-R
If set then columns that contain all missing values are removed from
the data.
setOptions
in interface OptionHandler
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public java.lang.String toString()
public java.lang.String removeAllMissingColsTipText()
public void setRemoveAllMissingCols(boolean r)
r
- true if cols are to be removed.public boolean getRemoveAllMissingCols()
public java.lang.String upperBoundMinSupportTipText()
public double getUpperBoundMinSupport()
public void setUpperBoundMinSupport(double v)
v
- Value to assign to upperBoundMinSupport.public java.lang.String lowerBoundMinSupportTipText()
public double getLowerBoundMinSupport()
public void setLowerBoundMinSupport(double v)
v
- Value to assign to lowerBoundMinSupport.public SelectedTag getMetricType()
public java.lang.String metricTypeTipText()
public void setMetricType(SelectedTag d)
d
- the type of metricpublic java.lang.String minMetricTipText()
public double getMinMetric()
public void setMinMetric(double v)
v
- Value to assign to minConfidence.public java.lang.String numRulesTipText()
public int getNumRules()
public void setNumRules(int v)
v
- Value to assign to numRules.public java.lang.String deltaTipText()
public double getDelta()
public void setDelta(double v)
v
- Value to assign to delta.public java.lang.String significanceLevelTipText()
public double getSignificanceLevel()
public void setSignificanceLevel(double v)
v
- Value to assign to significanceLevel.private void findLargeItemSets(Instances instances) throws java.lang.Exception
java.lang.Exception
- if an attribute is numericprivate void findRulesBruteForce() throws java.lang.Exception
java.lang.Exception
- if an attribute is numericprivate void findRulesQuickly() throws java.lang.Exception
java.lang.Exception
- if an attribute is numericpublic static void main(java.lang.String[] options)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |