前言
Deep Graph Library (DGL) 学习笔记.
Deep Graph Library (DGL) is a Python package built for easy implementation of graph neural network model family, on top of existing DL frameworks (currently supporting PyTorch, MXNet and TensorFlow). It offers a versatile control of message passing, speed optimization via auto-batching and highly tuned sparse matrix kernels, and multi-GPU/CPU training to scale to graphs of hundreds of millions of nodes and edges.
文档地址:https://docs.dgl.ai/
Github 地址:https://github.com/dmlc/dgl
操作系统:Ubuntu 22.04.2 LTS
参考文档
- 【scipy.sparse包】Python稀疏矩阵详解
- scipy 稀疏矩阵详解
- Categorical data
- pandas.Series.cat
- pandas.Series.cat.codes
- DataFrame.groupby
- TORCH.BMM
Home
文档地址:https://docs.dgl.ai/index.html
Install and Setup
文档地址:https://docs.dgl.ai/install/index.html
A Blitz Introduction to DGL
文档地址:https://docs.dgl.ai/tutorials/blitz/index.html
Node Classification with DGL
文档地址:https://docs.dgl.ai/tutorials/blitz/1_introduction.html
How Does DGL Represent A Graph?
文档地址:https://docs.dgl.ai/tutorials/blitz/2_dglgraph.html
Write your own GNN module
文档地址:https://docs.dgl.ai/tutorials/blitz/3_message_passing.html
Link Prediction using Graph Neural Networks
文档地址:https://docs.dgl.ai/tutorials/blitz/4_link_predict.html
Training a GNN for Graph Classification
文档地址:https://docs.dgl.ai/tutorials/blitz/5_graph_classification.html
Make Your Own Dataset
文档地址:https://docs.dgl.ai/tutorials/blitz/6_load_data.html
User Guide
文档地址:https://docs.dgl.ai/guide/index.html
Chapter 1: Graph
文档地址:https://docs.dgl.ai/guide/graph.html
1.1 Some Basic Definitions about Graphs (Graphs 101)
文档地址:https://docs.dgl.ai/guide/graph-basic.html
1.2 Graphs, Nodes, and Edges
文档地址:https://docs.dgl.ai/guide/graph-graphs-nodes-edges.html
1.3 Node and Edge Features
文档地址:https://docs.dgl.ai/guide/graph-feature.html
1.4 Creating Graphs from External Sources
文档地址:https://docs.dgl.ai/guide/graph-external.html
1.5 Heterogeneous Graphs
文档地址:https://docs.dgl.ai/guide/graph-heterogeneous.html
1.6 Using DGLGraph on a GPU
文档地址:https://docs.dgl.ai/guide/graph-gpu.html
Chapter 2: Message Passing
文档地址:https://docs.dgl.ai/guide/message.html
2.1 Built-in Functions and Message Passing APIs
文档地址:https://docs.dgl.ai/guide/message-api.html
2.2 Writing Efficient Message Passing Code
文档地址:https://docs.dgl.ai/guide/message-efficient.html
2.3 Apply Message Passing On Part Of The Graph
文档地址:https://docs.dgl.ai/guide/message-part.html
2.5 Message Passing on Heterogeneous Graph
文档地址:https://docs.dgl.ai/guide/message-heterograph.html
Chapter 3: Building GNN Modules
文档地址:https://docs.dgl.ai/guide/nn.html
3.1 DGL NN Module Construction Function
文档地址:https://docs.dgl.ai/guide/nn-construction.html
3.2 DGL NN Module Forward Function
文档地址:https://docs.dgl.ai/guide/nn-forward.html
3.3 Heterogeneous GraphConv Module
文档地址:https://docs.dgl.ai/guide/nn-heterograph.html
Chapter 4: Graph Data Pipeline
文档地址:https://docs.dgl.ai/guide/data.html
4.1 DGLDataset class
文档地址:https://docs.dgl.ai/guide/data-dataset.html
4.2 Download raw data (optional)
文档地址:https://docs.dgl.ai/guide/data-download.html
4.3 Process data
文档地址:https://docs.dgl.ai/guide/data-process.html
4.4 Save and load data
文档地址:https://docs.dgl.ai/guide/data-savenload.html
4.5 Loading OGB datasets using ogb package
文档地址:https://docs.dgl.ai/guide/data-loadogb.html
4.6 Loading data from CSV files
文档地址:https://docs.dgl.ai/guide/data-loadcsv.html
Chapter 5: Training Graph Neural Networks
文档地址:https://docs.dgl.ai/guide/training.html
5.1 Node Classification/Regression
文档地址:https://docs.dgl.ai/guide/training-node.html
5.2 Edge Classification/Regression
文档地址:https://docs.dgl.ai/guide/training-edge.html
5.3 Link Prediction
文档地址:https://docs.dgl.ai/guide/training-link.html
5.4 Graph Classification
文档地址:https://docs.dgl.ai/guide/training-graph.html
5.5 Use of Edge Weights
文档地址:https://docs.dgl.ai/guide/training-eweight.html
Chapter 6: Stochastic Training on Large Graphs
文档地址:https://docs.dgl.ai/guide/minibatch.html
6.1 Training GNN for Node Classification with Neighborhood Sampling
文档地址:https://docs.dgl.ai/guide/minibatch-node.html
6.2 Training GNN for Edge Classification with Neighborhood Sampling
文档地址:https://docs.dgl.ai/guide/minibatch-edge.html
6.3 Training GNN for Link Prediction with Neighborhood Sampling
文档地址:https://docs.dgl.ai/guide/minibatch-link.html
6.4 Implementing Custom Graph Samplers
文档地址:https://docs.dgl.ai/guide/minibatch-custom-sampler.html
6.5 Implementing Custom GNN Module for Mini-batch Training
文档地址:https://docs.dgl.ai/guide/minibatch-nn.html
6.6 Exact Offline Inference on Large Graphs
文档地址:https://docs.dgl.ai/guide/minibatch-inference.html
6.7 Using GPU for Neighborhood Sampling
文档地址:https://docs.dgl.ai/guide/minibatch-gpu-sampling.html
6.8 Feature Prefetching
文档地址:https://docs.dgl.ai/guide/minibatch-prefetching.html
Chapter 7: Distributed Training
文档地址:https://docs.dgl.ai/guide/distributed.html
7.1 Data Preprocessing
文档地址:https://docs.dgl.ai/guide/distributed-preprocessing.html
7.2 Tools for launching distributed training/inference
文档地址:https://docs.dgl.ai/guide/distributed-tools.html
7.3 Programming APIs
文档地址:https://docs.dgl.ai/guide/distributed-apis.html
7.4 Advanced Graph Partitioning
文档地址:https://docs.dgl.ai/guide/distributed-partition.html
7.5 Heterogeneous Graph Under The Hood
文档地址:https://docs.dgl.ai/guide/distributed-hetero.html
Chapter 8: Mixed Precision Training
文档地址:https://docs.dgl.ai/guide/mixed_precision.html
用户指南
文档地址:https://docs.dgl.ai/guide_cn/index.html
第1章:图
文档地址:https://docs.dgl.ai/guide_cn/graph.html
1.1 关于图的基本概念
文档地址:https://docs.dgl.ai/guide_cn/graph-basic.html
1.2 图、节点和边
文档地址:https://docs.dgl.ai/guide_cn/graph-graphs-nodes-edges.html
1.3 节点和边的特征
文档地址:https://docs.dgl.ai/guide_cn/graph-feature.html
1.4 从外部源创建图
文档地址:https://docs.dgl.ai/guide_cn/graph-external.html
1.5 异构图
文档地址:https://docs.dgl.ai/guide_cn/graph-heterogeneous.html
1.6 在GPU上使用DGLGraph
文档地址:https://docs.dgl.ai/guide_cn/graph-gpu.html
第2章:消息传递范式
文档地址:https://docs.dgl.ai/guide_cn/message.html
2.1 内置函数和消息传递API
文档地址:https://docs.dgl.ai/guide_cn/message-api.html
2.2 编写高效的消息传递代码
文档地址:https://docs.dgl.ai/guide_cn/message-efficient.html
2.3 在图的一部分上进行消息传递
文档地址:https://docs.dgl.ai/guide_cn/message-part.html
2.5 在异构图上进行消息传递
文档地址:https://docs.dgl.ai/guide_cn/message-heterograph.html
第3章:构建图神经网络(GNN)模块
文档地址:https://docs.dgl.ai/guide_cn/nn.html
3.1 DGL NN模块的构造函数
文档地址:https://docs.dgl.ai/guide_cn/nn-construction.html
3.2 编写DGL NN模块的forward函数
文档地址:https://docs.dgl.ai/guide_cn/nn-forward.html
3.3 异构图上的GraphConv模块
文档地址:https://docs.dgl.ai/guide_cn/nn-heterograph.html
第4章:图数据处理管道
文档地址:https://docs.dgl.ai/guide_cn/data.html
4.1 DGLDataset类
文档地址:https://docs.dgl.ai/guide_cn/data-dataset.html
4.2 下载原始数据(可选)
文档地址:https://docs.dgl.ai/guide_cn/data-download.html
4.3 处理数据
文档地址:https://docs.dgl.ai/guide_cn/data-process.html
4.4 保存和加载数据
文档地址:https://docs.dgl.ai/guide_cn/data-savenload.html
4.5 使用ogb包导入OGB数据集
文档地址:https://docs.dgl.ai/guide_cn/data-loadogb.html
第5章:训练图神经网络
文档地址:https://docs.dgl.ai/guide_cn/training.html
5.1 节点分类/回归
文档地址:https://docs.dgl.ai/guide_cn/training-node.html
5.2 边分类/回归
文档地址:https://docs.dgl.ai/guide_cn/training-edge.html
5.3 链接预测
文档地址:https://docs.dgl.ai/guide_cn/training-link.html
5.4 整图分类
文档地址:https://docs.dgl.ai/guide_cn/training-graph.html
第6章:在大图上的随机(批次)训练
文档地址:https://docs.dgl.ai/guide_cn/minibatch.html
6.1 针对节点分类任务的邻居采样训练方法
文档地址:https://docs.dgl.ai/guide_cn/minibatch-node.html
6.2 针对边分类任务的邻居采样训练方法
文档地址:https://docs.dgl.ai/guide_cn/minibatch-edge.html
6.3 针对链接预测任务的邻居采样训练方法
文档地址:https://docs.dgl.ai/guide_cn/minibatch-link.html
6.4 定制用户自己的邻居采样器
文档地址:https://docs.dgl.ai/guide_cn/minibatch-custom-sampler.html
6.5 为小批次训练实现定制化的GNN模块
文档地址:https://docs.dgl.ai/guide_cn/minibatch-nn.html
6.6 超大图上的精准离线推断
文档地址:https://docs.dgl.ai/guide_cn/minibatch-inference.html
第7章:分布式训练
文档地址:https://docs.dgl.ai/guide_cn/distributed.html
7.1 分布式训练所需的图数据预处理
文档地址:https://docs.dgl.ai/guide_cn/distributed-preprocessing.html
7.2 分布式计算的API
文档地址:https://docs.dgl.ai/guide_cn/distributed-apis.html
7.3 运行分布式训练/推断所需的工具
文档地址:https://docs.dgl.ai/guide_cn/distributed-tools.html
Relational Graph Convolutional Network
文档地址:https://docs.dgl.ai/tutorials/models/1_gnn/4_rgcn.html
rgcn/link.py
文档地址:https://github.com/dmlc/dgl/blob/master/examples/pytorch/rgcn/link.py
参考文档:
- dgl.data.FB15k237Dataset
- dgl.DGLGraph.edges
- torch.unique
- dgl.norm_by_dst
- numpy.tile
- random.randint
- random.uniform
- dgl.DGLGraph.find_edges
- numpy.unique
- numpy.stack
- dgl.dataloading.GraphDataLoader
- torch.utils.data.DataLoader
- tutorials/beginner/basics/data_tutorial.html
- dgl.nn.tensorflow.conv.RelGraphConv
- dgl.nn.pytorch.conv.RelGraphConv
- torch.nn.functional.binary_cross_entropy_with_logits
- torch.nn.utils.clip_grad_norm_
- torch.sort
- torch.nonzero
结语
第一百零五篇博文写完,开心!!!!
今天,也是充满希望的一天。