|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--laur.dm.ar.AssociationRule
An association rule has two parts: the antecedent of the rule and the consequent of the rule, both of which are itemsets. Associated with these are a support and a confidence. The support tells how many rows of a database support this rule, the confidence tells what percentage of the rows that contain the antecedent also contain the consequent.
Field Summary | |
static int |
BY_ANTECEDENT_SIZE
Specifies sorting should be performed according to antecedent size. |
static int |
BY_CONFIDENCE
Specifies sorting should be performed according to rule confidence. |
static int |
BY_CONSEQUENT_SIZE
Specifies sorting should be performed according to consequent size. |
static int |
BY_SUPPORT
Specifies sorting should be performed according to rule support. |
Constructor Summary | |
AssociationRule(Itemset antecedent,
Itemset consequent,
double support,
double confidence)
Creates a new association rule. |
Method Summary | |
int |
antecedentSize()
Return size of antecedent. |
int |
compareTo(java.lang.Object obj,
int criteria)
Compare two AssociationRule objects on one of several criteria. |
double |
computeConfidence()
Compute and return the confidence of the rule. |
double |
computeInfluence()
Compute and return the influence of the rule. |
double |
computeLift()
Compute and return the lift of the rule. |
double |
computePiatetskyShapiro()
Compute and return the Piatetsky-Shapiro measure of the rule. |
int |
consequentSize()
Return size of consequent. |
boolean |
equals(java.lang.Object obj)
Compare two AssociationRule objects on one of several criteria. |
Itemset |
getAntecedent()
Return antecedent of association rule. |
int |
getAntecedentItem(int i)
Return i-th item in antecedent. |
double |
getConfidence()
Return confidence of association rule. |
Itemset |
getConsequent()
Return consequent of association rule. |
int |
getConsequentItem(int i)
Return i-th item in consequent. |
double |
getSupport()
Return support of association rule. |
boolean |
isCoveredBy(AssociationRule ar)
Find out if this rule is covered (can be inferred from) the ar rule. |
static void |
main(java.lang.String[] args)
sample usage and testing |
void |
setConfidence(double confidence)
Set confidence of association rule. |
java.lang.String |
toString()
Return a String representation of the AssociationRule. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int BY_ANTECEDENT_SIZE
public static final int BY_CONSEQUENT_SIZE
public static final int BY_SUPPORT
public static final int BY_CONFIDENCE
Constructor Detail |
public AssociationRule(Itemset antecedent, Itemset consequent, double support, double confidence)
antecedent
- the antecedent of the association ruleconsequent
- the consequent of the association rulesupport
- the support of the association ruleconfidence
- the confidence of the association rulejava.lang.IllegalArgumentException
- antecedent
or consequent
are null or support
or confidence
are not between 0 and 1Method Detail |
public int antecedentSize()
public int consequentSize()
public Itemset getAntecedent()
public Itemset getConsequent()
public double getSupport()
public double getConfidence()
public void setConfidence(double confidence)
confidence
- the new value of the confidencepublic int getAntecedentItem(int i)
i
- the index of the item to geti
-th item in antecedentIndexOutOfBoundsException
- i
is an invalid indexpublic int getConsequentItem(int i)
i
- the index of the item to geti
-th item in consequentIndexOutOfBoundsException
- i
is an invalid indexpublic int compareTo(java.lang.Object obj, int criteria)
compareTo
in interface CriteriaComparable
ar
- the AssociationRule object with which we want to
compare this objectcriteria
- the criteria on which we want to compare, can
be one of ANTECEDENT_SIZE, CONSEQUENT_SIZE, SUPPORT or CONFIDENCE.ar
, 0 if they are equal, and a positive value if this
object is greater.java.lang.IllegalArgumentException
- obj
is not an
AssociationRule or criteria is invalidpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
ar
- the AssociationRule object with which we want to
compare this objectcriteria
- the criteria on which we want to compare, can
be one of ANTECEDENT_SIZE, CONSEQUENT_SIZE, SUPPORT or CONFIDENCE.public boolean isCoveredBy(AssociationRule ar)
ar
rule.ar
- the rule that we test againstar
and false
otherwise.public double computeConfidence()
public double computePiatetskyShapiro()
public double computeLift()
public double computeInfluence()
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |