Exploring Temporal Patterns from Multi-relational Databases
Full text
To my Parents
Acknowledgments The work presented in this thesis would not be accomplished without the support of many people and institutions that I hereby thank. First of all, I want to thank my supervisors, Professor Jo˜ao Gama, Associated Professor at the Faculty of Economics of the University of Porto (FEP), and Professor V´ıtor Santos Costa, Associated Professor at the Faculty of Sciences of the University of Porto, for accepting the supervision of this thesis. Professor Jo˜ao Gama introduce me to this amazing area of machine learning and was the main propeller of the work presented here. Beyond the guidance and technical collaboration, the many informal meetings and discussions we had were a source of motivation and knowledge. Even the discussions about our football (rival) teams contributed to good working environment and to overcome the most difficult phases of this work. Professor V´ıtor Santos Costa was my undergraduate teacher and since then I see him as an outstanding human being and researcher that is always involved and available. In this work I confirmed that and gain (I hope!) with his remarkable expertise in Inductive Logic Programming and scientific writing. I deeply thank Professor Pavel Brazdil and Professor Al´ıpio Jorge, the two coordinators of LIAAD-INESC TEC, in the period that I worked in this thesis, and Professor Fernando Silva, the coordinator of CRACS-INESC TEC. Without their support this work would be much more difficult to finish. A special thank to Professor Pavel Brazdil, he was the undergraduate teacher that introduce me to the Artificial Intelligence field and was the main source of inspiration that made me decide for this area. I thank all researches and collaborators of LIAAD-INESC TEC for the pleasant discussions and with whom I learn something. To Rui Leite, Jo˜ao Moreira, Lu´ıs Torgo, Carlos Soares, Petr Kosina, Raquel Sebasti˜ao, Rita Ribeiro, Pedro Rodrigues, M´arcia Oliveira, Ezilda Almeida, Lu´ıs Matias and Hadi Tork a great thanks. Moreover, I thank all people that present their work in the LIAAD-INESC TEC seminars. Without them I would not have evolved so much. I also thank the YAP Prolog compiler team for the outstanding support. A special thank to Professor V´ıtor Santos Costa and Ricardo Rocha. Thanks to my niece for the smile and the many fun times. V
To my parents I do not thank... Agrade¸co aos meus pais por TUDO! I thank the Faculty of Sciences of the University of Porto for allowing me to endure the doctoral program. I have been studying in this faculty since the beginning of my undergraduate course and it is a pleasure to be part of this institution. The work presented in this thesis was partially supported by the Portuguese Foundation for Science and Technology (FCT) and the Polytechnic Institute of Porto (ISEP/IPP) with the PhD grant SFRH/PROTEC/49634/2009. Two FCT projects also provide financial support and equipment to the work developed in this thesis, the Knowledge Discovery from Ubiquitous Data Streams (PTDC/EIAEIA/098355/2008) project and the HORUS: Horn Representations of Uncertainty in Systems (PTDC/EIA-EIA/100897/2008) project financed many of the work developed in this thesis. This work was also part-funded by the ERDF - European Regional Development Fund through the COMPETE Programme (operational programme for competitiveness) and by the Portuguese Funds through the FCT within project FCOMP-01-0124-FEDER- 022701 the FEDER funds through COMPETE program. Thanks! VI
Abstract Multi-relational databases are widely used to represent and store data. Often, a multirelational database is composed by tables recording static data, that do not change over time, and by tables recording dynamic data, that is being accumulated over time. Finding temporal patterns in such temporal databases is an important challenge in domains as diverse as video processing, computational biology and elderly monitoring. The main goal of this thesis is to study methods and techniques to explore the temporal information available in such multi-relational databases. Mainly, to find rich patterns and learn highly expressive classification theories. Therefore, this thesis is aimed at developing methodologies that can explore both static and dynamic data and the logico-relational information available in rich structured databases. Furthermore, as expressiveness of theories comes at expense of higher computational costs, in this thesis we investigated time and space efficient methodologies. To achieve these goals we analyze the state-of-the-art methods and present a set of frameworks and algorithms that combine methods and techniques from propositional and relational learning fields. In particular, we explore temporal information using either propositional or first-order logic (FOL) sequence miners. Moreover, we explore propositionalization and predicate invention techniques to learn either propositional or FOL theories. Our proposals include four frameworks and an ILP based algorithm. We introduce the propositional MuSer framework to explore temporal information using well-know and efficient propositional methodologies. At the core of this framework we have a new encoding methodology and a dual search strategy. The encoding methodology translates the temporal information available in a multi-relational database into a propositional sequence database suitable to be explored by a propositional sequence miner. With the dual search strategy frequent sequences are found by mining each dataset partition individually. Moreover, we make use of a new propositionalization VII
technique to induce a propositional classifier. The second framework, the XMuSer, combines propositional and relational techniques to learn a FOL classification theory. In this framework we use the encoding methodology introduced in the MuSer system and run a propositional sequence miner that can find a constrained set of temporal patterns. We find a constrained set of patterns and use a predicate invention technique to learn a FOL theory from static and temporal data. The third system that we introduce here does not use any propositional technique. Both the mining of sequence patterns and the theory learning procedures rely on FOL algorithms. The main goal of this framework is to explore the discriminative power of contrasting patterns found by the BeamSouL algorithm, also developed in this work. The BeamSouL algorithm is an ILP based algorithm that uses SeqLog representation formalism to represent and explore sequences of logical atoms. BeamSouL algorithm was designed to find all or a subset of long contrasting patterns. The efficiency of this algorithm relies on the θ-subsumption operator, that eliminates the need to run the sequence miner with low support values, and in a hybrid search strategy that combines exhaustive and beam search methods. By using a beam search procedure in a second phase the algorithm can find long size patterns that would be impossible to find with existing methods. All these proposals were evaluated empirically by using four real databases. Moreover, we compare our proposals with a set of algorithms. In this set we include the RUSEWARMR framework that we develop under this thesis. The RUSE-WARMR system uses arithmetic aggregation operations and a FOL association rule miner to explore temporal data. This way the RUSE-WARMR do not conveniently explore temporal data and exhibits the worst results among the evaluated architectures. Moreover, as all our proposals generate at some point a large number of patterns, we analyze feature selection techniques and introduced a new technique that selects features in a rank order space induced by an ensemble of metrics. VIII
Resumo Bases de dados relacionais s˜ao muito utilizadas para representar e armazenar dados. Geralmente, uma base de dados relacional ´e composta por um conjunto de tabelas, algumas destas registando informa¸c˜ao est´atica que n˜ao muda ao longo do tempo e outras tabelas registando informa¸c˜ao dinˆamica, que ´e acumulada ao longo do tempo. Encontrar padr˜oes temporais nestas bases de dados temporais ´e um desafio importante em dom´ınios t˜ao diversos como o processamento de v´ıdeo, a biologia computacional e a monitoriza¸c˜ao de idosos. O principal objetivo desta tese ´e estudar m´etodos e t´ecnicas que permitam explorar a informa¸c˜ao temporal dispon´ıvel nestas bases de dados relacionais. Mais precisamente, esta tese visa o desenvolvimento de metodologias que permitam encontrar padr˜oes e aprender teorias de classifica¸c˜ao expressivas. Assim, esta tese tem por objetivo o desenvolvimento de m´etodos que possam explorar tanto a informa¸c˜ao est´atica e dinˆamica como a informa¸c˜ao l´ogico relacional dispon´ıvel em base de dados relacionais. Al´em disso, como a expressividade das teorias ´e sempre obtida com elevados custos computacionais, tamb´em procuramos desenvolver metodologias eficientes em termos de tempo e espa¸co de procura. Para atingir estes objetivos, analisamos o estado-da-arte e apresentamos um conjunto de arquiteturas e algoritmos que combinam m´etodos e t´ecnicas de aprendizagem proposicional e relacional. Em particular, exploramos informa¸c˜ao temporal usando algoritmos proposicionais ou de l´ogica de primeira ordem (LOP) que descobrem padr˜oes sequenciais. Al´em disso, exploramos t´ecnicas de proposicionaliza¸c˜ao e de cria¸c˜ao de predicados para aprender teorias proposicionais ou de LPO. Assim, nesta tese desenvolvemos quatro novas arquiteturas e um algoritmo baseado em ILP. A arquitetura proposicional Muser explora informa¸c˜ao temporal usando algoritmos proposicionais, que s˜ao conhecidos pela sua eficiˆencia. Fundamental para o desempenho desta metodologia ´e a t´ecnica de codifica¸c˜ao e a estrat´egia de pesquisa IX
dual. A t´ecnica de codifica¸c˜ao transforma a informa¸c˜ao temporal existente na base de dados para uma outra base de dados contendo sequˆencias proposicionais, sendo que esta ´ultima ´e adequada para ser usada como entrada para um algoritmo proposicional de descoberta de padr˜oes sequenciais. Com a estrat´egia de pesquisa dual os padr˜oes sequenciais s˜ao encontrados explorando cada uma das parti¸c˜oes individualmente. Nesta arquitetura tamb´em fazemos uso da t´ecnica proposicionaliza¸c˜ao de modo a incluir os padr˜oes sequenciais na fase de aprendizagem de uma teoria proposicional. A segunda arquitetura desenvolvida ´e denominada XMuSer e combina algoritmos proposicionais de descoberta de padr˜oes sequenciais e algoritmos baseados em ILP que aprendem uma teoria usando LPO. Nesta metodologia utilizamos a t´ecnica de codifica¸c˜ao introduzida na arquitetura MuSer e um algoritmo de descoberta de padr˜oes sequenciais que encontra um conjunto restrito de padr˜oes. Depois de encontrar um conjunto limitado de padr˜oes, usamos a t´ecnica de inven¸c˜ao de predicados para aprender uma teoria LPO que pode incluir informa¸c˜ao est´atica e/ou temporal. A terceira metodologia que desenvolvemos n˜ao usa qualquer t´ecnica proposicional. Tanto a descoberta de padr˜oes sequenciais como a fase de aprendizagem usam a LPO como formalismo de representa¸c˜ao. O desenvolvimento desta metodologia tem por objetivo explorar o poder de discriminativo dos padr˜oes contrastantes encontrados pelo algoritmo Beam- SouL, tamb´em desenvolvido neste trabalho. O algoritmo BeamSouL ´e baseado em ILP e utiliza o formalismo SeqLog para representar e descobrir padr˜oes sequenciais de ´atomos l´ogicos. O algoritmo BeamSouL foi concebido para encontrar todos ou um subconjunto de padr˜oes contrastantes de grande comprimento. A eficiˆencia deste algoritmo baseia-se num procedimento, que usa a subordina¸c˜ao-θ, que elimina a necessidade de executar o algoritmo de descoberta de padr˜oes sequenciais usando um valor de suporte baixo e tamb´em no uso de uma estrat´egia de pesquisa h´ıbrida que combina pesquisa exaustiva com pesquisa de feixe. Ao usar a pesquisa de feixe na segunda fase, o algoritmo consegue encontrar padr˜oes de grande comprimento que seriam imposs´ıveis de encontrar recorrendo aos algoritmos existentes. Todas estas propostas foram avaliadas de forma emp´ırica e utilizando quatro conjuntos de dados reais. Na avalia¸c˜ao das nossas propostas consideramos um conjunto de algoritmos concorrentes. Neste conjunto inclu´ımos a arquitetura RUSE-WARMR que tamb´em desenvolvemos nesta tese. Esta arquitetura usa t´ecnicas de agrega¸c˜ao dos dados temporais e um algoritmo que encontra regras de associa¸c˜ao representadas em LPO. Com esta estrat´egia, o RUSE-WARMR n˜ao explora convenientemente dados temporais e apresenta piores resultados do que qualquer das metodologias especialmente desenvolvidas para explorar a informa¸c˜ao temporal. X
Al´em disso, e como todos os algoritmos de descoberta de padr˜oes sequenciais geram um grande n´umero de padr˜oes, analisamos um conjunto de t´ecnicas de sele¸c˜ao de atributos e introduzimos uma nova t´ecnica que seleciona atributos num espa¸co cuja ordena¸c˜ao ´e induzido por um conjunto de m´etricas. XI
8.3 Limitations .................................141 8.4 FutureWork.................................141 References 143 Appendix A DNF Formulae 155 Appendix B Datasets 157 B.1 Hepatitis...................................157 B.2 Financial...................................158 B.3 FinancialB..................................158 B.4 Protein....................................159 Appendix C RUSE-WARMR Results 161 Appendix D MuSer Results 165 Appendix E XMuSer Results 169 Appendix F ConFOLding Results 175 XVIII
List of Tables 2.1 Relational database. Illustrative example inspired in the PKDD 2005 Hepatitisdataset .............................. 8 2.2 Contingencytable.............................. 28 2.3 Selection metrics for association rules . . . . . . . . . . . . . . . . . . . 29 3.1 Four instances of the yellow-small+adult-stretch dataset . . . . . . . . . 55 3.2 Total order over the itemsets using the value of each heuristic . . . . . 55 3.3 Database enlarged with ten new attributes . . . . . . . . . . . . . . . . 56 3.4 Description of the datasets and the number of itemsets found by the Apriori algorithm and selected using the xor-filter ............ 58 3.5 Misclassification error using the six heuristics ensemble ......... 59 3.6 Theory size: number of tree nodes using the six heuristics ensemble . . 60 3.7 Misclassification error using a single heuristic . . . . . . . . . . . . . . . 61 3.8 Theory size: number of tree nodes using a single heuristic . . . . . . . . 62 4.1 Enlarged target table . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 4.2 Number of patterns found in different phases of the RUSE-WARMR framework.................................. 73 4.3 Generalization accuracy of the RUSE-WARMR framework . . . . . . . 74 5.1 Relational database used to illustrate the encoding technique . . . . . . 84 5.2 SequenceDatabase ............................. 85 XIX
5.3 Enlarged target table . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 5.4 Number of patterns found in each step of the MuSer framework . . . . 91 5.5 Generalization accuracy of the MuSer framework . . . . . . . . . . . . 92 6.1 SequenceDatabase .............................103 6.2 Predictive sequential patterns found . . . . . . . . . . . . . . . . . . . . 104 6.3 Ordered list of sequential patterns . . . . . . . . . . . . . . . . . . . . . 104 6.4 Sequence Relation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 6.5 Number of patterns found in each step of the XMuSer framework . . . 109 6.6 Generalization accuracy of the XMuSer framework . . . . . . . . . . . . 110 7.1 Relational database used to clarify some details of the BeamSouL algorithm and of the ConFOLding framework.................122 7.2 Number of patterns found in each run of the BeamSouL algorithm . . . 129 7.3 Generalization accuracy of the ConFOLding framework . . . . . . . . . 130 B.1 Number of relations and class distribution of each database . . . . . . . 159 C.1 Peak memory usage of the RUSE-WARMR framework (in kilobytes) . . 162 C.2 Run-time of the RUSE-WARMR framework (in seconds) . . . . . . . . 163 C.3 Generalization accuracy of the RUSE-WARMR framework selecting the top ten and the top twenty most interesting patterns . . . . . . . . . . 164 D.1 Peak memory usage in each step of the MuSer framework (in kilobytes) 166 D.2 Run-time of each step of the MuSer framework (in seconds) . . . . . . 167 E.1 Peak memory usage in each step of the XMuSer framework (in kilobytes)170 E.2 Run-time of each step of the XMuSer framework (in seconds) . . . . . 171 E.3 Generalization accuracy of the XMuSer framework using a propositional learner in the last step . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 XX
E.4 Theory size: number of nodes . . . . . . . . . . . . . . . . . . . . . . . 173 F.1 Peak memory usage of the ConFOLding framework (in kilobytes) . . . 176 F.2 Run-time of the ConFOLding framework (in seconds) . . . . . . . . . . 179 F.3 Theory size: number of rules . . . . . . . . . . . . . . . . . . . . . . . . 182 F.4 Generalization accuracy of the propositional ConFOLding framework . 183 F.5 Theory size: number of tree nodes . . . . . . . . . . . . . . . . . . . . . 184 XXI
List of Figures 2.1 Partial order over the itemsets . . . . . . . . . . . . . . . . . . . . . . . 40 3.1 Rank ensemble selection .......................... 56 3.2 Stand-aloneC4.5 .............................. 56 4.1 RUSE-WARMR induced decision tree for the Hepatitis subtype problem 71 5.1 Patient one event sequence . . . . . . . . . . . . . . . . . . . . . . . . . 85 5.2 MuSer’s best induced decision tree for the Hepatitis subtype problem . 90 5.3 Example of a decision tree induced when the support value of MuSer’s sequence miner is set to 90% . . . . . . . . . . . . . . . . . . . . . . . . 93 7.1 Number of patterns found by the BeamSouL algorithm in the majority partition of the Hepatitis dataset. We present the number of frequent, closed and maximal patterns found for a range of maximum refinement levels.....................................127 7.2 Run-time needed by the BeamSouL and the MineSeqLog algorithms to find patterns in the majority partition of the Hepatitis dataset. We present the run-time of these algorithms for a range of maximum refinementlevels ..............................128 7.3 Number of patterns found by the BeamSouL algorithm in the majority partition of the Hepatitis dataset. We present the number of frequent, closed and maximal patterns found for a range of beam sizes . . . . . . 132 XXIII
7.4 Run-time needed by the BeamSouL algorithm to find patterns in the majority class of the Hepatitis dataset. We present the run-time of the BeamSouL algorithm for different beam sizes . . . . . . . . . . . . . . . 133 F.1 Run-time needed by the BeamSouL and the MineSeqLog algorithms to find patterns in minority partition of the Hepatitis dataset. We present the run-time of these algorithms for different refinement levels . . . . . 177 F.2 Number of patterns found by the BeamSouL algorithm in the minority partition of the Hepatitis dataset. We present the number of frequent, closed and maximal patterns found for a range of beam sizes . . . . . . 178 F.3 Run-time needed by the BeamSouL algorithm to find patterns in the Hepatitis dataset. We present the run-time of the BeamSouL algorithm for different beam sizes and for the negative-run of the ConFOLding framework..................................180 F.4 Run-time needed by the BeamSouL algorithm to find patterns in the Hepatitis dataset. We present the run-time of the BeamSouL algorithm for different beam sizes and for the positive-run of the ConFOLding framework..................................181 XXIV
Chapter 1 Introduction Multi-relational databases are widely used to represent and store data. Often, a multirelational database is composed by a set of tables, some recording static characteristics that do not change over time and other tables recording evolving, dynamic, data that is accumulated over time. For instance, in the medical domain a set of tables can record static information about the patient, like the patient’s date-of-birth and name, and other tables may record an always increasing number of sequences of medical examinations, such as blood analysis or urinalysis. Finding sequence patterns in such temporal databases is an important challenge in domains as diverse as video processing, computational biology and elderly monitoring. The classical approach to explore such data is to join tables and then run a propositional miner to find temporal patterns [KLF00, KRZ+03b]. The main issue with joining before mining is the large size of the generated table and the loss of valuable logico-relational information. An alternative approach to join before mining is to mine before join. Among the methodologies used in this last approach is Inductive Logic Programming (ILP) [MR94, Rae08]. Moreover, most of the existing techniques, including ILP techniques, fail to correctly explore the temporal information. Typically temporal information is aggregated [DT99] and hence important logic and temporal information is lost. In this work we study and introduce algorithms and techniques to explore temporal information available in multi-relational databases. Namely, we explore temporal information using both propositional [AS95, Zak01, PHMA+01] and first-order logic (FOL) sequence miners [LR04, dAF07]. We use these techniques to develop novel methodologies for supervised learning. 1
CHAPTER 1. INTRODUCTION 1.1 Motivation The methodologies available to explore temporal databases are based on the exclusive use of propositional or multi-relational techniques [LR04]. The former set of methods are widely available and are well-known to be time efficient. The main issue with these propositional methods is that they are unable to explore valuable relational information recorded in multi-relational databases. For instance, if we join the tables and then use a sequence miner to find frequent sequences we are unable to explore conveniently static information or include other valuable domain knowledge. In contrast to this, the relational techniques, especially ILP techniques, use high order representational formalisms to learn and represent a theory but pay a high cost in terms of scalability and time efficiency [BS03]. For instance, ILP based methods fail to find long patterns available in multi-relational databases that record dynamic information that is accumulated over a long period of time. Moreover, it is well-known that pattern mining methodologies, both propositional and relational, find a large set of patterns [PHMA+01], and most of them are redundant and uninteresting. Typically, the number of findings is so large that it is almost impossible for a classification algorithm or a human to select the most interesting patterns [YL04, YL03]. Thus, the goal of this thesis is to study methodologies that can benefit from the strengths of propositional and relational methodologies and eliminate, or reduce, the weaknesses of the two approaches. We should answer the following research questions: RQ1: How can we find temporal patterns available in multi-relational databases that accumulate data over a long period of time? RQ2: How do we combine propositional sequence miners with ILP based techniques to gain with the efficiency of propositional miners and representational power of first-order logic formalism? RQ3: Can we develop feature selection techniques that select the most discriminative features found by a pattern mining algorithm? 1.2 Main Contributions The research questions presented in the previous section can be answered with a wide range of methodologies. In this thesis we propose a set of frameworks and algorithms 2
1.2. MAIN CONTRIBUTIONS that explore temporal data using either propositional or relational sequence miners. Moreover, the methodologies are targeted to solve classification problems. Thus, the main contributions of this work are: C1: Develop the BeamSouL algorithm [FGC14] that can be tuned to find all or a subset of the long and contrasting FOL sequences. This algorithm is based in the SeqLog representation formalism and uses a hybrid search strategy to explore the lattice induced by the subsumption operator. In the first phase the algorithm runs an exhaustive search to find all short patterns. In the second phase the algorithm uses a beam search strategy and the confidence metric to find interesting long sequences. Moreover, by using this algorithm we can find contrasting patterns available in the database without running the sequence miner to find low support patterns in any partition. C2: Develop the ConFOLding framework [FGC14] that both explores temporal patterns and learns a classification theory using first-order logic methods. This architecture uses predicate invention technique to include the most interesting FOL contrasting patterns in the ILP learning task, where a FOL classification theory is learned. C3: Develop the MuSer framework [FGC10] that explores temporal databases using a set of propositional methodologies. This architecture uses an encoding strategy and a classical propositional sequence miner to find temporal patterns. Then, two filters are used to select the most interesting patterns. A propositional classifier is used to learn a propositional classification model. C4: Introduce a strategy that converts the temporal data available in a multi-relational database into a sequence database [FGC10, FGC11, FGC12a]. The obtained database can contain sequence data from different source tables and is suitable to be explored by propositional sequence miners. C5: A strategy that finds discriminative patterns by mining each class partition individually [FGC10, FGC11, FGC12a, FGC14]. By using this strategy we can find a large number of patterns that can only be found if we run the sequence miner with low support values on the full dataset. With our strategy we can run different instances of a sequence miner in parallel, one instance to explore each dataset partition, using approximately the same running time and equal or less memory usage as if we run a sequence miner on the full dataset. Moreover, with our strategy we can find a larger set of patterns than we can find by mining the 3
CHAPTER 2. MULTI-RELATIONAL DATA MINING null) that refers to a primary key of another table, Tj.Ak. Moreover, the Dom(Ti.Am)⊆ Dom(Tj.Ak).This key ensures that the data stored in a database is consistent. Definition 3. A table Tiis said to have one-to-one relationship with table Tj,if for every tuple in table Tiwe have at most one associated tuple in table Tj. Definition 4. A table Tiis said to have a one-to-many relationship with table Tj,if for every tuple in Tiwe have zero, one or more tuples associated with table Tj.And, for each tuple in table Tjwe have an associated tuple in table Ti. Definition 5. Amany-to-many relationship between two tables Tiand Tjexists when for each tuple in table Tithere exist many tuples associated in table Tj,and vice versa. In a multi-relational classification task it is required to have a table labeling the individuals registered in the database. Definition 6. Atarget table is a table that consists of labeled n-ary tuples describing a unique individual/example. Each target tuple is associated with a class label. The individuals registered in this type of tables are characterized by non-target records related with the target table. Additionally, we can use the relational algebra formal system to manipulate relations. Among the operators available in relational algebra we highlight the natural join operation. Definition 7. The natural join of two database relations R1and R2,denoted R1⊲⊳ R2, is the set of all combinations of tuples in R1and R2having a common subset of attributes and matching attribute values. 2.3 Inductive Logic Programming Inductive Logic Programming is a research area that studies tools and techniques to learn FOL clausal theories from examples and background knowledge [MR94, Dˇ 03, LDN99]. Different from logical program systems that use deductive inference, ILP systems use inductive inference to explore relational data. In this section we introduce the clausal theory, the ILP predictive setting and some ILP algorithms that can find a predictive theory. 10
2.3. INDUCTIVE LOGIC PROGRAMMING 2.3.1 Clausal Theory In this section we introduce some syntactic and semantic logical concepts that will be useful along this thesis. 2.3.1.1 Syntax of Logical Clauses ILP uses the representational formalism of Logic Programming to learn a theory that consists of a set of FOL clauses. Each clause in the learning theory as a conclusion part and a condition part, and can be defined in the following way: Definition 8. A clause is an expression p1∨...∨pn←q1∧...∧qm,where the pis and the qjsare FOL atoms. The p1∨...∨pndisjunction is known as the head of the clause, or the conclusion part, and q1∧...∧qmconjunction is known as the body of the clause, or the condition part. Moreover, the variables appearing in each logical atom are universally quantified. A FOL atom is a formula of the form p(t1,...,tn), of arity n, where each tiis a term. A logical fact is a logical atom having no variables. A term tican be a constant, a variable or a k-ary functor fapplied to kterms. The clause p1∨...∨pn←q1∧...∧qmcan also be represented as a disjunction of literals p1∨...∨pn∨ ¬q1∨...∨ ¬qm,where a literal is a logical atom or its negation. Most of the existing ILP algorithms learn a theory that consists of a set of Horn clauses, i.e., clauses whose conclusion part has at most one positive literal. The clause patient Info(A, B, C, D)←blood Analysis(E, F, low, H), urinanalysis(A, J, plt, high) is an example of a Horn clause. In this clause patient Info(A, B, C, D) is the head of the clause and blood Analysis(E, F, low, H), urinanalysis(A, J, plt, high) is the body of the clause. This clause was found by an ILP system that learns a theory from the relational data presented in Table 2.1. A k-ary predicate in logic programming corresponds to a k-tuple relation in a relational database. The main difference is that in relational databases the attributes are associated with a domain whereas in Logic Programming they are not. Moreover, in an attempt to apply principles of logic programming to explore relational databases the Datalog representation formalism was invented. Datalog is a functionfree subset of the Prolog logic language that is related with the relational algebra. 11
CHAPTER 2. MULTI-RELATIONAL DATA MINING Any non-recursive Datalog logic program can be translated into database relational algebra [GMUW09]. 2.3.1.2 Semantic of Logical Clauses Definition 9. Asubstitution θis a finite set {X1/t1, X2/t2,...,Xn/tn}where the Xiare variables and the tjare terms. Each pair Xi/tjrepresents a replacement of variable Xiby the term tj.Moreover, we say that the pair Xi/tjis a binding for Xi. For instance, if we consider the clause c:patient Info(A, B, C, D)←urinanalysis(A, E, F, G) and define the substitution θ={C/m, F/plt, G/high},the instantiated formula cθ is the formula patient Info(A, B, m, D)←urinanalysis(A, E, plt, high).This formula was obtained by replacing the variables C, F and Gby the constants m, plt and high, respectively. Definition 10. AHerbrand interpretation of a set of clauses, C, is the set of ground atoms occurring in C. All ground atoms appearing in a Herbrand interpretation are assumed to be true. All other ground atoms, that do not appear in the Herbrand interpretation, are assumed to be false. Definition 11. The Herbrand model of a set of clauses Cis a Herbrand interpretation in which all clauses in Care true. Considering the Herbrand interpretation Iand a clause h←b, we say that Iis a Herbrand model for clause h←bif all substitutions θthat make bθ true in I, make hθ true in I. Moreover, we can define a Herbrand model for a set of clauses Cas a Herbrand interpretation that contains all consequences of the set of clauses C. Using this remark we define the notion of Least Herbrand model. Definition 12. The Least Herbrand model of a set of clauses, C, is the minimum set of all ground atoms that are a consequence of a set of clauses C. In the following definition we present a formal definition of logical consequence of a clause set C. We introduce the notion of logical entailment. 12
2.3. INDUCTIVE LOGIC PROGRAMMING Definition 13. Let Cbe a set of clauses and cbe a clause. We say that C(semantically) entails c, and write C|=c, if every Herbrand model of Cis a Herbrand model of c. In this definition we use Herbrand models to define entailment. This is not a requirement and entailment can be proved with any model. We use Herbrand models as they play a central role in ILP and because of theorem 1 [NCdW96]. Theorem 1. Let Hbe a set of clauses. Then Hhas a model if and only if Hhas a Herbrand model. In practical applications where we want to prove that a ground atom, g, is entailed by a set of clauses C, the semantic entailment C|=gis replaced by resolution deductive inference rule C⊢res g. In the majority of the cases, SLD-resolution [MR94] is used. Given a clause set Cand a clause c, we say that a Prolog system is sound if cis (Prolog) provable from Cimplies that cis semantically entailed by C. Formally we write: C⊢res c⇒C|=c. 2.3.2 Learning Tasks In general, the set of tasks that ILP can perform is formally defined [LDN99]: Given: •a set of examples E •a background theory B •a language bias Lthat define the clauses allowed in the hypothesis •an explanation criterion Find: •a hypothesis H⊂Lwhich explains the examples Ewith respect to the theory B Here we put the focus on ILP systems that find classification and descriptive logic rules. We restrict the presentation to these two tasks since these are the tasks that 13
CHAPTER 2. MULTI-RELATIONAL DATA MINING we address in this thesis and are among the most popular tasks addressed by ILP systems. There are systems such as FORS [KB97] that can be used to solve regression problems and Cola [Emd94] that can be used to solve clustering problems. In an ILP classification problem the goal is to learn a set of definite classification rules. Given: a set of positive examples E+and negative examples E−,i.e, examples that belong to the target table; a set of definite clauses Brepresenting background relations and domain knowledge; a definite hypothesis language Lspecifying syntactical and semantic restrictions. Find a classification theory that explains all examples in the target table and is complete and consistent. In this setting, the notion of explanation used is coverage. Given the example set E=E+∪E−, the background knowledge Band a hypothesis H, we say that an example e∈Eis covered by H if B∪H|=e. A hypothesis His complete if ∀e∈ E+:H∪B|=e. A hypothesis His consistent if ∀e∈E−:H∪B2e. This is equivalent to finding a theory Hwhere all examples in E+are true in the least Herbrand model of B∪Hand all examples in E−are false. In descriptive tasks the goal is to find a set of general rules/patterns available in the data. Typically, we consider that the set of examples is restricted to positive examples, E+,the background knowledge Bis restricted to definite clauses and the hypothesis language, L, is a set of general clauses. The goal is to find a hypothesis Hsuch that each clause c∈His true in the least Herbrand model of B∪E. In practical applications the data is noisy and it is usual to relax these notions. Typically, we relax the coverage criterion and learn incomplete and inconsistent theories, i.e., theories that do not cover some positive examples or/and cover some negative examples. Foil [QCJ95], Golem [MF90], Progol [Mug95] and Aleph [Sri03] are examples of predictive ILP systems that find FOL classification rules. Claudien [RD97], Warmr [DT99] and FARMER [NK01] are examples of descriptive ILP systems that find FOL association rules. 2.3.3 Searching for a Clausal Theory Any ILP task can be seen as a search problem. In the following two sections we introduce an order relation that structures the search space and present strategies to explore the search space. 14
2.3. INDUCTIVE LOGIC PROGRAMMING 2.3.3.1 Structuring the Search Space To explore the space of clauses determined by the language bias, L, we need to introduce an ordering in the ILP search space. One natural way to introduce ordering was to use semantic entailment. The problem with this approach is that semantic entailment is undecidable. In [Plo70] Plotkin introduced the syntactic relation θ−subsumption, a more general than relation, that is used by the majority of the existing ILP systems. Definition 14. Let c1and c2be two clauses. If there exists a substitution θsuch that c1θ⊂c2, we say that c1θ-subsumes c2. When we say that a clause c1θ-subsumes c2,we are saying that c1is more general than c2.If this is the case we write c1c2. One important property of θ-subsumption is that given two clauses c1and c2,if c1c2 then c1|=c2. Moreover, Plotkin proved in [Plo70] that this relation induces a lattice on the set of all clauses, up to equivalent classes and variable renaming. This guarantees that any two clauses have a least upper bound and a greatest lower bound that are unique up to renaming of variables. The clause that represents the least upper bound of two clauses is also known as the least general generalization (lgg). This lgg is a key clause that is explored for some of the most efficient ILP algorithms [Sri03]. Furthermore, we can use θ−subsumption to prune and bound the search. 2.3.3.2 Searching the Hypothesis Space To explore the lattice space induced by θ-subsumption on the space of clauses, three main strategies are used by the existing algorithms: top-down search, bottom-up search, and a hybrid strategy. Here we present an overview of each search strategy. Moreover, we present a generic ILP algorithm and a detailed description of the Aleph algorithm [Sri03], that uses a hybrid search strategy. We do so because in this thesis we present a set of ILP based frameworks that are grounded in the Aleph algorithm. In Algorithm 1 we present a generic top-down ILP algorithm. In this algorithm, E= E+∪E−is the set of positive and negative examples, L is the language bias, B is the background knowledge and H is the hypothesis theory. The function covers(B, H, e) is a boolean function that represents the notion of coverage. For each example e∈E, we say that hypothesis Hcovers an example ewith respect to background knowledge 15
CHAPTER 2. MULTI-RELATIONAL DATA MINING B if B∪H|=eand write covers(B, H, e) = true. The clause ⊤ ← represent a clause with no body and whose head is the most general clause, typically the target predicate with only free variables. This type of algorithms starts from the most general clause and search for the best clause through repeated θ-subsumption specializations. The specialization operator, that is also known as refinement operator, maps a clause cto a set of specializations ρ(c) = {c′∈L|cc′}.The best clause is a specific clause with the best score according to some metric like number of covered examples, accuracy, compression and minimum description length, etc. If the best specific clause does not cover any negative example and compresses the data, the clause is added to the current hypothesis theory. Next, all the positive examples covered by the current hypothesis theory are removed. If positive examples remain uncovered by the current hypothesis or the theory, we start again the covering loop. In the end the algorithm returns the hypothesis theory. Algorithm 1: Generic Top-down ILP Algorithm input : the set of examples, E; the language bias, L; the background knowledge, B output: Hypothesis H // Initialize the hypothesis space1 H := ∅;2 repeat3 // Covering Loop4 Hcurrent =H;5 c:= T←;6 repeat7 // Clause Specialization8 Find the best refinement cbest ∈ρ(c);9 c=cbest;10 until c cover examples E−and c compresses the examples;11 // Update the Hypothesis set of clauses12 H:= Hcurrent ∪ {c};13 // Remove positive examples covered by the Hypothesis14 E:= E− {e∈E+|covers(B, H′, e) = true};15 until H=Hcurrent or E+=∅16 return H;17 One instance of this generic algorithm is FOIL [QCJ95]. In FOIL algorithm, the best 16
2.3. INDUCTIVE LOGIC PROGRAMMING specific clause is selected using an entropy based metric. The other strategy is the bottom-up search. In this strategy the search starts from the examples (ground definite clauses) and uses a generalization operator (similar to lgg) to find the most general clauses. Typically, a generalization of two clauses is obtained through the use of the lgg. One example of such an ILP algorithm is GOLEM [MF90]. A hybrid strategy that combines ideas from the previous strategies is also available. In Algorithm 2 we present the pseudo-code of such an algorithm, the Aleph algorithm [Sri03]. The algorithm starts by randomly selecting an example e∈E+.Then, using the language bias L, the most specific clause that entails example eis built. This most specific clause is known as the bottom clause and is represented by the symbol ⊥. Next, and using the bottom clause as a bound, top-down search is used to find the best clause that is more general than the bottom clause. The top-down search uses refinements over the predicates and terms available in the bottom clause. When we arrive at a point where the bag of positive examples is empty or the theory does not compress, the algorithm returns the learned theory. By restricting the top-down search to the predicates in the bottom clause, the algorithm substantially reduces the search space. Progol [Mug95] is another example of an ILP algorithm that uses this hybrid search strategy. Unlike the majority of ILP algorithms that use a covering approach, TILDE [BR98] uses a divide-and-conquer strategy to induce logical decision trees. Using the learning from interpretations paradigm, where each example is represented by a set of definite clauses, the algorithm induces C4.5 like decision trees by upgrading heuristics to deal with clauses. The major difference are the tests put in the internal nodes, here every test is a conjunction of literals. Search for the best test is done using a refinement operator under θ-subsumption by adding literals, one or more, with the highest gain ratio (or gain) based on language specifications introduced by the user. Beyond language specifications that restrict the mode, types and number of conjunctions to be put in a test, the user must also supply a set of examples and background knowledge. Van Laer [LR00] describes a methodology to upgrade propositional learners to FOL preserving the structural methods and techniques of the propositional learner. The methodology is a generalization that extends heuristics and paradigms of propositional learners. Grounded on learning from interpretations paradigm, θ-subsumption and user biasing the author upgrades CN2 propositional learner to the ICL relational learner. 17
CHAPTER 2. MULTI-RELATIONAL DATA MINING Algorithm 2: Aleph Algorithm input : the set of examples, E; the language bias, L; the background knowledge, B output: Hypothesis H // Initialize the hypothesis space1 H := ∅;2 repeat3 Hcurrent =H;4 Select a positive example e∈E+;5 Build the bottom clause ⊥efor example e;6 Top-down search the subset of literals in ⊥eto find the best clause c;7 // Update the Hypothesis set of clauses8 H:= Hcurrent ∪ {c};9 // Remove positive examples covered by the Hypothesis10 E:= E− {e∈E+|covers(B, H′, e) = true};11 until E+=∅or H:= Hcurrent 12 return H;13 2.4 Propositionalization The complexity of multi-relational problems and the availability of efficient, despite less expressive [Fla99], propositional algorithms, like C4.5 [Qui93], motivated the development of a set of techniques that translate a multi-relational database into a single table. These techniques are known as propositionalization techniques [KRZ+03a]. To use any propositionalization technique it is required that in the multi-relational database there exists a clear notion of individual and the learning task is individual focused [KRZ+03a], e.g. are multi-relational classification tasks. In the obtained single-table, each individual is characterized by a set of features/attributes that summarize information that exists in non-target tables. The existing propositionalization approaches can be characterized according to the data translation completeness and the methodologies used to summarize the data. Concerning translation completeness, we can have complete or partial conversion. In complete conversion no information is lost. The main issue of this type of conversion is, typically, the large size of the single table generated by the translation process. Using this lossless conversion we can easily run out of computer disk space. In the 18
2.4. PROPOSITIONALIZATION partial conversion we search for a subset of features that summarize the most relevant information recorded in the database. Typically, a heuristic search and an aggregation strategy is used to summarize the data available in the non-target tables. The methodologies used to propositionalize the multi-relational data can be grouped into database-oriented and logical-oriented techniques. 2.4.1 Database-oriented Approach The propositionalization techniques presented in this section use relational algebra operations (mainly SQL, a query language for relational databases) and the aggregation functions implemented in a database system [GMUW09] to convert a multi-relational database into a single table. Most existing database oriented approaches [KHS01, KW01] exploit the relational database scheme, mainly the primary key and foreign key relationships, the table join operation and aggregations operations to summarize the attribute values. In [KHS01, KW01] the foreign keys of the examples registered in the target table are used to recursively join the tables reachable from the target table. The information of tables in the path from the target table will be included in the resulting join table. Using this procedure a set of join tables is built. Each one of these tables includes the target table. In this set of join tables the attributes of non-target tables are summarized using aggregation operations. If the attribute is numeric, the Average, Maximum, Minimum or Sum values of the attribute can be computed to summarize the values. If the attribute is nominal, and if the cardinality of the attribute is small, in the join table we can add a number of new attributes that equals the cardinality of the nominal attribute. The value of each one of these attributes can be obtained using the Count function. In the end all the join tables are combined into a single table. In the obtained table each row is associated with a unique individual/example and registers the individual features. The main issue with this approach is the cost of joining tables. Some strategies like virtual joins, also known as tuple-id propagation [KRZ+03a, YHYY04], were proposed. This technique consists in propagating the primary key of each individual to all nontarget tuples reachable from the target table. In [YH05] the authors combine virtual 19
CHAPTER 2. MULTI-RELATIONAL DATA MINING is generated (this issue is known as a replication problem). Beyond producing less legible and complex models, replication can cause a decrease in accuracy. •In Knowledge driven methodologies, experts provide domain knowledge that, sometimes in conjunction with the original data, is used to build new features. •Multi-strategy methodologies combine two, or more, of the above strategies to build new features. 2.5.1.2 Predicate Invention In ILP systems the need to build new predicates is more related with limitations of the language bias, that restricts the space of potential solutions to consider. In [Kle52] Kleen proved that the introduction of a new predicate is useful for finding a finite hypothesis: Theorem 2. Any recursively enumerable set C of formulas in a FOL language L0⊆L is finitely axiomatizable in a FOL language L using additional predicate symbols except for those in L0. In the ILP setting, C is the set of positive examples E+. Moreover, in [Sta93] it is observed that for infinite or undecidable languages, like FOL, predicate insufficiency detection has to be made heuristically. In [Sta93, Kra95] three main predicate invention strategies are identified: •In Reformulation and Inverse resolution approach new intermediate predicates are introduced to generate more compact representations from the learned theories, i.e., to reformulate theories. This type of approaches build new predicates by using a kind of reverse deductive explanation, which replaces intermediate predicates by their definition. Some of the existing systems directly invert deductive resolution steps. Other systems build new predicates as combinations of known literals. This later systems use an abstract schema to restrict literals used in the combinations. For instance, FOCL [SP91], an extension of FOIL [QCJ95], overcomes the limitation of FOIL to add only the literal with the maximum information gain to the body of the clause. FOCL builds combinations of literals restricted to a schema. 26
2.5. LEARNING ISSUES •The Data-Driven methods try to detect situations where the language bias is insufficient to learn a finite theory. In that case a new predicate is invented. The decision to build a new predicate is heuristic whenever it is not possible to make an exact decision. MENDEL [Lin91] introduces an inverse resolution system that builds new predicates only if the theory grows beyond a fixed bound. •Clause-refinement methods make an over-general clause consistent by adding literals which contain new predicates [SMB92]. This type of predicate invention is useful in discriminative applications where positive and negative examples are available. 2.5.2 Feature Selection Many of the descriptors available in a dataset can be redundant or irrelevant for a classification or prediction task. Using such descriptors to learn a concept could reduce algorithms performance and the accuracy of the learned models, especially when there is an insufficient number of instance. Thus, there is a need to introduce techniques that remove statistically related attributes and/or select a subset of attributes such that the resulting probability distribution of the different classes is close to the probability distribution using the original set of descriptors [HKP11]. Most of the existing works cast the feature selection problem into a search problem. Typically a search method is combined with a metric to evaluate the merit of each feature or subset of features. Moreover, heuristic methods are typically used to explore the search space. Furthermore, the existing feature selection methods can be grouped according to the type of selection methodology. Regarding this, we have two main strategies: the filter and wrapper methodology [YL04]. The wrapper method is grounded in a predefined mining algorithm and uses the performance of the learned model to select features. For instance, we can learn a decision tree model and remove all attributes that do not appear in the inner nodes. The filter method relies on the data descriptors and use a measure of interest to select or sort features. Different from the wrapper methodology, the filter selection method does not use a mining algorithm. Both methodologies can be parametrized to select a set or a single attribute. The metrics used to select the most interesting attributes typically measure the degree of independence among attributes or independence between the attributes and a certain class. 27
CHAPTER 2. MULTI-RELATIONAL DATA MINING Table 2.2: Contingency table C¯ C A n(AC) n(A¯ C) n(A) ¯ A n(¯ AC) n(¯ AC) n(¯ A) n(C) n(¯ C) N Consider the classification association rule A→Cwhere A is an itemset/attribute and C is the class attribute. Moreover, suppose that n(A) and P(A) define the number of occurrences and the probability of attribute A, respectivelly, and N is the number of observations. Then we can build a contingency table (see Table 2.2) and compute a set of metrics to select the best attributes. In Table 2.3 we present a sample set of metrics [TKS02]. Then, we can combine any of the metrics presented in Table 2.3 with a basic heuristic method to select a subset of features. These metrics can be used both in filter and wrapper type feature selection. In [HKP11] Han presents four basic types of heuristic methods to select features: stepwise forward selection, stepwise backward elimination, a combination of forward selection and backward elimination and decision tree induction. In [GH06] Geng surveys interesting measures and suggests a set of criterion’s to evaluate the interestingness of association rules and classification rules patterns. The authors consider that association rules are descriptive patterns and classification rules are predictive. Considering interestingness as an imprecise and broad concept, the authors introduce nine criterions to objectively qualify patterns. The interest of a pattern depends on: conciseness, coverage, reliability, peculiarity, diversity, novelty, surprisingness, utility and actionability features. Since some of these features are domain-dependent, the author also categorizes them into objective, subjective and semantic-based. Objective measures like conciseness, reliability, peculiarity and surprisingness, are extracted from raw data; features that not only use raw data but also user domain and background knowledge such as surprisingness and novelty are subjective measures; other features like utility an actionability are considered semanticbased measures because they use interpretation and explanation of the patterns. Based on the nine criteria the authors characterize a set of metrics that provide an automatic way to determine pattern interestingness. Boolean, partial ordering and rank measures could be created. For instance, the support of a frequent itemset can be used as a 28
2.5. LEARNING ISSUES Table 2.3: Selection metrics for association rules Measure Formula Support P(AC) Confidence P(C|A) Lift P(C|A) P(C)or P(AC) P(A)P(C) Cosine P(AC) pP(A)P(C) Conviction P(A)P(C) P(AC) Leverage P(C|A)−P(A)P(C) Laplace N(AC) + 1 N(A) + 2 Information Gain ln P(AC) P(A)P(C) Correlation P(AC)−P(A)P(C) qP(A)P(C)P(A)P(C) Chi-square N×P(A)P(C) (1 −P(A))(1 −P(C)) 29
CHAPTER 2. MULTI-RELATIONAL DATA MINING measure of generality/coverage of a pattern. Moreover, using this metric with a real value threshold we can suppress less general or low utility patterns in a partial ordered set of patterns. Webb [WZ05] observes that support and lift are complementary measures that can be used sequentially to discover interesting rules. One major drawback to this approach is that rules with high lift values apply to few cases since they have low coverage. In addition, the author argues that the combination of support and confidence not always select potential interesting rules. In some cases the user knows what to search and a specific rule, different from confidence measure could be more suitable. To address these issues Webb introduced the Kord algorithm. Kord algorithm takes as input a dataset, one measure of rule interest, a set of constraints, like the number of conditions in the antecedent, and the number of rules to be found. This algorithm explores the space of possible solutions and returns a specified number of sorted rules. The rules order is induced by the user specified interesting measure. The author experimental evaluation considers the leverage measure. Using this measure the dependence gain of the association rule can be measured. In [BMS97] Brin introduces an alternative to the support-confidence framework. This author presents an algorithm that selects interesting correlations rules using chi-square statistics. The authors argue that rules with high support are statistically significant. In all major problems, mainly in market basket analysis, being frequent is highly interesting. Some investments and market campaigns are supported by this measure. On the other side, the confidence metric is a directional measure that can be misleading and can be unable to detect negative correlations. Lenca [LMVL08] presents a methodology to select interesting non-redundant features based on the analysis of the properties of the measures and expert knowledge. This author observes the difficulty in defining an objective measure of rule interest and introduces a set of eight properties that can describe any measure. Using these properties, the authors study and describe a set of 20 measures. Some of these properties can be easily and objectively described without user contribution. One of these measures is rule asymmetry. Other properties like intelligibility are hard to define and evaluate incisively without user contribution. The methodology uses PROMETHEE, a multicriteria decision making (MCDA) method, to select and visualize interesting measures based on ranks. The ranks of each measure results from a pairwise comparison that uses measures properties and respective weights. In [YL04], the FCBF algorithm is introduced to find a subset of relevant and non- 30
2.5. LEARNING ISSUES redundant features. The obtained subset of features is found by decoupling relevance analysis from redundancy analysis. The authors say that almost all works select individual features by ranking them according to some heuristic and then select the top ones. This procedure, does not remove redundant features that are equally ranked. Using the filter method, the FCBF algorithm uses a symmetrical non-linear heuristic, named Symmetrical Uncertainty (SU), to rank features by measuring correlation between each feature and the available classes. Then all features that have a SU value higher than a selected threshold are considered relevant. Next, redundant features are eliminated using the SU metric to measure correlation between the selected features. In supervised learning, the classical approach is to select features using heuristics that compute the degree of association/correlation between features and classes. Liu [LHM98] propose an algorithm that integrates classification and association rule mining. Introducing minor changes to the Apriori algorithm, this algorithm starts by finding all classification association rules (CAR), a subset of association rules where the antecedent part is an attribute value conjunction (attribute =integer −value) and the consequent part is the class value. In the second phase, the confidence and the support values of each rule are used to define a total order relation on the set of CARs. The algorithm sorts all CAR rules and generates a raw classifier. Then, to refine the classifier, the sorted set and a covering strategy are used to select the best rules. The last rules, that do not improve accuracy, are deleted. The final classification model consists of the higher ranked rules and a default class rule, which labels an example as the majority class of the dataset. Another work that selects features using a single measure and then induces a classification model was developed by Terabe [TWM+02]. First, the data descriptors are extended using classification rules. Using a modified version of Apriori, the algorithm finds new attributes that are conjunctions of primitive attributes. The authors use an approximation of information gain to select the most interesting candidates descriptors. Next, the selected descriptors are mapped and a new extended dataset is build. Last, the extended dataset is used as input to the C4.5 decision tree induction algorithm. These algorithms proved to be effective but there are interesting problems that are best solved in rank-order spaces. In [SVRH05] four strategies to select features in rank-order spaces are presented. The presented methodologies are used in spaces where features have a common domain and are easy to sort. To search for an optimal subset of features a stepwise meta-algorithm 31
CHAPTER 2. MULTI-RELATIONAL DATA MINING is used. In each iteration a single feature is select for removal. This selection procedure is done in the rank-space with one of the four proposed strategies. Two of these strategies are grounded in information theory techniques and the other two techniques use algorithms from permutation theory. The algorithm removes features until we get a subset with a user-defined size or a divergence criterion is satisfied. 2.5.3 Classifier Evaluation Classification is a multi-step process where a model is used to assign a class label (or category) to a set of unclassified examples, that are described by a set of features. In machine learning, classification is an instance of supervised learning where the label of each example available in the training set is known in advance. Typically, in the first step a classification model is learned in a train set that contains labeled data. Second, a test set with labeled data is used to evaluate the performance on unseen examples. Last, the best model is used to classify new and unlabeled examples. In this section, we give an overview of strategies used to evaluate the performance of classification models on novel data and how do we compare the performance of two classification models. 2.5.3.1 Evaluation Criteria The usefulness of a classification model is related with the task we have in hands and the availability of resources. For instance, in a predictive task we are more interested in the predictive accuracy while in a descriptive task we are more interested in compact and understandable classification theories. In the following lines we present a set of criteria to evaluate classification models. Predictive Accuracy This criterion is related with the ability of a classification model to correctly predict a class label of an unseen example. This is the most used and important criteria that gives an important sketch on the generalization ability of a predictor. The accuracy of a predictor model is the fraction of correct predictions made by the predictor. In the simplest case where we only consider a zero-one loss function we can define accuracy for any classification model fas: 32
2.5. LEARNING ISSUES accuracy(f) = 1 N N X i=1 1(yi= ˆyi), where N is the number of samples, ˆyi=f(~xi) is the predicted class value for the ith vector sample and yiis the true class label of the i−th sample, and 1is the indicator function that takes value 1 when expression yi= ˆyiis true and takes value zero when yi6= ˆyi. In most works the predictive error, that is the counterpart of predictive accuracy, is used to present and analyze the results. In this case the indicator function is replaced by a loss function, typically the zero-one loss function is used: error(f) = 1 N N X i=1 L(yi,ˆyi), where L(yi,ˆyi) = (0 if y=f(~xi) 1 if y6=f(~xi) Other loss functions exist that can be more useful in other circumstances. Among these loss functions we can find some that can weight misclassification errors and other that associate costs to misclassifications [FGMB10, FGMB13]. Interpretability and Simplicity Interpretability is related with the understanding and the insights provided by the classification model. To analyze the interpretability of a classification model there are no metrics and typically only domain experts can measure this subjective property of classification models. For instance, FOL decision rules are much more expressive and understandable than a neural network model [ADT95]. Moreover, the understandability of the learned models can be related with the simplicity of the obtained models. For instance a compact decision tree or a small number of classification rules are more understandable and give more insight than a neural network classification model [ADT95]. A well known method to select understandable and simple theories is the minimum description length (MDL) principle [Ris78]. This principle is inspired in the Occam Razor and states that the best hypothesis for a given dataset is the one that leads to the largest compression of the data. 33
CHAPTER 2. MULTI-RELATIONAL DATA MINING In practical applications this principle means that we prefer small models over large ones. Typically we prefer decision trees with a small number of nodes and rule sets with few rules. Speed and Memory Despite the hypothetical high expressiveness and generalization accuracy of a given algorithm, it can be useless if there are no computer resources available to run such a powerful algorithm. For instance, if we run an ILP algorithm in a computer with the current standard specifications to solve a large and complex problem we may fail to learn a classification model. Moreover, the probability of failing increases if we define a high expressive language bias. Therefore, we must evaluate classifiers according to the run-time and amount of computer memory used to learn a theory. As the amount of memory used by one algorithm fluctuates during the learning process, typically we compute the peak of memory usage. Regarding the time and memory usage to test the classification model, these are almost always negligible when compared with time and memory usage at learning time. Moreover, the scalability of the algorithms can be important. It can be important to develop algorithms that scale to large amounts of data. Thus, in highly expressive models we can use heuristics to keep the problem tractable. As expected, we prefer algorithms that use few memory and spend less time learning a classification model. Robustness Other important issue when learning a classification model is its sensibility to noisy data. Typically we want to develop, or use, robust algorithms that can correctly label examples given noisy data or data with missing values. 2.5.3.2 Estimating the Performance of a Predictive Model When learning a model, typically we have algorithms that exhibit high prediction capabilities in the train set but perform poorly when predicting the labels of unseen data. This overfitting behavior of learning algorithms is well-known and a set of evaluation methodologies were developed to address this issue. Here we present a brief overview of the existing validation methods and give a detailed description of stratified k-fold cross-validation methodology, the validation methodology used in this work. Moreover we present a detailed description of the methodology used in this work to evaluate multi-class and non-symmetrical classifiers [F¨ur02]. 34
2.5. LEARNING ISSUES Resubstitution validation In resubstitution validation the model is learned and tested using all the available data. The main issue with this evaluation strategy is that the learned models overfit the data and will perform poorly on future unseen data. A strategy introduced to eliminate the overfit issue of resubstitution validation is hold-out validation. Hold-out validation In hold-out validation the data is split into two non-overlapping folds, the train and the test set, one fold is used to learn a model and the other fold is used to evaluate the model. The main issue with this methodology is that not all the available data is used to learn and important examples can be discarded. The most important statistical method to estimate the generalization ability of an algorithm is cross-validation [F¨ur02]. There exist a set of variants of this methodology all of them sharing a simple procedure. First, the data is divided into two segments, then one segment of data is used to train a model and the other segment is used to validate the learned model. k-fold Cross-Validation In k-fold cross validation the data is first partitioned into kequally sized folds. Then, an iterative process with kiterations starts. In each iteration a classifier is trained using all the data available in k−1 folds and is tested in the kfold not used for training. This procedure guarantees that all the data is used both for training and testing the classifier. This way the results will not be skewed by the choice of the examples used to train or test the classifier. One important issue with this methodology is the way we arrange the data in each fold. If each fold does not represent the overall class distribution we can end-up with misleading results. One strategy to eliminate this issue is to use a variant called stratified cross-validation. With this strategy the examples are distributed among the folders such that every folder is a representative of the class distribution of the dataset. In [Koh95] Kohavi analyzes a set of methodologies to estimate accuracy and suggests that 10-fold crossvalidation is the best method to use. He observes that this technique provides less biased estimation of the accuracy. Two other well known variants of the k−fold cross validation technique are leaveone-out cross-validation and repeated k−fold cross-validation. In the leave-one-out cross-validation technique we split a dataset with kexamples into kfolds, each fold containing one example. Then, the classifier is trained using k−1 folds and the remaining example is used to test the learned classifier. The main issue with this 35
CHAPTER 2. MULTI-RELATIONAL DATA MINING the FP-growth [HPY00] algorithm. In the first phase the Star FP-growth algorithm constructs a FP-Tree for each dimension table. Then, all the trees are merged into a super tree. Last, the algorithm runs the FP-growth over the super tree to output all frequent itemsets. In [SA12] these same authors extend the Star FP-growth algorithm to deal with stream data. 2.6.1.2 Finding First-order Logic Patterns Dehaspe et al. [DT99] present WARMR, an algorithm that discovers frequent DATALOG patterns in DATALOG databases using a levelwise strategy that is inspired in the APRIORI algorithm. The WARMR algorithm can be seen as an upgrade of the Apriori algorithm to work with FOL representations. In WARMR the user must specify what to count using a key predicate. Typically, the target table is used as the key predicate. The frequency of each query/pattern is the number of individuals, records in the key table, for which there are query bindings in the database. To search for frequent queries the algorithm uses the levelwise strategy and is guided by a declarative language bias, mode and type declarations, and background knowledge specified by a user. In the query generation phase the algorithm uses θ-subsumption to define an order and equivalence relation across queries. This way the algorithm prunes infrequent and redundant queries. Queries that are θ-specializations of infrequent queries and queries that are θ-equivalent to previous generated clauses are removed. An optimized version of WARMR is presented in [NK03]. The problem with WARMR is that it explores time information by employing aggregation techniques. Thus, WARMR may fail to find and use relevant event sequences, especially short-term fluctuations. 2.6.2 Frequent Sequence Discovery In this section we introduce concepts and algorithms developed to discover timeordered patterns from propositional and FOL datasets. 2.6.2.1 Finding Propositional Patterns Let I={i1, i2,...,in}be a set of items and ean event such that e⊆I. A sequence is an ordered list of events e1e2. . . emwhere each ei⊆I. Given two sequences α= 42
2.6. PATTERN MINING: ITEMSETS AND SEQUENCES a1a2. . . akand β=b1b2. . . bt, sequence αis called a subsequence of βif there exists integers 1 ≤j1< j2< . . . < jl≤tsuch that a1⊆bj1, a2⊆bj2,...,ak⊆bjl.A sequence database is a set of tuples < sid, α > where sid is the sequence identification and αis a sequence. The count of a sequence αin a database of sequences D, denoted count(α, D), is the number of examples in Dthat contain the αsubsequence. The support of a sequence αis the ratio between count(α, D) and the number of sequences in D. We denote support of a sequence as support(α, D). Given a sequence database Dand a minimum support value λ, the problem of sequence mining is to find all subsequences in Dhaving a support value equal or higher than the user-defined value, the λvalue. Each one of the obtained sequences is also known as a frequent sequence or a sequential pattern. When searching for all sequential patterns in a sequence database we face one of the major problems of sequence miners, these algorithms find a huge number of redundant and non-interesting patterns that are hard to analyze. To reduce this problem we can run other sequence miners [YHA03, GRS02] or use post-processing strategies to find a subset of patterns, e.g., that can find closed sequential patterns or maximal sequential patterns. Definition 15. (Closed Sequential Pattern) A frequent sequence αis a closed sequential pattern if there exists no proper supersequence βhaving the same support value as α. Definition 16. (Maximal Sequential Pattern) A frequent sequence αis maximal if it is not a subsequence of any other frequent sequence. The set of maximal sequential patterns is a subset of all closed sequential patterns. Moreover, in a classification problem, some sequential patterns have low discriminative power and could be eliminated. Thus, we introduce the concept of Discriminative Sequential Patterns to select inter-class discriminative sequential patterns. Definition 17. (Discriminative Sequential Patterns) Consider two sequence database partitions D1and D2,and a support threshold λ. We define the set of discriminative sequential patterns using the xor ( ˙ ∨) operator, Sdisc ={α|support(α, D1)≥ λ˙ ∨support(α, D2)≥λ}. Such discriminative patterns, and others like the emergent and the contrasting patterns, represent valuable information that can be extracted from a sequence database and that could be useful at theory learning time [NLW09]. To do so, we introduce the concept of Sequence Relation and Enlarged Database. 43
CHAPTER 2. MULTI-RELATIONAL DATA MINING Definition 18. (Sequence Relation and Enlarged Database) Consider a multi-relational database r,a sequence database Dencoded from r,where each sequence id equals the primary key of rtarget table. Also consider the set of sequential patterns Sobtained from solving the sequential mining problem. We define the sequence relation, rsr,to be the set of tuples (sid, αB 1, αB 2,...,αB n)where sid is the sequence id in Dand αB iis a binary attribute whose value is obtained according to the projection of the sequential pattern αiin the sequence database. The enlarged database is the database resulting from the union of the multi-relational database and the sequence relation. Formally we define the enlarged database as being Er=r∪rsr. As the algorithms we introduce in this thesis explore timed data present in multirelational databases, mainly sequence data, here we define sequence encoding, a strategy to translate time-series data into a sequence database. Definition 19. (Sequence encoding ) Given a multi-relational database r,having fact tables that register time events. We define sequence encoding as a procedure that for all, or a subset, of database fact tables, ri∈r,translates all, or a subset, of attributes ri.Ajinto a database of sequences. There exists a wide range of algorithms that can explore sequential data efficiently. To the best of our knowledge, [AS95] introduced the sequential data mining problem. In [SA96] Agrawal and Srikant introduce the GSP algorithm, an algorithm that generalizes the original sequential pattern mining problem and that is also inspired in the search procedure of the well-known APRIORI algorithm [AS94]. GSP uses a candidate-generation strategy to find all frequent sequences, and uses a lattice to generate all candidate sequences. The algorithm starts by finding all frequent 1-items that constitute the lattice base. Then, in an iterative process, at each lattice level, frequent sequences found in previous levels are combined to build new frequent sequence candidates. Notice that at each lattice level lonly the frequent subsequences of level l−1 are used to generate new candidates. We observe that GSP has limitations when dealing with large datasets, as candidate generation may require multiple database consults, and that in real problems it often finds a huge number of patterns. Several approaches have been proposed to address the above mentioned issues. Different from GSP, that uses horizontal layout format, the SPADE [Zak01] algorithm uses a vertical layout format where each sequence in the lattice is associated with the idlist. This idlist is a list of all examples containing the candidate sequence, the list contains a set of pairs where each pair consists of both the sequence id (sid) and an event identifier (typically the event time). To search for frequent patterns, SPADE also uses 44
2.6. PATTERN MINING: ITEMSETS AND SEQUENCES a candidate-generation strategy. To compute the support of each candidate pattern of level l, the idlist’s of sequences from level l−1 are joined using a temporal join. The support of each candidate pattern is the number of distinct sid in the candidate idlist. Like GSP, SPADE uses the apriori property to prune the search space. One of the most efficient and well known algorithms that can find frequent sequences is PrefixSpan [PHMA+01]. This algorithm uses the efficient pattern-growth [HPY00] strategy to find the complete set of frequent sequences. Like GSP, the algorithm starts by finding all frequent itemsets. Then, for each one of these frequent items (the prefix) PrefixSpan partitions the current database into prefix projections. Each projection database has all the sequences containing the given prefix. This procedure proceeds recursively until all frequent sequences, according to a user-defined support threshold, are found. PrefixSpan’s search strategy explores a tree having a prefix projection database at the nodes. This way the algorithm can easily handle large databases but, like GSP, in real problems the algorithm finds a huge number of uninteresting sequence patterns. A similar difficulty has been observed in most of the existing sequence miners and some methodologies were developed to solve this issue. Algorithms such as CloSpan [YHA03] return a set of closed sequential patterns. SPIRIT [GRS02] constrains the search space using regular expressions. cSPADE [Zak00] extends SPADE algorithm to find a constrained set of sequential patterns. By using cSPADE we can find, among other, sequential patterns predictive of one or more classes. [LZO98] claims that using highly predictive sequences as input to a propositional classifier we can get accuracy gains that range between 10% and 50%. All these sequence miners were designed to explore propositional data. However, there exists rich structured data representations that require other approaches. Therefore, there is a need to develop methodologies to explore temporal relational databases that include valuable logico-relational information and temporal information recorded in a subset of tables. 2.6.2.2 Finding First-order Logic Patterns In this section we introduce the SeqLog FOL representation formalism. Different from Datalog, SeqLog represents sequences of logical atoms rather than relations [LR04]. In the following lines we review some fundamental concepts in SeqLog. We use a set of Prolog facts extracted from a discretized version of the database presented in Table 2.1 45
CHAPTER 2. MULTI-RELATIONAL DATA MINING (Section 2.1) to illustrate some concepts. In SeqLog, a term tican be a constant, a variable or an n-ary functor fapplied to n terms. An atom is a predicate symbol p(t1,...,tn), of arity n, where each tiis a term. In SeqLog, a sequence is an ordered set, possibly empty, of logical atoms separated by operators: l1op1l2op2l3. . . ln−1opn−1ln.There are two types of order operators that can be used, the operator ✄indicates direct succession relation and the operator <indicates a transitive closure succession relation. To represent input data only the ✄operator is used. For instance the sequence q=urinalysis(1, A, plt, high)< urinalysis(1, B, ttp, normal)✄blood analysis(1, C, high, normal) is a SeqLog sequence. This SeqLog sequence says that patient number one made a urine analysis where the plt parameter has a high value. Then, after an undetermined period, and a set of examinations, the patient repeated the urine examination and get a normal value for the ttp parameter. Next, and just after the urine examination where he gets the ttp parameter equal to normal value, patient number one made a blood examination and get a high level of red blood cells and a normal level of white blood cells. In a SeqLog sequence, q, the head of the sequence, head(q),is the maximal prefix of qthat does not contain the <operator. The part of the sequence that appears after the first <operator is the tail of the sequence, tail(q).If we consider the sequence qabove we get head(q) = urinalysis(1, A, plt, high) and tail(q) = urinalysis(1, B, ttp, normal)✄blood analysis(1, C, high, normal). With these concepts we can now define subsumption in SeqLog, a key concept used to search and select the most promising sequential patterns. We initially define s-subsumption for simple sequences that do not include the < operator. A simple sequence u=l1✄l2✄...✄lns-subsumes a sequence r=s1op1s2op2s3... sm−1opm−1sm,if and only if there exists a substitution θsuch that (l1✄l2✄...✄ln)θ is a subsequence of si✄si+1 ✄si+2 ✄... ✄si+n−2✄si+n−1for some i. A sequence u=l1op1l2op2l3. . . ln−1opn−1lnsubsumes the sequence r=s1op1s2 op2s3. . . sm−1opm−1sm,if and only if there exists a substitution θand an integer isuch that head(u)θs-subsumes s1op1s2op2s3. . . siopisiand tail(u)θsubsumes si+1 ✄...✄sm. For instance, the pattern qabove is subsumed by the pattern u=urinalysis(1, A, plt, X)< urinalysis(1, B, ttp, Y ), 46
2.6. PATTERN MINING: ITEMSETS AND SEQUENCES as there exists a substitution θ={X/high, Y/normal}such that urinalysis(1, A, plt, X)θ is a subsequence of urinalysis(1, A, plt, high) and urinalysis(1, B, ttp, Y )θis a subsequence of urinalysis(1, B, ttp, normal)✄blood analysis(1, C, high, normal).For simplicity we will write uqto say that usubsumes q. Informally, we can say that uis more general than qor that qis more specific than u. The support of a logical sequence qin a sequence database Dis the percentage of sequences in Dthat are subsumed by q. Formally, we can write supp(q, D) = |{e∈ D|B∪e|=q}|/|D|, where the |= symbol represents the logic entailment in the SeqLog calculus. For brevity sake we omit here the definition of entailment and the fix point semantics of SeqLog. In [LR04] we find the definition of these two concepts. Refinement operators generate more specialized patterns and are fundamental for the mining process [Rae08]. SeqLog has an optimal refinement operator,ρ, that specializes each sequence pattern ρ(s)⊆ {s′|ss′},and has an associated refinement level vector [LR04]. This operator refines a sequence using one of four possible refinements: •Lengthening adds a new atom to the current pattern s; •Promotion promotes a <operator to a ✄operator; •Univar unifies two variables occurring in the pattern; •Instantiation replaces a variable by a constant. In the following we will write l, p, u and ito identify, respectively, the number of Lengthening,Promotion,Univar and Instantiation refinement operations used to generate a sequence pattern. Each refinement operation originates an updated refinement vector. For instance, if pattern shas an associated (l, p, u, i) vector, once we generate a s′pattern using a lengthening refinement we get the updated vector (l+ 1, p, u, i) for pattern s′; if we generate a s′′ from susing promotion refinement we get the vector (l, p + 1, u, i). This strategy is used to generate all candidates and associated vectors. Thus, when searching the lattice using a levelwise strategy we use the vector associated with each pattern to define the current level of the search. Moreover, the L1norm is used to convert the vector into an integer number v(s) = l+p+u+i. For instance, pattern < urinalysis(A, B, C, high), v(1,0,0,1) >is in level 2 = 1 + 0 + 0 + 1 and pattern < urinalysis(A, B, C, high)✄urinalysis(D, E, F, G), v(2,0,0,1) >is in level 3 = 2 + 0 + 0 + 1. 47
CHAPTER 2. MULTI-RELATIONAL DATA MINING Given a sequence database D, a language bias and a minimum support value λ, the problem of sequence mining is to find all subsequences qhaving sup(q, D)≥λ. Each one of the obtained sequences is also known as a frequent (logical) sequence. Like in itemset mining task (Section 2.6.1), the search for frequent sequence patterns typically generates a huge number of redundant and non-interesting findings. To reduce this issue we can use post-processing selection filters or constrain our search to find closed sequential patterns or maximal sequential patterns. A frequent sequence qis a closed sequential pattern if there exists no proper supersequence shaving the same support as q. A frequent sequence qis a maximal sequential pattern if it is not a subsequence of any other frequent sequence. The set of maximal sequential patterns is a subset of all closed sequential patterns. Last, a contrasting frequent sequence is a sequence qwhose sup(q,Dpos)≥λpos and sup(q,Dneg)≤λneg.Here Dpos and Dneg are two class partitions of Dand λpos and λneg are two user-defined support thresholds. λpos defines the minimum support that the contrasting pattern qcan have in the positive partition, the Dpos partition. λneg defines the maximum support that the contrasting pattern qcan have in the negative partition Dneg. In [NLW09] we can find a discussion about the utility of working with subsets of patterns. The authors put the focus on contrasting patterns, emerging patterns and subgroup discovering. In [LR04], beyond presenting the SeqLog representation formalism, the authors introduce the MineSeqLog logical sequence miner to find logical sequences in a database of logical atoms. This algorithm combines ideas from version spaces [Bay98, KRH01] and levelwise search to find all frequent and contrasting patterns, including the maximal ones. The algorithm suffers from some important performance drawbacks that are well-known in the majority of the ILP-based algorithms [BS03]. When fed with large databases, that accumulate data over long periods of time, the algorithm is unable to find long patterns. Moreover, even when dealing with small databases, the algorithm can easily be unable to find contrasting patterns. This last issue results from two design problems. First, when used to find contrasting sequential patterns, the algorithm needs to find all sequential patterns available in the two class partitions (in a binary classification problem). Therefore, it is necessary to run the sequence miner with small support values to find patterns in the negative partition of the data. Second, to find a large pattern, maybe a high confidence one, the algorithm needs to find the complete set of small size patterns. 48
2.6. PATTERN MINING: ITEMSETS AND SEQUENCES Moreover, it is well known that the enormous representational power of logic systems is obtained at the cost of scalability. In [BS03] it is observed that the ILP algorithms may not be effective to explore the large search spaces induced by sequence databases. Amo and Furtado [dAF07] propose an extension of the regular expressions formalism to FOL, including an algorithm that finds FOL sequential patterns satisfying a regular expression constraint. In [EMBF09] the Datalog formalism is extended to find FOL sequences that can include time, space and other dimensions and orderings between events. Based in the extended formalism the authors present a levelwise algorithm that can find all maximal FOL patterns. In [MBFE11] the sequence miner presented in [EMBF09] is used to find sequential patterns. Then, using a wrapper selection strategy, an optimal subset of patterns is selected and used to learn a propositional classification model. Notice that non-ILP approaches have also been used to find frequent patterns in multirelational data. One popular approach is graph mining. Matsuda et al. [MHM+99] upgrade the original GBI(Graph-based Induction) to deal with direct or undirected graphs, with or without loops, colored or uncolored nodes and links. GBI tries to minimize the graph size using stepwise pair expansion (pairwise chunking), at each step a frequent pattern is compressed to a node. The algorithm efficiency complexity is linear with the graph size resulting from using greedy search without backtracking. GBI only extracts meaningful typical patterns of a certain size. The algorithm is tested on Promoter DNA sequence, carcinogenicity and mutagenecity data being the prediction of extracted classification rules evaluated by 10-fold cross validation. In [MMYW02] Matsuda et al. analyze the Hepatitis dataset with an improved GBI version. This new version introduces: beam search, achieving a quasi-complete search; a discriminative function, for finding typical patterns after chunking and canonical labelling for enumerating identical patterns. 49
Chapter 3 Constructive Induction with Ensemble Feature Selection In this chapter we present a framework developed in the very beginning of this thesis to explore constructive induction technique and propositional pattern mining methods. The framework we present here combines a propositional association rule miner with a propositional classifier to learn a classification model. This work uses constructive induction technique and an ensemble of heuristics to select and include new and interesting patterns in the learning process. 3.1 Introduction In this section we present the rankCI framework, a three-phase classification architecture that extends the original description language and learns a classification model using both primitive and new descriptors. This framework follows the Cascade Generalization architecture [GB00] and sequentially combines the Apriori association rule miner [AS94] and the C4.5 decision tree induction algorithm [Qui93]. In the first phase, the Apriori algorithm finds all frequent itemsets available in each class partition of the training data. Then, in the second phase, the most interesting and relevant itemsets are select and used to build new attributes. These new attributes are then mapped into the primitive dataset. With this strategy we obtain an enlarged dataset that includes the primitive descriptors and the new attributes that can be seen as intermediate concepts. In the third phase, we run the C4.5 algorithm to learn a decision tree model. 51
CHAPTER 3. CONSTRUCTIVE INDUCTION WITH ENSEMBLE FEATURE SELECTION Table 3.4: Description of the datasets and the number of itemsets found by the Apriori algorithm and selected using the xor-filter Datasets Examples Primitive Attr. Apriori xor-filter adult+stretch 16 4 92 52 adult-stretch 16 4 92 52 dnf0 32 5 284 138 dnf1 256 8 1340 1305 dnf2 1024 10 8742 4284 dnf3 1024 10 8477 4105 kr-vs-kp 3196 36 1999 1539 monks1 432 6 727 305 monks2 432 6 504 200 monks3 432 6 684 418 promoters 106 57 2611 2611 tictactoe 958 9 2052 1104 yellow-stretch 16 4 102 42 yellow-small 16 4 92 52 algorithm available in the arules package of R. To induce the decision tree we use the J48 algorithm, a C4.5 clone available in the WEKA collection. 3.3.1.2 Organization of the Experiments In these experiments, our goal is to evaluate the performance of the rankCI framework and present a sensibility analysis of the parameters. Here we present the results that we obtained by running a rank ensemble that consists of six heuristics. The heuristics that we select to participate in the ensemble are: Pearson Correlation, Information Gain, Cosine, Gini, Leverage and Laplace. Furthermore, we compare our algorithm against the stand-alone C4.5 algorithm that uses only the primitive descriptors as input. In addition, we evaluate our algorithm using a rank ensemble of size one. I.e., we built six instances of our framework where only one of the six heuristics is used to sort and select features. To run our algorithm we must define two thresholds, the δand the λparameters. Using a validation set, we define the Apriori’s minimum support threshold equal to 58
3.3. EXPERIMENTAL EVALUATION Table 3.5: Misclassification error using the six heuristics ensemble Number of top patterns to keep (λ) 5 10 15 20 25 30 Stand-alone C4.5 adult+stretch 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) adult-stretch 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) dnf0 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 9.17 (14.9) dnf1 0.00 (0.0)* 0.00 (0.0)* 0.00 (0.0)* 0.00 (0.0)* 0.00 (0.0)* 0.00 (0.0)* 16.02 (6.4) dnf2 1.08 (1.2)* 1.47 (1.2)* 1.17 (1.1)* 1.17 (1.1)* 1.56 (1.4)* 1.66 (1.3)* 5.18 (1.5) dnf3 0.00 (0.0)* 0.39 (0.5) 0.00 (0.0)* 0.00 (0.0)* 0.00 (0.0)* 0.00 (0.0)* 0.78 (0.4) kr-vs-kp 0.41 (0.6) 0.41 (0.6) 0.41 (0.6) 0.44 (0.5) 0.44 (0.5) 0.44 (0.5) 0.53 (0.5) monks1 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) monks2 5.33 (4.0) 3.93 (3.1) 1.84 (1.8) 1.84 (1.8) 4.62 (1.9) 4.62 (2.9) 3.00 (3.1) monks3 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) promoters 17.09 (9.0) 16.00 (9.8) 10.36 (9.2) 12.27 (11.0) 12.27 (11.0) 15.27 (10.3) 18.27 (13.7) tictactoe 1.25 (0.4)* 1.67 (0.5)* 1.67 (0.5)* 1.67 (0.5)* 1.67 (0.5)* 1.67 (0.5)* 6.05 (3.8) yellow-stretch 0.00 (0.0)* 0.00 (0.0)* 0.00 (0.0)* 0.00 (0.0)* 0.00 (0.0)* 0.00 (0.0)* 35.00 (33.7) yellow-small 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) Arithmetic Mean 1.797 1.704 1.104 1.243 1.469 1.69 6.714 Geometric Mean 0.449 0.427 0.413 0.42 0.458 0.467 1 Average Ranks 3.607 3.964 3.179 3.5 3.929 4.179 5.643 Av. Error Ratio 0.741 0.658 0.638 0.65 0.721 0.734 1 Number wins 8 8 9 9 8 8 0 Number losses 1 1 0 0 1 1 0 Wilcoxon p-value 0.027 0.020 0.004 0.004 0.020 0.020 1,000 59
CHAPTER 3. CONSTRUCTIVE INDUCTION WITH ENSEMBLE FEATURE SELECTION Table 3.6: Theory size: number of tree nodes using the six heuristics ensemble Number of top patterns to keep (λ) 5 10 15 20 25 30 Stand-alone C4.5 Arithmetic Mean 22.414 19.143 18.643 19.1 19.129 17.557 34.314 Geometric Mean 0.675 0.578 0.571 0.581 0.568 0.556 1 Average ranks 4.643 3.643 3.25 3.607 3.464 3.036 6.357 Complexity Ratio 0.718 0.635 0.626 0.633 0.633 0.612 1 Number of Wins 11 12 12 12 12 13 0 Number of Losses 2 1 1 1 1 0 0 Wilcoxon p-value 0.03 0.007 0 0 0.007 0 1 five, δ= 5%.We use this parameter value for all datasets except for the kr-vs-kp and the promoters datasets. The different support values that we use for kr-vs-kp, 80%,and promoters, 20%,are due to the number of dataset examples and primitive attributes, otherwise we would end up with an intractable number of itemsets. The other user-defined threshold, λ, can take one of six user-defined values. We can select, for each heuristic, the top ranked 5, 10, 15, 20, 25 or 30 itemsets. By evaluating our algorithm for each one of these levels our goal is to study the relation between the number of new attributes we map and the performance of our framework. We want to analyze the stability and robustness of our framework. To evaluate our algorithm we run, for each dataset, a stratified 10-fold cross validation procedure. Using these results we analyze the performance of our framework according to the misclassification error and the complexity of the generated models (number of nodes in the generated tree). In addition, we compute the misclassification error and the associated standard deviation, the average mean, the geometric mean, the average error ratio, the number of wins and losses and the Wilcoxon hypothesis test p-value. We compute Wilcoxon signed ranked pair-test to evaluate how significantly our algorithms differ from the reference C4.5 algorithm. The null hypothesis of the test is that the median of the differences is zero. 3.3.2 Results Table 3.4 describes each one of the fourteen datasets. We present the number of instances and the number of primitive attributes. Moreover, we present the number of patterns found by the Apriori algorithm and the number of exclusive inter-class 60
3.3. EXPERIMENTAL EVALUATION Table 3.7: Misclassification error using a single heuristic Number of top patterns to keep (λ) 5 30 Heuristic P-Corr Gain Cosine Gini Leverage Laplace P-Corr Gain Cosine Gini Leverage Laplace adult+stretch 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) adult-stretch 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) dnf0 0.00 (0.0) 0.00 (0.0) 28.33 (18.9) 0.00 (0.0) 28.33 (18.9) 28.33 (18.9) 0.00 (0.0) 0.00 (0.0) 35.00 (11.7) 0.00 (0.0) 35.00 (11.7) 35.00 (11.7) dnf1 0.40 (1.3) 0.00 (0.0) 13.95 (8.5) 1.17 (1.9) 13.95 (8.5) 13.95 (8.5) 0.00 (0.0) 0.00 (0.0) 5.45 (4.9) 0.00 (0.0) 5.45 (4.9) 5.08 (4.6) dnf2 2.34 (1.8) 2.25 (1.8) 2.54 (1.3) 2.34 (1.8) 2.54 (1.3) 1.56 (1.4) 1.66 (1.3) 1.66 (1.3) 4.10 (2.3) 1.66 (1.3) 4.10 (2.3) 3.61 (2.1) dnf3 0.00 (0.0) 0.39 (0.5) 0.39 (0.5) 0.39 (0.5) 0.39 (0.5) 0.39 (0.5) 0.00 (0.0) 0.39 (0.5) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) kr-vs-kp 0.41 (0.6) 0.53 (0.5) 0.53 (0.5) 0.53 (0.5) 0.56 (0.5) 0.56 (0.5) 0.41 (0.6) 0.56 (0.5) 0.56 (0.5) 0.56 (0.5) 0.56 (0.5) 0.56 (0.5) monks1 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) monks2 1.39 (1.6) 1.39 (1.6) 7.86 (5.1) 1.39 (1.6) 7.86 (5.1) 7.86 (5.1) 3.70 (2.7) 3.70 (2.7) 11.07 (6.3) 3.70 (2.7) 11.07 (6.3) 11.07 (6.3) monks3 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) promoters 17.09 (9.0) 16.18 (8.3) 18.18 (14.9) 17.09 (9.0) 18.18 (14.9) 18.18 (14.9) 14.27 (10.3) 14.09 (10.9) 18.18 (14.9) 14.27 (10.3) 17.18 (15.8) 18.18 (14.9) tictactoe 1.56 (1.5) 4.80 (1.8) 4.07 (2.1) 3.24 (1.7) 4.90 (3.2) 3.24 (1.7) 0.00 (0.0) 0.73 (0.9) 1.67 (0.5) 1.67 (0.5) 1.67 (0.5) 1.67 (0.5) yellow-stretch 0.00 (0.0) 0.00 (0.0) 40.00 (39.4) 0.00 (0.0) 40.00 (39.4) 40.00 (39.4) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 40.00 (39.4) 40.00 (39.4) yellow-small 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) 0.00 (0.0) Arithmetic Mean 1.657 1.825 8.276 1.868 8.337 8.149 1.431 1.51 5.43 1.562 8.216 8.226 Geometric Mean 0.411 0.45 1.02 0.445 1.038 0.973 0.439 0.41 0.795 0.466 1.031 1.02 Av. Error Ratio 0.666 0.663 1.17 0.65 1.184 1.151 0.696 0.658 1.234 0.725 1.31 1.305 Wilcoxon p-value 0.004 0.008 0.742 0.008 0.82 0.82 0.012 0.027 0.426 0.02 1 1 61
CHAPTER 3. CONSTRUCTIVE INDUCTION WITH ENSEMBLE FEATURE SELECTION Table 3.8: Theory size: number of tree nodes using a single heuristic Number of top patterns to keep (λ) 5 30 Heuristic P-Corr Gain Cosine Gini Leverage Laplace P-Corr Gain Cosine Gini Leverage Laplace Arithmetic Mean 22.086 26.757 28.671 25.457 30.414 29.643 17.543 17.286 26.657 17.714 26.643 25.786 Geometric Mean 0.706 0.756 0.891 0.75 0.922 0.902 0.605 0.551 0.778 0.558 0.78 0.763 Av. Error Ratio 0.752 0.788 0.93 0.778 0.952 0.942 0.715 0.611 0.855 0.617 0.856 0.838 Wilcoxon p-value 0.019 0.022 0.08 0.022 0.08 0.354 0.013 0 0.097 0 0.073 0.097 itemsets selected using the xor-filter. In Table 3.5 and Table 3.6 we present the misclassification error (and the standard deviation) and the complexity, respectively, of the classification models that we obtained using an ensemble of six heuristics. In Table 3.5 we present the mean misclassification error and the standard deviation for a range of λvalues. For comparison purposes we also present, in last column, the results obtained with the stand-alone C4.5 algorithm and using only the primitive dataset as input. In the last seven rows of this table we present a set of statistics that summarize the results. In Table 3.6 we present statistics that summarize the complexity of the trees learned with the ensemble method. As mentioned above we also run our framework using only one of the six heuristic that participates in the ensemble to sort the itemsets. In Table 3.7 we present the misclassification error that we obtain by sorting the examples with a single heuristic. In Table 3.8 we summarize the complexity of the models. In these two tables we present relevant statistics values for two values of the λparameter, λ= 5 and λ= 30. 3.3.3 Analysis of the Results If we analyze the results presented in tables 3.5 and 3.7 we observe that the six heuristic ensemble generate the most accurate models that we learn using the rankCI framework. The six heuristic ensemble compares favorable against the single heuristic selection and the stand-alone models that were learned using only primitive attributes. Furthermore, we can say that when one of the heuristics used in the ensemble performs better than the stand-alone C4.5 algorithm, the six heuristic ensemble gains with the inclusion of this heuristic and obtains better results than the single heuristic selection method. In addition, we observed that our framework is sensitive to the number of new attributes, typically we get better results when we select a number of itemsets ranging 62
3.4. CONCLUSIONS between 15 and 20. Indeed, this range of values is associated with the high accurate classification models and with compact models. If we map a large number (>25) of itemsets we get high compact classification models at the cost of low accuracy values. This behavior means that the prediction model is overfitting the data. Moreover, we can say that the C4.5 algorithm used at level 3 gains with the ensemble diversity. There are few cases where the single heuristic models beat the six heuristic ensemble. This is especially clear when the heuristic in the single rank is a member of the ensemble. In comparison with the stand-alone model and the single heuristic configuration, we get high accurate models with small standard deviation values for the ensemble configuration, with a high diversity of heuristics. This is a well known behavior of ensembles [VD04]. Concerning the analysis of the framework configuration that uses a single heuristic, we obtained high accurate and high compact models when we use Pearson correlation and measures from the field of information theory to sort the itemsets. When we analyze the p-value of the Wilcoxon hypothesis test, we observe that our algorithm differ from the stand-alone C4.5 algorithm. Remember that our algorithm uses C4.5 at phase 3 to induce a decision tree model. Beyond generating high accurate and compact models, our framework finds new concepts that give insights on the concept being learned. Typically, these concepts are new attributes that appear in the inner nodes of the tree. One example of such new descriptors is presented in the illustrative example of Section 3.2.4. 3.4 Conclusions In this work we introduced the rankCI framework, a general three-phase architecture that combines sequentially an association rule miner and a propositional classifier. In the first phase the framework extends the primitive description language using conjunctions of items that are found by the Apriori algorithm. In the second phase we use a xor filter and a heterogeneous ensemble used to select the most interesting features. Last, we take the enlarged dataset as input to the C4.5 algorithm and learn a decision tree classification model. We experimentally evaluate our algorithm using a set of benchmark datasets and a heterogeneous set of heuristics. The rankCI framework generates high accurate and more compact models than the baseline, the stand-alone C4.5 algorithm. Moreover, 63
CHAPTER 3. CONSTRUCTIVE INDUCTION WITH ENSEMBLE FEATURE SELECTION we show that the ensemble methodology can gain with the diversity of the ensemble members. In comparison with a configuration that uses a single heuristic to sort the itemsets, the ensemble strategy obtains significant wins. Furthermore, we observe that the tree models generated by our framework include new attributes at the inner nodes, especially in positions near the root of the tree. In some cases, all the inner nodes of the generated models use new attributes. These new attributes are intermediate level concepts that can highlight important information hidden in the original dataset. These new attributes are selected using different metrics/views. By combining constructive induction with the ensemble strategy we reduce fragmentation and myopia, two well-known problems of decision tree models [PH90, JB03]. In the next chapter we extend some ideas of this work to multi-relational databases. We explore first-order logic representations and methodologies. 64
Chapter 4 Propositionalization with First-order Logic Features In this chapter we present the RUSE-WARMR framework that we developed to explore patterns available in multi-relational databases and learn a propositional classification model. Moreover, the goal of this work is to find patterns without joining the tables in a pre-processing phase. Thus, in this work we run a first-order logic association rule miner to find patterns and use constructive induction and logic-based propositionalization techniques to learn a classification model. 4.1 Introduction Different from the work presented in Chapter 3, the work presented in this chapter was developed to explore complex structured data, that may stem from a number of different and related sources. More precisely, we design a framework to explore information available in multi-relational databases and learn a classification model. In this chapter we introduce the RUSE-WARMR framework, an architecture designed to explore multi-relational patterns available in relational databases. In this work we run WARMR [DT99], an ILP pattern miner algorithm, to find first-order logic (FOL) patterns available in multi-relational databases. Next, a filter strategy is used to eliminate redundant and class unrelated patterns. Then, the top-kmost discriminative patterns found are mapped into the target table. Last, the top-kpatterns and the primitive descriptors are used to learn a theory describing the target concept. 65
CHAPTER 4. PROPOSITIONALIZATION WITH FIRST-ORDER LOGIC FEATURES Previous work in this research area, like RSD [ZL06], SAYU [DBD+05], nFOIL [LKR07], kFOIL [LPRF06], suggest that an effective approach to explore multi-relational data is propositionalization (see Section 2.4 in Chapter 2). By using this technique we can gain with the huge amount of research in feature-based learning. The effectiveness of this technique depends both upon the algorithm we use to generate the patterns and upon the propositional classifier. The majority of the new contributions in this area focuses in proposing new FOL pattern miners and strategies to select the most interesting patterns [ZL06, NLW09]. The main issue with this technique is the number of patterns found by the FOL miner, that grows exponentially when we use FOL powerful representation languages. On the one hand, if all these patterns are fed into the propositional learner, the learning task may become intractable and become very vulnerable to overfitting. On the other hand, if we constrain too much the number of patterns, we risk to miss important patterns that may be extremely useful to the learning task. In Chapter 3 and work [FG07] we study feature selection techniques. The RUSE-WARMR algorithm is motivated by the excellent results of ILP based pattern miners, such as WARMR, namely in terms of efficiency and robustness. In contrast to systems such as nFOIL or SAYU, where the pattern mining task is tightly integrated with classifier construction, and therefore is heavily dependent on the training examples, rule mining provides an excellent framework for efficiently mining the interesting patterns that are relevant on their own and that can scale very effectively on large datasets. The contributions of the RUSE-WARMR methodology are: •We develop a strategy that finds discriminative patterns by decomposing the pattern mining problem. First the class partitions are mined separately and, then, all sets of patterns found are merged. With this procedure we achieve efficiency and a natural parallelized algorithm. •We propose a novel method to select discriminative patterns among the set of all the patterns found. We introduce a relaxed version of θ-subsumption to implement this discriminative filter. In Section 4.2 we introduce some concepts that are needed to design the RUSEWARMR architecture. In Section 4.3 we present a detailed description of our framework. An illustrative example that explains every step of the architecture is also presented. In Section 4.4 we experimentally evaluate the RUSE-WARMR framework 66
4.2. PRELIMINARIES and present the obtained results. Finally, in Section 4.5 we conclud stressing the need to develop new methodologies that can explore conveniently temporal databases. 4.2 Preliminaries In this section we introduce some fundamental concepts that were important to the design of the RUSE-WARMR architecture. When exploring a database, r, to find frequent queries, Q, we define a language bias, L, that restricts the size of the search space and guides the search. We then aim to find a theory of frequent queries Q={q∈L:sup(q, r)> λ}, where sup(q, r) is the number of times a query qsucceeds in database r, and λis a user-defined support threshold. A query is said to succeed in a database if there are bindings, in the database, for all variables in the query, such that the query holds true. A special case is defined when exploring a database partition. In this case we define Qk={q∈L:sup(q, rk)> λ}, where rkis a database partition. When searching for frequent patterns within and across database partitions there is a need to introduce an equivalence relation. One of the most used query equivalence relations is Plotkin’s [Plo70] θ-subsumption. Definition 1 : Let q1and q2be two queries. If there exists a substitution θsuch that q1θ⊂q2, we say that q1θ-subsumes q2. Definition 2 : Let q1and q2be two queries. We say that q1is θ-equivalent to q2if and only if q1θ-subsumes q2and q2θ-subsumes q1. In our work we need to select discriminative patterns. Notice that we will usually learn queries from different class partitions of the database. Queries of interest are queries that have significant different support values in different database partitions. The next definition formalizes this idea. We define two queries q1and q2to be agreeing queries, and write q1∼ =θq2, if 1. q1is θ-subsumption equivalent to q2, and, 2. |sup(q1,ri)−sup(q2,rj)|< λ where sup(q1,ri) and sup(q2,rj) are the support values of the queries in different dababase partitions, i6=j, and λis a user-defined threshold value. In our system 67
CHAPTER 4. PROPOSITIONALIZATION WITH FIRST-ORDER LOGIC FEATURES Table 4.3: Generalization accuracy of the RUSE-WARMR framework Generalization Accuracy Datasets Support ChiValue C4.5 SVM Hepatitis 0.9 No-Chi 64.63 (8.20) 62.50 (6.18) 10 62.47 (5.97) 62.50 (6.25) 5 62.47 (5.97) 62.90 (6.12) Standard 62.70 (6.07) 62.90 (6.44) 0.8 No-Chi 63.42 (6.92) 63.29 (6.09) 10 62.67 (5.57) 62.70 (6.36) 5 62.47 (5.97) 62.90 (6.12) Standard 64.40 (7.29) 64.50 (6.13) Financial 0.9 No-Chi 86.76 (1.23) 85.92 (3.85) 10 86.76 (1.23) 86.76 (1.23) 5 86.76 (1.23) 86.76 (1.23) Standard 86.76 (1.23) 85.92 (3.85) 0.8 No-Chi 86.76 (1.23) 81.20 (6.50) 10 86.76 (1.23) 86.34 (1.60) 5 86.76 (1.23) 86.76 (1.23) Standard 86.76 (1.23) 85.92 (3.85) FinancialB 0.9 No-Chi 54.10 (12.91) 49.40 (17.70) 10 61.40 (1.90) 46.70 (16.91) 5 61.40 (1.90) 60.20 (4.05) Standard 61.81 (2.20) 60.69 (5.71) 0.8 No-Chi 59.20 (11.35) 54.40 (16.82) 10 61.80 (17.72) 61.80 (17.72) 5 61.80 (17.72) 67.00 (20.89) Standard 61.81 (2.20) 59.44 (8.83) Protein 0.9 No-Chi 63.33 (1.22) 63.33 (1.22) 10 63.33 (1.22) 63.33 (1.22) 5 63.33 (1.22) 63.33 (1.22) Standard 63.33 (1.22) 63.33 (1.22) 0.8 No-Chi 63.18 (1.18) 63.23 (1.49) 10 63.18 (1.18) 63.23 (1.49) 5 63.18 (1.18) 63.23 (1.49) Standard 62.32 (1.26) 62.32 (1.26) 74
4.4. EXPERIMENTAL EVALUATION experiments and then we present and analyze the obtained results. 4.4.1 Configuration of the Experiments As said before, the architecture of our framework is general and can match a wide range of algorithms both to find FOL patterns and to learn a propositional classification model. In these experiments we chose to build two instances of our framework. We present experiments that combine WARMR algorithm with C4.5 algorithm and experiments that combine WARMR algorithm with a linear kernel SVM - Support Vector Machine [Pla98]. We further study the effectiveness of our filter methodology. Here we also present the results that we obtained when we discard lines 4 and 5 of our algorithm (see the pseudo-code of Algorithm 5). In the results we write No-Chi to identify the results that we obtained without the chi-square filter. Furthermore, we present results for a configuration that takes the full training set as input (no partitions!) and does not employ filters to prune the WARMR findings. We name this configuration as Standard. The results presented with these configurations are identified in the table columns headed with ChiValue, a column associated with the δparameter of the RUSE-WARMR architecture. Moreover, we evaluate our framework for a set of parameters. We set the support value of the WARMR algorithm, the input parameter λ, to be equal to 90% and 80%. Moreover, we set the δparameter equal to 5% and 10%. Furthermore, we limit the maximum level of refinement of the WARMR algorithm to 4. Without this limit it would be impossible to search the full solution space. We use a tenfold stratified cross-validation strategy to evaluate all the configurations we evaluate in this work. For each configuration, we compute the mean and the standard deviation of the generalization accuracy. In the multi-class problem available in the Protein dataset we use the round-robin strategy presented in Section 2.5.3.3 of Chapter 2. Moreover, we evaluate how significantly the two instances of the RUSE-WARMR framework, WARMR + C4.5 and WARMR +SVM, and the No-chi configurations differ from a Standard approach. Therefore, we compute the Wilcoxon signed ranked pair-test, setting the confidence level to 95%. The null hypothesis of this test is that the median of the differences is zero. 75
CHAPTER 4. PROPOSITIONALIZATION WITH FIRST-ORDER LOGIC FEATURES For comparison purposes and to evaluate the contribution of the chi-square filter, we also introduce a slightly modified version of RUSE-WARMR. In this modified version we replace the chi-square filter, that uses the confidence level, by a filter that uses the chi-square statistic to sort and select the k most interesting patterns. With this strategy we eliminate the risk of having an extremely large number of patterns selected with a specified confidence level, the δparameter. To implemented all these versions we use the ACE [BDD+00] data mining System and WEKA [WF99] collection of data mining algorithms. 4.4.2 Results In tables 4.2, C.2, C.1 (the last two tables are presented in Appendix C) we present, respectively, the number of patterns, the run-time, in seconds, and the peak memory usage, in kilobytes, of each step of the RUSE-WARMR framework. In Table 4.2 we present in the first column the names of the datasets used. In column 2 we present the support value of the WARMR algorithm, the λparameter of RUSE-WARMR. In column three we present the chi-square statistic threshold, the δ parameter of the framework, and identify the type of experiment. If we run the RUSEWARMR without the chi-filter or if we use the classical/standard framework we write No-Chi and Standard, respectively. In columns four and five we present the number of patterns found by WARMR in each partition. We write Part A to identify the results obtained in the minority class partition and write Part B to identify the results obtained in the majority class partition. As said above, we present the average number of the patterns found in the multi-class problem. Remember that we use round-robin strategy (see Section 2.5.3.3) to solve the multi-class problem. In columns six and seven we present the number of patterns that we get after removing agreeing patterns and applying the chi-square filter. In the last column we present the size (number of nodes) of the trees that we get when we learn a tree model using the RUSE-WARMR framework. In Table C.2 (available in Appendix C) we use the same layout of Table 4.2 and present the run-time of each step of the RUSE-WARMR algorithm. Moreover, we present the time needed to run either the C4.5 algorithm or the SVM algorithm to learn a classification model in the enlarged target table. In Table 4.3 we present the generalization accuracy of two instances of the RUSEWARMR framework. We present the generalization accuracy using the C4.5 algorithm and the SVM algorithm in the last step of the RUSE-WARMR architecture. 76
4.4. EXPERIMENTAL EVALUATION In Table C.3 (see Appendix C) we show the results that we obtain if the chi-square filter is replaced by the filter that, first, uses the chi-square statistic to sort the patterns and then select the top-k most interesting patterns. We present results when we select and map the top ten and the top twenty most interesting patterns. 4.4.3 Analysis of the Results The statistics presented in Table 4.3 show that our results are somewhat better than the base accuracy. Among these, the most important gains were obtained in the balanced version of the Financial dataset. In this dataset we get a generalization accuracy of 67% using the SVM algorithm in the last step of the RUSE-WARMR architecture. In comparison, by running the standard algorithm we get a generalization accuracy of 59.44%.In all other problems we get small gains ranging between 1% and 3% in terms of generalization accuracy. In Table 4.2 we notice that we get a large number of patterns when we run the RUSEWARMR algorithm than when we run the classical approach. This behavior was expected as in RUSE-WARMR framework we run the WARMR algorithm in both partitions and we can find patterns that will be impossible to obtain if we use the full dataset as input to the WARMR algorithm. We can see that by running the RUSEWARMR we can get an equal or larger number of rules in one partition than the number of patterns that we found by taking the full dataset as input to the WARMR algorithm. This means that we can miss to find important class patterns if we do not run separate instances of the WARMR algorithm. The main issue with running WARMR in the two class partitions is that we get a large number of redundant queries. This is clear when we analyze the contribution of the discriminative filter. In column number six of Table 4.2 we present the number of non-agreeing patterns selected by the discriminative filter. Typically, we get a larger number of discriminative patterns than the number of patterns found by the standard algorithm. This is an important finding, with our approach we can find a large number of FOL patterns by running WARMR, with high support values, in each class partition. Most of the patterns obtained with this new strategy can only be found with the standard approach if we run the WARMR algorithm with low support values. Moreover, and depending on the characteristics of the dataset and on the computational resources, it can be impossible to find the same patterns using the standard approach. Moreover, in columns seven and eight of Table 4.2 we observe that the number of patterns selected by the chi-square filter and the size of the tree induced, using the 77
CHAPTER 4. PROPOSITIONALIZATION WITH FIRST-ORDER LOGIC FEATURES C4.5 algorithm, decrease with the significant level, the δparameter of the RUSEWARMR architecture. One interesting result is the size of the induced tree using the standard approach and the Financial datasets as input. We observe that we feed the C4.5 algorithm with many patterns and yet we get small size decision trees. This phenomena can be related with the low discriminative patterns found when we use the full datasets as input to the WARMR algorithm. The C4.5 algorithm does not find any pattern that reduces the entropy and, in many cases, learns the classifier with a single leaf, the majority class. Regarding the peak memory usage and the run-time presented in tables C.1 and C.2 (see Appendix C), we observe that running WARMR in any partition requires approximately equal or less memory than running WARMR using the full dataset as input. This is an interesting result that can be valuable if we run each WARMR instance in parallel. This issue should be explored in the future as running the WARMR algorithm is the most expensive step of the RUSE-WARMR framework and, as said before, a large number of patterns can be found when we run WARMR to explore each class partition than when we run WARMR to explore the full dataset. When we analyze the running times of the WARMR algorithm we observe that in the hepatitis problem the standard approach needs always more time than the time needed by WARMR to explore any partition of the dataset. In the other problems the maximum run-time measured in the two partitions is higher than the run-time required by the standard approach. This is especially clear when we explore the Financial datasets. In these problems we have many long patterns available in each partition, making the search last longer times. The run-time and memory usage of the other steps of the RUSE-WARMR framework are typically less expensive than the execution of the WARMR algorithm and both the run-time and memory usage decrease with the number of patterns available in each step. Furthermore, the runtime required to learn a classification model is always an order of magnitude less than the run-time needed to run the WARMR algorithm. The results presented in Table C.3 (see Appendix C) show that mapping a large number of patterns can generate low accurate classifiers. In general we get worse results when we map twenty patterns than when we map ten patterns. Moreover, these results are almost the same as those presented in Table 4.3. This behavior can be explained by the small number of interesting patterns that remain after applying the chi-square test of the RUSE-WARMR framework. 78
4.5. CONCLUSIONS 4.5 Conclusions In this chapter we presented a classification architecture that uses constructive induction and FOL pattern miners to explore complex structured data. In contrast to the classical approach that joins tables in a pre-processing step, our framework uses the FOL pattern miner to explore the logical relational structure of multi-relational databases and then uses propositionalization technique to use efficient propositional learners. We developed a three phase architecture that combines sequentially a FOL pattern miner, two feature selection filters and a propositional classifier. In the first phase we search for frequent FOL patterns using the WARMR algorithm. In the second phase we introduce two filters to remove non-discriminative and select interesting class correlated patterns. To do so we introduce a new equivalence relation and we use the chi-square statistic test. Then, we take the selected patterns and use the propositionalization technique to extend the target table with new Boolean attributes. In the third phase we run a propositional classifier, such as a decision tree learner or a SVM. In this architecture it is not required to find patterns in the full database. We find frequent patterns available in each class partition and then merge the obtained set of patterns. In the merge process we run a filter to select only discriminative patterns. With this strategy we achieve efficiency and a naturally parallel algorithm. The models generated by our system are readable and almost all the obtained models have both ILP patterns and primitive attributes from the target table at the inner nodes. An interesting observation is that in some runs all the inner nodes of the induced trees contain only these ILP patterns. Though our algorithm uses WARMR at phase 1 and C4.5 (or SVM) at phase 3, Wilcoxon significance test prove that our algorithm differs from the standard approach. Remember that the standard approach combines these same algorithms but do not uses any pattern pruning/selection strategy. The obtained results prove that our feature selection strategies remove non-interesting features. In the next two chapters we extend the framework presented here to explore the temporal relations available in multi-relational databases. More specifically, we will study propositional and FOL algorithms that can find sequences of events. Moreover, we will run highly efficient sequence miners to find longer patterns. We also search for other feature selection methods to select the most interesting patterns. 79
Chapter 5 Exploring Multi-Relational Temporal Data using Propositional Techniques In this chapter we present and analyze propositional methodologies to explore temporal information available in multi-relational databases. We introduce the MuSer framework that we develop in this thesis. At the core of this system is an encoding technique that translates the temporal information into a propositional sequence of events. By using this strategy we are able to explore the temporal information using a propositional sequence miner. Moreover, in this system we combine feature selection and propositionalization techniques to cast a multi-relational classification problem into a propositional one. 5.1 Introduction Quite often, multi-relational databases accumulate data over long periods of time. To explore such temporal records we can use aggregation operators (see Chapter 4) or use special purpose techniques that explore the time order of the events. In this work we assume that data stored in a subset of tables are sequences of events that reflect the evolution of a phenomenon of interest. As an example, consider a multi-relational dataset in a medical domain. A patient is subject to a sequence of examinations and a set of measurements, corresponding to the results of different analysis, are taken. For each patient, we get a sequence of measurements over time. Our hypothesis is that the 81
CHAPTER 5. EXPLORING MULTI-RELATIONAL TEMPORAL DATA USING PROPOSITIONAL TECHNIQUES evolution of these measurements might encode relevant information for the diagnosis of a certain disease. The problem we address here is therefore how can we explore such information? In more general terms, can we extract implicit multi-relational temporal information that can be used to learn predictive and highly accurate decision models? We believe that both intra-table and inter-table temporal patterns can be used for this purpose. To do so, we develop an architecture that is grounded in the propositionalization methodology [FGC08, ZL06]. We propose MuSer (MUlti-relational SEquential patteRn knowledge learning), a framework that discovers sequence patterns available in a subset of relational tables. The algorithm is organized as a pipeline. We start by converting the multi-relational temporal data into what we call a sequence database. In this new database the temporal information of each example is represented by a heterogeneous sequence, that can include events registered in one or more tables. In a second phase, we run a sequence miner to find frequent sequences in each database partition. Next, in phase three, we select a subset of sequence patterns. We extract the discriminative frequent ones, e.g. those that appear in only one class, and using a chi-square filter we remove class unrelated sequences. In phase four we map the selected patterns into a binary set of attributes, that indicate the presence or absence of a sequence in a particular example. Last, we induce a classification model using a propositional algorithm. We believe that this methodology is suitable to explore time related information stored in multi-relational datasets. To evaluate our methodology, we analyze the four multi-relational datasets described in Appendix B. We evaluate the effectiveness of our methodology by measuring the generalization accuracy and the usefulness of the learned classification models. A comparison against the RUSE-WARMR framework [FGC08] is also presented. In Chapter 4 of this thesis we presented the RUSE-WARMR framework. Remember that the RUSE-WARMR system aggregates temporal data using a set of statistics. The contributions of this work are therefore: •We developed MuSer, a framework that explores heterogeneous sources of time data recorded in a multi-relational database. Our methodology explores temporal records by abstracting patterns over time. We do not deal with explicit time, instead we explore the order of the events. •The MuSer architecture searches for sequence patterns in each class partition individually. With this strategy we find a large number of in-class and discriminative patterns. 82
5.2. THE MUSER FRAMEWORK Algorithm 6:MuSer pseudo-code input : a multi-relational dataset r; three thresholds λ, the support value of the sequence miner and k, the number of top patterns to map output: a classification model Pre-Processing Encoding1 s←conversion (r);2 3 s1,...,sm←partition (s);4 Finding Frequent Patterns5 for i= 1 to mdo6 sfi←SequenceMiner(si,λ);7 8 Filtering9 Sdisc ←discriminate(sf1,...,sfm);10 Sinter ←sort(Sdisc,chi-square);11 12 Mapping13 rEnlargedT arget ←Mapping(Sinter,k,rtarget);14 15 Classifier Induction16 ClassifierIndution(rEnlargedT arget);17 18 In Section 5.2 we present a detailed description of the MuSer framework. Next, in Section 5.3 we present and discuss the obtained results. At the end of this chapter we conclude and point to the development of new methodologies that can include valuable domain knowledge. 5.2 The MuSer Framework In this section we present the MuSer framework. This new architecture explores temporal and logico-relational information to build descriptive and highly accurate classification models. More precisely, the framework explores sequences of events registered in one or more tables of a multi-relational database. In the first phase we convert the multi-relational data into a sequence database. Then, in a second 83
CHAPTER 5. EXPLORING MULTI-RELATIONAL TEMPORAL DATA USING PROPOSITIONAL TECHNIQUES A28142 b (179.0/45.0) = 0 c (273.0/51.0) = 1 Figure 5.2: MuSer’s best induced decision tree for the Hepatitis subtype problem present the size of the induced tree to highlight the relation between the support value of the sequence miner and the complexity of the generated decision tree models. In tables D.1 and D.2, that we present in Appendix D, we use the same column descriptors of Table 5.4 and present the peak memory usage and the time needed to find these patterns and learn a classification model. In Table 5.5 we present the generalization accuracy (and standard deviation) of the models that we learn using either the C4.5 algorithm or the linear kernel SVM algorithm in the last step of the MuSer system. Moreover, we present the generalization accuracy that we get when we run the baseline algorithm, the RUSE-WARMR. The RUSE-WARMR results were obtained when we run the C4.5 algorithm in the last step, and with the support value of the WARMR algorithm equal to 80% and by mapping the twenty most interesting patterns. Furthermore, we present the p-value of the Wilcoxon test that we obtained when we compare the generalization accuracy of each MuSer instance against the RUSE-WARMR baseline. We show two columns heading the (Wilcoxon) p-value text. The first one shows the p-value of each instance of the MuSer algorithm that uses the C4.5 algorithm in the last step of the MuSer framework. The second column shows the same information for the experiments that we run with SVM to learn the classification model. In Figure 5.2 we present the tree model generated in the best run of the experiments we made with the Hepatitis dataset. These results were obtained in the first fold of the 10-cv evaluation. In this run we obtained an accuracy of 92%.This result was obtained by setting the support value of the sequence miner to 80% and mapping the ten most interesting patterns. In this specific example the split attribute that appears in the inner node of the tree is the sequence pattern A28142 : (30 33 37 48) that corresponds to the (che=normal d-bi=normal gpt=high t-bil=normal) itemset. This is a sequence of size one but we found trees and linear kernels that use sequences of larger sizes. In Figure 5.3 we present a tree that was found when we set the support value of the sequence miner to 90%.Different from the tree presented in Figure 5.2, this tree uses 90
5.3. EXPERIMENTAL EVALUATION Table 5.4: Number of patterns found in each step of the MuSer framework Sequence Miner Filters C4.5 Datasets Support Top-K Part A Part B Discriminative Chi-square TreeSize Hepatitis 0.9 10 0.1 ( 0.3 ) 67.6 ( 29.6 ) 67.5 ( 29.7 ) 10.0 ( 0.0 ) 7.4 ( 1.8 ) 20 0.1 ( 0.3 ) 67.6 ( 29.6 ) 67.5 ( 29.7 ) 20.0 ( 0.0 ) 10.2 ( 3.4 ) 0.8 10 122.1 ( 59.1 ) 56010.6 ( 19036.9 ) 55888.5 ( 19060.9 ) 10.0 ( 0.0 ) 3.0 ( 0.0 ) 20 122.1 ( 59.1 ) 56010.6 ( 19036.9 ) 55888.5 ( 19060.9 ) 20.0 ( 0.0 ) 6.0 ( 0.0 ) Protein 0.9 10 10006.2 ( 651.8 ) 356.0 ( 19.8 ) 9923.3 ( 651.4 ) 10.0 ( 0.0 ) 7.5 ( 2.1 ) 20 10006.2 ( 651.8 ) 356.0 ( 19.8 ) 9923.3 ( 651.4 ) 20.0 ( 0.0 ) 11.2 ( 2.6 ) 0.8 10 80537.2 ( 4301.2 ) 3230.3 ( 364.2 ) 81779.5 ( 4355.3 ) 10.0 ( 0.0 ) 7.6 ( 1.8 ) 20 80537.2 ( 4301.2 ) 3230.3 ( 364.2 ) 81779.5 ( 4355.3 ) 20.0 ( 0.0 ) 10.5 ( 3.9 ) 91
CHAPTER 5. EXPLORING MULTI-RELATIONAL TEMPORAL DATA USING PROPOSITIONAL TECHNIQUES Table 5.5: Generalization accuracy of the MuSer framework C4.5 SVM Datasets Support Top-K Accuracy Wilcoxon p-value Accuracy Wilcoxon p-value Hepatitis 0.9 10 64.10 ( 6.97 ) 0.33 65.50 ( 5.32 ) 0.18 20 65.50 ( 5.72 ) 0.21 65.50 ( 6.06 ) 0.23 0.8 10 79.90 ( 5.92 ) 0.00 80.10 ( 6.31 ) 0.00 20 79.90 ( 5.92 ) 0.00 80.10 ( 6.31 ) 0.00 RUSE – 63.42 ( 6.92 ) Protein 0.9 10 76.86 ( 0.03 ) 0.00 76.14 ( 0.02 ) 0.00 20 78.24 ( 0.03 ) 0.00 78.20 ( 0.03 ) 0.00 0.8 10 79.11 ( 0.02 ) 0.00 76.86 ( 0.03 ) 0.00 20 79.97 ( 0.03 ) 0.00 77.87 ( 0.03 ) 0.00 RUSE – 63.18 ( 1.18 ) also primitive attributes, the borndate attribute. 5.3.3 Analysis of the Results The results that we obtained are quite impressive. Even without using all the information available in each dataset and without including background knowledge from experts, we get significant accuracy wins over the baseline in the hepatitis subtype problem and in the protein fold classification problem, the two problems where we complete the experiments. Only when we run the MuSer framework with support value equal to 90% we do not get significant accuracy gains. In both problems we get accuracy gains of approximately 20 percentage points. These results show the contribution of algorithms that explore the time information using special purpose methodologies. Moreover, the results that we present here are better than the ones obtained by algorithms that explore the order of the events. In the Hepatitis dataset we get gains of approximately 1 percentage point over the work presented in [OYG+04], that was developed with the special purpose to explore the Hepatitis dataset. This is remarkable as we do not explore information available in all tables and do not include expert knowledge in the mining process. [OYG+04] uses computational expensive sub-graph patterns found by the Graph-Based Induction [MHM+99] as input to a decision tree learner. In the protein problem we obtained generalization accuracy gains of approximately 4 92
5.3. EXPERIMENTAL EVALUATION borndate A25 <= 1940-12-15 b (255.0/114.0) > 1940-12-15 A20 = 0 c (166.0/26.0) = 1 c (21.0/9.0) = 0 b (10.0/1.0) = 1 Figure 5.3: Example of a decision tree induced when the support value of MuSer’s sequence miner is set to 90% percentage points over the work developed by Kersting [KRR06]. This work introduces Logical Hidden Markov Models, a methodology that can include expert/background knowledge in the mining process. In these two problems we observe that the generalization accuracy increases with the decrease of the PrefixSpan support value. Moreover, if we increase the number of patterns to map from ten to twenty patterns, typically we get better results. This later behavior has some limitations as we explain in Chapter 3. If we map a larger set of patterns the propositional classifier can overfit the data. Regarding the analysis of the number of patterns found in each step of the MuSer framework, we get an exponential growth in the number of patterns found. The high growth rate is clear from the analysis of columns 4 and 5 of Table 5.4. The lower the support value the higher the number of patterns. This issue of sequence miners is well known [PHMA+01] and was the source of many problems we have in this work. We were unable to find all patterns having support equal or less than 70%. The effectiveness of the filters is clear when we analyze the number of patterns we found when we run the sequence miner with a support value equal to 80%.Typically we get numerous irrelevant and redundant patterns. Without the use of both filters, mainly the chi-square filter that selects class related patterns, we could not obtain the presented results or would get worst generalization ability of the obtained classification 93
CHAPTER 5. EXPLORING MULTI-RELATIONAL TEMPORAL DATA USING PROPOSITIONAL TECHNIQUES models (see Chapter 3). The number of patterns found by the sequence miner makes almost impossible to map all patterns and/or run any classifier on the augmented target table (see chapters 3 and 4 of this thesis). We run some experiments with lower support values and we had to wait several weeks to learn a classification model in a single dataset fold. Moreover, the number of patterns comes at high memory and run-time costs as we can see in Table D.1 and Table D.2 (see Appendix D). In these tables we do not present information about the discriminative filter, the one that removes matching patterns and is implemented with a simple matching operation that keeps non-agreeing patterns. We do so because the peak memory usage and run-times of this operation can be several orders of magnitude smaller than the other operations. This is especially clear when we run the sequence miner with low support values. The effectiveness of the discriminative filter can be apparent in datasets where we get many agreeing patterns. Also, we think that the obtained patterns require the analysis of domain technicians. We are not specialists in hepatitis or protein fold structure but we obtained some sequence patterns that, we hope, can be useful to unveil the mechanisms of disease progression or protein structure. 5.4 Conclusions In this work we presented MuSer, a framework that explores temporal information stored in multi-relational databases. The main contribution of the proposed system is a method that explores temporal patterns presented in relational data without losing valuable relational information, the ordering of the events. Based on the excellent results of other algorithms that use the propositionalization technique, the architecture of our algorithm consists of four steps. After a pre-processing phase, where we convert the temporal information available in the relational database into a database of sequences, in the first phase, we find all sequence patterns using the efficient PrefixSpan algorithm. Then, in a second phase, considering the huge number of uninteresting and irrelevant patterns we introduce two filters. The discriminative filter that prunes agreeing patterns and a chi-square filter that sorts patterns using the chi-square statistic. Next we map the most interesting patterns into the relational target table. This way we obtain an enlarged target. In the last phase, we induce a decision tree model by taking the augmented table as input to C4.5 algorithm. We experimentally evaluate the MuSer framework using four datasets and defining a 94
5.4. CONCLUSIONS large set of configurations. Our experiments show that the learned models are highly accurate and readable. Moreover, when we compare the results of MuSer against the baseline algorithm, the RUSE-WARMR algorithm presented in Chapter 4, we get significant better results. Remember that RUSE-WARMR aggregates temporal information, i.e., do not explore the temporal information conveniently. Moreover, in the hepatitis subtype problem we get the best results we can find in the literature. In the Protein dataset we are aware of better results but we beat the work of Kersting [KRR06]. This is an important work that was a reference during a set of years. These results are even more impressive as we do not use all the information available in the dataset and do not include expert knowledge. The algorithm has some limitations related to the huge number of sequential patterns found and the inclusion of domain knowledge in the learning process. In the next chapter we introduce strategies to constrain the search space, eliminate expensive filtering operations and find a constrained set of sequence patterns. 95
Chapter 6 Discriminative Sequence Miner in Multi-Relational Learning In this chapter we explore a set of methodologies to learn first-order logic (FOL) theories from multi-relational databases. We present a framework that uses a propositional predictive sequence miner that finds a constrained set of sequences and uses an ILP based algorithm to learn a classification model. With this architecture we can learn theories that can include spatial and both frequent and infrequent temporal data. Moreover, we reduce the need of heavy feature selection strategies and use predicate invention technique to include the findings of the sequence miner in the ILP learning task. 6.1 Introduction In this work we start from the hypothesis that evolving data may hold relevant information that can be valuable if combined with non-temporal information registered in other relations. The problem we address here is how best to explore such information? Here in this chapter we introduce the XMuSer (eXtended MUlti-relational SEquential patteRn knowledge learning) framework that allows us to explore multi-relational datasets that record different types of data. With this architecture we extend MuSer (see Chapter 5) to explore also non-temporal and infrequent data. On the one hand, we can benefit from computationally efficient propositional sequential miners such as cSpade [Zak00] to find the predictive sequence patterns without using complex filtering strategies. On the other hand, we still have access to the original data (static 97
CHAPTER 6. DISCRIMINATIVE SEQUENCE MINER IN MULTI-RELATIONAL LEARNING or dynamic) and can take advantage of the flexibility of Inductive Logic Programming (ILP) to learn in an extended multi-relational database. Indeed, we argue that the first step provides a good insight into the search space, and may enable XMuSer to perform better than classical ILP based algorithms in large search spaces. We should observe that the sequence miner and the ILP learning algorithm are decoupled and we can explore subsets of sequential patterns. For instance we can run other sequential miners such as: PrefixSpan [PHMA+01], that finds all frequent patterns, CloSpan [YHA03], that finds closed sequential patterns, or SPIRIT [GRS02], that constrains the search space using regular expressions. Or we can introduce post-processing strategies to select a subset of valuable patterns. The framework that we present here executes in five steps. First, we encode the multirelational temporal data into a sequence database. In this new database each example is a heterogeneous sequence that was built regarding both intra-table and inter-table relations within the temporal data. In the second phase, we use a sequence miner to find frequent and class predictive sequences available in the sequence database. By class predictive we mean sequential patterns that are frequent in at least one class partition. In the third phase we use the chi-square statistic to sort all sequential patterns. In the fourth phase we map back the top-kmost interesting sequential patterns by building a new relation, the Sequence Relation, where each example is characterized by the presence or absence of each pattern. In the last phase, we apply an ILP algorithm to learn a theory from the enlarged database, i.e., from the union of the original multi-relational database with the Sequence Relation. Our system is experimentally evaluated using the four datasets presented in Appendix B: the Hepatitis dataset, the two versions of the Financial dataset and the Protein Dataset. We evaluate the effectiveness of our methodology by measuring the generalization accuracy of the generated classification models. Moreover, we use the well-known Aleph [Sri03] ILP system as a baseline in our comparison. The results prove the benefits of using XMuSer’s sequential patterns and non-temporal data. The contributions of this work are therefore: •We explore heterogeneous sources of temporal data, either sequence data or time-series data, using a propositional predictive sequence miner. By using this strategy we eliminate expensive filtering operations. •XMuSer can learn theories that include both temporal, non-temporal, frequent and infrequent data. 98
6.2. PRELIMINARIES In Section 6.2 we introduce some concepts that will be very useful in the next sections. In Section 6.3 we present a detailed description of the XMuSer framework using an illustrative example to clarify each step. Next, in Section 6.4, we present and discuss the obtained results. At the end of the chapter we conclude and present other research lines. 6.2 Preliminaries One of the main contributions of the XMuSer system is to explore frequent sequence mining, an efficient and direct method to learn temporal patterns in the form of sequences. More precisely, to explore sequence patterns that are frequent in at least one class partition. When searching for all sequential patterns in a sequence database we face one of the major problems of sequential miners, the huge number of redundant and noninteresting findings. To alleviate this issue we can run sequence miners to find a constrained set of sequential patterns. As pointed out in Chapter 2, there are two important and valuable types of sequences that can be found among the set of frequent sequences: the closed and the maximal sequences. To find such patterns we can use a wide set of strategies. One strategy is to develop specialized algorithms that find a specific type of pattern, for instance CloSpan [YHA03] can find closed sequential patterns. The other way is to use a post-processing strategy to select a constrained subset of patterns among all frequent patterns. For instance, to find the set of closed sequential patterns we can use the following naive strategy: •Find all frequent sequences. •Sort descending all sequential patterns according to each one support value and, as a second criterion, sort using the length of each pattern. •Top-down searches the sorted set of sequential patterns and, for each sequential pattern, eliminate all subsequences having equal support value. The remaining patterns are the set of closed sequential patterns. To find all maximal sequential patterns we can use the following naive strategy: 99
CHAPTER 6. DISCRIMINATIVE SEQUENCE MINER IN MULTI-RELATIONAL LEARNING Using this procedure we get a new table, the sequence relation, that represents the most interesting temporal data available in the multi-relational database. 6.3.5 Learning a Theory - Phase 4 In this last step we learn a theory. We take all the primitive tables and the new sequence relation as input to an ILP algorithm, such as Aleph, and learn a set of FOL clauses. These clauses can therefore use the primitive tables and the new one, that encodes the temporal information. I.e., the ILP learner can use temporal, nontemporal, frequent or infrequent data. This is a major difference from what we have done in the MuSer framework. In that work we only learn classification models that use static attributes of the entities and temporal patterns. To learn a theory using the illustrative example as input to the Aleph algorithm, we can define the following language bias: patient_info(+id,+sex,+bornDate,+class). blood_analysis(+id,-date,#binValues,#binValues). urinalysis(+id,-date,#examName,#binValues). sequence_relation(+id,#a,#a,#a). sequence_relation(+id,#a,-a,-a). sequence_relation(+id,-a,#a,-a). sequence_relation(+id,-a,-a,#a). binValues(low). binValues(normal). binValues(high). examName(alb). examName(plt). examName(ttp). a(true). a(false). Here +,-,# specify input, output and constant modes. An example of a clause we can find with this hypothesis language is: patient_info(A,B,C,c):- blood_analysis(A,D,high,normal), urinalysis(A,E,plt,high), sequence_relation(A,true,F,G). This clause has the predicate patient info at the head, and a call to the predicates blood analysis,urinalysis and sequence relation in the clause body. This clause explains (or covers) patient number one in the database, a patient from class c. 106
6.4. EXPERIMENTAL EVALUATION 6.4 Experimental evaluation In this section we describe the configurations and results of our experimental evaluation. First, we describe the configurations of the experiments. Then, we present the results we obtain when we run a set of instances of the XMuSer framework. At the end of this section we discuss the obtained results. 6.4.1 Configuration of the Experiments When defining the experimental configuration to evaluate our framework we were constrained by the representational complexity and the amount of data. We use the YAP Prolog compiler [CRD12] to implement three tasks: converting the temporal data presented in the multi-relational database into a sequence database, that can be fed to the cSPADE algorithm; map the most interesting sequential patterns on the sequence relation; and run the Aleph algorithm. Moreover, we run the cSPADE algorithm to find frequent sequences available in the sequence database and use the Aleph algorithm to learn a classification theory. Using these tools, we define two configurations of the input parameters and run XMuSer to solve three classification problems: the hepatitis subtype, prediction of successful loans (the financial problem) and protein fold recognition. These three problems are available in four datasets described in Appendix B. We test two different sequence miner support values (the λparameter): 90% and 80%. Using these minimum support values we found all patterns available in the Hepatitis and Protein datasets. In the experiments we run in the Financial datasets (original and balanced versions) we had to limit the size of the sequence patterns to four, otherwise we would be unable to complete the experiments. In the fourth phase we map the ten most interesting patterns (k= 10). For comparison purposes we also run the standalone Aleph algorithm to solve each one of the three problems. Furthermore, besides presenting XMuSer results using all sequential patterns found by cSPADE, we present results using two subsets of sequential patterns, the closed set and the maximal subset. The closed and maximal sequences are obtained using a post-processing strategy and the naive strategy described in Section 6.2. Therefore, we run three instances of XMuSer: Frequent, Closed and Maximal. We evaluate our framework using a stratified ten-fold cross-validation procedure and compute: the mean number of patterns found after each step of XMuSer; the mean, 107
CHAPTER 6. DISCRIMINATIVE SEQUENCE MINER IN MULTI-RELATIONAL LEARNING and the standard deviation, generalization accuracy of the learned models; the mean time spent and the maximum memory usage to complete each step of XMuSer. Moreover, we compute the mean number of rules learned by the Aleph algorithm, both as a component of XMuSer and as a stand-alone algorithm. In the multi-class problem available in the Protein dataset we use the round-robin strategy presented in Section 2.5.3.3. Concerning the generalization accuracy, we also compute the Wilcoxon hypothesis test p-value to measure how significantly our algorithm differs from the reference algorithm, the stand-alone Aleph algorithm. We set Wilcoxon significance level to 0.05. Concerning the comparison, we use the same background knowledge and bias when running the Aleph algorithm, either using Aleph as a component of the XMuSer framework or by running it as stand-alone reference algorithm. The major difference is that when running Aleph as a component of XMuSer we allow extra refinements by introducing the sequence relation. As our goal is to evaluate the contribution of our novel technique, we do not search for the best overall results but only want to prove that by using our methodology we can explore efficiently and effectively temporal information stored in multi-relational databases and yet obtain accuracy gains. Thus, we run Aleph algorithm using a relatively simple bias, relying on the predefined tables in the database. 6.4.2 Results In this section we present the results that we obtained when running XMuSer and the stand-alone Aleph algorithm in the four datasets: Hepatitis, the two versions of the Financial and the Protein. In Table 6.5 we present the mean number of patterns found in each step of XMuSer. We present the mean number of sequential patterns found by the cSpade sequence miner and the number of rules that were learned by the Aleph algorithm, both as a standalone algorithm or as the final step of the XMuSer framework. As we run cSPADE and the two naive strategies introduced in Section 6.2 to find frequent, closed and maximal patterns, we report the number of frequent, closed and maximal sequential patterns found. In Table 6.6 we present the mean generalization accuracy (and the standard deviation) of the XMuSer algorithm. Moreover, we present the p-value of the Wilcoxon test that we obtained when we compare the generalization accuracy of each XMuSer instance against the baseline, the stand-alone Aleph algorithm. We 108
6.4. EXPERIMENTAL EVALUATION Table 6.5: Number of patterns found in each step of the XMuSer framework Sequence Miner: cSpade Theory Learning: Aleph Datasets Support Frequent Closed Maximal Frequent Closed Maximal Hepatitis 0.9 8.4 ( 4.4 ) 8.4 ( 4.4 ) 5.7 ( 3.8 ) 174.0 ( 5.9 ) 174.0 ( 5.9 ) 174.4 ( 6.3 ) 0.8 1055.0 ( 211.2 ) 729.1 ( 131.4 ) 254.4 ( 33.6 ) 140.2 ( 7.6 ) 139.9 ( 8.0 ) 137.0 ( 7.5 ) Aleph – – – 182.9 ( 1.3 ) Financial 0.9 45720.6 ( 2431.2 ) 6141.4 ( 497.8 ) 1846.4 ( 126.6 ) 35.7 ( 2.0 ) 35.7 ( 2.0 ) 26.9 ( 1.6 ) 0.8 96759.2 ( 4448.2 ) 14379.4 ( 607.6 ) 2902.2 ( 157.5 ) 35.7 ( 2.0 ) 35.7 ( 2.0 ) 26.1 ( 1.9 ) Aleph – – – 35.7 ( 2.0 ) FinancialB 0.9 63356.1 ( 6145.9 ) 5092.4 ( 313.4 ) 2214.0 ( 90.9 ) 24.6 ( 1.6 ) 24.6 ( 1.6 ) 19.9 ( 1.7 ) 0.8 130709.4 ( 5313.6 ) 10851.2 ( 465.8 ) 3062.4 ( 163.7 ) 24.6 ( 1.6 ) 24.6 ( 1.6 ) 13.8 ( 5.5 ) Aleph – – – 24.6 ( 1.6 ) Protein 0.9 1463.4 ( 68.5 ) 1341.0 ( 68.4 ) 301.4 ( 21.6 ) 184.3 ( 22.2 ) 231.7 ( 21.1 ) 196.0 ( 21.3 ) 0.8 15283.6 ( 18741.7 ) 13577.3 ( 16087.4 ) 1985.2 ( 1536.5 ) 104.5 ( 72.7 ) 146.1 ( 91.5 ) 119.5 ( 78.0 ) Aleph – – – 306.1 ( 5.322987 ) 109
CHAPTER 6. DISCRIMINATIVE SEQUENCE MINER IN MULTI-RELATIONAL LEARNING Table 6.6: Generalization accuracy of the XMuSer framework Accuracy and Wilcoxon p-value of the XMuSer Datasets Support Frequent p-Value Closed p-Value Maximal p-Value Hepatitis 0.9 60.71 ( 2.25 ) 0.065 60.71 ( 2.25 ) 0.065 60.32 ( 2.55 ) 0.065 0.8 65.31 ( 5.65 ) 0.108 65.12 ( 6.00 ) 0.108 65.12 ( 5.86 ) 0.108 Aleph 58.88 ( 1.07 ) Financial 0.9 79.15 ( 6.43 ) 1 79.15 ( 6.43 ) 1 80.80 ( 5.64 ) 0.539 0.8 79.15 ( 6.43 ) 1 79.15 ( 6.43 ) 1 80.42 ( 7.07 ) 0.674 Aleph 79.15 ( 6.43 ) FinancialB 0.9 58.06 ( 14.46 ) 1 58.06 ( 14.46 ) 1 65.56 ( 9.04 ) 0.233 0.8 58.06 ( 14.46 ) 1 58.06 ( 14.46 ) 1 59.17 ( 16.87 ) 0.639 Aleph 58.06 ( 14.46 ) Protein 0.9 66.82 ( 4.54 ) 0 73.01 ( 3.64 ) 0 73.78 ( 3.36 ) 0 0.8 70.81 ( 19.30 ) 0.015 75.25 ( 16.04 ) 0.002 75.46 ( 21.77 ) 0.002 Aleph 50.79 ( 3.37 ) show three columns heading p-value, one for each type of pattern: frequent, closed and maximal. Furthermore, in all experiments we use the same bias when running Aleph algorithm both as a component of XMuSer or as a stand-alone algorithm. The only difference is that the Aleph component of the XMuSer can also use the sequence relation to learn clauses. In Appendix E, we present the run-time (Table E.2) and the peak memory usage (Table E.1) needed by the sequence miner, to map patterns and to learn a classification theory. We present the mean run-time needed by cSPADE sequence miner to find frequent sequences and do not present the time required by the naive strategy to find the closed and maximal subsets of patterns. We do this because the run-time of these post-processing strategies is negligible when compared with the run-time of the sequence miner. In all tables we also present the results that we obtained when we run the stand-alone Aleph algorithm. In Table E.3 (Appendix E) we present the results that we obtain if we run a propositional classifier in the last step of the XMuSer framework. We present results for two propositional algorithms, the C4.5 and the linear kernel SVM. Moreover we present results for k= 10 and k= 20.In Table E.4 we present the size of the decision trees learned with the C4.5 algorithm. 110
6.4. EXPERIMENTAL EVALUATION 6.4.3 Analysis of the Results We present results only for two λvalues, 90% and 80%. For lambda values slightly larger than 90% we do not observe any significant change in comparison against the 90% value. Regarding the values lower than 80%. First, we are limited by the available computational power and time. With the current resources, if we set lambda parameter to values lower than 80% we are unable to run XMuSer to solve all problems. Second, in the datasets that we were able to run XMuSer we do not identify significant changes in the results. If we map a larger set of patterns, k > 10,we get small and non significant improvements over the results reported (k= 10). Nevertheless, the development of the XMuSer allows us to generate classification models for the Financial problem, either using the original or the balanced Financial dataset. Remember (Section 5 of Chapter 5.3) that we were unable to explore the Financial datasets using MuSer with the original PrefixSpan algorithm. First, the sequence miner that we use in XMuSer allow us to constrain the size of the sequence patterns we can find. Here we limit the size of patterns found in the Financial dataset to four itemsets. Second, with the modifications that we introduce in the sequence miner we eliminate the need to use the two filters introduced in MuSer (see Chapter 5 and [FGC10, FGC11]). The chi-square filter used in MuSer requires that we map all the patterns found by the sequence miner. This is a highly expensive operation but that is needed to select class correlated patterns. Here, in XMuSer, the chi-square statistic is embedded in the sequence miner, the cSpade algorithm, and each pattern found is associated with the class support and the chi-square statistic value. As we can see in tables E.2 and E.1,the mapping operation in XMuSer requires less memory and less time to complete. For comparison purposes the reader should consider only the results with k= 10,the same number of patterns that we map in XMuSer. Moreover, we can see that the amount of peak memory usage needed by cSpade (component of the XmuSer framework) is larger than the one needed by PrefixSpan (component of the MuSer framework). cSpade takes the full dataset as input and PrefixSpan takes only one partition at a time. Furthermore, the run-time needed by PrefixSpan is slightly larger than the run-time needed by cSpade. This was expected as PrefixSpan explores a partition at a time and finds a large number of patterns. As expected, XMuSer execution time is greater than the stand-alone Aleph algorithm. The execution time heavily depends on the input parameter λ. If we run XMuSer by setting λinput parameter to low values we get a huge number of sequential patterns and thus we get a run-time overhead. This is a typical behavior of sequence miners, 111
CHAPTER 6. DISCRIMINATIVE SEQUENCE MINER IN MULTI-RELATIONAL LEARNING the lower the support the higher the execution time and the higher the number of patterns found. Regarding the post-processing strategies that we used to select the closed and maximal sequential patterns, we can say that the time needed to select the maximal sequential patterns is higher than the time needed to select the closed sequential patterns. This is especially clear when we run the sequence miner with 0.8 low support values. Furthermore, if we analyze theoretically the run-time of the last step of XMuSer, we can say that by adding the sequence relation to the search bias we will have to explore a 2klarger search space, where kis the number of patterns/attributes in the sequential relation. In our experiments, when we compare the mean run-time of the last step of our framework against the stand-alone Aleph algorithm we can see that the time spent by the last component of our framework is almost the same as the run-time of the stand-alone Aleph algorithm. This means, that if we stay on low kvalues we can effectively and efficiently explore valuable temporal data with our framework. Regarding the generalization accuracy of the learned models, we can say that in all classification problems we address, XMuSer obtained better results than the baseline, the stand-alone Aleph algorithm. The best accuracy gains were obtained in the hepatitis subtype and in the protein fold classification problems. In the protein problem we get significant wins for all parameters and type of patterns we found. Moreover, the best results were obtained when we map the most interesting closed or maximal patterns. If we compare the obtained results with the ones presented in Chapter 5, we can see that MuSer generates higher accurate results than XMuSer. This is especially clear when we analyze the results obtained in hepatitis subtype problem. At first sight, we can explain this generalization ability difference by the usage of a ILP based classifier in the last step of XMuSer. But this is not true. If we replace the ILP algorithm used in the last step of XMuSer by a propositional algorithm we continue to get worst results than the ones obtained by the MuSer framework. In Table E.3 we present results when we run the C4.5 or the linear kernel SVM propositional algorithms in the last step of XMuSer. Moreover, by using ILP algorithms we can easily introduce expert knowledge [Dom12] in the learning task and get potentially high accurate models. The obtained results show the contribution of the strategy introduced in MuSer to find the sequence patterns. In MuSer we take each partition as input and find a larger number of patterns than when we run cSpade sequence miner. This is clear when we 112
6.5. CONCLUSIONS AND FUTURE WORK analyze tables 5.4 and 6.5 that present the number of patterns found by PrefixSpan and cSpade. The dual strategy of MuSer finds a large number and high interesting patterns. If we observe the complexity of the theories learned by MuSer, last column of Table 5.4, and the propositional XmuSer (replacing the ILP learner by a c4.5 or SVM learner), Table E.4, we can see that MuSer generates models with lower complexity. These remarks show that we should modify XMuSer to use the dual strategy and use the support value in each partition to reduce the mapping requirements. Without this modification and without expert knowledge to include in the learning process, we hardly obtain significant gains over the results that we report for the MuSer framework (see Table 5.5 in Chapter 5). A final remark concerns the time and memory needed to learn a FOL theory. If we compare the memory and run-time usage of the XMuSer framework presented in tables E.1 and E.2 with the results presented in tables D.1 and D.2 (see Chapter 5) we can see that ILP algorithms require a larger amount of time and memory than the propositional ones. This performance issues show that it is always a good thing to try propositional learners, especially if you do not have valuable expert knowledge to include in the ILP learning task [Dom12]. Overall, we can say that finding other types (frequent, closed or maximal) of sequence patterns and the usage of infrequent and non-temporal data in the learning process are ideas that have potential to improve a classifier. Moreover, the number of patterns found using the dual strategy of the MuSer framewrok (see Chapter 5) also proved to be valuable. Therefore, we should develop new algorithms and frameworks that find highly interesting and expressive sequence patterns and include temporal, nontemporal, frequent or infrequent data in the learning process. 6.5 Conclusions and Future Work In this chapter we have presented XMuSer a new multi-relational framework that explores temporal and non-temporal information stored in a database. With this architecture we can include information of frequent and infrequent patterns in the classification model. The XMuSer architecture is an effective alternative to previous ILP approaches that incorporate temporal data in the final first-order theory by either using time aggregation strategies [DT99], like time window aggregation, or by only refining ILP clauses or predicates that explicitly explores time. Differently from these approaches, our methodology, grounded in sequence data representation and in the 113
CHAPTER 6. DISCRIMINATIVE SEQUENCE MINER IN MULTI-RELATIONAL LEARNING strengths of predictive sequential miners, explores efficiently and with time abstraction any kind of temporal data. Our approach is general and can be used in conjunction with any classical ILP algorithm. To design our five step architecture we introduced some new methodologies. We use sequence encoding, a technique to encode the temporal data available in the original database into a sequence database (see Section 5.2.1). Regarding the number of findings of the sequential miner and the need to obtain class correlated sequential patterns among these findings, we introduce a filter that selects the top class related sequential patterns. We use the chi-square statistical to sort the sequential patterns and map the top most interesting ones. Given that these sequential patterns encode interesting temporal data we create a technique to incorporate this information in the final FOL theory. We define the sequential relation, a relation that encodes the time information of each example, the sequential patterns found by the sequential miner. Last, we define the enlarged database, a database that is the union of the original database and the sequence relation, and induce a first-order theory on the enlarged database. The experimental evaluation presented in this chapter shows that XMuSer can find sequence patterns that have strong impact in the classification performance. If available, XMuSer can include valuable expert knowledge in the learning process. This capability is beyond the MuSer (presented in Chapter 5) capabilities. The experiments show that learners are highly sensible to the type (either frequent, closed or maximal) of sequences. In this study we found that we can obtain high accurate models when we map the closed or maximal patterns. Moreover, if we compare these results with the ones obtained with MuSer (see Chapter 5), we can see that MuSer can find highly discriminative patterns by mining each class partition individually. In the next chapter we introduce algorithms and methods that search for highly discriminative temporal patterns. We discard the use and development of propositional techniques and will explore FOL temporal representation formalisms. 114
Chapter 7 Contrasting Logical Sequences in Multi-Relational Learning In this chapter we study first-order logic (FOL) sequence miners and introduce the BeamSouL FOL sequence miner to find contrasting logical sequences. Unlike the work presented in the previous chapters, this algorithm explores directly the logic relational information available in a multi-relational database. Moreover, the algorithm includes a beam search strategy that can find long logical sequences. Furthermore, we develop a first-order classification framework, the ConFOLding, to evaluate the discriminative power of the long patterns found by the BeamSouL algorithm. This architecture uses a predicate invention technique to include the most interesting contrasting patterns in the ILP learning phase. 7.1 Introduction Finding FOL temporal patterns in temporal databases is an important challenge in domains as diverse as video processing, computational biology, elderly monitoring. One of the main issues is the difficulty in finding long and low support discriminative sequential patterns. This problem has been initially identified in the propositional setting [Bay98] and efficient algorithms have been proposed [Zak00, DZ09]. A major issue with these algorithms is that they are unable to explore multi-relational temporal data without losing valuable logico-relational information [FGC08, FGC10, FGC12b]. In the last decade a few special purpose algorithms have been proposed to find sequence patterns in multi-relational temporal databases [LR04, EMBF09, FGC12b]. Using 115
CHAPTER 7. CONTRASTING LOGICAL SEQUENCES IN MULTI-RELATIONAL LEARNING Table 7.1: Relational database used to clarify some details of the BeamSouL algorithm and of the ConFOLding framework Patient Label (Target Table) Id Class 1c 2c 3c 4b 5b Blood Analysis Id Date RBC WBC 1 19720102 high normal 1 19780203 high high 2 19770107 normal low 3 19810107 high low 3 19830210 high normal 4 19810107 high low 5 19810421 low normal 5 19831017 low low Urinalysis Id Date Exam Value 1 19741201 plt low 1 19760204 alb high 2 19800403 plt low 2 19810301 alb high 3 19831102 plt normal 4 19820404 alb normal 4 19831211 plt low 5 19841104 plt low SexBornDate Id Sex BornDate 1 m 19520109 2 m 19660301 3 f 19680424 4 m 19750123 5 f 19760213 7.2.3 Illustrative Example To clarify some details of the BeamSouL algorithm and each step of the ConFOLding architecture we use the database presented in Table 7.1. This example database is a modified version of the illustrative database used in the previous chapters. Here we split the Patient Info table (see Table 5.1 in Chapter 5) into two new tables: table Patient Label registers only the ID and the class label of each patient and table SexBornDate that registers the sex and the date of birth, of each patient. Moreover, here we add three more patients and remove some non-useful parameters. Consider that we run the ConFOLding system to learn a classification model in the database presented in Table 7.1. Moreover, consider that we set the ConFOLding parameters λpos = 60%, λneg = 40% and m= 5. 122
7.2. THE BEAMSOUL ALGORITHM Consider also that in a pre-processing phase we translate all information in the relational database into a set of Prolog facts. For instance, all information available about patient number one is translated into: patient_label(1, c). sexBornDate(1, m, 19520109). blood_analysis(1, 19720102, high, normal). urinalysis(1, 19741201, plt, low). urinalysis(1, 19760204, alb, high). blood_analysis(1, 19780203, high, high). Moreover, consider that the sequence of examinations made by patient one is translated into the SeqLog sequence: q=blood analysis(1,19720102, high, normal)✄urinalysis(1,19741201, plt, low)✄ urinalysis(1,19760204, alb, high)✄blood analysis(1,19780203, high, high) Now that we have defined the input and the parameters of the ConFOLding system, we run the BeamSouL algorithm to find a set of contrasting patterns. First (line 2 of Algorithm 9), the BeamSouL algorithm finds all contrasting patterns having at least λpos = 60% of support in the majority class partition (Dpos) and having a support value small than λneg = 40% in the minority class partition (Dneg). Here the Dpos class partition is the partition containing patients having hepatitis subtype c, the majority class, and the Dneg class partition is the partition containing patients having hepatitis subtype b. Among the set of patterns (fspos patt) found in this step, we get pattern s=blood analysis(A, B, high, C)✄blood analysis(A, D, high, E) that has approximately 66% of support in the hepatitis subtype cclass partition and 0% support in the hepatitis subtype bclass partition. This means that this pattern is a subsequence of the SeqLog sequence of patients number one and number three (check that sq), that are both in csubtype class partition. In other words, this means that both patient one and three have two consecutive blood analysis examinations with high RBC values. Moreover, the confidence value of this pattern is Confpos=c= 2/2. This means that pattern sis a sequence of two examples in subtype cpartition and of no other example in the full dataset. Second (line 3 of Algorithm 9), we exchange the roles of the two database partitions and find patterns that are frequent in the Dneg partition and infrequent in the Dpos 123
CHAPTER 7. CONTRASTING LOGICAL SEQUENCES IN MULTI-RELATIONAL LEARNING partition (the fsneg patt set). Among the patterns found in this step we get the sequence l=blood analysis(A, B, C, low)✄urinalysis(A, D, plt, low) that has 100% support in the hepatitis subtype bclass partition (Dneg) and approximately 33% of support in the hepatitis subtype cclass partition (Dpos). This means that all patients with hepatitis subtype bhave this sequence of examinations and only one patient with hepatitis subtype c, the patient number two, has this sequence of results. The support of this pattern says that patients number two, four and five had a blood analysis test where a low WBC level is observed and, after some time, these same patients made a urine test and get low plt levels. Moreover, the confidence of this pattern is Confb= 2/3.This means that sequence lis a subsequence of two examples in the subtype bclass partition and is a subsequence of three examples in the full dataset. Next (in line 5), we sort the set of patterns fspos patt and fsneg patt using the confidence level of each pattern. In this illustrative example we consider that patterns sand labove were ranked in the top-5 (remember that the ConFOLding parameter mwas set to 5) positions of each set of patterns and that we find at least five contrasting patterns in each run. For instance, pattern shas the higher confidence value in the fspos patt and pattern lhas the third best confidence level in the pattern set fsneg patt.Overall, consider that pattern sis ranked in position two and pattern lis ranked in position eight. Then, we check if patterns sor lsubsume all the SeqLog sequences available in the Prolog database (see Section 2.6.2.2 of Chapter 2). For instance, if we consider sequence qabove, that describes the examinations made by patient number one, we add ten new logical facts that describe patient number one. We add two logical facts for sequences sand land eight other facts for each one of the other eight sequences. As sequence ssubsumes sequence q(sq) we add the Prolog fact logSeqMap(1,2, true) to the Prolog database. As sequence ldoes not subsume sequence qwe add the Prolog fact logSeqMap(1,8, false) to the Prolog database. Thus, after this step the Prolog database contains the following description of patient number one: patient_label(1, c). sexBornDate(1, m, 19520109). blood_analysis(1, 19720102, high, normal). urinalysis(1, 19741201, plt, low). urinalysis(1, 19760204, alb, high). blood_analysis(1, 19780203, high, high). 124
7.3. EXPERIMENTAL EVALUATION logSeqMap(1, 2, true). logSeqMap(1, 8, false). After applying this procedure to all 10 top patterns we get an enlarged database that includes the original database and new facts encoding temporal information. Last, we run an ILP algorithm, such as Aleph, to learn a set of clauses. One illustrative example of a clause we can find is: patient_label(A,c):- sexBornDate(A,m,B), urinalysis(A,C,alb,high), logSeqMap(A,2,true) This clause covers patients number one and number two in the hepatitis subtype c class partition and covers no patient in the hepatitis subtype bclass partition. It is important to note that in this case we allow a limited number of clause refinements with original predicates that record temporal information and that were explored by the BeamSouL algorithm. We do so to include low confidence and infrequent facts in the rule set. 7.3 Experimental Evaluation In this section we evaluate empirically the BeamSouL algorithm and the ConFOLding frameworks. First we present the experimental setup that we use in the experiments. Then we present and discuss the results that we obtained. 7.3.1 Configuration of the Experiments We evaluate the BeamSouL algorithm and the ConFOLding framework using the four datasets presented in Appendix B. Like in the previous chapters, all algorithms are evaluated using a ten-fold stratified cross-validation procedure. In the Hepatitis and the Financial datasets we define the positive partition to be the majority class. In the protein fold classification task we run a double round robin approach (see Section 2.5.3.3 of Chapter 2). 125
CHAPTER 7. CONTRASTING LOGICAL SEQUENCES IN MULTI-RELATIONAL LEARNING Using these procedures we compute: the number of frequent, closed and maximal patterns, the peak memory usage and the run-time of the BeamSouL algorithm. Regarding the classification framework, we analyze the peak memory usage and the time needed to learn an ILP theory and compute the generalization accuracy. Moreover, as the classification framework runs the BeamSouL algorithm two times to find contrasting patterns in the two partitions, we present the mean and the standard deviation of the number of patterns found and the mean run-time in the two runs. For comparison purposes, we also evaluate the MineSeqLog algorithm [LR04]. Remember that, if we set the beam size equal to zero, the BeamSouL algorithm finds the same patterns as the MineSeqLog algorithm. Like other combinatorial algorithms, the number of patterns found in the exhaustive mode of the BeamSouL algorithm grows exponentially with the maximum refinement level (the BeamSouL lch parameter). Thus, we run BeamSouL in exhaustive search mode to find the maximum refinement level that can give results in an acceptable runtime and without exceeding the maximum memory available in our computer. We run these experiments with the maximum refinement level ranging from zero to five. We test this range of refinement levels to check both the limits of the BeamSouL algorithm and of the baseline. In Figure 7.1 we plot the number of frequent, closed and maximal patterns found by the BeamSouL algorithm and in Figure 7.2 we present the run-time needed by the BeamSouL and the MineSeqLog algorithms to find the complete set of contrasting patterns available in the majority partition of the Hepatitis dataset (the positive-run of the ConFOLding architecture). In this particular experiment we set the ConFOLding parameters λpos = 0.4 and λneg = 0.3.In Appendix F, Figure F.1 presents the run-time needed to find the complete set of patterns in the minority partition of the Hepatitis dataset (the negative-run of the ConFOLding architecture). These figures show the typical behavior of sequence miners. We can see that the number of patterns grows exponential and that for refinement levels higher than four it can be impossible to run the baseline in acceptable run-times. Regarding the peak memory usage, if we run both algorithms in exhaustive mode, the two require almost the same amount of memory. For the maximum refinement level that we evaluate both algorithms we get a peak memory usage of approximately 11 gigabytes of ram memory. As we have a machine with 100 gigabytes the run-time is our major constraint. As a result of these experiments and to present a fair comparison, we decide to set the maximum level of exhaustive search equal to four (lch = 4) for all the experiments. That is to say that we run the BeamSouL algorithm in exhaustive mode until we 126
7.3. EXPERIMENTAL EVALUATION Level of Refinement Number of Patterns 12345 0 200 400 600 800 Frequent Closed Maximal Figure 7.1: Number of patterns found by the BeamSouL algorithm in the majority partition of the Hepatitis dataset. We present the number of frequent, closed and maximal patterns found for a range of maximum refinement levels explore all patterns of level 4. Then, the BeamSouL algorithm enters the heuristic phase and runs until no more frequent patterns are found. In each level, after the fifth level, a fixed number of patterns (the beam size) is refined to generate new candidate patterns. It is important to note that we set the MineSeqLog algorithm to explore the same search space that the BeamSouL algorithm explores in the exhaustive search phase. Concerning the support threshold used to find the frequent, the closed and the maximal patterns, we set the thresholds λpos = 0.8 and λneg = 0.4 for the Financial and Protein datasets. For the Hepatitis dataset we set the thresholds λpos = 0.4 and λneg = 0.3. If we use the same support values that we use either for the Financial and Protein datasets, both the BeamSouL algorithm and the MineSeqLog algorithm fail to find any contrasting patterns. Moreover, we run the BeamSouL algorithm for a range of beam sizes. We evaluate BeamSouL for kequal to 0,5,20,35 and 50. For the classification framework, we set the number of patterns to map equal to ten (m= 10) for all the three tasks. As each run of the classification framework includes two runs of the BeamSouL al- 127
CHAPTER 7. CONTRASTING LOGICAL SEQUENCES IN MULTI-RELATIONAL LEARNING Level of Refinement Total Time (sec) 12345 0 100 200 300 400 500 BeamSouL MineSeqLog Figure 7.2: Run-time needed by the BeamSouL and the MineSeqLog algorithms to find patterns in the majority partition of the Hepatitis dataset. We present the run-time of these algorithms for a range of maximum refinement levels gorithm, we compute and present the number of patterns and the run-time of the BeamSouL algorithm for the two runs. In the first run, the positive-run, we run the BeamSouL algorithm to find patterns having support higher than λpos in the majority class partition and having support value less than λneg in the negative partition. In the second run, the negative-run, we find contrasting patterns having a support value higher than λpos in the minority class partition and a support value less than λneg in the majority class partition. Furthermore, we compute the p-value of the Wilcoxon hypothesis test to evaluate the contribution of the beam search strategy. We set the baseline to be the MineSeqLog algorithm. 7.3.2 Results In Table 7.2 we present the mean and standard deviation of the number of patterns found by the BeamSouL algorithm, both for the positive-run and the negative-run of the ConFOLding framework. For each dataset we present the results that we obtain 128
7.3. EXPERIMENTAL EVALUATION Table 7.2: Number of patterns found in each run of the BeamSouL algorithm Dataset BeamSize Positive-Run Negative-Run Frequent Closed Maximal Frequent Closed Maximal Hepatitis 0 42.3(28.6) 37.6(24.9) 37.6(24.9) 9.5(1.6) 4.5(0.5) 4.5(0.5) 5 46.6(28.5) 38.4(23.9) 35.4(23.8) 13.5(1.6) 3.5(0.5) 1.5(0.5) 20 100.5(51.7) 57.8(32.6) 42(25.7) 13.5(1.6) 3.5(0.5) 1.5(0.5) 35 144.6(86.4) 74.8(44.7) 50.1(31.9) 13.5(1.6) 3.5(0.5) 1.5(0.5) 50 188.6(106.7) 90.1(51.2) 57.4(40.2) 13.5(1.6) 3.5(0.5) 1.5(0.5) MineSeqLog 42.3(28.6) 37.6(24.9) 37.6(24.9) 9.5(1.6) 4.5(0.5) 4.5(0.5) Financial 0 76.8(1.9) 69.8(1.9) 69.8(1.9) 0(0) 0(0) 0(0) 5 93.6(3.0) 76.1(2.9) 67.4(2.5) 0(0) 0(0) 0(0) 20 236.2(30.1) 149.9(22.6) 117.1(15.8) 0(0) 0(0) 0(0) 35 436.7(50.5) 254.7(22.9) 152.5(9.5) 0(0) 0(0) 0(0) 50 614.6(49.0) 337.1(18.2) 208.3(30.1) 0(0) 0(0) 0(0) MineSeqLog 76.8(1.9) 69.8(1.9) 69.8(1.9) 0(0) 0(0) 0(0) FinancialB 0 75.9(1.9) 68.9(1.9) 68.9(1.9) 0.2(0.4) 0.2(0.4) 0.2(0.4) 5 80.2(7.5) 68.9(3.3) 67.6(1.8) 5.3(10.2) 3(7.1) 2.6(6.5) 20 175.6(3.3) 99.5(1.4) 97.6(1.4) 47.2(42.5) 18.2(18.0) 15.6(15.2) 35 310.7(5.7) 182.4(6.9) 176.3(2.8) 71.5(72.4) 23.2(24.9) 20.2(21.3) 50 502.1(24.7) 307.5(19.8) 298(20.3) 86.9(92.1) 29.1(36.3) 24.3(29.7) MineSeqLog 75.9(1.9) 68.9(1.9) 68.9(1.9) 0.2(0.4) 0.2(0.4) 0.2(0.4) Protein 0 0.9(0.2) 0.9(0.2) 0.9(0.2) 11.5(0.4) 10.7(0.4) 10.7(0.4) 5 48.7(2.8) 33.5(2.2) 12.3(2.1) 20.6(0.9) 14.7(0.8) 9.8(0.5) 20 184.4(13.6) 116.7(13.0) 39.9(6.8) 107.0(8.7) 52.8(4.1) 27.8(3.5) 35 345.6(35.6) 210.2(25.0) 74.0(12.0) 173.0(10.8) 82.9(5.0) 45.3(4.4) 50 469.7(23.6) 280.5(15.8) 93.1(8.5) 242.4(15.5) 119.8(5.8) 66.4(5.8) MineSeqLog 0.9(0.2) 0.9(0.2) 0.9(0.2) 11.5(0.4) 10.7(0.4) 10.7(0.4) 129
CHAPTER 7. CONTRASTING LOGICAL SEQUENCES IN MULTI-RELATIONAL LEARNING Table 7.3: Generalization accuracy of the ConFOLding framework Frequent Closed Maximal Dataset BeamSize Gen. Acc. Wilcoxon Gen. Acc. Wilcoxon Gen. Acc. Wilcoxon p-value p-value p-value Hepatitis 0 79.49 ( 7.26 ) 1 79.49 ( 7.26 ) 1 79.26 ( 7.37 ) 1 5 84.13 ( 6.95 ) 0.064 84.13 ( 6.95 ) 0.049 83.93 ( 7.03 ) 0.049 20 84.13 ( 7.31 ) 0.064 84.13 ( 7.31 ) 0.049 84.13 ( 7.31 ) 0.049 35 84.52 ( 7.42 ) 0.064 84.52 ( 7.42 ) 0.049 84.32 ( 7.22 ) 0.049 50 84.32 ( 7.16 ) 0.064 84.52 ( 7.42 ) 0.049 84.52 ( 7.13 ) 0.049 MineSeqLog 79.49 ( 7.26 ) – 79.49 ( 7.26 ) – 79.26 ( 7.37 ) – Financial 0 86.76 ( 1.23 ) 1 86.76 ( 1.23 ) 1 86.76 ( 1.23 ) 1 5 87.17 ( 1.98 ) 1 87.17 ( 1.98 ) 1 87.17 ( 1.98 ) 1 20 87.17 ( 1.98 ) 1 87.17 ( 1.98 ) 1 87.17 ( 1.98 ) 1 35 87.17 ( 1.98 ) 1 87.17 ( 1.98 ) 1 87.17 ( 1.98 ) 1 50 86.76 ( 1.23 ) 1 86.76 ( 1.23 ) 1 86.76 ( 1.23 ) 1 MineSeqLog 86.76 ( 1.23 ) – 86.76 ( 1.23 ) – 86.76 ( 1.23 ) – FinancialB 0 61.81 ( 2.20 ) 1 61.81 ( 2.20 ) 1 61.81 ( 2.20 ) 1 5 61.81 ( 2.20 ) 1 61.81 ( 2.20 ) 1 61.81 ( 2.20 ) 1 20 63.06 ( 4.73 ) 1 61.81 ( 2.20 ) 1 61.81 ( 2.20 ) 1 35 61.81 ( 6.29 ) 1 60.56 ( 4.30 ) 1 60.56 ( 4.30 ) 1 50 61.81 ( 6.29 ) 1 60.56 ( 4.30 ) 1 60.56 ( 4.30 ) 1 MineSeqLog 61.81 ( 2.20 ) – 61.81 ( 2.20 ) – 61.81 ( 2.20 ) – Protein 0 62.24 ( 3.17 ) 1 62.43 ( 2.98 ) 1 62.43 ( 2.98 ) 1 5 67.28 ( 3.57 ) 0.002 65.93 ( 3.53 ) 0.006 69.57 ( 3.56 ) 0.006 20 66.44 ( 2.64 ) 0.018 69.18 ( 3.88 ) 0.006 69.75 ( 3.18 ) 0.009 35 67.99 ( 3.14 ) 0.006 72.64 ( 4.49 ) 0.002 74.41 ( 2.99 ) 0.002 50 69.33 ( 3.95 ) 0.01 73.06 ( 3.14 ) 0.006 75.27 ( 3.49 ) 0.002 MineSeqLog 62.24 ( 3.17 ) – 62.43 ( 2.98 ) – 62.43 ( 2.98 ) – 130
7.3. EXPERIMENTAL EVALUATION by running the BeamSouL algorithm with different beam sizes. The results obtained by running the MineSeqLog algorithm are presented in the table row having the beam size equal to MineSeqLog. In Table 7.3 we present the generalization accuracy that we obtained when running our classification framework to learn a discriminative model in the four datasets. For each dataset we present the mean and standard deviation for the three instances of the framework. Remember that each instance of the classification framework is associated with one type of sequence pattern: Frequent, Closed and Maximal. Again, the results obtained with the MineSeqLog algorithm are presented in the row identified with MineSeqLog text. In these tables we can see that by setting the beam size equal to zero, k= 0,we obtained the same results as if we run the MineSeqLog algorithm. In Table F.2 (Appendix F) we present the run-time needed by the BeamSouL algorithm to find a subset of patterns. We present the run-time spent in the positive-run and negative-run. Moreover, we present the run-time of the ILP-based learner. We present the run-time of the three instances of the framework: Frequent, Closed and maximal. In Table F.1 (Appendix F) we present the peak memory usage for each step of the ConFOLding framework. We present the overall (including the positive-run and the negative-run) memory peak usage of the BeamSouL algorithm, the mapping procedure and the ILP-based learner. Again, we present results for the three instance of the framework and for different beam sizes. Moreover, we present the peak memory usage of the reference sequence miner, the MineSeqLog algorithm. In Table F.3 (Appendix F) we present the size of the theory learned by the Aleph algorithm, the last step of the ConFOLding framework. We present the number of rules learned by each one of the three instances of the framework. In Table F.4 (Appendix F) we present the results that we obtain if we run a propositional classifier in the last step of the ConFOLding framework. We present results for two propositional algorithms, the C4.5 and the linear kernel SVM. Moreover we present results when we map ten (m= 10) and twenty (m= 20) frequent, closed and maximal patterns. In Table F.5 we present the size of the decision trees learned by the C4.5 algorithm. 131