270 likes | 435 Views
Gilles ÉNÉE and Mathias PEROUMALNAÏK LAMIA laboratory University of Antilles and Guyana French West Indies. Boost Character-Based Matching in Learning Classifier Systems with Xor. Presentation Overview. Character-based Matching Context Algorithm Logic Experimentations Pure matching
E N D
Gilles ÉNÉE and Mathias PEROUMALNAÏK LAMIA laboratory University of Antilles and Guyana French West Indies Boost Character-Based Matching in Learning Classifier Systems with Xor
Presentation Overview Character-based Matching • Context • Algorithm Logic Experimentations • Pure matching • XCS and APCS Conclusion 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
Character-based Matching Context • 65 % of computational time spent with matching (Llora and al. 2006) • Changing encoding is not always faster (Butz and al. 2008) • Can we do better ? (Lanzi presentation in 2008) 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
Character-basedMatching 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
Character-basedMatching Let’s suppose that R[1] contains condition[pos], R[2] inputs[pos] • (condition[pos]==‘#’) || (condition[pos]==inputs[pos]) || (inputs[pos]==‘#’) Will be written in assembler • Cmpi R[3], R[1],’#’ • Jeq R[3], end_match_test • Cmp R[3], R[1], R[2] • Jeq R[3], end_match_test • Cmpi R[3], R[2], ‘#’ • Jne R[3], end_matching_function 6 assembler instructions 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
Logic 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
Logic Deduced from previous table • IsMatching(pos) when ¬(condition[pos] ⊕ inputs[pos]) Using C / C++ language • IsMatching(pos) when ((condition[pos]⊕inputs[pos]) ≠1) Simplifying • IsMatching(pos) when ((condition[pos]⊕inputs[pos])−1) 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
Logic (condition[pos] ⊕ inputs[pos]) 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
Logic Let’s suppose that R[1] contains condition[pos], R[2] inputs[pos] • IsMatching(pos) when ((condition[pos]⊕inputs[pos])−1) Will be written in assembler • Xor R[3], R[1], R[2] • Cmpi R[4], R[3], 1 • Jeq R[4], end_matching_function 3 assembler instructions 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsPure Matching Hardware and Software • Intel Core 2 Duo 3 Ghz • 2 Gb • Gcc 4.4.1 –O3 • Ubuntu 64 bits • /usr/bin/time -f “%U” 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsPure Matching • Classifier condition • Length is 10, 50, 100 bits • Filled with : 0%, 50% and 100% of wildcard • Size of rule that matches : 0%, 1%, 5%, 10%, 15%, 20%, 25%, 50%, 75% and 100% • Repeated : 107 times 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsPure Matching Wildcard Rate is 0% 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsPure Matching Closer look to 0% with length = 100 bits 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsPure Matching Why ? Assembler code gives answer • Or • Cmpi R[3], R[1],’#’ • Jeq R[3], end_match_test • Cmp R[3], R[1], R[2] • Jeq R[3], end_match_test • Cmpi R[3], R[2], ‘#’ • Jne R[3], end_matching_function • Xor • Xor R[3], R[1], R[2] • Cmpi R[4], R[3], 1 • Jeq R[4], end_matching_function 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsPure Matching Wildcard Rate is 50% 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsPure Matching Why Xor is that much better ? • 50% of the time boolean test works with ‘#’ • 50% of the time boolean test works with == • Processor optimizations , thanks to Branch Unit, reaches their limits 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsPure Matching Wildcard Rate is 100% 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsPure Matching Why Or is better then ? • Branch Unit statistically detects that the test with wildcard should be run more often • The longer is your condition part, the more CPU opimizes this 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsPure Matching But we don’t have exactly 100% in condition part of learnt classifiers so ? • Some experimentations made with ggc 3.3 on JS21 blades (RISC architecture) with 2 Gbytes per core 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsPure Matching 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
Experimentations Summarize • Xor better for character based matching ? • Globally yes • Depends heavilly upon • CPU (RISC or CISC) • Compiler (dedicated or version) • Order of your tests with Or version • Wildcard rate • Size of your condition part 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsXCS and APCS Hardware and Software • Intel Core 2 Duo 2,2 Ghz • 2 Gb • Gcc 4.4.3 with –g –O1 –O2 and –O3 • Ubuntu 64 bits • /usr/bin/time -f “%U” • 10 experimentations each • XCS tested with M Tuberculosis database (Valetudie and al. 2007) • APCS tested with small Yin Yang ball 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsXCS and APCS XCS results 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsXCS and APCS APCS results 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
ExperimentationsXCS and APCS Explanations for APCS 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
Conclusion Is it worth to change Character-Based matching algorithm with Xor ? • Yes • You simplify testing ternary bits moreover if you can have wildcards in incoming signal like in classifications cases • Your code pass through –O3 optimization :) • 2% can be crucial when dealing with a lot of datas • Maybe not • If you don’t need to test wildcards in signals : testing has to be done to be fair 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)
Conclusion Thanks for your attention 13th International Workshop on Learning Classifier Systems - Gilles Enée (gilles.enee@univ-ag.fr)