Report

Faculty of Electrical Engineering University of Belgrade Ant-Miner Data Mining with an Ant Colony Optimization Algorithm (Parpinelli R., Lopes H., Freitas A.) Marko Jovanović [email protected] Sonja Veljković [email protected] Outline 1. Introduction 2. Problem Statement 3. Real Ant Colonies 4. Ant Colony Optimization 5. Existing Solutions 6. Ant-Miner 7. Example 8. Proof of Concept 9. Trends and Variations 10. Future work Marko Jovanović [email protected] Sonja Veljković 2/36 [email protected] Introduction • The goal of data mining: extract (comprehensible) knowledge from data – Comprehensibility is important when knowledge will be used for supporting a decision made by a human • Algorithm for data mining called Ant-Miner (Ant Colony-based Data Miner) – Discover classification rules in data sets – Based on the behavior of real ant colonies and on data mining concepts Marko Jovanović [email protected] Sonja Veljković 3/36 [email protected] Problem Statement • Rule Induction for classification using ACO – Given: training set – Goal: (simple) rules to classify data – Output: ordered decision list Marko Jovanović [email protected] Sonja Veljković 4/36 [email protected] Real Ant Colonies • Different insects perform related tasks – colony is capable of solving complex problems • Find the shortest path between a food source and the nest without using visual information • Communication by means of pheromone trails – As ants move, a certain amount of pheromone is dropped on the ground, marking the path – The more ants follow a given trail, the more attractive this trail becomes (loop of positive feedback) Marko Jovanović [email protected] Sonja Veljković 5/36 [email protected] Obstacle on the Trail? Marko Jovanović [email protected] Sonja Veljković 6/36 [email protected] Ant Colony Optimization • ACO algorithm for the classification task – Assign each case to one class, out of a set of predefined classes • Discovered knowledge is expressed in the form of IF-THEN rules: IF <conditions> THEN <class> – The rule antecedent (IF) contains a set of conditions, connected by AND operator – The rule consequent (THEN) specifies the class predicted for cases whose predictor attributes satisfy all the terms specified in IF part Marko Jovanović [email protected] Sonja Veljković 7/36 [email protected] Basic Ideas of ACO • Each path followed by an ant is associated with a candidate solution • Ant follows a path – the amount of pheromone on that path is proportional to the quality of the corresponding candidate solution •Ant choose between paths – the path(s) with a larger amount of pheromone have a greater probability of being chosen Marko Jovanović [email protected] Sonja Veljković 8/36 [email protected] Result • Ants usually converge to the optimum or near-optimum solution! Marko Jovanović [email protected] Sonja Veljković 9/36 [email protected] Importance of ACO • Why are important for Data Mining? – Algorithms involve simple agents (ants) that cooperate to achieve an unified behavior for the system as a whole! – System finds a high-quality solution for problems with a large search space – Rule discovery: search for a good combination of terms involving values of the predictor attributes Marko Jovanović [email protected] Sonja Veljković 10/36 [email protected] Existing Solutions • Rule Induction Using a Sequential Covering Algorithm 1. CN2 2. AQ 3. Ripper Marko Jovanović [email protected] Sonja Veljković 11/36 [email protected] CN2 • Discovers one rule at a time • New rule to the end of the list of discovered rules – list is ordered! • Removes covered cases from the training set • Calls again the procedure to discover another rule for the remaining training cases • Beam search for rule construction – At each iteration adds all possible terms to the current partial rules – Retains only the best b partial rules (b - beam width) – Repeated until a stopping criterion is met • Returns the best of b rules currently kept by the beam search Marko Jovanović [email protected] Sonja Veljković 12/36 [email protected] AQ • Builds a set of rules from the set of examples for the collection of classes • Given positive examples p and negative examples n • Randomly select example from p • Search for set of rules that cover description of every element in p set and none in n set • Remove all examples from p that are covered by the rule • Algorithm stops when p is empty • Dependence on specific training examples during search! Marko Jovanović [email protected] Sonja Veljković 13/36 [email protected] Ripper • Inductive rule learner • Search method to search through the hypothesis •There are two kinds of loop in Ripper algorithm 1. Outer loop: adding one rule at a time to the rule base 2. Inner loop: adding one condition at a time to the current rule – Conditions are added to the rule to maximize an information gain measure – Conditions are added to the rule until it covers no negative example • Uses FOIL gain (First Order Inductive Learner) • Disadvantage: conditions selected based only on the values of the statistical measure! Marko Jovanović [email protected] Sonja Veljković 14/36 [email protected] Ant-Miner • Algorithm consists of several steps – Rule construction – Rule pruning – Pheromone updating Marko Jovanović [email protected] Sonja Veljković 15/36 [email protected]l.com Rule Construction • Ant starts with empty rule • Ant adds one term at a time to rule • Choice depends on two factors: – Heuristic function (problem dependent) η – Pheromone associated with term τ Marko Jovanović [email protected] Sonja Veljković 16/36 [email protected] Rule Pruning • Some irrelevant terms may be added during previous phase • Imperfect heuristic function – Ignores attribute interactions Marko Jovanović [email protected] Sonja Veljković 17/36 [email protected] Pheromone Updating • Increase pheromone in trail followed by current ant – According to quality of found rule • Decrease pheromone in other trails – Simulate pheromone evaporation • New ant starts with rule construction – Uses new pheromone data! Marko Jovanović [email protected] Sonja Veljković 18/36 [email protected] Stopping Criteria • Num. of rules >= Num. of ants • Convergence is met – Last k ants found exactly the same rule, k = No_rules_converg • List of discovered rules is updated • Pheromones reset for all trails Marko Jovanović [email protected] Sonja Veljković 19/36 [email protected] Algorithm Pseudocode TrainingSet = {all training cases}; DiscoveredRuleList = [ ]; /* rule list is initialized with an empty list */ WHILE (TrainingSet > Max_uncovered_cases) t = 1; /* ant index */ j = 1; /* convergence test index */ Initialize all trails with the same amount of pheromone; REPEAT Antt starts with an empty rule and incrementally constructs a classification rule Rt by adding one term at a time to the current rule; Prune rule Rt; Update the pheromone of all trails by increasing pheromone in the trail followed by Antt (proportional to the quality of Rt) and decreasing pheromone in the other trails (simulating pheromone evaporation); IF (Rt is equal to Rt-1) /* update convergence test */ THEN j = j + 1; ELSE j = 1; END IF t = t + 1; UNTIL (i ≥ No_of_ants) OR (j ≥ No_rules_converg) Choose the best rule Rbest among all rules Rt constructed by all the ants; Add rule Rbest to DiscoveredRuleList; TrainingSet = TrainingSet - {set of cases correctly covered by Rbest}; END WHILE Marko Jovanović [email protected] Sonja Veljković 20/36 [email protected] How Terms Are Chosen? • Heuristic function ηij and pheromone amount τij(t) • Probability function: • Heuristic function acts similar as proximity function in TSP • Limitations! Marko Jovanović [email protected] Sonja Veljković 21/36 [email protected] Heuristic Function ηij • Based on information theory – In information theory, entropy is a measure of the uncertainty associated with a random variable – “amount of information” • Entropy for each termij is calculated as: • Final heuristic function defined as: Marko Jovanović [email protected] Sonja Veljković 22/36 [email protected] Heuristic Function ηij P(play|outlook=sunny) = 2/14 = 0.143 P(don’t play|outlook=sunny) = 3/14 = 0.214 H(W,outlook=sunny)=-0.143*log(0.143)-0.214*log(0.214) = 0.877 ηsunny =logk-H(W,outlook=sunny) = 1-0.877 = 0.123 Marko Jovanović [email protected] Sonja Veljković 23/36 [email protected] Heuristic Function ηij P(play|outlook=overcast) = 4/14 = 0.286 P(don’t play|outlook=overcast) = 0/14 = 0 H(W,outlook=overcast)=-0.286*log(0.286) = 0.516 ηovercast =logk-H(W,outlook=overcast) = 1-0.516 = 0.484 Marko Jovanović [email protected] Sonja Veljković 24/36 [email protected] Rule Pruning • Remove irrelevant, unduly included terms in rule – Thus, improving simplicity of rule • Iteratively remove one-term-at-a-time – Test new rule against rule-quality function: • Process repeated until further removals no more improve quality of the rule Marko Jovanović [email protected] Sonja Veljković 25/36 [email protected] Pheromone Updating • Increase probability termij will be chosen by other ants in future – In proportion to rule quality Q – 0 <= Q <= 1 • Updating: • Pheromone evaporation Marko Jovanović [email protected] Sonja Veljković 26/36 [email protected] Ant-Miner example Pheromone TP=1, FN=8,update: TN=5, FP=0 τQ=0.111 overcast(2)=(1+0.444)* τovercast(1) τw/o outlook=overcast (2)=0.481 overcast Q=0.111 Normalization: w/o temp=81 τ overcast (2)=0.419 w/o humid=75…… τ sunny(2)=0.29 DiscoveredRuleList=[IF DiscoveredRuleList=[] overcast THEN play] w/o temp=81 and humid=75 τ rain(2)=0.29 TP=2, FN=7, TN=5, FP=0 Rule=IF η72rain 0.124, (outlook=overcast) Q=0.222 – better! ηη75 =η=η=0.456, = η65 = 95 = 0.075, f AND η75sunny = =0.123, w/o outlook=overcast ηη96 =η=(temp=81) η0.599, η85 = 0.728, 78 = 0.048, t AND η71overcast η81==η0.484 69= η64= η65= TP=6, FN=3,TN=3, FP=2 ηη90 ==τ(humid=75) 0.456, (1) = 1/2 all AND τ68rain (1) η70==0.327 τηsunny (1) = ητ85 = (1) = 1/3 Q=0.4 – even better! 83= η 80= overcast ηη70 ==false η(windy=false) 80 THEN overcast ??? w/o windy=false τ0.728 all(1) = 1/12 THEN τall(1)PLAY = 1/12 TP=4, FN=5, TN=5, FP=0 75 81 Q=0.444 – BEST! sunny overcast rain false true 85 80 83 70 68….. Marko Jovanović [email protected] Sonja Veljković 27/36 [email protected] Proof of Concept • Compared against well-known Rule-based classification algorithms based on sequential covering, like CN2 • Essence of every algorithm is the same – Rules learned one-at-a-time – Each time new rule found, tuples which are covered are removed from training set Marko Jovanović [email protected] Sonja Veljković 28/36 [email protected] Proof of Concept • Ant-Miner is better, because: – Uses feedback (pheromone mechanism) – Stochastic search, instead of deterministic • End effect: shorter rules • Downside: sometimes worse predictive accuracy – But acceptable! Marko Jovanović [email protected] Sonja Veljković 29/36 [email protected] Proof of Concept • Well known data sets used for comparison Data set #Cases #Categorical attributes #Continuous attributes #Classes Ljubljana breast cancer 282 9 - 2 Wisconsin breast cancer 683 - 9 2 Tic tac toe 958 9 - 2 Dermatology 366 33 1 6 Hepatitis 155 13 6 2 Cleveland heart disease 303 8 5 5 Marko Jovanović [email protected] Sonja Veljković 30/36 [email protected] Proof of Concept • Predictive accuracy Data set Ant-Miner’s predictive accuracy (%) CN2’s predictive accuracy (%) Ljubljana breast cancer 75.25 ± 2.24 67.69 ± 3.59 Wisconsin breast cancer 96.04 ± 0.93 94.88 ± 0.88 Tic tac toe 73.04 ± 2.53 97.38 ± 0.52 Dermatology 94.29 ± 1.20 90.38 ± 1.66 Hepatitis 90.00 ± 3.11 90.00 ± 2.50 Cleveland heart disease 59.67 ± 2.50 57.48 ± 1.78 Marko Jovanović [email protected] Conclusion Sonja Veljković 31/36 [email protected] Proof of Concept • Simplicity of rule lists Number of rules found Average number of terms in rule Data set Ant-Miner CN2 Ant-Miner CN2 Ljubljana breast cancer 7.10 ± 0.31 55.40 ± 2.07 1.28 2.21 Wisconsin breast cancer 6.20 ± 0.25 18.60 ± 0.45 1.97 2.39 Tic tac toe 8.50 ± 0.62 39.70 ± 2.52 1.18 2.90 Dermatology 7.30 ± 0.15 18.50 ± 0.47 3.16 2.47 Hepatitis 3.40 ± 0.16 7.20 ± 0.25 2.41 1.58 Cleveland heart disease 9.50 ± 0.92 42.40 ± 0.71 1.71 2.79 Marko Jovanović [email protected] Sonja Veljković 32/36 [email protected] Trends and Variations • Specialized types of classification problems: – Development of more sophisticated Ant-Miner variations 1.Modification for Multi–Label Classification 2.Hierarchical classification 3.Discovery of fuzzy classification rules Marko Jovanović [email protected] Sonja Veljković 33/36 [email protected] Future Work 1. Extend Ant-Miner to cope with continuous attributes – this kind of attribute is required to be discretized in a preprocessing step 2. Investigate the performance of other kinds of heuristic function and pheromone updating strategy Marko Jovanović [email protected] Sonja Veljković 34/36 [email protected] References • Parpinelli R., Lopes H., Freitas A.: Data Mining with an Ant Colony Optimization Algorithm • Han J., Kamber M.: Data Mining – Concepts and Techniques • Wikipedia article on Ant colony optimization http://en.wikipedia.org/wiki/Ant_colony_opti mization • Singler J., Atkinson B.: Data Mining using Ant Colony Optimization Marko Jovanović [email protected] Sonja Veljković 35/36 [email protected] Thank you for your attention! Marko Jovanović [email protected] Sonja Veljković 36/36 [email protected]