Design robust graph neural networks with PyTorch Geometric by combining graph theory and neural networks with the latest developments and apps
Purchase of the print or Kindle book includes a free PDF eBook
Key Features
Implement state-of-the-art graph neural network architectures in Python
Create your own graph datasets from tabular data
Build powerful traffic forecasting, recommender systems, and anomaly detection applications
Book Description
Graph neural networks are a highly effective tool for analyzing data that can be represented as a graph, such as social networks, chemical compounds, or transportation networks. The past few years have seen an explosion in the use of graph neural networks, with their application ranging from natural language processing and computer vision to recommendation systems and drug discovery.
Hands-On Graph Neural Networks Using Python begins with the fundamentals of graph theory and shows you how to create graph datasets from tabular data. As you advance, you'll explore major graph neural network architectures and learn essential concepts such as graph convolution, self-attention, link prediction, and heterogeneous graphs. Finally, the book proposes applications to solve real-life problems, enabling you to build a professional portfolio. The code is readily available online and can be easily adapted to other datasets and apps.
By the end of this book, you'll have learned to create graph datasets, implement graph neural networks using Python and PyTorch Geometric, and apply them to solve real-world problems, along with building and training graph neural network models for node and graph classification, link prediction, and much more.
What you will learn
Understand the fundamental concepts of graph neural networks
Implement graph neural networks using Python and PyTorch Geometric
Classify nodes, graphs, and edges using millions of samples
Predict and generate realistic graph topologies
Combine heterogeneous sources to improve performance
Forecast future events using topological information
Apply graph neural networks to solve real-world problems
Who this book is for
This book is for machine learning practitioners and data scientists interested in learning about graph neural networks and their applications, as well as students looking for a comprehensive reference on this rapidly growing field. Whether you're new to graph neural networks or looking to take your knowledge to the next level, this book has something for you. Basic knowledge of machine learning and Python programming will help you get the most out of this book.
Author(s): Maxime Labonne
Edition: 1
Publisher: Packt Publishing Pvt Ltd
Year: 2023
Language: English
Commentary: True EPUB
Pages: 701
Contents
Preface
Part 1: Introduction to Graph Learning
1
Getting Started with Graph Learning
Why graphs?
Why graph learning?
Why graph neural networks?
Summary
Further reading
2
Graph Theory for Graph Neural Networks
Technical requirements
Introducing graph properties
Directed graphs
Weighted graphs
Connected graphs
Types of graphs
Discovering graph concepts
Fundamental objects
Graph measures
Adjacency matrix representation
Exploring graph algorithms
Breadth-first search
Depth-first search
Summary
3
Creating Node Representations with DeepWalk
Technical requirements
Introducing Word2Vec
CBOW versus skip-gram
Creating skip-grams
The skip-gram model
DeepWalk and random walks
Implementing DeepWalk
Summary
Further reading
Part 2: Fundamentals
4
Improving Embeddings with Biased Random Walks in Node2Vec
Technical requirements
Introducing Node2Vec
Defining a neighborhood
Introducing biases in random walks
Implementing Node2Vec
Building a movie RecSys
Summary
Further reading
5
Including Node Features with Vanilla Neural Networks
Technical requirements
Introducing graph datasets
The Cora dataset
The Facebook Page-Page dataset
Classifying nodes with vanilla neural networks
Classifying nodes with vanilla graph neural networks
Summary
Further reading
6
Introducing Graph Convolutional Networks
Technical requirements
Designing the graph convolutional layer
Comparing graph convolutional and graph linear layers
Predicting web traffic with node regression
Summary
Further reading
7
Graph Attention Networks
Technical requirements
Introducing the graph attention layer
Linear transformation
Activation function
Softmax normalization
Multi-head attention
Improved graph attention layer
Implementing the graph attention layer in NumPy
Implementing a GAT in PyTorch Geometric
Summary
Part 3: Advanced Techniques
8
Scaling Up Graph Neural Networks with GraphSAGE
Technical requirements
Introducing GraphSAGE
Neighbor sampling
Aggregation
Classifying nodes on PubMed
Inductive learning on protein-protein interactions
Summary
Further reading
9
Defining Expressiveness for Graph Classification
Technical requirements
Defining expressiveness
Introducing the GIN
Classifying graphs using GIN
Graph classification
Implementing the GIN
Summary
Further reading
10
Predicting Links with Graph Neural Networks
Technical requirements
Predicting links with traditional methods
Heuristic techniques
Matrix factorization
Predicting links with node embeddings
Introducing Graph Autoencoders
Introducing VGAEs
Further reading
14
Explaining Graph Neural Networks
Technical requirements
Introducing explanation techniques
Explaining GNNs with GNNExplainer
Introducing GNNExplainer
Implementing GNNExplainer
Explaining GNNs with Captum
Introducing Captum and integrated gradients
Implementing integrated gradients
Summary
Further reading
Part 4: Applications
15
Forecasting Traffic Using A3T-GCN
Technical requirements
Exploring the PeMS-M dataset
Processing the dataset
Implementing the A3T-GCN architecture
Summary
Further reading
16
Detecting Anomalies Using Heterogeneous GNNs
Technical requirements
Exploring the CIDDS-001 dataset
Preprocessing the CIDDS-001 dataset
Implementing a heterogeneous GNN
Summary
Further reading
17
Building a Recommender System Using LightGCN
Technical requirements
Exploring the Book-Crossing dataset
Preprocessing the Book-Crossing dataset
Implementing the LightGCN architecture
Summary
Further reading
18
Unlocking the Potential of Graph Neural Networks for Real-World Applications
Index
Other Books You May Enjoy