ca.pfv.spmf.algorithms.sequential_rules.topseqrules_and_tns
Class Rule
- java.lang.Object
-
- ca.pfv.spmf.algorithms.sequential_rules.topseqrules_and_tns.Rule
-
- All Implemented Interfaces:
- java.lang.Comparable<Rule>
public class Rule extends java.lang.Object implements java.lang.Comparable<Rule>
This class represent a sequential rule as output by the TNS and TopSeqRules algorithm.
It is optimized for these algorithms by storing several additional fields that are necessary for such top-k algorithms. For example, a rule includes the transactions IDs of the antecedent, the transaction IDs of the consequent, the transaction IDs of the sequences where the antecedent appears before the consequent, maps of occurences for the antecedent and consequent, etc.- See Also:
AlgoTopSeqRules,AlgoTNS
-
-
Constructor Summary
Constructors Constructor and Description Rule(int[] itemset1, int[] itemset2, double confidence, int transactioncount, java.util.Set<java.lang.Integer> tidsI, java.util.Set<java.lang.Integer> tidsJ, java.util.Set<java.lang.Integer> tidsIJ, java.util.Map<java.lang.Integer,java.lang.Short> occurencesIfirst, java.util.Map<java.lang.Integer,java.lang.Short> occurencesJlast)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcompareTo(Rule o)Compare this rule to another rulebooleanequals(java.lang.Object o)Check if this rule is equal to another (if they have the same items in their antecedent and consequent).intgetAbsoluteSupport()Get the absolute support (a number of sequences)doublegetConfidence()Get the confidence of this ruleint[]getItemset1()Get the antecedent itemset.int[]getItemset2()Get the consequent itemset.doublegetRelativeSupport(int sequencecount)Get the relative support (a percentage)voidprint()Print this rule to the consolejava.lang.StringtoString()Get a string representation of this rule.
-
-
-
Constructor Detail
-
Rule
public Rule(int[] itemset1, int[] itemset2, double confidence, int transactioncount, java.util.Set<java.lang.Integer> tidsI, java.util.Set<java.lang.Integer> tidsJ, java.util.Set<java.lang.Integer> tidsIJ, java.util.Map<java.lang.Integer,java.lang.Short> occurencesIfirst, java.util.Map<java.lang.Integer,java.lang.Short> occurencesJlast)Constructor- Parameters:
itemset1- antecedentitemset2- consequentconfidence- confidence of the ruletransactioncount- absolute supporttidsI- the transaction IDs of the antecedenttidsJ- the transaction IDs of the consequenttidsIJ- transaction IDs of the sequences where the antecedent appears before the consequentoccurencesIfirst- maps of first occurences of the antecedentoccurencesJlast- maps of last occurences of the antecedent
-
-
Method Detail
-
getItemset1
public int[] getItemset1()
Get the antecedent itemset.- Returns:
- the antecedent.
-
getItemset2
public int[] getItemset2()
Get the consequent itemset.- Returns:
- the consequent.
-
getAbsoluteSupport
public int getAbsoluteSupport()
Get the absolute support (a number of sequences)- Returns:
- the absolute support
-
getRelativeSupport
public double getRelativeSupport(int sequencecount)
Get the relative support (a percentage)- Parameters:
sequencecount- the number of sequence in the original sequence database- Returns:
- the relative support
-
print
public void print()
Print this rule to the console
-
toString
public java.lang.String toString()
Get a string representation of this rule.- Overrides:
toStringin classjava.lang.Object- Returns:
- the string representation
-
getConfidence
public double getConfidence()
Get the confidence of this rule- Returns:
- the confidence
-
compareTo
public int compareTo(Rule o)
Compare this rule to another rule- Specified by:
compareToin interfacejava.lang.Comparable<Rule>- Returns:
- 0 if equal, 0< if smaller or >0 if larger
-
equals
public boolean equals(java.lang.Object o)
Check if this rule is equal to another (if they have the same items in their antecedent and consequent).- Overrides:
equalsin classjava.lang.Object- Returns:
- true if equal
-
-
DMelt 3.0 © DataMelt by jWork.ORG