Package weka.associations
Class FPGrowth.AssociationRule
java.lang.Object
weka.associations.FPGrowth.AssociationRule
- All Implemented Interfaces:
Serializable
,Comparable<FPGrowth.AssociationRule>
- Enclosing class:
- FPGrowth
public static class FPGrowth.AssociationRule
extends Object
implements Serializable, Comparable<FPGrowth.AssociationRule>
- Author:
- mhall
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum for holding different metric types -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAssociationRule
(Collection<FPGrowth.BinaryItem> premise, Collection<FPGrowth.BinaryItem> consequence, FPGrowth.AssociationRule.METRIC_TYPE metric, int premiseSupport, int consequenceSupport, int totalSupport, int totalTransactions) Construct a new association rule. -
Method Summary
Modifier and TypeMethodDescriptionint
Compare this rule to the supplied rule.boolean
containsItems
(ArrayList<Attribute> items, boolean useOr) boolean
Return true if this rule is equal to the supplied one.static List<FPGrowth.AssociationRule>
generateRulesBruteForce
(weka.associations.FPGrowth.FrequentItemSets largeItemSets, FPGrowth.AssociationRule.METRIC_TYPE metricToUse, double metricThreshold, int upperBoundMinSuppAsInstances, int lowerBoundMinSuppAsInstances, int totalTransactions) Generate all association rules, from the supplied frequet item sets, that meet a given minimum metric threshold.Get the consequence of this rule.int
Get the support for the consequence.Get the metric type of this rule (e.g.double
Get the value of the metric for this rule.Get the premise of this rule.int
Get the support for the premise.int
Get the total support for this rule (premise + consequence).int
Get the total number of transactions in the data.static List<FPGrowth.AssociationRule>
pruneRules
(List<FPGrowth.AssociationRule> rulesToPrune, ArrayList<Attribute> itemsToConsider, boolean useOr) toString()
Get a textual description of this rule.toXML()
-
Field Details
-
TAGS_SELECTION
Tags for display in the GUI
-
-
Constructor Details
-
AssociationRule
public AssociationRule(Collection<FPGrowth.BinaryItem> premise, Collection<FPGrowth.BinaryItem> consequence, FPGrowth.AssociationRule.METRIC_TYPE metric, int premiseSupport, int consequenceSupport, int totalSupport, int totalTransactions) Construct a new association rule.- Parameters:
premise
- the premise of the ruleconsequence
- the consequence of the rulemetric
- the metric for the rulepremiseSupport
- the support of the premiseconsequenceSupport
- the support of the consequencetotalSupport
- the total support of the ruletotalTransactions
- the number of transactions in the data
-
-
Method Details
-
getPremise
Get the premise of this rule.- Returns:
- the premise of this rule.
-
getConsequence
Get the consequence of this rule.- Returns:
- the consequence of this rule.
-
getMetricType
Get the metric type of this rule (e.g. confidence).- Returns:
- the metric type of this rule.
-
getMetricValue
public double getMetricValue()Get the value of the metric for this rule.- Returns:
- the value of the metric for this rule.
-
getPremiseSupport
public int getPremiseSupport()Get the support for the premise.- Returns:
- the support for the premise.
-
getConsequenceSupport
public int getConsequenceSupport()Get the support for the consequence.- Returns:
- the support for the consequence.
-
getTotalSupport
public int getTotalSupport()Get the total support for this rule (premise + consequence).- Returns:
- the total support for this rule.
-
getTotalTransactions
public int getTotalTransactions()Get the total number of transactions in the data.- Returns:
- the total number of transactions in the data.
-
compareTo
Compare this rule to the supplied rule.- Specified by:
compareTo
in interfaceComparable<FPGrowth.AssociationRule>
- Parameters:
other
- the rule to compare to.- Returns:
- the result of the comparison.
-
equals
Return true if this rule is equal to the supplied one. -
containsItems
-
toString
Get a textual description of this rule. -
toXML
-
generateRulesBruteForce
public static List<FPGrowth.AssociationRule> generateRulesBruteForce(weka.associations.FPGrowth.FrequentItemSets largeItemSets, FPGrowth.AssociationRule.METRIC_TYPE metricToUse, double metricThreshold, int upperBoundMinSuppAsInstances, int lowerBoundMinSuppAsInstances, int totalTransactions) Generate all association rules, from the supplied frequet item sets, that meet a given minimum metric threshold. Uses a brute force approach.- Parameters:
largeItemSets
- the set of frequent item setsmetricToUse
- the metric to usemetricThreshold
- the threshold value that a rule must meetupperBoundMinSuppAsInstances
- the upper bound on the support in order to accept the rulelowerBoundMinSuppAsInstances
- the lower bound on the support in order to accept the ruletotalTransactions
- the total number of transactions in the data- Returns:
- a list of association rules
-
pruneRules
public static List<FPGrowth.AssociationRule> pruneRules(List<FPGrowth.AssociationRule> rulesToPrune, ArrayList<Attribute> itemsToConsider, boolean useOr)
-