Skip to main content

Paddle Graph Learning

Project description

PyPi Latest Release License

DOC | Quick Start | 中文

Breaking News !!

One amazing paper about knowledge representation learning was accepted! (2022.05.06)

  • Simple and Effective Relation-based Embedding Propagation for Knowledge Representation Learning, to appear in IJCAI2022. Code can be found here.

PGL v2.2 2021.12.20

  • Graph4Rec: We released a universal and large-scale toolkit with graph neural networks for recommender systems. Details can be found here.

  • Graph4KG: We released a flexible framework named Graph4KG to learn embeddings of entities and relations in KGs, which supports training on massive KGs. Details can be found here.

  • GNNAutoScale: PGL now supports GNNAutoScale framework, which can scale arbitrary message-passing GNNs to large graphs. Details can be found here.

🔥 🔥 🔥 OGB-LSC KDD CUP 2021 winners announced!! (2021.06.17)

Super excited to announce our PGL team won TWO FIRST place and ONE SECOND place in a total of three track in OGB-LSC KDD CUP 2021. Leaderboards can be found here.

  • First place in MAG240M-LSC track: Code and Technical Report can be found here.

  • First place in WikiKG90M-LSC track: Code and Technical Report can be found here.

  • Second place in PCQM4M-LSC track: Code and Technical Report can be found here.

Two amazing paper using PGL are accepted: (2021.06.17)

  • Masked Label Prediction: Unified Message Passing Model for Semi-Supervised Classification, to appear in IJCAI2021.
  • HGAMN: Heterogeneous Graph Attention Matching Network for Multilingual POI Retrieval at Baidu Maps, to appear in KDD2021.

PGL Dstributed Graph Engine API released!!

  • Our Dstributed Graph Engine API has been released and we developed a tutorial to show how to launch a graph engine and a demo for training model using graph engine.

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

The newly released PGL supports heterogeneous graph learning on both walk based paradigm and message-passing based paradigm by providing MetaPath sampling and Message Passing mechanism on heterogeneous graph. Furthermor, The newly released PGL also support distributed graph storage and some distributed training algorithms, such as distributed deep walk and distributed graphsage. 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.

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 to send the message from the source to the target node. For the second step, the recv function is responsible for aggregating messages together from different sources.

To write a sum aggregator, users only need to write the following codes.

    import pgl
    import paddle
    import numpy as np

    
    num_nodes = 5
    edges = [(0, 1), (1, 2), (3, 4)]
    feature = np.random.randn(5, 100).astype(np.float32)

    g = pgl.Graph(num_nodes=num_nodes,
        edges=edges,
        node_feat={
            "h": feature
        })
    g.tensor()

    def send_func(src_feat, dst_feat, edge_feat):
        return src_feat

    def recv_func(msg):
        return msg.reduce_sum(msg["h"]) 
     
    msg = g.send(send_func, src_feat=g.node_feat)

    ret = g.recv(recv_func, msg)

Highlight: Flexibility - Natively Support Heterogeneous Graph Learning

Graph can conveniently represent the relation between things in the real world, but the categories of things and the relation between things are various. Therefore, in the heterogeneous graph, we need to distinguish the node types and edge types in the graph network. PGL models heterogeneous graphs that contain multiple node types and multiple edge types, and can describe complex connections between different types.

Support meta path walk sampling on heterogeneous graph

The left side of the figure above describes a shopping social network. The nodes above have two categories of users and goods, and the relations between users and users, users and goods, and goods and goods. The right of the above figure is a simple sampling process of MetaPath. When you input any MetaPath as UPU (user-product-user), you will find the following results Then on this basis, and introducing word2vec and other methods to support learning metapath2vec and other algorithms of heterogeneous graph representation.

Support Message Passing mechanism on heterogeneous graph

Because of the different node types on the heterogeneous graph, the message delivery is also different. As shown on the left, it has five neighbors, belonging to two different node types. As shown on the right of the figure above, nodes belonging to different types need to be aggregated separately during message delivery, and then merged into the final message to update the target node. On this basis, PGL supports heterogeneous graph algorithms based on message passing, such as GATNE and other algorithms.

