ca.pfv.spmf.algorithms.associationrules.TopKRules_and_TNR
Class RuleG
- java.lang.Object
-
- ca.pfv.spmf.algorithms.associationrules.TopKRules_and_TNR.RuleG
-
- All Implemented Interfaces:
- java.lang.Comparable<RuleG>
public class RuleG extends java.lang.Object implements java.lang.Comparable<RuleG>
This class represents an association rule found by the TNR or TopKRules algorithm for top-k association rule mining.
This implementation is optimized for these algorithms. In particular, it stores the tidset of the rule and the tidset of the rule antecedent as bitsets. Furthermore, the antecedent and consequent are stored as array of integers. Lastly, for optimization, the maximum item id of the antecedent and consequent of the rule are precalculated and kept (as explained in the papers).- See Also:
AlgoTNR,AlgoTopKRules
-
-
Field Summary
Fields Modifier and Type Field and Description java.util.BitSetcommonbooleanexpandLRintmaxLeftintmaxRightjava.util.BitSettids1
-
Constructor Summary
Constructors Constructor and Description RuleG(java.lang.Integer[] itemset1, java.lang.Integer[] itemset2, int count, java.util.BitSet tids1, java.util.BitSet common, int maxLeft, int maxRight)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcompareTo(RuleG o)Compare this rule with another rule "o".booleanequals(java.lang.Object o)intgetAbsoluteSupport()Get the support of this rule.doublegetConfidence()Get the confidence of this rule.java.lang.Integer[]getItemset1()Get the antecedent.java.lang.Integer[]getItemset2()Get the consequent.java.lang.StringtoString()Get a string representation of this rule.
-
-
-
Field Detail
-
tids1
public java.util.BitSet tids1
-
common
public java.util.BitSet common
-
maxLeft
public int maxLeft
-
maxRight
public int maxRight
-
expandLR
public boolean expandLR
-
-
Constructor Detail
-
RuleG
public RuleG(java.lang.Integer[] itemset1, java.lang.Integer[] itemset2, int count, java.util.BitSet tids1, java.util.BitSet common, int maxLeft, int maxRight)Constructor- Parameters:
itemset1- the left itemsetitemset2- the right itemsetcount- support of the ruletids1- tidset of the antecedentcommon- tidset of the rulemaxLeft- maximum item id in the antecedentmaxRight- maximum item id in the consequent
-
-
Method Detail
-
getItemset1
public java.lang.Integer[] getItemset1()
Get the antecedent.- Returns:
- an itemset
-
getItemset2
public java.lang.Integer[] getItemset2()
Get the consequent.- Returns:
- an itemset
-
getAbsoluteSupport
public int getAbsoluteSupport()
Get the support of this rule.- Returns:
- the support (integer)
-
getConfidence
public double getConfidence()
Get the confidence of this rule.- Returns:
- the confidence (double)
-
compareTo
public int compareTo(RuleG o)
Compare this rule with another rule "o".- Specified by:
compareToin interfacejava.lang.Comparable<RuleG>- Returns:
- 1 if this rule is larger, 0 if equal, or -1 if smaller. The comparison is done based on the support, then on the size of the antecedent, then on the size of the consequent, then on the confidence, then on the hashCodes.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
Get a string representation of this rule.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string
-
-
DMelt 3.0 © DataMelt by jWork.ORG