{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "Maxime Labonne",
  "title_listed": "GIN: How to Design the Most Powerful Graph Neural Network",
  "keywords": "GNN,GIN,图分类",
  "domain": "机器学习",
  "content_type": "深度技术解析",
  "is_paid_flag": "部分免费/会员墙",
  "url": "https://towardsdatascience.com/how-to-design-the-most-powerful-graph-neural-network-3d18b07a6e66/",
  "publish_date": "2022-04",
  "corpus_stage": "预训练/SFT",
  "notes": "",
  "id": "5c74e8467052",
  "collected_at": "2026-10-01T22:04:57",
  "title": "GIN: How to Design the Most Powerful Graph Neural Network | Towards Data Science",
  "body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Programming](https://towardsdatascience.com/category/programming/)\n# GIN: How to Design the Most Powerful Graph Neural Network\nGraph classification with Graph Isomorphism Networks\n[Maxime Labonne](https://towardsdatascience.com/author/mlabonne/)\nApril 27, 20229 min read\n![Image by author](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1X13RjfsrTf9L1HhqBUt1sg.png)\nImage by author\nGraph Neural Networks are not limited to classifying nodes.\nOne of the most popular applications is **graph classification**. This is a common task when dealing with molecules: they are represented as graphs and features about each atom (node) can be used to predict the behavior of the entire molecule.\nHowever, GNNs only learn node embeddings. How to combine them in order to produce an entire **graph embedding**? In this article, we will:\n  * See a new type of layer, called \"**global pooling** \", to combine node embeddings;\n  * Introduce a new architecture called **Graph Isomorphism Network** (GIN), designed by [Xu et al.](https://arxiv.org/abs/1810.00826v3) in 2018.\n\n\nWe'll detail the advantages of GIN in terms of **discriminative power** compared to a GCN or GraphSAGE, and its connection to the Weisfeiler-Lehman test. Beyond its powerful aggregator, GIN brings exciting takeaways about GNNs in general.\nYou can run the code with the following [Google Colab notebook](https://colab.research.google.com/drive/1b6SWugNKnxsI0L9auX1zwszlXf3rRZyS?usp=sharing).\nLearn this step by step with the interactive [Computer Science](https://roadmap.sh/computer-science) and [Machine Learning](https://roadmap.sh/machine-learning) roadmaps.\n## 🌐 I. PROTEINS dataset\n![3D plot of a protein \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1sk7hX7GKcVqepVQCfOTduw.png)\n3D plot of a protein (image by author)\n[PROTEINS](https://chrsmrrs.github.io/datasets/docs/datasets/)¹ is a popular dataset in bioinformatics. It is a collection of **1113 graphs** representing proteins, where nodes are amino acids. Two nodes are connected by an edge when they are close enough (< 0.6 nanometers). The goal is to classify each protein as an **enzyme** or **not**.\nEnzymes are a particular type of **proteins** that act as catalysts to speed up chemical reactions in the cell. They are essential for digestion (e.g., lipases), respiration (e.g., oxidases), and other crucial functions of the human body. They are also used in commercial applications, like the production of antibiotics.\nThis dataset is also available on TUDataset¹ and implemented in PyTorch Geometric.\npython\n\n```\nfrom torch_geometric.datasets import TUDataset\n\ndataset = TUDataset(root='.', name='PROTEINS').shuffle()\n\n# Print information about the dataset\nprint(f'Dataset: {dataset}')\nprint('-------------------')\nprint(f'Number of graphs: {len(dataset)}')\nprint(f'Number of nodes: {dataset[0].x.shape[0]}')\nprint(f'Number of features: {dataset.num_features}')\nprint(f'Number of classes: {dataset.num_classes}')\n```\n\ntext\n\n```\nDataset: PROTEINS(1113)\n----------------------\nNumber of graphs: 1113\nNumber of nodes: 23\nNumber of features: 3\nNumber of classes: 2\n```\n\nI'm not a biochemist so I'm curious about these proteins. Let's plot one as a graph to see what it looks like:\n![3D plot of a protein with matplotlib \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1gVrJo6SkZbVoFKZs76rr7A.png)\n3D plot of a protein with matplotlib (image by author)\nThe previous 3D structure is **randomly generated** : obtaining the correct 3D representation is a problem so difficult it's the whole point of [AlphaFold](https://alphafold.ebi.ac.uk/).\nGraphs are not the only way to represent molecules. The simplified molecular-input line-entry system (**SMILES**) is another popular method, which uses a line (string) notation. It is obtained by printing the nodes encountered in a depth-first tree traversal of a slightly modified molecular graph.\nResearchers often use this representation when working with molecules or chemical compounds. Fortunately for us, the PROTEINS dataset is **already encoded** in the form of graphs. Otherwise, we could have to translate the SMILES strings into `networkx` graphs.\nIt doesn't mean we'll directly feed the PROTEINS dataset to our GNN. If [GraphSAGE](https://mlabonne.github.io/blog/graphsage/) taught us anything, it's that **mini-batching is incredibly efficient**. It is now an indispensable tool whenever we implement a GNN.\npython\n\n```\nfrom torch_geometric.loader import DataLoader\n\n# Create training, validation, and test sets\ntrain_dataset = dataset[:int(len(dataset)*0.8)]\nval_dataset   = dataset[int(len(dataset)*0.8):int(len(dataset)*0.9)]\ntest_dataset  = dataset[int(len(dataset)*0.9):]\n\n# Create mini-batches\ntrain_loader = DataLoader(train_dataset, batch_size=64, shuffle=True)\nval_loader = DataLoader(val_dataset, batch_size=64, shuffle=True)\ntest_loader = DataLoader(test_dataset, batch_size=64, shuffle=False)\n```\n\ntext\n\n```\nTraining set   = 890 graphs (14 subgraphs)\nValidation set = 111 graphs (2 subgraphs)\nTest set       = 112 graphs (2 subgraphs)\n```\n\nPROTEINS is not a huge dataset, but mini-batching will **s** peed up the training nonetheless. We could use a GCN or a GAT, but there's a new architecture I'd like to introduce: the **Graph Isomorphism Network**.\n## 🍾 II. Graph Isomorphism Network (GIN)\nGIN was designed by researchers trying to maximize **** th** e representational (or discriminative) powe**r of a GNN. But how do you define a \"representational power\"?\n## A. Weisfeiler-Lehman test\nA way to characterize the \"power\" of a GNN is to use the Weisfeiler-Lehman (WL) graph isomorphism test. [Isomorphic graphs](https://en.wikipedia.org/wiki/Graph_isomorphism) mean that they have the **same structure** : identical connections but a permutation of nodes. The WL test is able to tell if two graphs are non-isomorphic, but it cannot guarantee that they are isomorphic.\n![Two isomorphic graphs \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/18OQ8kcwzuYT0_h_ukENcNg.png)\nTwo isomorphic graphs (image by author)\nThis might not seem like much, but it can be **extremely difficult** to tell two large graphs apart. In fact, this problem is not known **** to be solvable in polynomial time, nor to be NP-complete. It might even be somewhere in between, in the computational complexity class [NP-intermediate](https://en.wikipedia.org/wiki/Graph_isomorphism_problem) (if it only exists).\nOkay, but how is it related to GNNs? Some researchers in graph learning noticed that **this test and the way GNNs learn are oddly similar**. In the WL test,\n  1. Every node starts with the **same label** ;\n  2. Labels from neighboring nodes are aggregated and **hashed** to produce a new label;\n  3. The previous step is repeated until the labels **stop changing**.\n\n\nIf you're interested in the WL test, I would recommend [this blog post](https://davidbieber.com/post/2019-05-10-weisfeiler-lehman-isomorphism-test/) by David Bieber and [this article](https://towardsdatascience.com/expressive-power-of-graph-neural-networks-and-the-weisefeiler-lehman-test-b883db3c7c49) by [Michael Bronstein](https://towardsdatascience.com/how-to-design-the-most-powerful-graph-neural-network-3d18b07a6e66/None).\nNot only this test is similar to how feature vectors are aggregated in GNNs, but its ability to tell graphs apart makes it **more powerful** than a lot of architectures, including GCNs and GraphSAGE. This is what inspired [Xu et al.](https://arxiv.org/abs/1810.00826v3)² to design a new aggregator that they proved to be as good as the WL test.\n## B. One aggregator to rule them all\nTo be as good as the WL test, this new aggregator must produce **different node embeddings** when dealing with non-isomorphic graphs.\nWe'll skip the math-heavy part of the paper, but the solution they found is to use two injective functions. Which ones? We don't know, we can just learn them with an MLP!\n  * With GATs, we used a neural network to learn the **best weighting factors** for a given task;\n  * With GINs, we now learn the **approximation of two injective functions** thanks to the [Universal Approximation Theorem](https://en.wikipedia.org/wiki/Universal_approximation_theorem).\n\n\nHere's how to calculate the hidden vector of a particular node _i_ with GIN:\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1jK-37UeXyUo6l0lnMuCpjA.png)\nIn this formula, ɛ determines the **importance of the target node** compared to its neighbors (it has the same importance if ɛ = 0). It can be a learnable parameter or a fixed scalar.\nNote that we talk about MLPs to highlight the fact that there is more than one layer. According to the authors, one layer is **not sufficient** for graph learning in general.\n## C. Global pooling\nGlobal pooling or graph-level readout consists of producing a **graph embedding** using the node embeddings calculated by the GNN.\nA simple way to obtain a graph embedding is to use the **mean** , **sum** , **** o** r max** of every node embedding _h_ᵢ:\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1KNE3dcyTcT1lHyXmRYp0qA.png)\nThe authors make two important points about graph-level readout:\n  * To consider all structural information, it is necessary to **keep embeddings from previous layers** ;\n  * The sum operator is surprisingly **more expressive** than the mean and the max.\n\n\nThese observations lead them to propose the following global pooling method:\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1u8_D9BLSSWuE8DMVvWviOg.png)\nFor each layer, node embeddings are **summed** and the result is **concatenated**. This solution combines the expressiveness of the sum operator with the memory of previous iterations from the concatenation.\n## 🧠 III. GIN in PyTorch Geometric\nIt is always interesting to see the differences between the original design and its implementations.\nThere is a `GINConv` layer in PyTorch Geometric with different parameters:\n  * `nn`: the **MLP** that is used to approximate our two injective functions;\n  * `eps`: the initial value of ɛ, which is **0 by default** ;\n  * `train_eps`: a True/False statement to determine if ɛ is trainable, which is **False by default**.\n\n\nYou can see that ɛ is entirely removed by default in this implementation: it's a hyperparameter we can tune, but probably not an essential one.\nThere is a **second GIN layer** in PyTorch Geometric, called `GINEConv`. It comes from [this paper's implementation](https://arxiv.org/pdf/1905.12265.pdf) of GIN, which applies a _ReLU_ function to the neighbors' features. We won't use it in this tutorial, since the benefits are not clear.\nWe still need to design a MLP for the `GINConv` layer. Here's the design we'll implement, inspired by the original paper:\n![MLP used in the GIN layer \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/13dRGZWsMt7evfFOQKaqbHw.png)\nMLP used in the GIN layer (image by author)\nThe paper stacks **5 layers** but we'll be more humble with **3 layers** instead. Here is what the entire architecture looks like:\n![Our GIN architecture \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1oU83LfFGE4xYwPLliMOSiQ.png)\nOur GIN architecture (image by author)\nI could not find any implementation of GIN with graph embedding **concatenation** , so here is my version (it improves the accuracy by 1% on average). Let's compare it to a GCN with a simple mean pooling (and no concatenation).\npython\n\n```\nclass GIN(torch.nn.Module):\n    \"\"\"GIN\"\"\"\n    def __init__(self, dim_h):\n        super(GIN, self).__init__()\n        self.conv1 = GINConv(\n            Sequential(Linear(dataset.num_node_features, dim_h),\n                       BatchNorm1d(dim_h), ReLU(),\n                       Linear(dim_h, dim_h), ReLU()))\n        self.conv2 = GINConv(\n            Sequential(Linear(dim_h, dim_h), BatchNorm1d(dim_h), ReLU(),\n                       Linear(dim_h, dim_h), ReLU()))\n        self.conv3 = GINConv(\n            Sequential(Linear(dim_h, dim_h), BatchNorm1d(dim_h), ReLU(),\n                       Linear(dim_h, dim_h), ReLU()))\n        self.lin1 = Linear(dim_h*3, dim_h*3)\n        self.lin2 = Linear(dim_h*3, dataset.num_classes)\n\n    def forward(self, x, edge_index, batch):\n        # Node embeddings \n        h1 = self.conv1(x, edge_index)\n        h2 = self.conv2(h1, edge_index)\n        h3 = self.conv3(h2, edge_index)\n\n        # Graph-level readout\n        h1 = global_add_pool(h1, batch)\n        h2 = global_add_pool(h2, batch)\n        h3 = global_add_pool(h3, batch)\n\n        # Concatenate graph embeddings\n        h = torch.cat((h1, h2, h3), dim=1)\n\n        # Classifier\n        h = self.lin1(h)\n        h = h.relu()\n        h = F.dropout(h, p=0.5, training=self.training)\n        h = self.lin2(h)\n\n        return h, F.log_softmax(h, dim=1)\n\ngcn = GCN(dim_h=32)\ngin = GIN(dim_h=32)\ngcn = train(gcn, train_loader)\ngin = train(gin, train_loader)\n```\n\ntext\n\n```\nGCN test accuracy = 59.38%\nGIN test accuracy = 73.70%\n```\n\nThis time, there's no competition!\nThe GIN architecture completely **** outperforms the GCN. This gap (10% accuracy on average) is due to several reasons:\n  * GIN's aggregator is specifically designed to **discriminate graphs** that the GCN's aggregator cannot;\n  * Graph hidden vectors from every layer are **concatenated instead** of only considering the last one;\n  * The sum operator is **superior** to the mean operator (at least in theory).\n\n\nLet's visualize the proteins we classified with the GCN and the GIN.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1jALpsWj0oIj-PP4ceInwwQ.png)\n![Image by author](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1yS9xLSChYVQC79NHZ-Wu8Q.png)\nImage by author\nInterestingly enough, the two models make **different mistakes**. This is a common result in machine learning when different algorithms are applied to the same problem.\nWe can take advantage of this behavior by creating an **ensemble**. There are many ways of combining our graph embeddings. The simplest method is to take the mean of the normalized output vectors.\npython\n\n```\nfor data in test_loader:\n    # Get classifications\n    _, out_gcn = gcn(data.x, data.edge_index, data.batch)\n    _, out_gin = gin(data.x, data.edge_index, data.batch)\n    out = (out_gcn + out_gin)/2\n\n    # Calculate accuracy scores\n    acc_gcn += accuracy(out_gcn.argmax(dim=1), data.y) / len(test_loader)\n    acc_gin += accuracy(out_gin.argmax(dim=1), data.y) / len(test_loader)\n    acc += accuracy(out.argmax(dim=1), data.y) / len(test_loader)\n```\n\ntext\n\n```\nGCN test accuracy     = 59.38%\nGIN test accuracy     = 73.70%\nGCN+GIN test accuracy = 75.00%\n```\n\nThis time, we're lucky enough to see the **accuracy improved**.\nObviously, it's not always the case. More sophisticated methods involve building an entirely different ML algorithm for classification, such as a Random Forest. This classifier takes graph embeddings as inputs and outputs the final classification.\n## Conclusion\nGraph Isomorphism Networks are an important step in the understanding of GNNs.\nThey not only improve the accuracy scores on several benchmarks but also provide a **theoretical framework** to explain why one architecture is better than another. In this article,\n  * We saw a new task with **graph classification** , performed with global pooling;\n  * We introduced the **WL test** and its connection with the new GIN layer;\n  * We implemented a GIN and a GCN and made a simple **ensemble** with their classifications.\n\n\nAlthough GINs achieve good performance, especially with social graphs, their theoretical superiority doesn't always translate well in the real world. It is true with other [\"provably powerful\" architectures](https://arxiv.org/pdf/2003.00982.pdf), which tend to **underperform in practice** , such as the 3WLGNN.\nIf you enjoyed this article, feel free to [follow me on Twitter](https://twitter.com/maximelabonne) for more graph content! 📣\n## References\n[1] Christopher Morris and Nils M. Kriege and Franka Bause and Kristian Kersting and Petra Mutzel and Marion Neumann. TUDataset: A collection of benchmark datasets for learning with graphs. In _ICML 2020 Workshop on Graph Representation Learning and Beyond_.\n[2] Xu, Keyulu and Hu, Weihua and Leskovec, Jure and Jegelka, Stefanie. How Powerful are Graph Neural Networks? __ In _ICLR 201_9.\n## Related articles\n> [**Chapter 3: Introduction to GraphSAGE in Python**](https://towardsdatascience.com/introduction-to-graphsage-in-python-a9e7f9ecf9d7)\n> [**Chapter 2: Graph Attention Networks: Self-Attention Explained**](https://towardsdatascience.com/graph-attention-networks-in-python-975736ac5c0c)\n* * *\n_Learn more about machine learning and support my work with one click - become a Medium member here:_\n> [**Join Medium with my referral link - Maxime Labonne**](https://medium.com/@mlabonne/membership)\n_If you're already a member, you can_[ _follow me on Medium_](https://medium.com/@mlabonne) _._\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657499317_sxy3ci.png)\nWritten By\n## [Maxime Labonne](https://towardsdatascience.com/author/mlabonne/)\n[See all from Maxime Labonne](https://towardsdatascience.com/author/mlabonne/)\n[Graph Neural Networks](https://towardsdatascience.com/tag/graph-neural-networks/)[Hands On Tutorials](https://towardsdatascience.com/tag/hands-on-tutorials/)[Machine Learning](https://towardsdatascience.com/tag/machine-learning/)[Programming](https://towardsdatascience.com/tag/programming/)[Python](https://towardsdatascience.com/tag/python/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fhow-to-design-the-most-powerful-graph-neural-network-3d18b07a6e66%2F&title=GIN%3A%20How%20to%20Design%20the%20Most%20Powerful%20Graph%20Neural%20Network)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-to-design-the-most-powerful-graph-neural-network-3d18b07a6e66%2F&title=GIN%3A%20How%20to%20Design%20the%20Most%20Powerful%20Graph%20Neural%20Network)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-to-design-the-most-powerful-graph-neural-network-3d18b07a6e66%2F&text=GIN%3A%20How%20to%20Design%20the%20Most%20Powerful%20Graph%20Neural%20Network)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/01/04SuEbGpBFQB1ySgk.jpg)](https://towardsdatascience.com/frequentist-vs-bayesian-statistics-with-tensorflow-fbba2c6c9ae5/)\n## [Frequentist vs. Bayesian Statistics with Tensorflow](https://towardsdatascience.com/frequentist-vs-bayesian-statistics-with-tensorflow-fbba2c6c9ae5/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nProbabilistic deep learning\n[Luís Roque](https://towardsdatascience.com/author/luisroque/)\nJanuary 5, 202310 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/10/0Ef96bMiPLgVPKoij-scaled.jpg)](https://towardsdatascience.com/a-simple-guide-to-pandas-dataframes-b125f64e1453/)\n## [A Simple Guide To Pandas DataFrames](https://towardsdatascience.com/a-simple-guide-to-pandas-dataframes-b125f64e1453/)\n[Programming](https://towardsdatascience.com/category/programming/)\nHow to create, store, and manipulate data using Python's Pandas library\n[Sam Starkman](https://towardsdatascience.com/author/sam-starkman/)\nOctober 1, 202110 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/02/1drVMtyU0vS802O6OtXhNZA.jpeg)](https://towardsdatascience.com/d-tale-for-fast-and-easy-exploratory-data-analysis-of-well-log-data-a2ffca5295b6/)\n## [D-Tale for Fast and Easy Exploratory Data Analysis of Well Log Data](https://towardsdatascience.com/d-tale-for-fast-and-easy-exploratory-data-analysis-of-well-log-data-a2ffca5295b6/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nSpeeding Up The Exploratory Data Analysis Workflow With The D-Tale Python Library\n[Andy McDonald](https://towardsdatascience.com/author/andymcdonaldgeo/)\nFebruary 13, 202310 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/01/1bupD6a6WVcDOkWf8UupP3A.jpeg)](https://towardsdatascience.com/aarogya-bot-the-ai-driven-chatbot-to-answer-your-medical-queries-4a76daf80fc4/)\n## [Aarogya-Bot: The AI-driven chatbot to answer your medical queries](https://towardsdatascience.com/aarogya-bot-the-ai-driven-chatbot-to-answer-your-medical-queries-4a76daf80fc4/)\n[NLP](https://towardsdatascience.com/category/artificial-intelligence/nlp/)\nA simplistic chatbot built using Knowledge Base Graph and Siamese LSTM that can answer your health concerns (with a pinch of salt of...\n[Arghyadeep Das](https://towardsdatascience.com/author/arghyadeep-d/)\nJanuary 7, 20216 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2019/09/1crYMLTlfzREkCvyYRE6q1w.png)](https://towardsdatascience.com/programming-languages-for-data-scientists-afde2eaf5cc5/)\n## [Programming Languages For Data Scientists](https://towardsdatascience.com/programming-languages-for-data-scientists-afde2eaf5cc5/)\n[Programming](https://towardsdatascience.com/category/programming/)\nWith 256 programming languages available today, choosing which language to learn can be overwhelming and difficult. Some languages work...\n[Mackenzie Mitchell](https://towardsdatascience.com/author/mackenziemitchell6/)\nSeptember 24, 20195 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/10/15x_tZX-3lfawIy_5ZsDCug-scaled.jpeg)](https://towardsdatascience.com/machine-learning-algorithms-from-start-to-finish-in-python-knn-7a92cce47986/)\n## [Machine Learning Algorithms from Start to Finish in Python: KNN](https://towardsdatascience.com/machine-learning-algorithms-from-start-to-finish-in-python-knn-7a92cce47986/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nAn essential algorithm in a Machine Learning Practitioner's toolkit has to be K Nearest Neighbours(or KNN, for short). While it may be one...\n[Vagif Aliyev](https://towardsdatascience.com/author/vagifaliyev/)\nOctober 9, 20207 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/10/1B9g05UuHJSqgwbhIjR0OUQ.jpeg)](https://towardsdatascience.com/6-examples-to-perform-efficient-data-analysis-and-manipulation-with-r-73db4ef6efc9/)\n## [6 Examples to Perform Efficient Data Analysis and Manipulation with R](https://towardsdatascience.com/6-examples-to-perform-efficient-data-analysis-and-manipulation-with-r-73db4ef6efc9/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nR makes it simple, efficient, and fast.\n[Soner Yıldırım](https://towardsdatascience.com/author/sonery/)\nOctober 12, 20214 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/08/1N1X9a3IxbQNctgdzmv_RTQ.png)](https://towardsdatascience.com/lda-linear-discriminant-analysis-how-to-improve-your-models-with-supervised-dimensionality-52464e73930f/)\n## [LDA: Linear Discriminant Analysis - How to Improve Your Models with Supervised Dimensionality...](https://towardsdatascience.com/lda-linear-discriminant-analysis-how-to-improve-your-models-with-supervised-dimensionality-52464e73930f/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nAn in-depth comparison of PCA and LDA with Python examples\n[Saul Dobilas](https://towardsdatascience.com/author/solclover/)\nAugust 8, 202112 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/08/1r_GCk_hwe-cobcsTunpADA-scaled.jpeg)](https://towardsdatascience.com/a-4-step-process-to-answer-how-long-will-this-take-d0b44250ab90/)\n## [A 4-Step Process to Answer \"How Long Will This Take?\"](https://towardsdatascience.com/a-4-step-process-to-answer-how-long-will-this-take-d0b44250ab90/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nHow to tackle this common stakeholder question\n[Vicky Yu](https://towardsdatascience.com/author/madfordata/)\nAugust 4, 20213 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607631/image?etag=1781543525510&width=500&height=500) Critical Mistakes Companies Make When Integrating AI/ML into Their Processes ](https://towardsdatascience.com/critical-mistakes-companies-make-when-integrating-ai-ml-into-their-processes/ \"Critical Mistakes Companies Make When Integrating AI/ML into Their Processes\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n\n\n",
  "metadata": {
    "title": "GIN: How to Design the Most Powerful Graph Neural Network | Towards Data Science",
    "description": "Graph classification with Graph Isomorphism Networks",
    "keywords": null,
    "author": "Maxime Labonne",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "GIN: How to Design the Most Powerful Graph Neural Network",
    "og:description": "Graph classification with Graph Isomorphism Networks",
    "og:url": "https://towardsdatascience.com/how-to-design-the-most-powerful-graph-neural-network-3d18b07a6e66/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1X13RjfsrTf9L1HhqBUt1sg.png",
    "og:image:width": "1280",
    "og:image:height": "720",
    "og:image:type": "image/png",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "Maxime Labonne",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "9 min read",
    "article:published_time": "2022-04-27T03:54:01.000Z",
    "article:modified_time": "2022-04-27T03:54:01.000Z",
    "article:author": "https://towardsdatascience.com/author/mlabonne/"
  },
  "paywall": {
    "listed_paid": true,
    "detected": false,
    "marker": "",
    "public_only": true,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 202,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/5c74e8467052/code/block_000.txt",
      "chars": 400
    },
    {
      "language": "txt",
      "file": "attachments/5c74e8467052/code/block_001.txt",
      "chars": 133
    },
    {
      "language": "txt",
      "file": "attachments/5c74e8467052/code/block_002.txt",
      "chars": 485
    },
    {
      "language": "txt",
      "file": "attachments/5c74e8467052/code/block_003.txt",
      "chars": 127
    },
    {
      "language": "txt",
      "file": "attachments/5c74e8467052/code/block_004.txt",
      "chars": 1446
    },
    {
      "language": "txt",
      "file": "attachments/5c74e8467052/code/block_005.txt",
      "chars": 54
    },
    {
      "language": "txt",
      "file": "attachments/5c74e8467052/code/block_006.txt",
      "chars": 446
    },
    {
      "language": "txt",
      "file": "attachments/5c74e8467052/code/block_007.txt",
      "chars": 93
    }
  ],
  "images": [
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1X13RjfsrTf9L1HhqBUt1sg.png",
      "alt": "Image by author",
      "local_path": "attachments/5c74e8467052/images/000.png",
      "bytes": 689404,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1sk7hX7GKcVqepVQCfOTduw.png",
      "alt": "3D plot of a protein (image by author)",
      "local_path": "attachments/5c74e8467052/images/001.png",
      "bytes": 391190,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1gVrJo6SkZbVoFKZs76rr7A.png",
      "alt": "3D plot of a protein with matplotlib (image by author)",
      "local_path": "attachments/5c74e8467052/images/002.png",
      "bytes": 410356,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/18OQ8kcwzuYT0_h_ukENcNg.png",
      "alt": "Two isomorphic graphs (image by author)",
      "local_path": "attachments/5c74e8467052/images/003.png",
      "bytes": 178376,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/13dRGZWsMt7evfFOQKaqbHw.png",
      "alt": "MLP used in the GIN layer (image by author)",
      "local_path": "attachments/5c74e8467052/images/004.png",
      "bytes": 160308,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1oU83LfFGE4xYwPLliMOSiQ.png",
      "alt": "Our GIN architecture (image by author)",
      "local_path": "attachments/5c74e8467052/images/005.png",
      "bytes": 154874,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1yS9xLSChYVQC79NHZ-Wu8Q.png",
      "alt": "Image by author",
      "local_path": "attachments/5c74e8467052/images/006.png",
      "bytes": 88545,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2023/01/04SuEbGpBFQB1ySgk.jpg",
      "alt": "",
      "local_path": "attachments/5c74e8467052/images/007.jpg",
      "bytes": 120585,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/10/0Ef96bMiPLgVPKoij-scaled.jpg",
      "alt": "",
      "local_path": "attachments/5c74e8467052/images/008.jpg",
      "bytes": 270773,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2023/02/1drVMtyU0vS802O6OtXhNZA.jpeg",
      "alt": "",
      "local_path": "attachments/5c74e8467052/images/009.jpeg",
      "bytes": 118308,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/01/1bupD6a6WVcDOkWf8UupP3A.jpeg",
      "alt": "",
      "local_path": "attachments/5c74e8467052/images/010.jpeg",
      "bytes": 11949,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2019/09/1crYMLTlfzREkCvyYRE6q1w.png",
      "alt": "",
      "local_path": "attachments/5c74e8467052/images/011.png",
      "bytes": 41044,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2020/10/15x_tZX-3lfawIy_5ZsDCug-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/5c74e8467052/images/012.jpeg",
      "bytes": 875647,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/10/1B9g05UuHJSqgwbhIjR0OUQ.jpeg",
      "alt": "",
      "local_path": "attachments/5c74e8467052/images/013.jpeg",
      "bytes": 351281,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/08/1N1X9a3IxbQNctgdzmv_RTQ.png",
      "alt": "",
      "local_path": "attachments/5c74e8467052/images/014.png",
      "bytes": 226251,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/08/1r_GCk_hwe-cobcsTunpADA-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/5c74e8467052/images/015.jpeg",
      "bytes": 191789,
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [
    {
      "src": "https://www.youtube.com/c/TowardsDataScience",
      "quality": "unavailable",
      "local_path": "",
      "note": "无1080p且无720p，未交付更低清晰度"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/programming/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/mlabonne/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/expressive-power-of-graph-neural-networks-and-the-weisefeiler-lehman-test-b883db3c7c49"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/how-to-design-the-most-powerful-graph-neural-network-3d18b07a6e66/None"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/introduction-to-graphsage-in-python-a9e7f9ecf9d7"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/graph-attention-networks-in-python-975736ac5c0c"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/graph-neural-networks/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/hands-on-tutorials/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/machine-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/programming/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/python/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/frequentist-vs-bayesian-statistics-with-tensorflow-fbba2c6c9ae5/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/luisroque/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/abs/1810.00826v3"
    },
    {
      "type": "external",
      "href": "https://colab.research.google.com/drive/1b6SWugNKnxsI0L9auX1zwszlXf3rRZyS?usp=sharing"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/computer-science"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/machine-learning"
    },
    {
      "type": "external",
      "href": "https://chrsmrrs.github.io/datasets/docs/datasets/"
    },
    {
      "type": "external",
      "href": "https://alphafold.ebi.ac.uk/"
    },
    {
      "type": "external",
      "href": "https://mlabonne.github.io/blog/graphsage/"
    },
    {
      "type": "external",
      "href": "https://en.wikipedia.org/wiki/Graph_isomorphism"
    },
    {
      "type": "external",
      "href": "https://en.wikipedia.org/wiki/Graph_isomorphism_problem"
    },
    {
      "type": "external",
      "href": "https://davidbieber.com/post/2019-05-10-weisfeiler-lehman-isomorphism-test/"
    },
    {
      "type": "external",
      "href": "https://en.wikipedia.org/wiki/Universal_approximation_theorem"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/pdf/1905.12265.pdf"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/pdf/2003.00982.pdf"
    },
    {
      "type": "external",
      "href": "https://twitter.com/maximelabonne"
    },
    {
      "type": "external",
      "href": "https://medium.com/@mlabonne/membership"
    },
    {
      "type": "external",
      "href": "https://medium.com/@mlabonne"
    },
    {
      "type": "external",
      "href": "https://www.facebook.com/sharer/sharer.php?title=GIN%3A+How+to+Design+the+Most+Powerful+Graph+Neural+Network&u=https%3A%2F%2Ftowardsdatascience.com%2Fhow-to-design-the-most-powerful-graph-neural-network-3d18b07a6e66%2F"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-14T11:11:48Z",
  "source_url": "https://towardsdatascience.com/how-to-design-the-most-powerful-graph-neural-network-3d18b07a6e66/",
  "delivery_status": "excluded_paid",
  "discovery_status": "excluded_paid",
  "missing_reason": "按原约定排除付费/会员全文"
}