Large-Scale: Support distributed graph storage and distributed training algorithms

In most cases of large-scale graph learning, we need distributed graph storage and distributed training support. As shown in the following figure, PGL provided a general solution of large-scale training, we adopted PaddleFleet as our distributed parameter servers, which supports large scale distributed embeddings and a lightweighted distributed storage engine so it can easily set up a large scale distributed training algorithm with MPI clusters.

Model Zoo

The following graph learning models have been implemented in the framework. You can find more examples and the details here.

Model feature
ERNIESage ERNIE SAmple aggreGatE for Text and Graph
GCN Graph Convolutional Neural Networks
GAT Graph Attention Network
GraphSage Large-scale graph convolution network based on neighborhood sampling
unSup-GraphSage Unsupervised GraphSAGE
LINE Representation learning based on first-order and second-order neighbors
DeepWalk Representation learning by DFS random walk
MetaPath2Vec Representation learning based on metapath
Node2Vec The representation learning Combined with DFS and BFS
Struct2Vec Representation learning based on structural similarity
SGC Simplified graph convolution neural network
GES The graph represents learning method with node features
DGI Unsupervised representation learning based on graph convolution network
GATNE Representation Learning of Heterogeneous Graph based on MessagePassing

The above models consists of three parts, namely, graph representation learning, graph neural network and heterogeneous graph learning, which are also divided into graph representation learning and graph neural network.

System requirements

PGL requires:

  • paddlepaddle >= 2.2.0
  • cython

PGL only supports Python 3

Installation

You can simply install it via pip.

pip install pgl

The Team

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

E-mail: nlp-gnn[at]baidu.com

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

If you're not sure about the file name format, learn more about wheel file names.

pgl-2.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

