Package: pgl
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 inIJCAI2022. Code can be foundhere.PGL v2.2 2021.12.20Graph4Rec: We released a universal and large-scale toolkit with graph neural networks for recommender systems. Details can be foundhere.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 foundhere.GNNAutoScale: PGL now supports GNNAutoScale framework, which can scale arbitrary message-passing GNNs to large graphs. Details can be foundhere.🔥 🔥 🔥OGB-LSC KDD CUP 2021 winners announced!!(2021.06.17)Super excited to announce our PGL team wonTWO FIRSTplace andONE SECONDplace in a total of three track in OGB-LSC KDD CUP 2021.
Leaderboards can be foundhere.First place in MAG240M-LSC track: Code and Technical Report can be foundhere.First place in WikiKG90M-LSC track: Code and Technical Report can be foundhere.Second place in PCQM4M-LSC track: Code and Technical Report can be foundhere.Two amazing paper using PGL are accepted:(2021.06.17)Masked Label Prediction: Unified Message Passing Model for Semi-Supervised Classification, to appear inIJCAI2021.HGAMN: Heterogeneous Graph Attention Matching Network for Multilingual POI Retrieval at Baidu Maps, to appear inKDD2021.PGL Dstributed Graph Engine API released!!Our Dstributed Graph Engine API has been released and we developed atutorialto show how to launch a graph engine and ademofor training model using graph engine.Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based onPaddlePaddle.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 adoptMessage Passing Paradigmsimilar toDGLto help to build a customize graph neural network easily. Users only need to writesendandrecvfunctions 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 functionto send the message from the source to the target node. For the second step, the recv functionis responsible for aggregatingmessages together from different sources.To write a sum aggregator, users only need to write the following codes.importpglimportpaddleimportnumpyasnpnum_nodes=5edges=[(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()defsend_func(src_feat,dst_feat,edge_feat):returnsrc_featdefrecv_func(msg):returnmsg.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 LearningGraph 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 graphThe 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 graphBecause 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 algorithmsIn 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 adoptedPaddleFleetas 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 ZooThe following graph learning models have been implemented in the framework. You can find moreexamplesand the detailshere.ModelfeatureERNIESageERNIE SAmple aggreGatE for Text and GraphGCNGraph Convolutional Neural NetworksGATGraph Attention NetworkGraphSageLarge-scale graph convolution network based on neighborhood samplingunSup-GraphSageUnsupervised GraphSAGELINERepresentation learning based on first-order and second-order neighborsDeepWalkRepresentation learning by DFS random walkMetaPath2VecRepresentation learning based on metapathNode2VecThe representation learning Combined with DFS and BFSStruct2VecRepresentation learning based on structural similaritySGCSimplified graph convolution neural networkGESThe graph represents learning method with node featuresDGIUnsupervised representation learning based on graph convolution networkGATNERepresentation Learning of Heterogeneous Graph based on MessagePassingThe 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 requirementsPGL requires:paddlepaddle >= 2.2.0cythonPGL only supports Python 3InstallationYou can simply install it via pip.pipinstallpglThe TeamPGL is developed and maintained by NLP and Paddle Teams at BaiduE-mail: nlp-gnn[at]baidu.comLicensePGL uses Apache License 2.0.