Association Rule Mining 2023 (Compatibility Mode)
Association Rule Mining 2023 (Compatibility Mode)
Rules Discovered:
{Src IP = 206.163.37.95,
Dest Port = 139,
Bytes [150, 200]} --> {ATTACK}
Association rule learning
5
Association Mining
Association rule mining:
Finding frequent patterns, associations, or
correlations, among sets of items or objects in
transaction databases, relational databases, and other
information repositories.
Examples.
Rule form: “Body ead [support, confidence]”.
buys(x, “Bread”) buys(x, “Milk”) [0.5%, 60%]
major(x, “CS”) ^ takes(x, “DB”) grade(x, “A”) [1%,
75%]
Example Association Rule
I: itemset
{cucumber, parsley, onion, tomato, salt, bread, olives,
cheese, butter}
D: set of transactions
1 {{cucumber, parsley, onion, tomato, salt, bread},
2 {tomato, cucumber, parsley},
3 {tomato, cucumber, olives, onion, parsley},
4 {tomato, cucumber, onion, bread},
5 {tomato, salt, onion},
6 {bread, cheese}
7 {tomato, cheese, cucumber}
8 {bread, butter}}
FORMAL MODEL
Association rule: X Y
here X I, Y I and X Y = .
Rule X Y has a support s in D
if s% of transactions in D contain X Y.
Ck = Ck U {c}
Apriori Candidate Generation
Example :
L3 = { { 1,2,3},{1,2,5},{1,3,5},{2,3,4},{2,3,5} }
Algorithm will generate following itemset
1) { 1, 2,3, 5 } is generated from { 1,2 ,3}
and {1,2,5}
Similarly , { 2,3,4,5} is generated from { 2,3,4} and
{ 2,3, 5}.
Now
Ck = { {1,2,3,5} , {2,3,4,5} }
Example of Generating Candidates
prune(Ck)
for all c Ck
for all (k-1)-subsets d of c do
if d Lk-1
then Ck = Ck \ {c}
APRIORI ALGORTHM
Example:
with k = 3 (& k-itemsets lexicographically ordered)
genereate all possible (k+1)-itemsets, by, for each to sets where we have
{a1,a2,..a(k-1),X} and {a1,a2,..a(k-1),Y}, results in candidate
{a_1,a_2,...a_(k-1),X,Y}.
1: 3, 5, 8.
2: 2, 6, 8.
3: 1, 4, 7, 10.
4: 3, 8, 10.
5: 2, 5, 8.
6: 1, 5, 6.
7: 4, 5, 6, 8.
8: 2, 3, 4.
9: 1, 5, 7, 8.
10: 3, 8, 9, 10.
1: 3, 5, 8.
2: 2, 6, 8.
3: 1, 4, 7, 10.
4: 3, 8, 10.
5: 2, 5, 8.
6: 1, 5, 6.
7: 4, 5, 6, 8.
8: 2, 3, 4.
9: 1, 5, 7, 8.
10: 3, 8, 9, 10.
1: 3, 5, 8.
2: 2, 6, 8.
3: 1, 4, 7, 10.
4: 3, 8, 10.
5: 2, 5, 8.
6: 1, 5, 6.
7: 4, 5, 6, 8.
8: 2, 3, 4.
9: 1, 5, 7, 8.
10: 3, 8, 9, 10.
For a rule:
R: < c1, c2, …, ci-1 > < ci, ci+1, ... ck >
Head Tail