Full text
Graph Convolutional Neural Networks for Open Data Discovery - Bachelor’s Degree Thesis - Zoé Marie Meini June 2021 Advisor: Sergi Nadal - Departament d’Enginyeria de Serveis i Sistemes d’Informació (ESSI) Faculties: Facultat d’Informàtica de Barcelona (FIB) Escola Tècnica Superior d’Enginyeria de Telecomunicació de Barcelona (ETSETB) Facultat de Matemàtiques i Estadística (FME) Universitat Politècnica de Catalunya BarcelonaTech
Acknowledgements First of all, I would like to express my sincere gratitude to my advisor Sergi Nadal, who has guided and helped me throughout the whole realization of this thesis. He has been patient, present and offered me great encouragement whenever I needed it. I also appreciate that he trusted me to carry out a part of the "An Automatic Data Discovery Approach to Enhance Barcelona’s Data Ecosystem" project becausethanksto thisopportunityIhave been able toexpand my knowledge in many ways. I would also like to acknowledge professor Oscar Romero who pointed me towards this project when I asked him about any suggestions for my bachelor’s degree thesis. He has also been present during the development of the thesis coming to several meetings and giving me very good advise. I would like to greet Javier Flores who helped me with the NextiaJD tool very kindly when I required his assistance. I also wish to thank Mariona González and Yasmina Assantuh, two of my dearest friends who helped me with their thoughtful counsels. I could not have done this thesis without the help and the cheering of Roger Creus who has been my biggest support throughout this experience. I am grateful that I had him by my side. This bachelor’s degree has not been an easy road, but I feel very lucky that I met wonderful friends that I hope to keep for the rest of my life. Júlia Sala, Sara Sánchez, Roger Creus, Xavier Rubiés and Dànae Canillas, you have made the path worth the adversity, enjoyable and memorable. Finally, I would like to thank my family who has given me unconditional support and never doubted my capacities to succeed in all the projects I engaged during the degree.
Abstract In this thesis we study the suitability of a graph-based approach for data discovery in the context of Open Data BCN with respect to other traditional Machine Learning (ML) or Deep Learning (DL) methods such as Random Forest or Multi-Layer Perceptron. Data discovery consists on finding semantic relationships between datasets and their attributes (i.e., similar topic, joinable, unionable, etc.) in a massive open data repository. We tackle the dataset similarity task, which we reduce to a classification problem by defining two similar datasets as datasets sharing the same thematic area which we call: class. Exact and hash-based approaches have shown to be ineffective in such large environments, this is why we approach the problem from a learning perspective based on data profiles. We define profiles as representations that capture the underlying characteristics of the schemata and data values of datasets. Relying on profiles diminishes the complexity and enhances the model performances. To this goal, we provide both an efficient tool to extract datasets from the council’s open data website and a Graph Neural Network (GNN) framework leveraging a graph representation of the Barcelona’s repository by representing the datasets as nodes, the node embeddings as profiles and the edges as indicators of two nodes sharing a class. Specifically, we propose to solve a link prediction task using a Graph Convolutional Neural Network (GCNN) and to later map it into a classification task for each of the nodes in the graph. This mapping step is done with a novel function we designed called Class_Selector that uses both the amount of edges involving each of the classes and their corresponding probabilities. Our experiments show that both the baseline methodologies and our GCNN approach are able to learn from the training sets but have difficulties generalizing in the test phase due to the lack of data available in the repository. With respect to the baseline models, our approach obtains lower accuracy results but those could be improved by introducing inductive link prediction emerging solutions which are still under development.
Resum En aquesta tesi estudiem la validesa d’un model basat en grafs per al descobriment de dades en el context d’Open Data BCN, respecte d’altres mètodes tradicionals d’aprenentatdge automàtic o profund com ara el Perceptró Multicapa o els Boscos Aleatoris. El descobriment de dades, conegut com a data discovery, consisteix en trobar relacions semàntiques entre conjunts de dades i els seus atributs en un repositori massiu de dades obertes (com per exemple, temes similars, punts d’unió, punts de "join", etc.). Abordem la tasca de semblança, que reduïm a un problema de classificació definint dos conjunts de dades similars com a conjunts de dades que comparteixen la mateixa àra temàtica que anomenem classe. Els enfocaments basats en comparacions de valors exactes o en funcions de hash resulten ser ineficaços en grans entorns de dades, per això abordem el problema des d’una perspectiva d’aprenentatge basada en perfils de dades. Aquests són representacions que capturen les característiques subjacents dels esquemes i els valors dels conjunts de dades. Basar-se en els perfils disminueix la complexitat i millora el rendiment dels models. Amb aquest objectiu, proporcionem una eina eficient per extreure conjunts de dades del portal de dades obertes de l’ajuntament i una implementació d’una Xarxa Neuronal basada en Grafs (GNN) que es beneficia de representar el repositori de Barcelona en forma de graf. Això s’aconsegueix codificant els conjunts de dades com a nodes, els seus perfils com a informació continguda al node (embedding) i un indicador de si dos conjunts de dades comparteixen classe com a una aresta. Concretament, proposem resoldre una tasca de predicció d’arestes mitjançant una Xarxa Neuronal Convolucional basada en grafs (GCNN). Posteriorment ho transformem a una tasca de classificació per a cadascun dels nodes del graf. Aquesta transformació es realitza amb una nova funció que hem dissenyat anomenada Class_Selector que utilitza tant la quantitat d’arestes relacionant nodes pertanyents a una classe específica, com les probabilitats assignades pel model a aquestes arestes. Els nostres experiments mostren que tant les metodologies bàsiques com el nostre model de GCNN són capaços d’aprendre dels conjunts de’entrenament, però que tenen dificultats per generalitzar en la fase de prova a causa de la manca de dades disponibles al repositori. Pel que fa al rendiment del nostre model, no s’aconsegueixen sobrepassar els resultats dels models més tradicionals. No obstant, el model de GCNN es podria millorar introduint solucions recents de predicció d’arestes inductiuves que encara estan en ple desenvolupament.
Resumen En esta tesis estudiamos la validez de un model basado en grafos para el descubrimiento de datos en el contexto de Open Data BCN con respecto a otros métodos tradicionales de aprendizaje automático o profundo como los Bosques aleatorios o el Perceptrón multicapa. El descubrimiento de datos, conocido como data discovery, consiste en encontrar relaciones semánticas entre los conjuntos de datos y sus atributos en un repositorio masivo de datos abiertos (por ejemplo, temas similares, puntos de unión, puntos de "join", etc.). Abordamos la tarea de similaridad, la cual reducimos a un problema de clasificación al definir dos conjuntos de datos similares como conjuntos de datos que comparten la misma área temática a las que llamamos clase. Los enfoques basados en valores exactos o en funciones de hash se han mostrado ineficaces en entornos tan grandes, por eso abordamos el problema desde una perspectiva de aprendizaje basada en perfiles de datos. Estos se definen como representaciones que capturan las características subyacentes de los esquemas y valores de los conjuntos de datos. Utilizar los perfiles disminuye la complejidad y mejora el rendimiento del modelo. Con este objetivo, proporcionamos una herramienta eficiente para extraer conjuntos de datos del repositorio de datos abiertos del ayuntamiento de barcelona y una implementación de una Red neuronal basada en grafos (GNN) que se beneficia de la representación del repositorio de Barcelona como un grafo. Esto se consigue al codificar los conjuntos de datos como nodos, sus perfiles como información contenida en el nodo (embedding) y un indicador de dos nodos compartiendo clase como una arista. Específicamente, proponemos resolver una tarea de predicción de aristas utilizando una Red neuronal convolucional basada en grafos (GCNN). Esta tarea es posteriormente transformada a una tarea de clasificación para cada uno de los nodos del grafo. Esta transformación se realiza con una nueva función diseñada a la que llamamos Class_Selector. Esta usa tanto la cantidad de aristas que involucran a cada una de las clases, como las probabilidades correspondientes que el modelo les ha asignado. Nuestros experimentos muestran que tanto las metodologías más tradicionales como nuestro modelo de GCNN pueden aprender de los conjuntos de entrenamiento, pero tienen dificultades para generalizar en la fase de prueba debido a la falta de datos disponibles en el repositorio. Nuestro modelo de GCNN no consigue alcanzar los resultados obtenidos por las propuestas más tradicionales. No obstante, estos resultados podrían mejorar mediante la introducción de soluciones emergentes de predicción de enlaces inductivos que están actualmente en pleno desarrollo.
Contents 1 Introduction 6 1.1 Motivation......................................... 6 1.2 DataDiscovery ...................................... 6 1.3 OpenDataDiscovery................................... 9 1.3.1 OpenData..................................... 9 1.3.2 Data Discovery in Open Data . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4 Use case: Open Data Discovery in Barcelona . . . . . . . . . . . . . . . . . . . . . 11 1.4.1 Open Data BCN and Barcelona’s Data Ecosystem . . . . . . . . . . . . . . 11 1.4.2 Problem Formalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.5 Graph Neural Networks for Open Data Discovery in Barcelona . . . . . . . . . . . 13 1.5.1 Background.................................... 13 1.5.2 Proposal and Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.5.3 Novelty of the Proposal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2 Preliminaries 15 2.1 Classification Predictive Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.2 Graph Neural Networks (GNNs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.2.1 Graphs and Graph embeddings . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.2.2 Neural Message Passing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.2.3 Graph Neural Networks (GNNs) and Graph Convolutional Neural Networks(GCNNs) ................................. 17 2.2.4 Learning Tasks on Graphs (Applications) . . . . . . . . . . . . . . . . . . . 18 3 Data Collection and Preparation 21 3.1 DataCollection ...................................... 21 3.1.1 Scraper....................................... 23 3.2 DataPreparation ..................................... 24 3.2.1 DataCleaning................................... 24 3.2.2 Data Profiling: Meta-Feature Extraction . . . . . . . . . . . . . . . . . . . . 24 3.2.3 Data Preparation as Input for Models . . . . . . . . . . . . . . . . . . . . . 26 4 Overview of Classification Approaches Proposed for Barcelona Open Data Discovery 28 4.1 Classification using traditional ML . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.1.1 Logistic Regression (LR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.1.2 RandomForest(RF)............................... 29 4.1.3 Suport Vector Machines (SVM’s) . . . . . . . . . . . . . . . . . . . . . . . . 29 4.2 Classification using Neural Networks (NN’s) . . . . . . . . . . . . . . . . . . . . . 30 4.2.1 Multi-Layer Perceptron (MLP) . . . . . . . . . . . . . . . . . . . . . . . . . 30 5 Overview of the Link Prediction - GCNN Approach Proposed for Barcelona Open Data Discovery 32 5.1 ChoiceofLinkPrediction ................................ 32 5
attributes with heavily skewed cardinality distributions. Through examples, they also highlight the power of search solutions making open data more transparent and usable. Nevertheless, one of the drawbacks of using LSH methods is that it is not a scalable approach and, for growing repositories such as open portals, this can become a limited solution. We state, that for data discovery in open data the most suitable approach would be the one based on profiles comparisons. 1.4 Use case: Open Data Discovery in Barcelona 1.4.1 Open Data BCN and Barcelona’s Data Ecosystem The city of Barcelona has its own open data portal called Open Data BCN. Open Data BCN was born in 2010 and is managed by the Barcelona’s city council, more specifically the Department of Statistics and Data Dissemination of the Municipal Data Office. This platform has as goal to provide open and accurate data related to Barcelona’s citizens and infrastructures. It currently has approximately 490 datasets categorized in different thematic areas as shown in Figure 2. The amount of datasets in each category is not balanced, being city and services the one with most datasets (around 160) and economy and business the one with less data (around 20 datasets). Exploring the classes and the type of data contained in each, we can see that for some cases we have multiple instances of a same dataset but for different years, type of vehicles, buildings, etc., which makes us think that these have been generated slicing a multi-dimensional dataset, and in consequence they share the same attribute structure. Figure 2: Thematic areas in the dataset catalogue of Open Data BCN In Open Data BCN, data are displayed in many file formats such as: CSV, DGN, DWG, SHP, KMZ, WMS, JSON, WMTS, XML, RDF, among others, being the CSV the most frequent. The Barcelona’s Data Ecosystem is also formed by other open data portals such as: Tourism Data 11
System12, Institut d’Estadística de Catalunya13, Àrea Metropolitana de Catalunya14, Real-time Bicing data15, BIOCOMSC COVID-19 reports16, Meteocat REST API17, among others. Therealsoare datasourcesownedbythird-partyorganizationsthatdemand subscriptionmechanism in order to have access to their data. The type of data produced by these platforms is crucial for studying population and their behaviour. There are data providers that span the entire scope of data relating to Barcelona’s urban challenges, such as: tourism, food supply, population, well-being, mobility and housing and basic services. These kind of data has harder access as organizations keep them behind pay-walls. One of the limitations that the Barcelona’s Ecosystem has is that it is somehow composed by independent sources of data making integration a non-trivial process. Those data sources become isolated silos with unlinked data generating a vertical view. Whereas addressing Barcelona’s urban challenges intelligently would require having an horizontal view, which is achieved by finding, contextualizing and crossing data. 1.4.2 Problem Formalization This thesis focuses on solving the similarity task of data discovery, using tabular data (CSV format), specifically in the Open Data BCN context. To formalize our problem we define the following concepts: Profiles. A profile Pfor a dataset Dn, reffered as P(Dn)is a set of both numeric and nominal meta-features m1, ..., mm. Each miis a statistic about the content of an attribute of Dn. Similarity. Let A={A1, . . . , Ak}be a set of thematic areas, and D={D1, . . . , Dm}a set of datasets. Each Dibelongs to a thematic area Ai(denoted t(Dn) = Ai). We say two datasets Di, Djare similar if t(Di) = t(Dj). Similarity function. LetD={D1, . . . , Dm}be an openrepositorycomposedbytabulardatasets. We define a function F(P(Di), P (Dj)), such that for a pair of profiles P(Di),P(Dj)it outputs true if t(Di) = t(Dj)or false otherwise. In other words, two datasets share the same thematic area, and hence, are similar. The problem of finding similarities among datasets will be reduced to predict their thematic area to see whether they belong to the same or not. Hence, given a new unlabeled dataset what we want is to predict its thematic area to know its similarity with other datasets of the repository. The rest of the thesis is devoted to present our approach of the similarity function Fusing a GNN model to predict similarities among datasets of the Barcelona Open repository. 12https://barcelona.tourism-data-system.cat/ 13https://www.idescat.cat/emex/?id=080193 14https://www.amb.cat/s/web/area-metropolitana/dades-obertes.html 15https://www.bicing.barcelona/dades-bicing 16https://biocomsc.upc.edu/en/covid-19 17https://apidocs.meteocat.gencat.cat/ 12
1.5 Graph Neural Networks for Open Data Discovery in Barcelona 1.5.1 Background In the last decade, neural network models have been developed successfully for structured data such as text, images, audios or videos. The connection structure between layers makes neural networks suitable for processing signals in tensor forms where the tensor elements are arranged in a meaningful order. This fixed input order is fundamental for neural networks to extract higher-level features [23]. Nevertheless, in certain cases data can be presented under complex relational forms that lack a tensor representation with fixed ordering. An example is graph-structured data. Graphs are universal data structures made up of nodes and edges that can represent complex relational data. Additional challenges arrive with these kind of structures making traditional deep learning limited to handle complex relational data. For example, convolutions, which are typical operations of networks, cannot be explicitly extended to irregular graph domains. These challenges, sparked the development of Geometric Deep Learning (GDL) research, which aims to apply deep learning techniques to non-Euclidean data and since graphs are so common in real-world implementations, there has been a surge of interest in applying learning methods to them [24]. In the past few years, Graph Neural Networks (GNNs) have emerged as an effective class of models for learning embeddings of nodes. GNNs are based on a recursive neighborhood aggregation (or message passing) scheme, in which each node aggregates the feature vectors of its neighbors to compute its own new feature vector [25]. These representation learning techniques learn a mapping that embeds nodes, or even entire graphs, as points in a low-dimensional vector space Rd. The objective is to optimize this mapping such that geometric relationships in the embedding space match the original graph’s structure. The learnt embeddings can be utilized as feature inputs for downstream ML tasks after the embedding space has been optimized (i.e. schema matching or entity alignment) [26]. 1.5.2 Proposal and Contributions Data integration tasks such as data discovery can be vastly enhanced by the use of arising deep learning models based on graphs. Indeed, when we need to go beyond attribute name comparison, graph data structures can help in catching data distributions and their relationships. This is possible thanks to the flexibility and interoperability of the graph data model, where instead of storing all instances of a dataset we can store succinct and informative summaries of them. This is why, in order to efficiently and effectively address large-scale data discovery, we propose to introduce GNN models to solve profile-based approaches for the similarity task at dataset level. We would represent the different elements of the Open Data BCN repository using graphs, where the nodes would denote the datasets with arbitrary complex meta-features. We would call their data profile as the node embeddings, and the edges would denote similarities between the aforementioned datasets. Using the proposed graph representation of the input data, we can learn node embeddings, and perform matching operations in the embedded space. In order to perform comparisons for the matching tasks, we must obtain a convenient 13
representation that is able to capture both, structural and semantic information of the nodes in the graph. For all the reasons stated above, we aim to explore the Graph Convolutional Network (GCN) approach, to generate a vectorized representation of the nodes (embeddings) in the graph. Particularly, we make hypothesessummarized inthe followingresearchquestions that thethesis will address: •RQ1: Can Graph Neural Network-based techniques be used for data discovery in Open Data BCN repository? •RQ2: Can we notice an improvement in the performance (in terms of accuracy) of GNN approaches in front of more classical data discovery methodologies? To approach these research questions we will work on both a GNN model and more traditional ML and DL techniques. 1.5.3 Novelty of the Proposal In this proposal we advocate for a novel GNN-based approach for data discovery on large-scale repositories of heterogeneous, independently created datasets. Our work is motivated by (i) the poor predictive performance of current profile-based solutions, and (ii) the inability to scaleup of hash-based approaches, as well as their low precision, which is undesirable for large-scale scenarios. There are other works proposing to learn embeddings from graph representations [27, 28, 29, 30], or directly from the columns of tabular datasets. However, these leverage instance data from the datasets and will thus fail at large-scale data lakes such as Barcelona’s. To the best of our knowledge, the proposal is unique as it combines computation of large volumes of data while retaining high predictive quality. 14
2 Preliminaries 2.1 Classification Predictive Modeling In machine and deep learning, classification refers to a predictive modeling problem where a class label is predicted for a given example of input data. Commonly classification models estimate a continuous value as the probability of a given example belonging to each output class. The probabilities reflect the likelihood or confidence that a given example belongs to each class. By choosing the class label with the highest probability, an expected probability may be translated into a class value. In order to validate the classification capacity of the model there are many available metrics (i.e. accuracy, precision, recall, F-score). There are different types of classification tasks: •Binary Classification: It consists in assigning an element into a set of two classes using a classification rule or a classifier. Typically, binary classification tasks involve one class that is the normal state and another class that is the abnormal state. Commonly, binary classifiers are modeled by predicting a Bernoulli probability distribution for each data instance. The higher outcome of probability of each class will be the one assigned to the element. For example, classifying whether a new is real or fake is a Binary Classification problem. •Multi-Class Classification: It generalizes Binary Classification to problems where there exist multiple options of class membership. In these problems, the output is a discrete probability distribution over the set of possible classes. As in Binary classification, we consider a unique class membership for each observation. For example, the classification of facial expressions from images can define a multi-class classification problem since a face could either be sad,happy,angry,surprised or other. •Multi-Label Classification: Compared to classes, labels are not considered unique annotations for input observations. In this way, label classification can tag observations with different number of annotations. For instance, object detection from images is a multilabel classification problem since an image could contain only a dog, or could contain both a dog and a cat, or a dog, a cat and a person. In machine learning, some algorithms that are typically used for solving classification problems are: Logistic Regression (LR) [31], Decision Trees (DT) [32], Support Vector Machines (SVMs) [33], k-Nearest Neighbours (k-NN) [34]. In these cases, an important part of the performance of the models depends on the observation representations. Depending on how the observations are encoded, these can belong to dimensional spaces where it can both be easier or more difficult to classify in. It is a common challenge in machine learning to perform accurate feature engineering so that the classification framework is suitable. Moreover, feature engineering can be complicated with tabular data but even more with more complex data structures like images or text. For this reason, machine learning extends to deep learning by using sophisticated artificial neural network architectures. Neural Networks are complex and robust architectures adaptable to a wide range of domains. The later is possible since Neural Networks carry an embedded rep- 15
resentation learning system that allows them to learn useful feature representations from raw data in an autonomous way. However, they demand larger quantities of data, which is not actually a severe problem nowadays. With all this, different configurations of Neural Networks have succeeded in solving classification problems (among many others) in domains as complex as images, videos and text. 2.2 Graph Neural Networks (GNNs) With the usage of deep learning architectures the AI community has solved problems in domains that traditional ML could not tackle. Either image-based (i.e. image classification, object segmentation, video trajectory tracking), text-based (i.e. text semantic recognition, question answering) or voice-based (i.e. speech understanding or generation) problems cannot be approached with ML because they are not based on input tabular data. In this way, Neural Networks are well-suited to processing data in tensor forms, with the tensor components ordered in a meaningful order, thanks to the connection structure between layers. In fact, computer vision and Natural Language Processing are two fields of study that have experienced revolutionary results through DL (i.e. Recurrent Neural Networks (RNN) and Convolutional Neural Networks(CNN)). Even though images, text or audio signals propose more challenging setups than tabular data for autonomously learning patterns, in many settings data can have even more complex structures that lack a tensor representation with fixed ordering and can not be tackled with standard NNs. An example are graphs, which do not have sequential nor gridlike representations and do not provide an embedded spatial locality property or a fixed node ordering and hence can not be tackled with standard NNs. For those structures we use Graph Neural Network (GNN) approaches. 2.2.1 Graphs and Graph embeddings Formally, we definea graph as apair G= (V,E)whereV=v1, . . . , v|V| isthe vertex or node set and E=e1, . . . , e|E| is the set of edges that connects them, where each edge ek∈ E represents a pair of nodes (vi, vj)with vi, vj∈ V. We say a graph is weighted if there exists a function that assigns a weight to an edge between a pair of nodes: w:(vi, vj)→wij. Contrarily, we say that the graph is unweighted. We define a directed graph as a graph in which the order of the node-pair (vi, vj) given by an edge ekis not permutable, as (vj, vi)may not belong to E. On the other hand, we say a graph is undirected if the fact that (vi, vj)∈ E implies that (vj, vi)∈ E. Then for an edge ekwith (vi, vj)and an edge elwith (vj, vi)we have that ek=eland that the relations between nodes are symmetric. The definitions are taken and adapted from [24]. We can represent a graph G= (V,E)with an Adjacency Matrix A∈ M|V|x|V| whose elements indicate whether pairs of vertices are adjacent (they define an edge) or not. We assume the matrix binary, with an arbitrary element from A,aij = 1 meaning that the pair (vi, vj)∈ E and aij = 0 otherwise. We also define the Degree Matrix D∈ M|V|x|V| as a diagonal matrix containing the number of edges attached to a node. Hence, the count of edges containing viis stored in the i-th item of the diagonal. Additionally, we define the neighbourhood of an arbitrary node vi,N(vi)as the set of the nodes vjsuch that there exists an edge (vj, vi)∈ E. 16
Recently in DL there has been an emerging interest in learning from graphs since there exist large amounts of data that are encoded in this format, such as social networks, biological structures like proteins and molecules, among others. That is why Graph Representation Learning (GRL) methods, which aim at dealing with these kind of data, have gained popularity in the last decade. As other typical NNs approaches, GRL learns from low-dimensional vector representations of the graphs called graph embeddings or network embeddings [27, 24]. The goal of converting graph attributes to vectors is to make graph data useful as inputs for DL models such as NNs, which have been shown to operate well with tensor data. Node embeddings encode nodes so that similarity in the embedding space approximates similarity in the graph. Formally, given a graph G= (V,E)represented with an adjacency matrix A∈ M|V|x|V|, we define low-dimensional vector representations {Zi}i∈V for nodes vi∈ V in the graph called graph embeddings, such that graph properties are preserved [24]. For instance, if two nodes have similar connections in the original graph, their learned vector representations should be close. We denote as Z∈R|V|×dthe node embedding matrix. 2.2.2 Neural Message Passing The major common approach for tackling graphs with Neural Networks is with message passing, which tries to generalize the convolution operation present in classical DL approaches to the graph format. Message passing works over the key idea that the feature information of the node is passed through the structure of the graph and updated to the node that receives it. We define the states of the node viat a specific time t:hi tas the embedded information of this node at time t. Message passing has the following steps: •Fetch the current (t−1) neighbour states of a node vi:hj t−1,∀vj∈ N(vi). •Prepare the messages the node will receive from its neighbours: f(hj t−1),∀vj∈ N(vi). •Summarize/Aggregate the information received by the node obtaining the new node state for vi:hi t. In the message passing framework, the step of information update happens at the same time for all the nodes of the network. The preparation and aggregation processes are shared among all nodes. Besides, the number of update steps to perform is a user-defined hyper-parameter. Another particularity of message passing is that what we call the node receptive field of a node, which is the set of nodes passing a message to a specific node, increases at each step with the node neighbourhood. 2.2.3 Graph Neural Networks (GNNs) and Graph Convolutional Neural Networks (GC- NNs) Any GNN can be understood over the idea of neural message passing. In the definition of a generic GNN we define hi 0as the initial features of node viand hi Tits embedding after T updates. Then the general update formula of a node is: 17
hi t=σ Uhi t−1+WX v∈N(i) Ekhj t−1 Where the matrices U,W, and Ekare the GNN trainable weights. Uis learnt such that the important information of the node embedding in the previous update hi t−1is preserved. W is learnt such that the valuable information in the nodes vj∈ N(i)is accordingly passed to the node vi(N(vi)being the neighbourhood of node vi). Then Ekdefines the way the edge attributes influence the information passed from neighbouring nodes vj∈ N(vi)to vi. Finally, σ(x)is a non-linear activation function that enables the GNN to estimate complex functions. With all this, we can feed the final embeddings of the nodes to a suitable loss function for the given task and update the GNN weights to minimize the loss (i.e. with Stochastic Gradient Descent). A popular and more specific approach to define a GNN is the Graph Convolutional Neural Network (GCNN) defined as: hi t=σ X vj∈N(i) Wthj t−1 deg(i) (1) Where we extend the convolution operation to graphs by learning a shared weight matrix W that effectively transforms and aggregates the information between neighbouring nodes. The matrix form of Equation 1 is the following. Hi t=σD−1 2AD−1 2Ht−1Wt(2) Where matrices Aand Dare the adjacency and degree matrices respectively and Ht−1stores the node embeddings of all the nodes in the previous update. The matrices Aand Dare usually modified to include self-loops. These are edges that are added from each node to itself. In this way, we open a channel for nodes to maintain a degree of information from their own embedding in the last update. 2.2.4 Learning Tasks on Graphs (Applications) The objective of GNN in a graph is to learn meaningful node embeddings that encode the node features in a meaningful way. Once we have done this, we can use that graph model for many different applications. In this section we provide a brief overview of the most important and well-studied tasks we can solve on graph data. We take the examples from [35]. - Node Classification: In node classification, the goal is to predict the label or the class associated to the nodes v∈ V when only the true labels of a specific set of nodes are given, which are used as the training 18
set. Node classification has become through the years the most popular ML task on graph data. Some examples are: classifying the function of proteins in the interactome [36] and classifying the topic of documents based on hyperlinks or citation graphs [37]. Node classification is useful for inferring information about a node based on its relationships with other nodes in the graph. Figure 3: Example of node classification. The GNN classifies the nodes that did not belong to any class. - Link Prediction: Sometimes we are missing the information about relationships between nodes in the graph and we would need an approach to infer those edges. This is the task that link prediction does which besides node classification, is also one of the most popular ML tasks with graph data. Formally, given a set of nodes Vand an incomplete set of edges between those nodes Etrain ⊂ E , which is used as training set, the goal is to infer the missing edges E \ Etrain. The approach can also be modified to remove edges by setting a threshold on the probability score given to an edge. Some examples are: recommending content to users in social platforms [38] or inferring new facts in a relational database [39]. The complexity of this task is dependant on the type of graph data that we are dealing with. If, for instance, the graphs have multi-labeled edges, the difficulty of detecting new edges on this graph increases. Figure 4: Example of link prediction. The GNN finds the new edges in red and removes the edges represented in dotted lines. - Graph Classification: In graph classification the goal is to make predictions on the type or class of each of the graphs within a multiple graph dataset. Given a set of graphs G={g1, g2, . . . , gn}and a set of classes 19
C={c1, c2, . . . , cm}we want toassignaclasscitoeach graphofG. See asexamples: aregression model that can predict whether a molecule is toxic or soluble [40], or a classification model to detect if a computer program is malicious [41]. Figure 5: Example of graph classification. The GNN assigns a class to each of the graphs - Community Detection: In a graph, a community is defined when nodes are linked between them more densely than in other parts of the graph. The objective of community detection is given a graph G= (V,E), to infer its existing community structures. For example, uncovering fraudulent groups of users in financial transaction networks [42]. Figure 6: Example of community detection. The GNN finds communities within a graph. 20
negatively because in this context a missing value means that the attribute was empty which can be replaced by having a 0 instead. The left join allows us to create profiles for a dataset even when this one does not have numerical attributes. An inner join would make us loose the profile of the dataset whenever this one would not have either numerical or nominal attributes. On the other hand, a right join would make some of the profiles very sparse, as for those which would not have nominal attributes, 43 columns would be filled with zero values. At the end, we drop the column containing the attribute name as this one will not be relevant for the next steps. At the same time as we merge the profiles we also aggregate them. The aggregation method consist in computing the mean value and the standard deviation of each of the profile columns for a particular dataset. In other words, we group the profile by their dataset name using as aggregation functions the mean and the standard deviation. Hence, each dataset profile will be a row of twice as many columns as it had before the aggregation step. The aggregation step returns a single csv file of dimensions 319 x 140, where 319 is the number of datasets remaining after all the previous processes (those which have nominal attributes) and 140 is the number of meta-features remaining after the aggregation step plus a column containing the dataset name and another column containing the number of the class membership of the dataset which we call the ground-truth. In Figure 12 we can see the first rows of the profiles file obtained after all these steps. Figure 12: First columns of the aggregated profiles file Finally, we need to split our aggregated profiles file, which will be used as input for the models, into training and test sets. For that we keep 80% of the rows to form the training set and we leave 20% for the testing part. It is important to state that the class-balance that we originally had for each of the categories was respected when forming the train and test sets. As models do not support non-numeric attributes we drop the column of the dataset name and we generate a dictionary stored in a JSON file, called Map of datasets containing the information of which row contains which profile. The dictionary has as key the number of the row (starting with a 0 for the first profile row) and as value the name of the dataset contained by the row. For example in Figure 12 in the dictionary we would have the pairs: (0, 1_Accions formatives adreçades al personal municipal de la ciutat de Barcelona.csv), (1, 1_Adreces per secció censal de la ciutat de Barcelona.csv), and so on. 27
4 Overview of Classification Approaches Proposed for Barcelona Open Data Discovery In order to answer the research questions formulated in Section 1.5.2, we need to develop classification approaches using traditional ML and DL techniques that will serve as baselines to compare with the GNN approach to evaluate its performance. In this section, all the datasets have been normalized by mean and standard deviation using the sklearn.preprocessing.StandardScaler() before feeding the models. Also, all the choices of the hyper-parameters of the different models have been made maximizing the accuracy metric, which for classification problems is simply the rate of correct classifications. 4.1 Classification using traditional ML The similarity data discovery task we are trying to solve is reduced to categorizing the datasets with their class membership, hence, we face a classification problem. In Machine Learning, models like Classification Trees, Support Vector Machine’s (SVMs) and Logistic Regression (LR) are arguably the most popular approaches for classification problems. These traditional models learn in a supervised way due to the availability of class labels. 4.1.1 Logistic Regression (LR) Logistic regression is a statistical model that in its basic form uses a logistic function28 to model a binary dependent variable, although it can be adapted for non-binary dependent variables in order to solve multi-class classification problems like in our case. The model used is the LogisticRegression provided by sklearn.linear_model. Around 20 different configurations of this model were tried out by changing its hyper-parameter values29. The best set of hyper-parameters chosen for this model, after a comparison-search using accuracy metric as the goodness of fit, are: •penalty =l2. The penalty is used to specify the norm used in the penalization of the model. •C=0.15. This coefficient corresponds to the inverse of the regularization strength. Smaller values specify stronger regularization. •solver:newton-cg. This hyper-parameter designes the algorithm to use in the optimization problem. •max_iter =1000. Which is the maximum number of iterations taken for the solver to converge. •multi_class =multinomial. Specifies that the loss minimised is the multinomial loss fit across the entire probability distribution. 28It is a common S-shaped curve (sigmoid curve). See: https://en.wikipedia.org/wiki/Logistic_function 29All possible hyper-parameters can be found here: https://scikit-learn.org/stable/modules/generated/ sklearn.linear_model.LogisticRegression.html 28
•All other hyper-parameters are set to the default value. 4.1.2 Random Forest (RF) A random forest is a meta estimator that fits a number of decision tree classifiers on various sub-samples of the dataset and uses averaging to improve the predictive accuracy and control over-fitting. When dealing with a classification problem, it operates by constructing a multitude of decision trees at training time and outputting the class that was assigned in more instances. The model used is the RandomForestClassifier from the sklearn.ensemble. Around 25 different configurations were tried out for this model by changing the hyper-parameter values30 of the model. The best hyper-parameter set found is the following: •max_depth:10. Sets the maximum depth of the trees. •n_estimators:100. Which determines the number of trees in the forest. •max_features:sqrt. Sets the rule to apply to the number of features to consider when looking for the best flip. If sqrt, then max_features =sqrt(n_features). •random_state:0. This parameter controls the randomness of the bootstrapping of the samples used when building the trees. •All other hyper-parameters are set to default value. 4.1.3 Suport Vector Machines (SVM’s) Support vector machines are a set of supervised learning methods used for classification, regression and outliers detection. As we are dealing with a classification problem, the SVM to use is a Support Vector Classifier (SVC). The objective of an SVC is to fit to the data provided, returning a "best fit" hyperplane that divides, or categorizes it. After getting the hyperplane, some features can be fed to the classifier to see what the predicted class is. The model used is SVC from sklearn.svm python library. Around 15 different configurations of hyper-parameters31 were tried out for this model and the best hyper-parameters fitting the model to our data are: •C:150. Designing the regularization parameter, i.e. the strength of the regularization is inversely proportional to this parameter C. •decision_function_shape:ovo. Multi-class strategy for the decision function of classification. •shrinking:False. Sets whether to use the shrinking heuristic or not. 30All possible hyper-parameters can be found here: http://scikit-learn.org/stable/modules/generated/ sklearn.ensemble.RandomForestClassifier.html 31All possible hyper-parameters can be found here: https://scikit-learn.org/stable/modules/generated/ sklearn.svm.SVC.html 29
•probability:True. Whether to enable probability estimates and it internally uses 5-fold cross-validation. •All other hyper-parameters are set to default value. 4.2 Classification using Neural Networks (NN’s) Another possibility to approach a multi-class classification problem is using Deep Learning. In this case, we will model a simple neural network called Multi-Layer Perceptron (MLP). MLP is a supervised learning algorithm that given a set of features and a target, can learn a nonlinear function approximator for either classification or regression. There are at least three node levels in it: an input layer, a hidden layer, and an output layer. Each node, with the exception of the input nodes, is a neuron with a nonlinear activation function. For training, it employs backpropagation, a supervised learning approach. 4.2.1 Multi-Layer Perceptron (MLP) For this method we use the MLPClassifier offered by the sklearn.neural_network python library. After around 25 different model configurations changing the hyper-parameter values32, we chose the following set of hyper-parameters, which are also depicted in Figure 13, as the best possible configuration based on the accuracy metric: Figure 13: Schema of MLP-1 model architecture 32All possible hyper-parameters can be found here: https://scikit-learn.org/stable/modules/generated/ sklearn.neural_network.MLPClassifier.html 30
•hidden_layer_sizes:45. Representing the number of neurons in the hidden layer. •activation:tanh. Designing the activation function used for the hidden layer. In this case, it is the hyperbolic tangent function. •alpha:0.01. The L2 penalty parameter (regularization term). •random_state:2. Integer set for reproducible results across multiple function calls. •All other hyper-parameters are set to default value. 31
5 Overview of the Link Prediction - GCNN Approach Proposed for Barcelona Open Data Discovery This approach is modeled using the python library Pytorch Geometric. As in Section 4, data wasnormalizedusingthesklearn.preprocessing.StandardScaler() beforefeedingtheGraph Neural Network. 5.1 Choice of Link Prediction As seen in Section 2.2.4, there are many different tasks we can solve with a GNN. In the context of this thesis and following the definition of the problem of finding similar datasets among the Open Data BCN repository (Section 1.4.2), we need to find the proper way to map the similarity task to a task that can be solved within a graph. Hence, we need to define nodes, node embeddings and edges in a way that it is possible to model a GCNN to predict similarities among datasets by finding out which datasets share the same class. We decide to represent the datasets with nodes and the profiles extracted from them as node embeddings. As for what concerns the edges, we need to find a criterion to link the datasets in a meaningful way. For that, we define an edge between two nodes as an indicator of those two nodes being similar, and hence, belonging to the same class. Therefore, finding similarities among new datasets of the repository would mean to find new edges between the nodes representing the new datasets and the nodes we already have in the graph. This is defining a link prediction task. Choosing this approach, weleverage the messagepassing framework whichtakesintoaccountthe information of the neighbouring nodes to influence each of the graph nodes. In this way, we enable the GCNN to learn node features that encode the different properties of each class. The latter is achieved by using both the node attributes and edge structure information to construct the node feature representation. Contrarily, if we wanted to use a node classification framework for this problem, we would not have a consistent criterion to link the nodes and therefore we would not be able to learn node embeddings that shared their properties among the other nodes that belong to the same class. 5.2 Input Graph Representation As mentioned above we represent the Open Data BCN repository as a graph by codifying the datasets as nodes, the profiles as node embeddings and the class memberships as edges. The idea is to transform a multi-class classification problem as we solved in Section 4 into a link prediction task using a GCNN. With this goal we model the problem as a GCNN receiving as input the graph from which we want to find similarities and predicting the similarities between the nodes by finding edges and their corresponding probability (we decide later on which threshold to use on the probability value returned by the model in order to predict whether it is high enoughornottoconsidertheedgevalid). Aseachedgedeterminesthefactoftwo nodes sharing the same class, we can model a GCNN to understand the relations between datasets leveraging the message passing principle. For that, we need a graph to train the model and another graph, which will be an extension of 32
the training graph, to predict links for each of the new nodes that will enter the repository. 5.2.1 Input Graph for Training In this modeling the input graph that the GCNN receives for training is formed by as many fully-connected components as classes we have in the conventional classification problem. In the schema depicted in Figure 14 we see a small example of the input graph modeled for our problem, where each class is represented by a different color. Figure 14: Example of input graph for training step GCNN - Link prediction As input, the model needs to receive the information to create the graph. What we provide to the model is: •a list with the profiles ordered by the node tag (being this one the integer assigned during the data preparation process in the mapping step). •a list of all existing edges in the input graph (if a pair (node_0,node_1) appears in the list of edges, it means that there exist an edge between node_0and node_1). The input graph of this training step is made taking only the datasets of the Open Data BCN repositories belonging to the train set that we created in Section 3.2.3. To provide only one graph to the model for the training step is enough because link prediction approaches use a train-test split of the edges of one graph in order to be trained. They train themselves by masking sets of edges and trying to predict them in multiple iterations. 5.2.2 Input Graph for Testing Once the model is trained for the graph representing the entire training set of the Open Data BCN repository, we need to create another graph including the testing datasets for the model to predict new edges for them. 33
The idea is to pass to the model a new graph including all the datasets of which we already know the class (the ones used in the train step) and an additional test dataset for which we want to predict the class. The test step will be performed in as many iterations as datasets we have in the test set. The known datasets will be exactly codified as in Section 5.2.1 and for the test datasets we try two different approaches. Approach 1: Model adds edges. The test dataset is codified as a disconnected node with its profile as embedding (see Figure 15 (a)). The model predicts the edges between this node and the rest of the graph, finding similarities between them. Then we define a metric that computes the class of the test node taking into account the class of the nodes it linked to, and their corresponding probabilities. Approach 2: Model removes edges. The test dataset is codified as a node, with its profile as embedding, which is connected to all the other nodes of the graph (see Figure 15 (b)). The model needs to "disconnect" the test node of the nodes that aren’t similar to the dataset (we understand as "disconnect" to not predict the edges having a probability lower than a given threshold). Then we define a metric that computes the class of the test node taking into account the class of the nodes it is still linked to, and the corresponding probabilities. (a) Input Graph Test, Approach 1 (b) Input Graph Test, Approach 2 Figure 15: Examples of input graph for test step of GCNN Link prediction. The test node is represented as a grey node because its class is unknown. On the right, the test node is unlinked from the other components of the graph. On the left, the test node is linked to all the other nodes of the graph. 5.3 Model Architecture The structure of the GCNN architecture for this approach is depicted in Figure 16. It is formed by three graph convolutional layers with ReLU activation functions and dropout layers in between. After the output of the last convolutional layer, a softmax layer is added in order to normalize the output of the network to a probability distribution. The layout of the model presented above is achieved after trying out a large amount of different configurations and keeping the one obtaining best results (in terms of loss and accuracy). A decoder transforms the model output into a score which is a probability, thanks to the softmax layer, associated to each pair of nodes in the graph. Then, another decoder (called decoder_all) 34
transforms the probabilities into an adjacency matrix, based on a probability threshold (if the probability of the pair of nodes returned by the model is greater or equal than the threshold, then in the adjacency matrix the edge will be present, otherwise, we won’t consider it). We also define a function obtain_probs that returns for a pair of nodes the probability predicted by the model so we can use it later on. Figure 16: GCNN model architecture More specifically, the hyper-parameters of the GCNN giving the best results are the following: •Number and sizes of layers: Three layers of sizes (138x256), (256x256), (256x138). •Drop out factor:0.05. During training, probability of randomly set to zero some of the elements of the input tensor. •Activation function:ReLU. Activation function used between layers. Decides, whether a neuron should be activated or not by using the ReLU function (piecewise linear function that will output the input directly if it is positive, otherwise, it will output zero: y= max(0, x)). •Optimizer:Adam. Optimization algorithm used to change the attributes of the neural network such as weights and learning rate to reduce the losses. •Learning rate:0.01. Controls how much to change the model in response to the estimated error each time the model weights are updated. •Epochs:40. Number of times that the learning algorithm will work through the entire training dataset. Moreover, as mentioned before, the model outputs probabilities and not a binary decision for whether twonodes arelinked ornot, hence, we definea probabilitythresholdinthedecoder_all as a supplementary hyper-parameter. This threshold is set to 0.5, meaning that if the probability of connection between two nodes is greater than 0.5, the model predicts an edge between those two nodes. The loss function minimized by the model is the binary_cross_entropy implemented in the pytorch’s functional package. It is a function that measures the binary cross entropy between the target and the output probabilities. The binary cross entropy evaluates each of the predicted 35
probabilities against the actual class output, which can be 0 or 1. This function penalizes the probabilities based on their deviation from the expected value. It follows the bellow equation: Binary_Cross_Entropy =−(ylog(p) + (1 −y)log(1 −p)) where: •yis the binary indicator (0 or 1) of whether a pair of nodes has an edge or not •pis the predicted probability for a pair of nodes to have an edge or not. 5.4 Link prediction to Classification As mentioned in the previous section, we obtain as output of the model after the decoding steps: an edge-adjacency matrix and the corresponding probabilities of each of the edges defined in the matrix. Nevertheless, what we are trying to solve is a classification problem, so we need to adapt this output so that we can obtain the class assigned to each node. To do so, we need to take into account both, •the number of edges to a node having a specific class and •the probabilities of each of those edges. Hence, we will define a function that, given the edges of a node and its probabilities, returns the class of this node. 5.4.1 Class Selector Function Before defining the class selector function we need to define other functions that will be needed for its construction. Let G= (V,E)be a graph with V:v1, . . . , vrnodes and E:e1, . . . , esedges. Let C:{c1, . . . , cm} be the set of possible classes that a node of the graph can belong to. We take an arbitrary node vi. Let be Ei:ei1, ei2, . . . , einthe set of edges of the node vilinking with nodes that belong to the class cl, with their corresponding probabilities Pi:pi1, pi2, . . . , pin and tthe threshold probability defined in order for the model to consider an edge between two nodes. - Definition 1. We define a function that returns a discretization set of the probability set Pi with as many levels as desired (n_levels sets the number of levels we want), as: discretize(Pi, n_levels)→ {1,1−1−t n_levels,1−2·(1 −t) n_levels, . . . , t} which can also be written as n_levels intervals as follows: I0=h1,1−1−t n_levels i, 36
Figure 22: Comparison between the training input graph passed to the GCNN model against the output obtained after the training step. The graphs are displayed randomly, which is why the two graphs look different, but in reality they are the same. The exact same edges are predicted obtaining 100% of accuracy. Each connected component represents a class. 6.2.2 Results Classification The next step is to transform the adjacency-matrix obtained as output of the GCNN model into predictions of classes for each node. We do that using the Class_Selector(.)function defined in Section 5.4.1. Train Accuracy Test Accuracy Approach 1 100% 60.94% Approach 2 100% 6.25% Table 6: Results of the GCNN model as a Classification problem. These are obtained after applying the Class_Selector(.)function. In the approach 1, the model adds edges to the test nodes and in approach 2 the model removes edges of the test nodes. The results obtained by the Approach 2 are extremely bad, proving that this approach is clearly not the way to go. Approach 1, although being over-fitted, offers a better performance. Nevertheless, the test accuracy obtained is significantly lower than both the train accuracy and the test accuracy obtained by the methods in 6.1.1. Figure 23: Comparison between the input graph of the GCNN model (approach 1) for a specific test dataset against the output graph obtained from the model. The test dataset is represented as the red node. The node was linked to all the nodes (76 nodes) of a class (class 2) which turned out to be its true class (The normalized W eight_Class computed was 0.987). 43
Figure 24: Comparison between the input graph of the GCNN model (approach 2) for a specific test dataset against the output graph obtained from the model. The test dataset is represented as the red node. The model linked it to all the nodes of a class (class 3), but this class is not the true class of the node (the true class is 2). The GCNN miss-classified this test node and the The normalized W eight_Class obtained was 0.9656. In order to analyse with more precision the output obtained by the model in both approaches we compute the confusion matrices. (a) Approach 1 Confusion Matrix (b) Approach 1 Normalized Confusion Matrix Figure 25: Confusion matrices computed with the predictions made by the GCNN model for the Test set with the approach 1 as input graph. (a) Approach 2 Confusion Matrix (b) Approach 2 Normalized Confusion Matrix Figure 26: Confusion matrices computed with the predictions made by the GCNN model for the Test set with the approach 2 as input graph. 44
In Figure 25 we can see that for approach 1 there is a class that the model has learnt to predict with perfect score: the Population class. It also classifies Administration and Services class with a high score of accuracy. Conversely, the model has difficulties classifying samples belonging to Territory and Economy and Business categories. These results were expected as those two classes are the ones having the less representation in the train set and in the Open Data BCN repository. On the other hand, in Figure 26 we notice that the model links all the test nodes but one, to the Economy and Business category. Thus makes us think that linking the test node to all the other nodes so that the model could only keep the edges going to/from nodes with its true class is not a good method. 6.3 Discussion The results of the models presented both in Sections 6.1 and 6.2 are good but they could have been better if we had not encountered some limiting problems. One of the problems faced involves imbalance classes. In Sections 6.1 and 6.2, we notice that the classes the model encounters more difficulties to classify are the ones with less representation in the Barcelona’s repository, showing that the unbalancing of the classes is shrinking the model’s accuracy performances. This is an inconvenient that is hard to avoid in real life, because in most data repositories there are no rules about the amount of datasets in each category, and most of the time those will be different. In our case, we knew from the beginning that making in sort that the model could classify correctly the Economy and Business thematic area having only 15 available datasets would be an almost impossible task. We could have considered to apply oversampling methods to our profile dataset, but when constructing and trying out the ML models in section 4, we tried a very similar approach using the class_weight33 hyper-parameter provided by those models, and the results obtained were actually worse because the accuracy decreased. Another limitation comes with the subjectivity of the thematic areas. The dataset categorization in the Open Data BCN repository is a manual task made by different people which decide, sort of subjectively, where to classify the datasets. Hence, there are no specific rules determining whether a dataset should belong to a class or another, and some datasets could have been classified elsewhere if someone different had had to do the task. This adds complexity to the classification problem as it introduces a certain randomness in the dataset categorization. Furthermore, an additional constraint is added when aggregating the profiles. Although this step is compulsory because we need to obtain profiles at a dataset level and not at an attribute level, it makes us loose a lot of information that affects negatively on the models performances. We had to decide which aggregation technique to use, and we chose to aggregate the data in a Gaussian form by keeping the mean and standard deviation values of the profile meta-features. 33We can tweak the existing training procedure to accommodate for the classes skewed distribution. This is achieved by giving different weights to both the majority and minority classes using the class_weight hyperparameter during the training phase. 45
As a possible future work, we could study if other more complex aggregation techniques (i.e. Principal Components (PCA)) could have provided better results. Another possible future work is to analyse whether all the meta-features extracted from the datasets that form the profiles are indeed useful or meaningful for the models to learn how to identify classes. This can be done with feature selection techniques such as Linear Discriminant Analysis (LDA) in order to reduce the profile sizes by only keeping the most significant features. Finally, the major limitation, specially for the DL approaches, is the lack of available data in the repository. To train the models we only had a dataset of 254 profiles, which is a very low amount of data for the model to learn how the data behaves instead of "memorizing" it. 6.3.1 Research Questions At the beginning of this thesis, two research questions were formulated. With the results obtained we can argue and answer them. •RQ1: Can Graph Neural Network-based techniques be used for data discovery in Open Data BCN repository? As for what has been approached in this thesis, which is the similarity task for data discovery: yes, GNN-based techniques can be used for data discovery in Open Data BCN repository, although, the approach presented in this thesis has not turned out to be very high performing. To sustain this answer we provide the following observations. The link prediction GCNN model provided in this thesis (detailed architecture in Section 5), has shown an overall good behaviour regarding the classification task it was designed to solve, achieving 100% of accuracy in training and 60.94% in test, which for a 5-class classification problem is considerably good. One of the reasons explaining why the model does not achieve very good test results is that the way the GCNN is designed, we are asking the model to predict links of a node that it has never seen (which is known as inductive link prediction [44]). Whereas in typical link prediction approaches, the model predicts new edges in the same graph it has learnt from in the training phase (this is known as transductive link prediction). To understand the limitation caused by this fact we need to analyse what is going on behind the message passing algorithm implemented by the model. In our approach, we obtain a perfect edge prediction in the training stage meaning that we learn a meaningful weight matrix Wfollowing notation from Equation 2. This means that after some iterations we learn Wsuch that node features are encoded and mapped to a dimensional space where it is easy to determine whether a pair of nodes contains an edge or not. Following Equation 2, Woperates on the adjacency and degree matrices Aand Drespectively. In our case, when we add a new node to the graph (representing a new dataset from Open Data BCN) to predict its edges, we modify both Aand Dmatrices to include this node which is only linked to itself. In order to find edges for the new node, we forward its initial features (the actual profile of the dataset) to the GCNN defined by the learnt Wand aim to obtain a meaningful node embedding in the dimensional space where it is easy to determine what edges should be created from it. However, since Woperates on Aand Dand the new node is 46
notconnectedtoany other node, the weightmatrix only influencestheself-loop introducedwith the new node obtaining a poor representation of the node embedding that we later compare to the ones obtained in the training phase. On the other hand, if the node from which we want to predict was linked to the right nodes of the graph (following a transductive methodology), the representation we would obtain of the node embedding would be comparable to the ones we obtained in the train phase. Consequently, test result would be more similar to the ones obtained in train. We hypothesise that using an inductive-based approach would lead to better fit of the problem [45, 44]. Still, the fact that we achieve a 60.94% accuracy in the test set with the aforementioned limitation indicates that a considerable amount of the valuable information to determine whether an edge should be created for a given node relies in the node attributes. Then, the lower performance achieved in the test set in comparison with the one obtained in the train one is due to the unknown edge structure of the new node. Also, the approach proposed may not be that suitable to solve the similarity task of data discovery, but the pipeline provided can be useful to tackle other data discovery tasks such as finding unions or joins. In this thesis, we wanted to approach the "easiest" data discovery task because it was our first experience with graph neural networks, which is why we started with a problem that only required comparisons and classifications at a dataset level. Nonetheless, with some perspective and experience, we realise that working at an attribute level would have helped us to avoid the aggregation problem and would have allow us to work with more data. Also, we could have modeled the input graph from which the model learns in a more sophisticated way leveraging more on the perks of using graph-structured data. •RQ2: Can we notice an improvement in the performance (in terms of accuracy) of GNN approaches in front of more classical data discovery methodologies? As for what has been approached in this thesis, which is the similarity task for data discovery: no, we did not obtain better results in the GCNN approach than in any of the other more traditional ML or DL classification approaches that we set as baselines. The best results obtained are those provided by the Random Forest model, achieving a train accuracy of 100% and a test accuracy of 87.5%. In the GCNN approach we get 100% of accuracy in training and 60.94% in test. In Tables 4 and 6 we can see that in fact, GCNN’s are providing good train results, but its test accuracy diminishes considerably. This is probably due to the inductive link prediction problem we stated above. If we had been able to implement the approach in a way that the graph could have learnt properly how to predict edges in an inductive way, the results would likely be improved. We think, that for this specific task of finding similarities using graph-based deep learning models is not appropriate as with much simpler ML models we obtain more satisfying results. For what we have seen, it is not worth introducing deep learning to solve the classification task for the Open Data BCN repository, as the Random Forest approach provides very good performances. 47
7 Related Work In the field of deep learning, graph neural networks are receiving lots of interest recently [46, 25, 47]. These models are showing high capabilities for learning valuable representations from graphs, which are a source of data that is becoming more and more popular every day. Graphs are complex data structures rich in relation information that had hardly been tackled with deep learning. So far, graph neural networks have been applied to recommender systems [48], optimization frameworks [49], study of molecular dynamics [50] and many others. Among all the problems that can be solved with graph neural networks, in this work we focus in link prediction. When tackling link prediction in attributed graphs, neural networks can use both the node attributes and the graph edge structure to add potentially new edges. The standard and most common formulation of link prediction is the transductive one [51, 52]. In such framework, graph neural networks predicts new edges between nodes that already have connections with other nodesinthegraph. However, many applicationsrequire to tackleinductive linkprediction, where the nodes we are interested in finding edges are unlinked from the graph from which the model learns the edge structure [44]. For instance, in a social network we can leverage graph neural networks to predict new friendship connections for a given user taking into account its existing connections and its profile (attributes), which defines a transductive link prediction problem. However, if we wanted to recommend friendship connections to a new user who just registered we would not have information of any existing connections and therefore we could not exploit any learnt edge structure. For overcoming such limitation, Hao et.al.[44] implement two parallel encoders in a single graph neural networks together with an alignment system to rely on attribute information or edge structure information when one of the two is missing. Another very recent paper about inductive link prediction tackles this problem by proposing an efficient way to link the isolated nodes to the rest of the graph by using a K-Nearest Neighbours (KNN) algorithm to transform the inductive problem to a transducting one [45]. Also, in this thesis we used a profiling tool provided by NextiaJD system, but their proposal is much more than simply a profiling tool. In [43] they tackle a data discovery task: the problem of discovering joinable datasets at scale. They use profiles to approach the problem in order to avoid unscalable solutions offered by techniques based on index structures like comparison by hash or by value techniques. They also leverage on Spark framework, which offers a distributed system to extract profiles efficiently. They also define a novel notion of join quality, relying on the containment and cardinality proportion, which is capable to detect 5 different quality levels (None, poor, moderate, good and high). NextiaJD uses a predictive model based on a random forest classifier to efficiently rank candidate pairs of joinable attributes using the metric they defined. They run the model over distance vectors obtained by comparing each meta-feature of a normalization of the profiles with min-max and Z-score techniques. In the experiments presented we can see that NextiaJD obtains similar predictive performance than other hashbased methods with a lower amount of false positives and moreover it is able to scale-up to larger volumes of data thanks to the use of Apache parquet formats. 48
8 Conclusions and Future Work In this thesis we tackle the similarity task of data discovery in the Open Data BCN repository, which we formalized as classifying its datasets in five thematic areas. To this end, we hypothesized that representing the repository as a graph and using graph-based learning models such as graph neural networks, would be useful to exploit connections between similar datasets providing better results than more traditional methodologies. To validate our hypothesis we provided a Graph Convolutional Neural Network approach solving a link prediction task, that we later mapped into classification, and compared it with other ML and DL baseline methods. The results obtained by our approach are good, proving that it is possible to tackle data discovery tasks with graph-based models, but have not been able to overcome the baseline approaches. Nonetheless, some future work could be able to improve the results obtained by the GCNN making it more likely to outperform some of the baseline models presented. As discussed in Section 6.3.1, in the prediction phase the model is used to predict connections to nodes which are completely isolated from the other nodes of the graph, which is known as inductive link prediction. However, the model was trained to solve transductive link prediction tasks, where the nodes from which we predict new links are already linked to the graph. To overcome this issue, we should consider implementing one of the state of the art solutions proposed in [44, 45]. This way, the model would be able to find more suitable links for the disconnected nodes and the accuracy would increase. Although the approach we provided did not turn out to be the best way to find similarities in the Open Data BCN repository, we developed a fully fledged pipeline to solve data discovery tasks in a non-structured and heterogeneous environment, which can be used to solve tasks such as finding joins or unions. Hence, in the context of the project for the city council (i.e., An Automatic Data Discovery Approach to Enhance Barcelona’s Data Ecosystem), the methodology presented in this thesis can be used to approach the aforementioned tasks which are much more difficult to solve with traditional ML or DL models. The pipeline can also be more useful in the future when the repository will host more public data, as another limitation we encountered was the number of data available to train the models. As stated in Section 1.1, data integration tasks are often considered the most burdening aspect of data science. Throughout this thesis we had to engage a large data preparation and data cleaning process which consumed a noteworthy amount of our time. It turns out that dealing with Open repositories is not as comfortable as one could think as it is extremely time consuming to find a way to extract the data from it. In this thesis, to overcome this situation, we have developed a scraper which succeeded at efficiently downloading and tagging all datasets from Barcelona’s open data website. Hence, as an added value to the project, we render the scraper and the datasets we obtained with it, publishing them in the git repository of the project for all users interested in working with data from Open Data BCN’s portal. 49
Github Repository All the code generated throughout this thesis can be found at: https://github.com/dtim-upc/GCNN-Open-Data-BCN/. The repository is divided in 4 main folders. Data This folder contains the datasets extracted from the Open Data BCN portal after the cleaning step of Section 3.2.1. For storage reasons, Git does not allow to upload files heavier than 25MB, which is why, a few datasets could not be uploaded. The datasets are separated in folders denoting thematic areas exactly in the same way as we can find them in Barcelona’s website. Scripts This folder contains the scripts we mentioned in Section 3. We have the following: •1.scraper.py: Extracts datasets from the Open Data BCN’s website. •2.rename_datasets.py: Renames datasets to include their class labels. •3.clean_datasets.py: Cleans the datasets so they are compatible with the pofiling tool. •4.create_information_csv.py: Create a file with necessary information about the datasets in order to create their profiles. •5.profiling.scala: Creates profiles of the nominal attributes of the datasets. •6.numeric_profiling.py: Creates profiles of the numeric attributes of the datasets. •7.create_input_models.py: Prepares training and tests sets and a map of the edges we need to create the input graph for the GCNN method. Input for Models This folder hosts the files returned by the code 7.create_input_models.py, which are the ones required to train and test the models. It contains: •agg_profiles_train.csv & agg_profiles_test.csv: Profiles of the datasets used to train and test the models respectively. •map_datasets_train.JSON & map_datasets_test.JSON: Dictionary to identify which profile corresponds to which dataset in both the train and the test files. •map_of_edges_train.JSON: Adjacency matrix of the train set to construct the input graph for the GCNN model. Models This folder contains the python notebook hosting the models implemented in Sections 4 and 5. When running them you can obtain the results shown in 6. •Simpler_models_class_prediction.ipynb: Contains all models from Section 4. •GCNN_Class_Prediction.ipynb: Contains the GCNN approach explained in Section 5. There is alsothefinalmodel chosenwhich providestheresultsof Section6.2: model_class_prediction_final.pt 50
References [1] Davenport, Thomas H., and D. J. Patil. Data scientist: The sexiest job of the 21st century. Harvard Business Review 90, no. 10, (October 2012): 70–76. [2] Gil Press. Cleaning big data: Most time-consuming, least enjoyable data science task, survey says. Forbes, 2016. [3] Fatemeh Nargesian, Erkang Zhu, Renée J. Miller, Ken Q. Pu, and Patricia C. Arocena. Data lake management: Challenges and opportunities. Proc. VLDB Endow. 12, 12, (2019), 1986–1989. [4] Renée J. Miller, Fatemeh Nargesian, Erkang Zhu, Christina Christodoulakis, Ken Q. Pu, and Periklis Andritsos. Making open data transparent: Data discovery on open data. IEEE Data Eng. Bull., 41(2):59–70, 2018. [5] Christos Koutras, George Siachamis, Andra Ionescu, Kyriakos Psarakis, Jerry Brons, Marios Fragkoulis, Christoph Lofi, Angela Bonifati, and Asterios Katsifodimos. Valentine: Evaluating matching techniques for dataset discovery. arxiv, 2021. [6] Miller and R. J. Open data integration. Proc. VLDB Endow. 11, 12, page 2130–2139., (2018). [7] Mary Shacklett. How to tackle data discovery. The Republic, 2020. [8] Val Henson. An analysis of compare-by-hash. In HotOS, pages 13–18, 2003. [9] Dong Deng, Albert Kim, Samuel Madden, and Michael Stonebraker. Silkmoth: An efficient method for finding related sets with maximum matching constraints. arXiv preprint arXiv:1704.04738, 2017. [10] Erkang Zhu, Dong Deng, Fatemeh Nargesian, and Renée J Miller. Josie: Overlap set similarity search for finding joinable tables in data lakes. In Proceedings of the 2019 International Conference on Management of Data, pages 847–864, 2019. [11] Chuan Xiao, Wei Wang, Xuemin Lin, Jeffrey Xu Yu, and Guoren Wang. Efficient similarity joins for near-duplicate detection. ACM Transactions on Database Systems (TODS), 36(3):1– 41, 2011. [12] Andrei Z Broder. On the resemblance and containment of documents. In Proceedings. Compression and Complexity of SEQUENCES 1997 (Cat. No. 97TB100171), pages 21–29. IEEE, 1997. [13] Raul Castro Fernandez, Jisoo Min, Demitri Nava, and Samuel Madden. Lazo: A cardinality-based method for coupled estimation of jaccard similarity and containment. In 2019 IEEE 35th International Conference on Data Engineering (ICDE), pages 1190–1201. IEEE, 2019. [14] Yang Yang, Ying Zhang, Wenjie Zhang, and Zengfeng Huang. Gb-kmv: An augmented kmv sketch for approximate containment similarity search. In 2019 IEEE 35th International Conference on Data Engineering (ICDE), pages 458–469. IEEE, 2019. 51
[15] Erkang Zhu, Fatemeh Nargesian, Ken Q Pu, and Renée J Miller. Lsh ensemble: Internetscale domain search. arXiv preprint arXiv:1603.07410, 2016. [16] Chen Chen, Behzad Golshan, Alon Y Halevy, Wang-Chiew Tan, and AnHai Doan. Biggorilla: An open-source ecosystem for data preparation and integration. IEEE Data Eng. Bull., 41(2):10–22, 2018. [17] AnHai Doan, Pedro Domingos, and Alon Halevy. Learning to match the schemas of data sources: A multistrategy approach. Machine Learning, 50(3):279–301, 2003. [18] Mayank Kejriwal and Daniel P Miranker. Semi-supervised instance matching using boosted classifiers. In European semantic web conference, pages 388–402. Springer, 2015. [19] Javier Flores, Sergi Nadal, and Oscar Romero. Towards scalable data discovery. In Yannis Velegrakis, Demetris Zeinalipour-Yazti, Panos K. Chrysanthis, and Francesco Guerra, editors, Proceedings of the 24th International Conference on Extending Database Technology, EDBT 2021, Nicosia, Cyprus, March 23 - 26, 2021, pages 433–438. OpenProceedings.org, 2021. [20] Ignacio G Terrizzano, Peter M Schwarz, Mary Roth, and John E Colino. Data wrangling: The challenging yourney from the wild to the lake. In CIDR, 2015. [21] Defining open data. https://blog.okfn.org/2013/10/03/defining-open-data/. [22] Renée J. Miller, Fatemeh Nargesian, Erkang Zhu, Christina Christodoulakis, Ken Q. Pu, and Periklis Andritsos. Making open data transparent: Data discovery on open data. IEEE Data Eng. Bull., 41(2):59–70, 2018. [23] Muhan Zhang, Zhicheng Cui, Marion Neumann, and Yixin Chen. An end-to-end deep learning architecture for graph classification. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018. [24] Ines Chami, Sami Abu-El-Haija, Bryan Perozzi, Christopher Ré, and Kevin Murphy. Machine learning on graphs: A model and comprehensive taxonomy. arXiv preprint arXiv:2005.03675, 2020. [25] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018. [26] William L Hamilton, Rex Ying, and Jure Leskovec. Representation learning on graphs: Methods and applications. arXiv preprint arXiv:1709.05584, 2017. [27] Riccardo Cappuzzo, Paolo Papotti, and Saravanan Thirumuruganathan. Local embeddings for relational data integration. arXiv preprint arXiv:1909.01120, 2019. [28] Raul Castro Fernandez and Samuel Madden. Termite: a system for tunneling through heterogeneous data. In Proceedings of the Second International Workshop on Exploiting Artificial Intelligence Techniques for Data Management, pages 1–8, 2019. [29] Christos Koutras, Marios Fragkoulis, Asterios Katsifodimos, and Christoph Lofi. Rema: Graph embeddings-based relational schema matching. In EDBT/ICDT Workshops, 2020. 52