|
(A rule that has low confidence value is not useful because the rule is rarely valid)
And |Y| = k
|
This number excludes these meaningless rules:
|
Possible association rules that can be generated:
|
Input: F = all frequent item sets for ( each (frequent) item set S ∈ F ) do { for ( each proper subset X &sub S ) do { Y = S - X; // X is the antecedent // Y is the consequence if ( ( Freq( S (= X∪Y) ) / Freq(X) ) ≥ min_confidence ) { print X ⇒ Y; } } } |
This requires a smarter way to reduce the number of checks
|
Proof:
|
|
![]() |
|
|
|
|
|
|
for ( each frequent k-itemset fk (k ≥ 2) ) do { /* -------------------------------------------------- Compute association rules with 1-item consequence -------------------------------------------------- */ H1 = ∅ // All assoc. rules with 1-item consequence for ( each x ∈ fk ) do if ( ( Freq( fk ) / Freq({x}) ) ≥ min_confidence ) Add {x} to H1; /* -------------------------------------------------------- Find association rules with 2 or more items consequence -------------------------------------------------------- */ Apriori-GenRules( fk, H1 ); } |
Apriori-GenRules( fk, Hm ) { k = | fk |; // # items in fk m = | { x | x ∈ Hm } |; // m = size of the consequence /* ----------------------------------------- Stop searching when m = k - 1 (avoid generating the rule: ∅ &rArr fk ----------------------------------------- */ if ( m == k - 1 ) return; /* ---------------------------------- Generate "candidate consequences" ---------------------------------- */ Hm+1 = Apriori-Gen( Hm ); // See: click here /* --------------------------------------------------- Delete consequences with less than min threshold --------------------------------------------------- */ for ( each hm+1 ∈ Hm+1 ) do { conf = Freq(fk) / Freq(fk - hm+1); if ( conf ≥ min_confidence ) { output rule (fk - hm+1) ⇒ hm+1; } else { delete hm+1 from Hm+1; } } /* ---------------------------------------- Find higher degree consequence rules ---------------------------------------- */ if ( Hm+1 != ∅ ) { Apriori-GenRules( fk, Hm+1 ); } } |