pgl-2.2.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (9.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.5+ x86-64

pgl-2.2.4-cp39-cp39-macosx_10_9_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

pgl-2.2.4-cp38-cp38-win_amd64.whl (7.9 MB view details)

Uploaded CPython 3.8Windows x86-64

pgl-2.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

pgl-2.2.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (9.0 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.5+ x86-64

pgl-2.2.4-cp38-cp38-macosx_10_9_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

pgl-2.2.4-cp37-cp37m-win_amd64.whl (7.9 MB view details)

Uploaded CPython 3.7mWindows x86-64

pgl-2.2.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.2 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

pgl-2.2.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (9.0 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.5+ x86-64

pgl-2.2.4-cp37-cp37m-macosx_10_9_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

pgl-2.2.4-cp36-cp36m-win_amd64.whl (7.9 MB view details)

Uploaded CPython 3.6mWindows x86-64

pgl-2.2.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.2 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.17+ x86-64

pgl-2.2.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (9.0 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.5+ x86-64

pgl-2.2.4-cp36-cp36m-macosx_10_9_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

Details for the file pgl-2.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgl-2.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb44e88118c3cf0dc92847b5c16e4eae88019f91cea27356f815cf5edad4c81d
MD5 e09de5d8c6a97e5637bb8a4400a014cc
BLAKE2b-256 7ef2b91ed05e0c30d80c5ff7443cadd640bf86641b46fe9f0d97120a8977de9e

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pgl-2.2.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7c81e7eb0bf49e5b3a8a95f222da7407095775ef44da0976e190aa3b858a3450
MD5 2f2d6b42d47f0f647d5dd9f3c544b050
BLAKE2b-256 0ed54d62c80720d33a6e5c640078c62a286f2b66da096d6cc73a6e4a53ed5c72

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pgl-2.2.4-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 8.4 MB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pgl-2.2.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 868d47ec606588f5e7a14be734b8e0521996aa4e6a2afd3943dda228cbc21830
MD5 77fb1e859d218a5ddb496f347f1062da
BLAKE2b-256 445130785b9243805e2757db4ba6a03fb4dd59112d417b1de3e18e7cab54a555

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pgl-2.2.4-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for pgl-2.2.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 aefdfc1877b589bd59887b3297903962b4e299c706be5cfd2aabf0fcc4a097dd
MD5 f53304356d7eb607118775cebce54458
BLAKE2b-256 db34cc813113ee2531264ef5e25742730518d382b6c9d4ddc76243baed843809

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgl-2.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 66051f2a8bd7f18838a10ed0852ecae8080a0d83259301acd5d4e7e78f4d8aa0
MD5 30faf6a53af418ce7ebbd86fef30ffe6
BLAKE2b-256 9d5a16b3df14e981882c1352da0eed6a613b94a71de1ffd95d9e612606e3197c

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pgl-2.2.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9425da5d88907bd721e62afe489afa8d24bf33849aea526a32e121b0fca6ed68
MD5 9cf63f2db364da18cae0c90bd7d07060
BLAKE2b-256 d7e494e677751320e30d2f2649769d988b90ab18435f4bde14b70f4e60266ef6

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pgl-2.2.4-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 8.4 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pgl-2.2.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cd718f3c159391cfaa5786650c916c011a1d31a3216f8635333c5b39e875c8f2
MD5 bdf6565fb0e033970a85812195f06b7c
BLAKE2b-256 a0a03552fe1c365af0d8d8965058866d93d22d82a92f6b8233fa6c680820d159

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pgl-2.2.4-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.9

File hashes

Hashes for pgl-2.2.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 130f3ce12bc244e3d7629e30936749504a4bbb407fb23cd1e8accddd8f25c13e
MD5 61ace2ba4cb1e9dca608b1132e04d337
BLAKE2b-256 91759409e99e895e0384813a1a3a349fc063bf4d8ec77d8e928f163c7d7f2ea6

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgl-2.2.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8bed950692ad77f391088def2f8318ec50bd09d79ba4274696f60dc664e684ed
MD5 a0da140b4f0ad47473a4a25884b8e562
BLAKE2b-256 e286f32837dff03a494d6a3b3e9f578c3e12df32e05ddb389a47a02fbd1f9455

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pgl-2.2.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d161a00544947f0b14b55d5773675c3ae33ed52ecbb749d9325bbba3e9ec7585
MD5 8c3c9a838e3ff1bc66cac8f461898d34
BLAKE2b-256 fe261a628714707ff132ca4612d74ee731a1a4b6c6617aaa4c1fafc1991cfa50

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pgl-2.2.4-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 8.4 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pgl-2.2.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e5005a0a373b8e78b6a4363b3ed21748348f30bfa1f554dadd2b88878483d0af
MD5 fff03b840948ef2c50972364c24f4384
BLAKE2b-256 d76263e1b354771065357515caa5a9109fadaa91f2f45534e561b86aa700fa2b

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pgl-2.2.4-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

File hashes

Hashes for pgl-2.2.4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 4b30103c05188846fc809786f94a856c2da7664ce050e7bd6277874e40710b4e
MD5 3449a91f7da54e495b1606a87d365ac5
BLAKE2b-256 1169f91b686f3750cffc8ab02003971ac47cdb909d9b69bd51884fc5c3258307

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgl-2.2.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a219fbde86f13fd80be4572bc5d252e917f90ac117a5cc92712d88977a7891f8
MD5 eb06bf2f47ca588ffc57892c656df31b
BLAKE2b-256 a4c6e5b337f46bc1df748e3ee2b11d17414a8520914761e97445ad05cbfd91be

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pgl-2.2.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e2d278adea8cd33306b2c40d21c9da145c707595a1c787733ffc3d9484fadd3c
MD5 240cbdab8f0d750c5b2282f707ee1046
BLAKE2b-256 ef8d9613eda95e18c4ad9f9e9d5ed43876115ca16c12c1f79d261f2738ab4451

See more details on using hashes here.

File details

Details for the file pgl-2.2.4-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pgl-2.2.4-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 8.4 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pgl-2.2.4-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ef57ba07a071aa1fa01c002b2a51f478f226293b027cc6cd27a7377df92d92ac
MD5 78b7c2c4050033c2e060876c1bc18b48
BLAKE2b-256 db5a3d0c31e58cf35e06081f7b6372688d961d3b5123f55a76ddd4b67244dccf

See more details on using hashes here.

Supported by

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