{"id":1882,"date":"2019-08-13T03:54:23","date_gmt":"2019-08-13T03:54:23","guid":{"rendered":"http:\/\/kusuaks7\/?p=1487"},"modified":"2024-05-02T16:20:34","modified_gmt":"2024-05-02T16:20:34","slug":"the-data-fabric-machine-learning-part-1-b-deep-learning-on-graphs","status":"publish","type":"post","link":"https:\/\/www.experfy.com\/blog\/ai-ml\/the-data-fabric-machine-learning-part-1-b-deep-learning-on-graphs\/","title":{"rendered":"The Data Fabric for Machine Learning Part 1-b \u2013 Deep Learning on Graphs"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"1882\" class=\"elementor elementor-1882\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-773ff400 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"773ff400\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-59b89131\" data-id=\"59b89131\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-72c97d92 elementor-widget elementor-widget-text-editor\" data-id=\"72c97d92\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tDeep learning on graphs is taking more importance by the day. Here I\u2019ll show the basics of thinking about machine learning and deep learning on graphs with the library Spektral and the platform MatrixDS.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6a73f95 elementor-widget elementor-widget-image\" data-id=\"6a73f95\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/2560\/1*blkpaGjw1VeTVfHYAjLphg.jpeg\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-31975b1 elementor-widget elementor-widget-text-editor\" data-id=\"31975b1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tDisclaimer: This is not the second part of the\u00a0<a href=\"https:\/\/towardsdatascience.com\/the-data-fabric-for-machine-learning-part-1-2c558b7035d7\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\">past <\/a>article on\u00a0the subject; it\u2019s a continuation of the first part putting the emphasis on deep learning. <a href=\"https:\/\/www.experfy.com\/blog\/the-data-fabric-for-machine-learning-part-1\">Read Part 1 here<\/a>.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b39ca46 elementor-widget elementor-widget-heading\" data-id=\"b39ca46\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\"><h3>Introduction<\/h3><\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-aacac9a elementor-widget elementor-widget-image\" data-id=\"aacac9a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*2ikKD0QxQM4ht93R\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-61bc834 elementor-widget elementor-widget-text-editor\" data-id=\"61bc834\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tWe are in the process of defining a new way of doing machine learning, focusing on a new paradigm, the data fabric.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c726d09 elementor-widget elementor-widget-text-editor\" data-id=\"c726d09\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\nIn the past article I gave my new definition of machine learning:\n<blockquote>Machine learning is the automatic process of discovering hidden insights in data fabric by using algorithms that are able to find those insights without being specifically programmed for that, to create models that solves a particular (or multiple) problem(s).<\/blockquote>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9e92ae4 elementor-widget elementor-widget-text-editor\" data-id=\"9e92ae4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tThe premise for understanding this it\u2019s that we have created a data fabric. For me, the best tool out there for me for doing that is Anzo as I mentioned in other articles.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-df366ef elementor-widget elementor-widget-image\" data-id=\"df366ef\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*v2nboJXUzRq9OmMM7LpjTA.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a3cd4e2 elementor-widget elementor-widget-text-editor\" data-id=\"a3cd4e2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p style=\"text-align: center;\"><span><a href=\"https:\/\/www.cambridgesemantics.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.cambridgesemantics.com\/<\/a><\/span><\/p>\nYou can build something called \u201cThe Enterprise Knowledge Graph\u201d with Anzo, and of course, create your data fabric.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fbef90b elementor-widget elementor-widget-text-editor\" data-id=\"fbef90b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tBut now I want to focus on a topic inside machine learning, deep learning. In\u00a0<a href=\"https:\/\/becominghuman.ai\/deep-learning-made-easy-with-deep-cognition-403fbe445351\" target=\"_blank\" rel=\"noopener noreferrer\">another article<\/a>\u00a0I gave a definition of deep learning:\n<blockquote>Deep learning is a specific subfield of machine learning, a new take on learning representations from data which puts an emphasis on learning successive\u00a0<strong>\u201clayers<\/strong>\u201d [neural nets] of increasingly meaningful representations.<\/blockquote>\nHere we\u2019ll talk about a combination of deep learning and graph theory, and see how it can help move our research forward.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6152475 elementor-widget elementor-widget-heading\" data-id=\"6152475\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\"><h3>Objectives<\/h3><\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-10c7ba1 elementor-widget elementor-widget-text-editor\" data-id=\"10c7ba1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<b>General<\/b>\n<blockquote>Set the basis of doing deep learning on the data\u00a0fabric.<\/blockquote>\n<b>Specifics<\/b>\n<ul>\n \t<li>Describe the basics of deep learning on graphs.<\/li>\n \t<li>Explore the library Spektral.<\/li>\n \t<li>Validate the possibility of doing deep learning on the data fabric.<\/li>\n<\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-152bb6c elementor-widget elementor-widget-heading\" data-id=\"152bb6c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\"><h3>Main Hypothesis<\/h3><\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-53793aa elementor-widget elementor-widget-text-editor\" data-id=\"53793aa\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tIf we can construct a\u00a0<strong>data fabric<\/strong>\u00a0that supports all the data in the company, the\u00a0<strong>automatic process<\/strong>\u00a0of discovering insights through\u00a0<strong>learning increasingly meaningful representations<\/strong>\u00a0from data using\u00a0<strong>neural nets<\/strong>\u00a0(deep learning) can run inside the data fabric.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9b1a99b elementor-widget elementor-widget-heading\" data-id=\"9b1a99b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\"><h3>Section 1. Deep learning on\u00a0graphs?<\/h3><\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f46d567 elementor-widget elementor-widget-image\" data-id=\"f46d567\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*PMxUTkuIlREthZ1_.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-95eabc1 elementor-widget elementor-widget-text-editor\" data-id=\"95eabc1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p style=\"text-align: center;\"><span><a href=\"https:\/\/tkipf.github.io\/graph-convolutional-networks\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/tkipf.github.io\/graph-convolutional-networks\/<\/a><\/span><\/p>\nNormally we create neural nets using tensors, but remember that we can also define a tensor with a matrix and\u00a0<a href=\"https:\/\/towardsdatascience.com\/graph-databases-whats-the-big-deal-ec310b1bc0ed\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\">graphs<\/a>\u00a0can be define through matrices.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9a648b6 elementor-widget elementor-widget-text-editor\" data-id=\"9a648b6\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tIn the documentation of the library\u00a0<a href=\"https:\/\/danielegrattarola.github.io\/spektral\/data\/\" target=\"_blank\" rel=\"noopener noreferrer\">Spektral<\/a>\u00a0they state that a graph is generally represented by three matrices:\n<ul>\n \t<li>A\u2208{0,1}#k8SjZc9Dxk(N\u00d7N): a binary adjacency matrix, where A_<em>ij<\/em>=1 if there is a connection between nodes<em>\u00a0i\u00a0<\/em>and\u00a0<em>j<\/em>, and A_<em>ij<\/em>=0 otherwise;<\/li>\n \t<li>X\u2208\u211d#k8SjZc9Dxk(N\u00d7F): a matrix encoding node attributes (or features), where an FF-dimensional attribute vector is associated to each node;<\/li>\n \t<li>E\u2208\u211d#k8SjZc9Dxk(N\u00d7N\u00d7S): a matrix encoding edge attributes, where an\u00a0<em>S<\/em>-dimensional attribute vector is associated to each edge.<\/li>\n<\/ul>\nI won&#8217;t go into details here but if you want a more complete overview on deep learning on graphs, check out\u00a0<a href=\"https:\/\/medium.com\/@tobiasskovgaardjepsen\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\">Tobias Skovgaard Jepsen<\/a>\u2019s article:\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-beb3396 elementor-widget elementor-widget-text-editor\" data-id=\"beb3396\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/towardsdatascience.com\/how-to-do-deep-learning-on-graphs-with-graph-convolutional-networks-7d2250723780\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>How to do Deep Learning on Graphs with Graph Convolutional Networks<\/strong>\n<em>Part 1: A High-Level Introduction to Graph Convolutional Networks<\/em>\u00a0towardsdatascience.com<\/a>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ccb69bd elementor-widget elementor-widget-text-editor\" data-id=\"ccb69bd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tThe important part here is the concept of Graph Neural Networks (GNN).\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-55aa1a4 elementor-widget elementor-widget-text-editor\" data-id=\"55aa1a4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<b>Graph Neural Networks\u00a0(GNN)<\/b>\n\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0669f53 elementor-widget elementor-widget-image\" data-id=\"0669f53\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1200\/1*kCcqLTz17w6oVU0UTmRD6g.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-545e4a0 elementor-widget elementor-widget-text-editor\" data-id=\"545e4a0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tThe idea of GNN is simple: to encode structural information of the graph, each node v_<em>i<\/em>\u00a0can be represented by a low-dimensional state vector s_<em>i<\/em>\u00a0, 1 \u2264\u00a0<em>i<\/em>\u2264 N (Remember vectors can be thought as rank 1 tensors, and tensors can be represented with matrices).\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b6e028b elementor-widget elementor-widget-text-editor\" data-id=\"b6e028b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tThe tasks for learning deep model on graphs can be broadly categorized into two domains:\n<ul>\n \t<li><strong>Node-focused tasks:\u00a0<\/strong>the tasks are associated with individual nodes in the graph. Examples include node classification, link prediction and node recommendation.<\/li>\n \t<li><strong>Graph-focused tasks:<\/strong>\u00a0the tasks are associated with the whole graph. Examples includes graph classification, estimating certain properties of the graph or generating graphs.<\/li>\n<\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-61bc05f elementor-widget elementor-widget-heading\" data-id=\"61bc05f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\"><h3>Section 2. Deep Learning with\u00a0Spektral<\/h3><\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cca77a1 elementor-widget elementor-widget-image\" data-id=\"cca77a1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*L9nmD2lvITEpQFar.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a7fbe0e elementor-widget elementor-widget-text-editor\" data-id=\"a7fbe0e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\n<p style=\"text-align: center;\"><span><a href=\"https:\/\/github.com\/danielegrattarola\/spektral\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/danielegrattarola\/spektral\/<\/a><\/span><\/p>\nThe author defined Spektral as a framework for relational representation learning, built in Python and based on the Keras API.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-da5ada2 elementor-widget elementor-widget-text-editor\" data-id=\"da5ada2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<b>Installation<\/b>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c185463 elementor-widget elementor-widget-text-editor\" data-id=\"c185463\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tWe will be using\u00a0<a href=\"https:\/\/matrixds.com\/\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\">MatrixDS<\/a>\u00a0as the tool or running our codes. Remember than in\u00a0<a href=\"https:\/\/www.cambridgesemantics.com\/product\/\" target=\"_blank\" rel=\"noopener noreferrer\">Anzo<\/a>\u00a0you will be able to take this code and run in it there too.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-edba67f elementor-widget elementor-widget-text-editor\" data-id=\"edba67f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tThe first thing you need to do is to fork the MatrixDS project:\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-17b40e7 elementor-widget elementor-widget-text-editor\" data-id=\"17b40e7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\n<a href=\"https:\/\/community.platform.matrixds.com\/community\/project\/5c6ae7c8c1b06ba1e18f2a6e\/files\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\"><strong>MatrixDS | The Data Project Workbench<\/strong>\n<em>MatrixDS is a place to build, share and manage data projects at any scale.<\/em>community.platform.matrixds.com<\/a>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7b787d0 elementor-widget elementor-widget-text-editor\" data-id=\"7b787d0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tClick on:\n\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-960719f elementor-widget elementor-widget-image\" data-id=\"960719f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*hHi396lQHDjTDpodph-XxQ.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-606e9e2 elementor-widget elementor-widget-text-editor\" data-id=\"606e9e2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tyou will have the library installed and everything working\u00a0:).\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0d7c976 elementor-widget elementor-widget-text-editor\" data-id=\"0d7c976\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tIf you are running this outside remember that the framework is tested for Ubuntu 16.04 and 18.04, and you should install:\n<pre>sudo apt install graphviz libgraphviz-dev libcgraph6<\/pre>\nAnd then install the library with:\n<pre>pip install spektral<\/pre>\n&nbsp;\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b8d841a elementor-widget elementor-widget-text-editor\" data-id=\"b8d841a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<b>Data representation<\/b>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ed274eb elementor-widget elementor-widget-text-editor\" data-id=\"ed274eb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\nIn Spektral, some layers and functions are implemented to work on a single graph, while others consider sets (i.e., datasets or batches) of graphs.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d034c26 elementor-widget elementor-widget-text-editor\" data-id=\"d034c26\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tThe framework distinguishes between three main\u00a0<em>modes<\/em>\u00a0of operation:\n<ul>\n \t<li><strong>single<\/strong>, where we consider a single graph, with its topology and attributes;<\/li>\n \t<li><strong>batch<\/strong>, where we consider a collection of graphs, each with its own topology and attributes;<\/li>\n \t<li><strong>mixed<\/strong>, where we consider a graph with fixed topology, but a collection of different attributes; this can be seen as a particular case of the batch mode (i.e., the case where all adjacency matrices are the same) but is treated separately for computational reasons.<\/li>\n<\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d9f15ce elementor-widget elementor-widget-image\" data-id=\"d9f15ce\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/437\/1*bz1_Mhb2eyU5D948vspgHQ.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8ecd1da elementor-widget elementor-widget-text-editor\" data-id=\"8ecd1da\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p style=\"text-align: center;\"><\/p>\nFor example, if we run\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><span style=\"font-family: courier new,courier,monospace;\">from spektral.datasets import citation\nadj, node_features, edge_features, _, _, _, _, _ = citation.load_data(&#8216;cora&#8217;)<\/span><\/div>\n&nbsp;\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-376a615 elementor-widget elementor-widget-text-editor\" data-id=\"376a615\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tWe will be loading the data in sigle mode:\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-663fd5b elementor-widget elementor-widget-text-editor\" data-id=\"663fd5b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tOur Adjacency matrix is:\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><span style=\"font-family: courier new,courier,monospace;\">In [3]: adj.shape\nOut[3]: (2708, 2708)<\/span><\/div>\n&nbsp;\n\nOut note attributes are:\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><span style=\"font-family: courier new,courier,monospace;\">In [3]: node_attributes.shape\nOut[3]: (2708, 2708)<\/span><\/div>\n&nbsp;\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-529c400 elementor-widget elementor-widget-text-editor\" data-id=\"529c400\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tAnd our edge attributes are:\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><span style=\"font-family: courier new,courier,monospace;\">In [3]: edge_attributes.shape\nOut[3]: (2708, 7)<\/span><\/div>\n&nbsp;\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-93fed14 elementor-widget elementor-widget-text-editor\" data-id=\"93fed14\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\n<b>Semisupervised classification with Graph Attention layers\u00a0(GAT)<\/b>\n<blockquote>Disclaimer: I\u2019m assuming that you know Keras from\u00a0here.<\/blockquote>\nFor more detail and code view:\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-dff89e3 elementor-widget elementor-widget-text-editor\" data-id=\"dff89e3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/community.platform.matrixds.com\/community\/project\/5c6ae7c8c1b06ba1e18f2a6e\/files\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\"><strong>MatrixDS | The Data Project Workbench<\/strong>\n<em>MatrixDS is a place to build, share and manage data projects at any scale.<\/em>community.platform.matrixds.com<\/a>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4d9ada0 elementor-widget elementor-widget-text-editor\" data-id=\"4d9ada0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tA GAT is novel neural network architectures that operate on graph-structured data, leveraging masked self-attentional layers. In Spektral the\u00a0<em>GraphAttention<\/em>\u00a0layer computes a convolution similar to\u00a0<code>layers.GraphConv<\/code>, but uses the attention mechanism to weight the adjacency matrix instead of using the normalized Laplacian.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b351ed8 elementor-widget elementor-widget-text-editor\" data-id=\"b351ed8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tThe way they work is by stacking layers in which nodes are able to attend over their neighborhoods\u2019 features, that enables (implicitly) specifying different weights to different nodes in a neighborhood, without requiring any kind of costly matrix operation (such as inversion) or depending on knowing the graph structure upfront.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5b82bfb elementor-widget elementor-widget-image\" data-id=\"5b82bfb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*7__z-bYUg-o-ito9q0imkA.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-15d79c6 elementor-widget elementor-widget-text-editor\" data-id=\"15d79c6\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p style=\"text-align: center;\"><a href=\"https:\/\/arxiv.org\/pdf\/1812.04202.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/arxiv.org\/pdf\/1812.04202.pdf<\/a>. The attention mechanism employed by the model, parametrized by a weight vector, applying a LeakyReLU activation.<\/p>\nThe model we will use is simple enough:\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><span style=\"font-family: courier new,courier,monospace;\"># Layers\ndropout_1 = Dropout(dropout_rate)(X_in)\ngraph_attention_1 = GraphAttention(gat_channels,\nattn_heads=n_attn_heads,\nattn_heads_reduction=&#8217;concat&#8217;,\ndropout_rate=dropout_rate,\nactivation=&#8217;elu&#8217;,\nkernel_regularizer=l2(l2_reg),\nattn_kernel_regularizer=l2(l2_reg))([dropout_1, A_in])\ndropout_2 = Dropout(dropout_rate)(graph_attention_1)\ngraph_attention_2 = GraphAttention(n_classes,\nattn_heads=1,\nattn_heads_reduction=&#8217;average&#8217;,\ndropout_rate=dropout_rate,\nactivation=&#8217;softmax&#8217;,\nkernel_regularizer=l2(l2_reg),\nattn_kernel_regularizer=l2(l2_reg))([dropout_2, A_in])<\/span><\/div>\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><\/div>\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><span style=\"font-family: courier new,courier,monospace;\"># Build model\nmodel = Model(inputs=[X_in, A_in], outputs=graph_attention_2)\noptimizer = Adam(lr=learning_rate)\nmodel.compile(optimizer=optimizer,\nloss=&#8217;categorical_crossentropy&#8217;,\nweighted_metrics=[&#8216;acc&#8217;])\nmodel.summary()<\/span><\/div>\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><span style=\"font-family: courier new,courier,monospace;\"># Callbacks\nes_callback = EarlyStopping(monitor=&#8217;val_weighted_acc&#8217;, patience=es_patience)\ntb_callback = TensorBoard(log_dir=log_dir, batch_size=N)\nmc_callback = ModelCheckpoint(log_dir + &#8216;best_model.h5&#8242;,\nmonitor=&#8217;val_weighted_acc&#8217;,\nsave_best_only=True,\nsave_weights_only=True)<\/span><\/div>\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><\/div>\n&nbsp;\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-30dae1b elementor-widget elementor-widget-text-editor\" data-id=\"30dae1b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\nBtw, the model is quite big:\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-de6a758 elementor-widget elementor-widget-text-editor\" data-id=\"de6a758\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\">___________________________________________________________________________________\nLayer (type)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Output Shape\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Param #\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Connected to\n===============================================================================\ninput_1 (InputLayer)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0(None, 1433)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0\n___________________________________________________________________________________\ndropout_1 (Dropout)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (None, 1433)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 input_1[0][0]\n___________________________________________________________________________________\ninput_2 (InputLayer)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (None, 2708)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a00\n___________________________________________________________________________________\ngraph_attention_1 (GraphAttenti\u00a0 \u00a0 \u00a0 \u00a0 \u00a0(None, 64)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a091904\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0dropout_1[0][0]\ninput_2[0][0]\n___________________________________________________________________________________\ndropout_18 (Dropout)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0(None, 64)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a00\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 graph_attention_1[0][0]\n___________________________________________________________________________________\ngraph_attention_2 (GraphAttenti\u00a0\u00a0 \u00a0 \u00a0 \u00a0 (None, 7)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0\u00a0 469\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 dropout_18[0][0]\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-584d686 elementor-widget elementor-widget-text-editor\" data-id=\"584d686\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tinput_2[0][0]\n===============================================================================\nTotal params: 92,373\nTrainable params: 92,373\nNon-trainable params: 0<\/div>\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><\/div>\n&nbsp;\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5fc16c8 elementor-widget elementor-widget-text-editor\" data-id=\"5fc16c8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tSo if you don\u2019t have that much power lower the number of epochs an play with it. Remember that is very easy to upgrade your\u00a0<a href=\"https:\/\/matrixds.com\/pricing\/\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\">MatrixDS account<\/a>.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fbba270 elementor-widget elementor-widget-text-editor\" data-id=\"fbba270\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tThen we train it (this may take some hours if you don\u2019t have enough power):\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><span style=\"font-family: courier new,courier,monospace;\"># Train model\nvalidation_data = ([node_features, adj], y_val, val_mask)\nmodel.fit([node_features, adj],\ny_train,\nsample_weight=train_mask,\nepochs=epochs,\nbatch_size=N,\nvalidation_data=validation_data,\nshuffle=False,\u00a0 # Shuffling data means shuffling the whole graph\ncallbacks=[es_callback, tb_callback, mc_callback])<\/span><\/div>\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><\/div>\n&nbsp;\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-45634bc elementor-widget elementor-widget-text-editor\" data-id=\"45634bc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tGet the best model:\n<pre>model.load_weights(log_dir + 'best_model.h5')<\/pre>\n&nbsp;\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-451e1df elementor-widget elementor-widget-text-editor\" data-id=\"451e1df\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tAnd evaluate it:\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><span style=\"font-family: courier new,courier,monospace;\">print(&#8216;Evaluating model.&#8217;)\neval_results = model.evaluate([node_features, adj],\ny_test,\nsample_weight=test_mask,\nbatch_size=N)\nprint(&#8216;Done.\n&#8216;\n&#8216;Test loss: {}\n&#8216;\n&#8216;Test accuracy: {}&#8217;.format(*eval_results))<\/span><\/div>\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><\/div>\n&nbsp;\n\nSee more in the MatrixDS project:\n\n<a href=\"https:\/\/community.platform.matrixds.com\/community\/project\/5c6ae7c8c1b06ba1e18f2a6e\/files\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\"><strong>MatrixDS | The Data Project Workbench<\/strong>\n<em>MatrixDS is a place to build, share and manage data projects at any scale.<\/em>community.platform.matrixds.com<\/a>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e5912f9 elementor-widget elementor-widget-heading\" data-id=\"e5912f9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\"><h3>Section 3. Where does this fit in the data\u00a0fabric?<\/h3>\n<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e860814 elementor-widget elementor-widget-text-editor\" data-id=\"e860814\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tIf you remember from the last part that if we have a data fabric:\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6003ae8 elementor-widget elementor-widget-image\" data-id=\"6003ae8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*b04zqRXIGDWoAdUsKiiL1w.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9e39680 elementor-widget elementor-widget-text-editor\" data-id=\"9e39680\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tAn insight can be thought of as a\u00a0<strong>dent<\/strong>\u00a0in it:\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d84a29b elementor-widget elementor-widget-image\" data-id=\"d84a29b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*h0eLec-nM_Qn7UEFW4PoRw.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f0a1ab0 elementor-widget elementor-widget-text-editor\" data-id=\"f0a1ab0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tAnd if you are following this tutorial in the MatrixDS platform, you realized that the data we are using is not a simple CS, but we provided the library with:\n<ul>\n \t<li>an N by N adjacency matrix (N is the number of nodes),<\/li>\n \t<li>an N by D feature matrix (D is the number of features per node), and<\/li>\n \t<li>an N by E binary label matrix (E is the number of classes).<\/li>\n<\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-52e83cc elementor-widget elementor-widget-text-editor\" data-id=\"52e83cc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tAnd that was stored is a series of files:\n<div style=\"background: #eee; border: 1px solid #ccc; padding: 5px 10px;\"><span style=\"font-family: courier new,courier,monospace;\">ind.dataset_str.x =&gt; the feature vectors of the training instances as scipy.sparse.csr.csr_matrix object;\u00a0\u00a0\u00a0 ind.dataset_str.tx =&gt; the feature vectors of the test instances as scipy.sparse.csr.csr_matrix object;\u00a0\u00a0\u00a0 ind.dataset_str.allx =&gt; the feature vectors of both labeled and unlabeled training instances\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (a superset of ind.dataset_str.x) as scipy.sparse.csr.csr_matrix object;\u00a0\u00a0\u00a0 ind.dataset_str.y =&gt; the one-hot labels of the labeled training instances as numpy.ndarray object;\u00a0\u00a0\u00a0 ind.dataset_str.ty =&gt; the one-hot labels of the test instances as numpy.ndarray object;\u00a0\u00a0\u00a0 ind.dataset_str.ally =&gt; the labels for instances in ind.dataset_str.allx as numpy.ndarray object;\u00a0\u00a0\u00a0 ind.dataset_str.graph =&gt; a dict in the format {index: [index_of_neighbor_nodes]} as collections.defaultdict\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 object;\u00a0\u00a0\u00a0 ind.dataset_str.test.index =&gt; the indices of test instances in graph, for the inductive setting as list object.<\/span><\/div>\n&nbsp;\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e784a21 elementor-widget elementor-widget-text-editor\" data-id=\"e784a21\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tSo this data lives in a graph. And what we did was loading that data to the library. Actually, you can transform your data from and to NetworkX, numpy and sdf format in the library.\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-926d2a2 elementor-widget elementor-widget-text-editor\" data-id=\"926d2a2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\nThis means, that if we are storing our data in a data fabric, we have our knowledge-graph so we already have a lot of these features, what we have is to find a way of connecting it with the library. That\u2019s the tricky part right now.\n<blockquote>And then we can start finding insights in your data fabrics through the process of running deep learning algorithms on the graphs inside of\u00a0it.<\/blockquote>\nThe interesting part here is that there could be ways of running these algorithms in the graph itself, and for that we need to be able to build models with data stored\u00a0<em>inherently\u00a0<\/em>in the graph\u2019s structure, there\u2019s a very interesting approach for that with Neo4j by\u00a0<a href=\"https:\/\/medium.com\/@lauren.shin\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\">Lauren Shin<\/a>\u00a0here:\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3f59ba9 elementor-widget elementor-widget-text-editor\" data-id=\"3f59ba9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/towardsdatascience.com\/graphs-and-ml-multiple-linear-regression-c6920a1f2e70\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\"><strong>Graphs and ML: Multiple Linear Regression<\/strong>\n<em>Same neo4j linear regression procedures, now unlimited independent variables! More functionality without additional\u2026<\/em>\u00a0towardsdatascience.com<\/a>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e3c90c9 elementor-widget elementor-widget-text-editor\" data-id=\"e3c90c9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tBut it\u2019s also a work in progress. I imagine the process to be something like this:\n\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4d55a52 elementor-widget elementor-widget-image\" data-id=\"4d55a52\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/1*h0eLec-nM_Qn7UEFW4PoRw.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-929c5c6 elementor-widget elementor-widget-text-editor\" data-id=\"929c5c6\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tMeaning that the neural net could live inside the data fabric, and the algorithms will be running with the resources inside it.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-61880ff elementor-widget elementor-widget-text-editor\" data-id=\"61880ff\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tOne important thing I\u2019m not even mentioning here is the concept of\u00a0<strong>non-euclidean data\u00a0<\/strong>but I\u2019ll go there later.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a9ca2cb elementor-widget elementor-widget-heading\" data-id=\"a9ca2cb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h3>Conclusions<\/h3><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-04738f9 elementor-widget elementor-widget-text-editor\" data-id=\"04738f9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tIt\u2019s possible to run deep learning algorithms on the data fabric by deploying graph neural nets models for the graph data we have if we can connect the knowledge-graph with the Spektral (or other) library.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-999e766 elementor-widget elementor-widget-text-editor\" data-id=\"999e766\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tBesides standard graph inference tasks such as node or graph classification, graph-based deep learning methods have also been applied to a wide range of disciplines, such as modeling social influence, recommendation systems, chemistry, physics, disease or drug prediction, natural language processing (NLP), computer vision, traffic forecasting, program induction and solving graph-based NP problems. See\u00a0<a href=\"https:\/\/arxiv.org\/pdf\/1812.04202.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/arxiv.org\/pdf\/1812.04202.pdf<\/a>.\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-dd667a8 elementor-widget elementor-widget-text-editor\" data-id=\"dd667a8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\nThe applications are endless, this is the beginning of a new exciting era. Stay tuned for more\u00a0\ud83d\ude42\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>It&rsquo;s possible to run deep learning algorithms on the data fabric by deploying graph neural nets models for the graph data we have, if we can connect the knowledge-graph with the Spektral (or other) library. Besides standard graph inference tasks such as node or graph classification, graph-based deep learning methods have also been applied to a wide range of disciplines, such as modeling social influence, recommendation systems, chemistry, physics, disease or drug prediction, natural language processing (NLP), computer vision, traffic forecasting, program induction and solving graph-based NP problems.<\/p>\n","protected":false},"author":252,"featured_media":3613,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[183],"tags":[92],"ppma_author":[2881],"class_list":["post-1882","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-ml","tag-machine-learning"],"authors":[{"term_id":2881,"user_id":252,"is_guest":0,"slug":"favio-vazquez","display_name":"Favio V\u00e1zquez","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","user_url":"","last_name":"V\u00e1zquez","first_name":"Favio","job_title":"","description":"<a href=\"https:\/\/towardsdatascience.com\/@favio.vazquezp?source=post_header_lockup\">Favio V&aacute;zquez<\/a>, physicist and computer engineer, is Data Scientist at <a href=\"http:\/\/www.bbvadata.com\/\">BBVA Data &amp; Analytics<\/a>. He works on Big Data, Data Science, Machine Learning and Computational Cosmology. Since 2015, he&#039;s been part of the Apache Spark collaboration, with some minor bug fixes, and improvement of documentation."}],"_links":{"self":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts\/1882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/users\/252"}],"replies":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/comments?post=1882"}],"version-history":[{"count":4,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts\/1882\/revisions"}],"predecessor-version":[{"id":36840,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts\/1882\/revisions\/36840"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/media\/3613"}],"wp:attachment":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/media?parent=1882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/categories?post=1882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/tags?post=1882"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=1882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}