10.07.2015 Views

Exercise 10: Apriori algorithm, solution - LSIR

Exercise 10: Apriori algorithm, solution - LSIR

Exercise 10: Apriori algorithm, solution - LSIR

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Exercise</strong> <strong>10</strong>: <strong>Apriori</strong> <strong>algorithm</strong>, <strong>solution</strong>1.We need to look for the association rules of the form:{cause} {car_accident}i.e. in which the left-hand side represents the cause of the accident.The possible association rules are:{lightning} {car_accident} support: 0.25 confidence: 0.4{wind} {car_accident} support: 0.375 confidence: 0.6{fire} {car_accident} support: 0.375 confidence: 0.5{clouds} {car_accident} support: 0.25 confidence: 0.33{rain} {car_accident} support: 0.125 confidence: 0.2Wind has both the highest confidence and the highest support and isthe most likely cause of the accidents.2.We first find all the frequent itemsets of size one. The minimal supportrequirement is 0.6, which means that to be frequent an itemset mustoccur in at least 6 out of the 8 transactions, 6/8=0.625>=0.6. Thereare five frequent itemsets:{clouds} support: 0.75{wind} support: 0.625{lightning} support: 0.625{rain} support: 0.625{fire} support: 0.75From the above itemsets we next generate all possible itemsets of size2 and prune the itemsets with support below 0.6. Only two itemsetsremain:{lightning fire} support: 0.625{clouds rain} support: 0.625It is not possible to generate the itemsets of size 3 out of the above 2itemsets, the intersection is empty.


Based on the itemsets of size 2 we generate all possible associationrules and compute their confidence:{lightning} {fire} support: 0.625 confidence: 1.0{fire} {lightning} support: 0.625 confidence: 0.833{clouds} {rain} support: 0.625 confidence: 0.833{rain} {clouds} support: 0.625 confidence: 1.0There are only two association rules with confidence equal to 1 andthat is the final <strong>solution</strong>.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!