Skip to main content

Paddle Graph Learning

Project description

Paddle Graph Learning (PGL)

API | Tutorials

Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based on PaddlePaddle.

The Framework of Paddle Graph Learning (PGL)

We provide python interfaces for storing/reading/querying graph structured data and two fundamental computational interfaces, which are walk based paradigm and message-passing based paradigm as shown in the above framework of PGL, for building cutting-edge graph learning algorithms. Combined with the PaddlePaddle deep learning framework, we are able to support both graph representation learning models and graph neural networks, and thus our framework has a wide range of graph-based applications.

Highlight: Efficient and Flexible Message Passing Paradigm

One of the most important benefits of graph neural networks compared to other models is the ability to use node-to-node connectivity information, but coding the communication between nodes is very cumbersome. At PGL we adopt Message Passing Paradigm similar to DGL to help to build a customize graph neural network easily. Users only need to write send and recv functions to easily implement a simple GCN. As shown in the following figure, for the first step the send function is defined on the edges of the graph, and the user can customize the send function $\phi^e$ to send the message from the source to the target node. For the second step, the recv function $\phi^v$ is responsible for aggregating $\oplus$ messages together from different sources.

The basic idea of message passing paradigm

As shown in the left of the following figure, to adapt general user-defined message aggregate functions, DGL uses the degree bucketing method to combine nodes with the same degree into a batch and then apply an aggregate function $\oplus$ on each batch serially. For our PGL UDF aggregate function, we organize the message as a LodTensor in PaddlePaddle taking the message as variable length sequences. And we utilize the features of LodTensor in Paddle to obtain fast parallel aggregation.

The parallel degree bucketing of PGL

Users only need to call the sequence_ops functions provided by Paddle to easily implement efficient message aggregation. For examples, using sequence_pool to sum the neighbor message.

    import paddle.fluid as fluid
    def recv(msg):
        return fluid.layers.sequence_pool(msg, "sum")

Although DGL does some kernel fusion optimization for general sum, max and other aggregate functions with scatter-gather. For complex user-defined functions with degree bucketing algorithm, the serial execution for each degree bucket cannot take full advantage of the performance improvement provided by GPU. However, operations on the PGL LodTensor-based message is performed in parallel, which can fully utilize GPU parallel optimization. Even without scatter-gather optimization, PGL still has excellent performance. Of course, we still provide build-in scatter-optimized message aggregation functions.

Performance

We test all the GNN algorithms with Tesla V100-SXM2-16G running for 200 epochs to get average speeds. And we report the accuracy on test dataset without early stoppping.

Dataset Model PGL Accuracy PGL speed (epoch time) DGL speed (epoch time)
Cora GCN 81.75% 0.0047s 0.0045s
Cora GAT 83.5% 0.0119s 0.0141s
Pubmed GCN 79.2% 0.0049s 0.0051s
Pubmed GAT 77% 0.0193s 0.0144s
Citeseer GCN 70.2% 0.0045 0.0046s
Citeseer GAT 68.8% 0.0124s 0.0139s

System requirements

PGL requires:

  • paddle >= 1.5
  • networkx

PGL supports both Python 2 & 3

Installation

pip install pgl

The Team

PGL is developed and maintained by NLP and Paddle Teams at Baidu

License

PGL uses Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pgl-0.1.0b0-cp37-cp37m-manylinux1_x86_64.whl (8.1 MB view hashes)

Uploaded CPython 3.7m

pgl-0.1.0b0-cp37-cp37m-macosx_10_9_x86_64.macosx_10_10_x86_64.whl (7.9 MB view hashes)

Uploaded CPython 3.7m macOS 10.10+ x86-64 macOS 10.9+ x86-64

pgl-0.1.0b0-cp36-cp36m-manylinux1_x86_64.whl (8.1 MB view hashes)

Uploaded CPython 3.6m

pgl-0.1.0b0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (7.9 MB view hashes)

Uploaded CPython 3.6m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

pgl-0.1.0b0-cp35-cp35m-manylinux1_x86_64.whl (8.1 MB view hashes)

Uploaded CPython 3.5m

pgl-0.1.0b0-cp34-cp34m-manylinux1_x86_64.whl (8.1 MB view hashes)

Uploaded CPython 3.4m

pgl-0.1.0b0-cp27-cp27mu-manylinux1_x86_64.whl (8.1 MB view hashes)

Uploaded CPython 2.7mu

pgl-0.1.0b0-cp27-cp27m-manylinux1_x86_64.whl (8.1 MB view hashes)

Uploaded CPython 2.7m

pgl-0.1.0b0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (7.9 MB view hashes)

Uploaded CPython 2.7m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page