Hands-On Graph Neural Networks Using Python: Practical techniques and architectures for building powerful graph and deep learning apps with PyTorch

Hands-On Graph Neural Networks Using Python: Practical techniques and architectures for building powerful graph and deep learning apps with PyTorch

Hands-On Graph Neural Networks Using Python: Practical techniques and architectures for building powerful graph and deep learning apps with PyTorch
Автор: Labonne Maxime
Дата выхода: 2023
Издательство: Packt Publishing Limited
Количество страниц: 563
Размер файла: 18.7 MB
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы  Дополнительные материалы 

Hands-On Graph Neural Networks Using Python....2

Contributors....3

About the author....3

About the reviewers....4

Preface....20

Who this book is for....22

What this book covers....23

To get the most out of this book....29

Download the example code files....32

Download the color images....32

Conventions used....33

Get in touch....33

Share your thoughts....34

Download a free PDF copy of this book....34

Part 1: Introduction to Graph Learning....36

Chapter 1: Getting Started with Graph Learning....38

Why graphs?....39

Why graph learning?....43

Why graph neural networks?....48

Summary....53

Further reading....53

Chapter 2: Graph Theory for Graph Neural Networks....55

Technical requirements....56

Introducing graph properties....56

Directed graphs....57

Weighted graphs....59

Connected graphs....61

Types of graphs....64

Discovering graph concepts....67

Fundamental objects....67

Graph measures....69

Adjacency matrix representation....72

Exploring graph algorithms....76

Breadth-first search....77

Depth-first search....80

Summary....83

Chapter 3: Creating Node Representations with DeepWalk....85

Technical requirements....86

Introducing Word2Vec....86

CBOW versus skip-gram....88

Creating skip-grams....90

The skip-gram model....93

DeepWalk and random walks....100

Implementing DeepWalk....104

Summary....112

Further reading....113

Part 2: Fundamentals....114

Chapter 4: Improving Embeddings with Biased Random Walks in Node2Vec....116

Technical requirements....117

Introducing Node2Vec....117

Defining a neighborhood....118

Introducing biases in random walks....121

Implementing Node2Vec....129

Building a movie RecSys....134

Summary....140

Further reading....141

Chapter 5: Including Node Features with Vanilla Neural Networks....142

Technical requirements....143

Introducing graph datasets....143

The Cora dataset....144

The Facebook Page-Page dataset....148

Classifying nodes with vanilla neural networks....151

Classifying nodes with vanilla graph neural networks....157

Summary....163

Further reading....164

Chapter 6: Introducing Graph Convolutional Networks....165

Technical requirements....166

Designing the graph convolutional layer....166

Comparing graph convolutional and graph linear layers....174

Predicting web traffic with node regression....183

Summary....195

Further reading....195

Chapter 7: Graph Attention Networks....197

Technical requirements....198

Introducing the graph attention layer....198

Linear transformation....199

Activation function....200

Softmax normalization....201

Multi-head attention....202

Improved graph attention layer....205

Implementing the graph attention layer in NumPy....206

Implementing a GAT in PyTorch Geometric....212

Summary....223

Part 3: Advanced Techniques....224

Chapter 8: Scaling Up Graph Neural Networks with GraphSAGE....226

Technical requirements....227

Introducing GraphSAGE....227

Neighbor sampling....228

Aggregation....234

Classifying nodes on PubMed....236

Inductive learning on protein-protein interactions....245

Summary....253

Further reading....253

Chapter 9: Defining Expressiveness for Graph Classification....255

Technical requirements....256

Defining expressiveness....256

Introducing the GIN....260

Classifying graphs using GIN....264

Graph classification....264

Implementing the GIN....266

Summary....280

Further reading....281

Chapter 10: Predicting Links with Graph Neural Networks....283

Technical requirements....284

Predicting links with traditional methods....284

Heuristic techniques....285

Matrix factorization....289

Predicting links with node embeddings....293

Introducing Graph Autoencoders....293

Introducing VGAEs....295

Implementing a VGAE....296

Predicting links with SEAL....300

Introducing the SEAL framework....301

Implementing the SEAL framework....305

Summary....312

Further reading....313

Chapter 11: Generating Graphs Using Graph Neural Networks....315

Technical requirements....316

Generating graphs with traditional techniques....316

The Erdős–Rényi model....317

The small-world model....321

Generating graphs with graph neural networks....324

Graph variational autoencoders....325

Autoregressive models....328

Generative adversarial networks....331

Generating molecules with MolGAN....335

Summary....340

Further reading....341

Chapter 12: Learning from Heterogeneous Graphs....343

Technical requirements....344

The message passing neural network framework....344

Introducing heterogeneous graphs....349

Transforming homogeneous GNNs to heterogeneous GNNs....354

Implementing a hierarchical self-attention network....365

Summary....372

Further reading....373

Chapter 13: Temporal Graph Neural Networks....375

Technical requirements....376

Introducing dynamic graphs....376

Forecasting web traffic....377

Introducing EvolveGCN....378

Implementing EvolveGCN....384

Predicting cases of COVID-19....397

Introducing MPNN-LSTM....399

Implementing MPNN-LSTM....402

Summary....410

Further reading....411

Chapter 14: Explaining Graph Neural Networks....413

Technical requirements....414

Introducing explanation techniques....414

Explaining GNNs with GNNExplainer....417

Introducing GNNExplainer....417

Implementing GNNExplainer....420

Explaining GNNs with Captum....425

Introducing Captum and integrated gradients....426

Implementing integrated gradients....427

Summary....435

Further reading....436

Part 4: Applications....438

Chapter 15: Forecasting Traffic Using A3T-GCN....440

Technical requirements....441

Exploring the PeMS-M dataset....441

Processing the dataset....449

Implementing the A3T-GCN architecture....457

Summary....464

Further reading....464

Chapter 16: Detecting Anomalies Using Heterogeneous GNNs....465

Technical requirements....466

Exploring the CIDDS-001 dataset....466

Preprocessing the CIDDS-001 dataset....475

Implementing a heterogeneous GNN....483

Summary....494

Further reading....494

Chapter 17: Building a Recommender System Using LightGCN....496

Technical requirements....497

Exploring the Book-Crossing dataset....497

Preprocessing the Book-Crossing dataset....509

Implementing the LightGCN architecture....515

Summary....529

Further reading....529

Chapter 18: Unlocking the Potential of Graph Neural Networks for Real-World Applications....531

Index....535

Why subscribe?....556

Other Books You May Enjoy....557

Packt is searching for authors like you....561

Share your thoughts....561

Download a free PDF copy of this book....562

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.


Похожее:

Список отзывов:

Нет отзывов к книге.