Graph learning method, framework, computer system and readable storage medium
By providing a unified graph learning method on TensorFlow and PyTorch, the limitations of cross-platform use of graph deep learning frameworks in the existing technology are solved, and cross-platform seamless migration of graph data processing and model training is realized, improving the flexibility of the model and scalability.
Patent Information
- Application Number
- CN202110144656.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-02
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2041-02-02
AI Technical Summary
Most of the existing graph deep learning frameworks can only be used alone in TensorFlow or PyTorch, and lack a cross-platform unified graph data interface, which limits the training and application of graph learning models.
It provides a graph learning method based on TensorFlow and PyTorch at the same time. It samples sample graphs through preset interfaces, and uses Dataset and Transform jointly provided by TensorFlow and PyTorch to process sampled data to realize cross-platform graph data processing and model training.
It realizes seamless migration of graph learning models between TensorFlow and PyTorch, provides a unified graph data interface, improves the flexibility and scalability of model training, and decouples data processing and model training.
Smart Images

Figure CN113761289B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and more specifically, to a graph learning method, framework, computer system, and readable storage medium. Background Art
[0002] Graph is a network based on entities and their relationships. Many complex systems in the real world can be described and analyzed using the relevant characteristics of graphs, such as social networks, e-commerce, literature citation networks, protein interaction networks, urban transportation networks, knowledge graphs, etc. Compared with data in Euclidean space, such as images, videos, voice and natural language, graphs can express more complex relationships between entities.
[0003] In recent years, many graph deep learning frameworks based on existing deep learning frameworks have emerged. Graph deep learning frameworks based on TensorFlow include Euler, Spektral, NeuGraph, etc. Graph deep learning frameworks based on PyTorch include PyG, DGL, PyTorch-BigGraph, Geo2DR. Among them, PyTorch-BigGraph is only suitable for graph embedding algorithms and cannot apply GNN-related algorithms based on attribute graphs. Since AliGraph and NeuGraph are not open source, their specific implementations are unknown. Summary of the invention
[0004] In view of this, the present disclosure provides a graph learning method, framework, computer system and readable storage medium based on both TensorFlow and PyTorch.
[0005] One aspect of the present disclosure provides a graph learning method, comprising:
[0006] Sampling the sample graph using a preset interface including vertex and / or edge attribute index parameters to obtain sampled data, wherein the preset interface is implemented using TensorFlow and PyTorch respectively;
[0007] Process the sampled data using Dataset and Transform provided by TensorFlow and PyTorch to obtain processed sampled data;
[0008] The processed sampling data is input into a learning model so that the learning model learns the sample graph.
[0009] According to an embodiment of the present disclosure, the type of attribute index includes Hash index and Range index;
[0010] The Hash index supports filtering conditions where vertex and / or edge attribute values are equal or unequal;
[0011] The Range index supports any one of the filtering conditions of existence, non-existence, greater than, less than, greater than or equal to, and less than or equal to of the vertex and / or edge attribute values;
[0012] The filtering condition is used to filter the points and / or edges of the sample graph.
[0013] According to an embodiment of the present disclosure, the preset interface includes at least one of a point-edge sampling interface, a neighbor sampling interface, a random walk interface, and a subgraph sampling interface;
[0014] The method of sampling the sample graph using a preset interface including point and / or edge attribute index parameters to obtain the sample data includes:
[0015] According to a preset sampling type, obtaining a preset interface corresponding to the preset sampling type;
[0016] TensorFlow and PyTorch are used respectively to implement the preset interface, sample the sample graph, and obtain sample data.
[0017] Among them, when the preset sampling type includes point-edge sampling, the point-edge sampling interface is obtained; when the preset sampling type includes neighbor sampling, the neighbor sampling interface is obtained; when the preset sampling type includes random sampling, the random sampling interface is obtained; when the preset sampling type includes sub-graph sampling, the sub-graph sampling interface is obtained.
[0018] According to an embodiment of the present disclosure, wherein the preset interface further includes an attribute query interface, the method includes:
[0019] Using the attribute query interface, obtain the attribute to be queried of the specified point and / or edge, as well as the dimension of the attribute to be queried, wherein the attribute to be queried includes at least one of a sparse value, a dense value, and a string value;
[0020] According to the dimension of the attribute to be queried, the attribute to be queried is intercepted.
[0021] According to an embodiment of the present disclosure, when the preset sampling type includes point-edge sampling, after acquiring the point-edge sampling interface, the method further includes:
[0022] Obtaining weights of the screened points and / or edges;
[0023] Constructing a probability distribution graph according to the weights of the screened points and / or edges;
[0024] At least one random sampling is performed on the probability distribution graph to obtain the sampled data.
[0025] According to an embodiment of the present disclosure, the parameters of the point-edge sampling interface include the type and number of points or edges, the type of attribute index, the operator of the attribute index, and the attribute value;
[0026] The parameters of the neighbor sampling interface include vertex set, edge type, number, K value of Topk neighbors, attribute index type, attribute index operator, and attribute value;
[0027] The parameters of the attribute query interface include a set of vertices or edges, attributes to be queried, and dimensions of the attributes;
[0028] The parameters of the random walk interface include a specified vertex set, edge type, length of the random walk sequence, window size for generating a context sequence from the random walk sequence, parameters for the random walk control to return the probability of the current vertex, parameters for the random walk control to control depth-first search or breadth-first search, type of attribute index, operator of attribute index, and attribute value;
[0029] The parameters of the subgraph sampling interface include a specified vertex set, the type of edges of neighbors per hop, the number of neighbors per hop, the type of attribute index, the operator of the attribute index, and the attribute value.
[0030] According to an embodiment of the present disclosure, the learning model supports DeepWalk model, Node2vec model, Line, MetaPath2Vec model, GraphSage model, and Graph Attention networks model.
[0031] According to an embodiment of the present disclosure, the learning model supports a unified custom model, and the method further includes:
[0032] Build a unified custom model, the custom model includes a model_fn function and an input_fn function, the model_fn function is used to define the execution logic of the model, and the input_fn function is used to define the processed sampling data;
[0033] The train function is called to train the custom model as the learning model.
[0034] Another aspect of the present disclosure provides a graph learning framework, including:
[0035] A sampling module, used to sample the sample graph using a preset interface including vertex and / or edge attribute index parameters to obtain sampling data, wherein the preset interface is implemented using TensorFlow and PyTorch respectively;
[0036] A processing module, used to process the sampled data using Dataset and Transform provided by TensorFlow and PyTorch to obtain processed sampled data;
[0037] The input module is used to input the processed sampling data into the learning model so that the learning model learns the sample graph.
[0038] According to an embodiment of the present disclosure, the types of attribute indexes include Hash index and Range index;
[0039] The Hash index supports filtering conditions where vertex and / or edge attribute values are equal or unequal;
[0040] The Range index supports any one of the filtering conditions of existence, non-existence, greater than, less than, greater than or equal to, and less than or equal to of the vertex and / or edge attribute values;
[0041] The filtering condition is used to filter the points and / or edges of the sample graph.
[0042] According to an embodiment of the present disclosure, the preset interface includes at least one of a point-edge sampling interface, a neighbor sampling interface, a random walk interface, and a subgraph sampling interface;
[0043] The sampling module comprises:
[0044] An acquisition submodule, used to acquire a preset interface corresponding to the preset sampling type according to the preset sampling type;
[0045] The sampling submodule is used to implement the preset interface using TensorFlow and PyTorch respectively, sample the sample graph, and obtain sampling data.
[0046] Among them, when the preset sampling type includes point-edge sampling, the point-edge sampling interface is obtained; when the preset sampling type includes neighbor sampling, the neighbor sampling interface is obtained; when the preset sampling type includes random sampling, the random sampling interface is obtained; when the preset sampling type includes sub-graph sampling, the sub-graph sampling interface is obtained.
[0047] According to an embodiment of the present disclosure, it also includes:
[0048] A first screening module, used for screening out points and / or edges in the sample graph that meet the type of preset points and / or edges;
[0049] An acquisition module, used to acquire the attribute values of the points and / or edges screened out in the sample graph, as well as the type of the pre-set attribute index and the filtering conditions supported by the type of the attribute index;
[0050] A second screening module, used to screen out points and / or edges in the sample graph that meet the type of the preset attribute index and the filtering condition;
[0051] The data sampling module performs sampling of a preset sampling type on the points and / or edges to obtain the sampled data.
[0052] According to an embodiment of the present disclosure, the preset interface further includes an attribute query interface, and the determination module includes:
[0053] An attribute acquisition submodule, used to obtain the to-be-queried attribute of the specified point and / or edge and the dimension of the to-be-queried attribute by using the attribute query interface, wherein the to-be-queried attribute includes at least one of a sparse value, a dense value and a string value;
[0054] The attribute interception submodule is used to intercept the attribute to be queried according to the dimension of the attribute to be queried.
[0055] According to an embodiment of the present disclosure, it also includes:
[0056] A weight acquisition module, used to acquire the weights of the screened points and / or edges;
[0057] A graph construction module, used to construct a probability distribution graph according to the weights of the screened points and / or edges;
[0058] The sampling module is used to perform at least one random sampling on the probability distribution diagram to obtain the sampled data.
[0059] According to an embodiment of the present disclosure, the parameters of the point-edge sampling interface include the type and number of points or edges, the type of attribute index, the operator of the attribute index, and the attribute value;
[0060] The parameters of the neighbor sampling interface include vertex set, edge type, number, K value of Topk neighbors, attribute index type, attribute index operator, and attribute value;
[0061] The parameters of the attribute query interface include a set of vertices or edges, attributes to be queried, and dimensions of the attributes;
[0062] The parameters of the random walk interface include a specified vertex set, edge type, length of the random walk sequence, window size for generating a context sequence from the random walk sequence, parameters for the random walk control to return the probability of the current vertex, parameters for the random walk control to control depth-first search or breadth-first search, type of attribute index, operator of attribute index, and attribute value;
[0063] The parameters of the subgraph sampling interface include a specified vertex set, the type of edges of neighbors per hop, the number of neighbors per hop, the type of attribute index, the operator of the attribute index, and the attribute value.
[0064] According to an embodiment of the present disclosure, the learning model supports DeepWalk model, Node2vec model, Line, MetaPath2Vec model, GraphSage model, and Graph Attention networks model.
[0065] According to an embodiment of the present disclosure, the learning model supports a unified custom model, and the graph learning framework further includes:
[0066] A construction module is used to construct a unified custom model, wherein the custom model includes a model_fn function and an input_fn function, wherein the model_fn function is used to define the execution logic of the model, and the input_fn function is used to define the processed sampling data;
[0067] The calling module is used to call the train function to train the custom model as the learning model.
[0068] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0069] Another aspect of the present disclosure provides a computer system, comprising:
[0070] one or more processors;
[0071] a memory for storing one or more programs,
[0072] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0073] According to the embodiments of the present disclosure, the preset interfaces including the index parameters of the point and / or edge attributes are implemented using TensorFlow and PyTorch respectively, providing a unified graph data interface, so that the training learning model no longer cares about the storage method of the sample graph, and has strong scalability. At the same time, the Dataset and Transform provided by TensorFlow and PyTorch are used to process the sampled data, providing a unified training interface for the training learning model, decoupling data processing from model training, and improving the reusability of the interface code, wherein the Dataset can be pre-fetched in parallel, effectively improving the model training speed, and the Transform can realize flexible data conversion / processing, and has strong scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0075] Figure 1 An exemplary system architecture to which a graph learning method can be applied according to an embodiment of the present disclosure is schematically shown;
[0076] Figure 2 A flowchart of a graph learning method according to an embodiment of the present disclosure is schematically shown;
[0077] Figure 3 The flowchart of the sampling process according to the embodiment of the present disclosure is schematically shown;
[0078] Figure 4 A flowchart of a graph learning method according to another embodiment of the present disclosure is schematically shown;
[0079] Figure 5 Schematically shows a block diagram of a graph learning framework according to an embodiment of the present disclosure;
[0080] Figure 6 The block diagram of a computer system according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0081] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0082] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0083] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0084] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0085] The embodiments of the present disclosure provide a graph learning method, framework, computer system and readable storage medium. The method includes sampling a sample graph using a preset interface including point and / or edge attribute index parameters to obtain sampled data, the preset interface is implemented using TensorFlow and PyTorch respectively, and the sampled data is processed using Dataset and Transform provided by TensorFlow and PyTorch to obtain processed sampled data. The processed sampled data is input to a learning model so that the learning model learns the sample graph.
[0086] Figure 1 The exemplary system architecture 100 to which the graph learning method can be applied according to an embodiment of the present disclosure is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0087] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0088] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients and / or social platform software, etc. (only as examples).
[0089] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0090] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0091] It should be noted that the graph learning method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the graph learning framework provided in the embodiment of the present disclosure can generally be set in the server 105. The graph learning method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal device 101, 102, 103 and / or the server 105. Accordingly, the graph learning framework provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal device 101, 102, 103 and / or the server 105. Alternatively, the graph learning method provided in the embodiment of the present disclosure can also be executed by the terminal device 101, 102, or 103, or it can also be executed by other terminal devices different from the terminal device 101, 102, or 103. Accordingly, the graph learning framework provided in the embodiment of the present disclosure can also be set in the terminal device 101, 102, or 103, or it can be set in other terminal devices different from the terminal device 101, 102, or 103.
[0092] For example, the sample graph may be originally stored in any one of the terminal devices 101, 102, or 103 (for example, the terminal device 101, but not limited thereto), or stored in an external storage device and may be imported into the terminal device 101. Then, the terminal device 101 may locally execute the graph learning method provided by the embodiment of the present disclosure, or send the sample graph to other terminal devices, servers, or server clusters, and the other terminal devices, servers, or server clusters that receive the sample graph may execute the graph learning method provided by the embodiment of the present disclosure.
[0093] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0094] Figure 2The flowchart of the graph learning method according to an embodiment of the present disclosure is schematically shown.
[0095] like Figure 2 As shown, the method includes operations S201 to S203.
[0096] In operation S201, a sample graph is sampled using a preset interface including point and / or edge attribute index parameters to obtain sampled data, where the preset interface is implemented using TensorFlow and PyTorch.
[0097] In operation S202, the sampled data is processed using Dataset and Transform provided by TensorFlow and PyTorch to obtain processed sampled data.
[0098] In operation S203, the processed sample data is input to a learning model so that the learning model learns the sample graph.
[0099] In the present disclosure, the sample graph may come from a graph storage server storing the sample graph, which is scalable, or may come from a local file system. In addition, for ultra-large-scale graphs, a distributed file system or distributed graph storage service is generally used.
[0100] In the present disclosure, the sample graph supports homogeneous / heterogeneous graphs, attributed / unattributed graphs, weighted / unweighted graphs, and directed / undirected graphs. Among them, homogeneous graphs refer to graphs with only vertices of the same type, and heterogeneous graphs refer to graphs with vertices of multiple types. Attributed graphs refer to graphs with one or more attribute values for both vertices and edges, and attribute values support sparse values, dense values, and string values. Weighted graphs refer to graphs with weights for both vertices and edges. Directed / undirected graphs refer to graphs with directions for edges between vertices.
[0101] In this disclosure, the learning model supports DeepWalk model, Node2vec model, Line, MetaPath2Vec model, GraphSage model, and Graph Attention networks model.
[0102] Among them, DeepWalk is an unsupervised algorithm for classic unbiased random walks.
[0103] Node2vec configures the parameter p of the random walk to control the probability of returning the current vertex and the parameter q of the random walk to control the depth-first search or breadth-first search, thereby implementing an unsupervised algorithm that tends to favor the breadth-first search (BFS) or depth-first search (DFS) walk.
[0104] Line is an unsupervised algorithm that flexibly utilizes first-order and second-order neighbor information. MetaPath2Vec is a Node2vec algorithm applied to heterogeneous graphs.
[0105] GraphSage is a GCN algorithm based on neighbor sampling and aggregation.
[0106] Graph Attention Networks is a GCN algorithm that uses the Attention mechanism for neighbor aggregation.
[0107] The attribute index disclosed in the present invention includes a Hash index and / or a Range index. The Hash index supports filtering conditions of equal or unequal attribute values. The Range index supports filtering conditions of any one of the attribute value existence, non-existence, greater than, less than, greater than or equal to, and less than or equal to, wherein the filtering conditions are used to filter points and / or edges of a sample graph.
[0108] According to the present disclosure, the preset interfaces including the index parameters of point and / or edge attributes are implemented using TensorFlow and PyTorch respectively, providing a unified graph data interface, so that the training learning model no longer cares about the storage method of the sample graph, and has strong scalability. At the same time, the Dataset and Transform provided by TensorFlow and PyTorch are used to process the sampled data, providing a unified training interface for the training learning model, decoupling data processing from model training, and improving the reusability of the interface code. Among them, Dataset can be pre-fetched in parallel, effectively improving the model training speed, and Transform can realize flexible data conversion / processing, which has strong scalability.
[0109] In one embodiment of the present disclosure, the preset interface includes at least one of a point-edge sampling interface, a neighbor sampling interface, a random walk interface, and a subgraph sampling interface, and operation S201 includes: according to the preset sampling type, obtaining a preset interface corresponding to the preset sampling type; using TensorFlow and PyTorch to implement the preset interface respectively, sampling the sample graph, and obtaining sampling data.
[0110] Among them, when the preset sampling type includes point-edge sampling, obtain the point-edge sampling interface; when the preset sampling type includes neighbor sampling, obtain the neighbor sampling interface; when the preset sampling type includes random sampling, obtain the random sampling interface; when the preset sampling type includes sub-graph sampling, obtain the sub-graph sampling interface.
[0111] Figure 3 The flowchart of the sampling process according to the embodiment of the present disclosure is schematically shown.
[0112] like Figure 3 As shown, the method includes operations S301 to S304.
[0113] In operation S301, points and / or edges that meet the types of preset points and / or edges are screened out in a sample graph.
[0114] In operation S302, the attribute values of the points and / or edges screened out in the sample graph, as well as the pre-set attribute index type and the filtering conditions supported by the attribute index type are obtained.
[0115] In operation S303, points and / or edges that meet the pre-set attribute index type and filtering conditions are screened out in the sample graph.
[0116] In operation S304, sampling of a preset sampling type is performed on the points and / or edges to obtain sampling data.
[0117] In the embodiment of the present disclosure, the type of the point and / or edge to be attribute indexed can be set by the user or randomly selected. The preset interface also includes an attribute query interface, in operation S303: obtaining the attributes to be queried of the screened points and / or edges, the attributes to be queried include at least one of a sparse value, a dense value, and a string value; intercepting the attributes to be queried according to the dimension of the attributes to be queried.
[0118] In the embodiment of the present disclosure, the parameters of the point-edge sampling interface include the type and number of points or edges, the type of attribute index, the operator of the attribute index, and the attribute value.
[0119] The parameters of the neighbor sampling interface include vertex set, edge type, number, K value of Topk neighbors, attribute index type, attribute index operator, attribute value
[0120] The parameters of the attribute query interface include the set of vertices or edges, the attributes to be queried, and the dimensions of the attributes.
[0121] The parameters of the random walk interface include the specified vertex set, edge type, length of the random walk sequence, window size for generating context sequence from the random walk sequence, parameters for controlling the probability of returning the current vertex by the random walk, parameters for controlling the depth-first search or breadth-first search by the random walk, type of attribute index, attribute index operator, and attribute value.
[0122] The parameters of the subgraph sampling interface include the specified vertex set, the edge type of each hop neighbor, the number of each hop neighbors, the type of attribute index, the attribute index operator, and the attribute value.
[0123] In the present disclosure, the type of preset interface is determined according to the type of learning model used. Exemplarily, when the learning model is a Deepwalk model, the preset interface includes a point-edge sampling interface, a neighbor sampling interface, and a random walk interface.
[0124] In this disclosure, point-edge sampling is performed by sampling the weights on the points and edges. For unweighted graphs, the weights are all 1.0. First, the points and edges in the sample graph are screened out according to their types and the attribute points and edges that are indexed in advance. Then, a probability distribution is constructed based on the weights of the screened points and edges. Finally, multiple random samplings are performed based on this probability distribution to obtain the final sampling result. The unified point-edge sampling interface is implemented as follows:
[0125] SampleNode(type, count, index_name, index_op, attribute_value)
[0126] SampleEdge(type, count, index_name, index_op, attribute_value)
[0127] Among them, type represents the type parameter of the vertex / edge, count represents the number parameter, index_name represents the type parameter of the attribute index, index_op represents the operator parameter of the attribute index, and the optional values are equal / unequal / exists / does not exist / is greater than / is less than / is greater than or equal to / is less than or equal to, attribute_value represents the attribute value parameter, which can be multiple values, separated by commas.
[0128] In the embodiment of the present disclosure, the process of point-edge sampling is: using the point-edge sampling interface to screen out points and / or edges that meet the types of preset points and / or edges in the sample graph; obtaining the weights of the screened points and / or edges; constructing a probability distribution graph based on the weights of the screened points and / or edges; and performing at least one random sampling on the probability distribution graph to obtain sampling data.
[0129] In this disclosure, neighbor sampling refers to neighbor sampling based on specified vertices, including weighted neighbor sampling and TopK neighbors by weight. Neighbor sampling also supports sampling according to edge types and attributes. The unified neighbor sampling interface includes the following interfaces, which are implemented as follows:
[0130] SampleNeighbor(nodes, edge_type, count, index_name, index_op, attribute_value)
[0131] GetTopKNeighbor(nodes, edge_type, K, index_name, index_op, attribute_value)
[0132] GetFullNeighbor(nodes, edge_type, index_name, index_op, attribute_value)
[0133] Among them, nodes represents the vertex set parameter, edge represents the edge type parameter, count represents the number parameter, KTopK represents the neighbor K value parameter, index_name represents the attribute index type parameter, index_op represents the attribute index operator parameter, and the optional values are equal / unequal / exist / not exist / greater than / less than / greater than or equal to / less than or equal to, attribute_value represents the attribute value parameter, which can be multiple values separated by commas. The implementation of SampleNeighbor is similar to the sampling of point edges, except that the selected points are all neighbors. GetTopKNeighbor obtains the Top K neighbors by establishing a minimum heap sorted by neighbor weights. GetFullNeighbor obtains all neighbors that meet the specified edge type and attributes.
[0134] In the disclosed embodiment, the process of neighbor sampling is as follows: using the neighbor sampling interface, according to the vertex set, all neighbors based on the vertex are obtained in the sample graph data, the neighbors that meet the edge type are screened out from all neighbors, the attribute value of the neighbor, as well as the type of attribute index and the filtering conditions supported by the type of attribute index (that is, the operator of the attribute index), the neighbors that meet the type of attribute index and the filtering conditions are screened out in the sample graph, and the target neighbor is obtained. For SampleNeighbor, a probability distribution graph is constructed according to the weights of the screened target neighbors, and multiple random samplings are performed on the basis of this probability distribution graph to obtain the final sampling data. For GetTopKNeighbor, a minimum heap tree is established with the weights of the screened target neighbors, and the top K neighbors are intercepted. For GetFullNeighbor, the target neighbor obtained is the sampling data.
[0135] In this disclosure, attribute query includes sparse value (Sparse), dense value (Dense) and string value (string) interfaces for querying vertex and edge attributes. The unified attribute query interface has the following interfaces, which are implemented as follows:
[0136] GetNodeSparseAttribute(nodes, attribute_name, attribute_dim)
[0137] GetNodeDenseAttribute(nodes, attribute_name, attribute_dim)
[0138] GetNodeStringAttribute(nodes, attribute_name, attribute_dim)
[0139] GetEdgeSparseAttribute(Edges, attribute_name, attribute_dim)
[0140] GetEdgeDenseAttribute(Edges, attribute_name, attribute_dim)
[0141] GetEdgeStringAttribute(Edges, attribute_name, attribute_dim)
[0142] Among them, nodes represents the vertex set parameter, Edges represents the edge set parameter, attribute_name represents the attribute name parameter, and attribute_dim represents the attribute dimension parameter.
[0143] In the embodiment of the present disclosure, the attribute query process is: using the attribute query interface, obtaining the attributes to be queried of the specified points and / or edges, as well as the dimensions of the attributes to be queried, the attributes to be queried including at least one of sparse values, dense values and string values, and intercepting the attributes to be queried according to the dimensions of the attributes to be queried.
[0144] In this disclosure, random walk refers to obtaining a series of vertex sequences by performing multiple neighbor sampling according to certain probability rules. The unified random walk interface is implemented as follows:
[0145] RandomWalk(nodes, edge_type, walk_length, context_size, p, q, index_name, index_op, attribute_value)
[0146] Among them, nodes represents the parameter for specifying the vertex set, edge_type represents the type parameter of the edge, walk_length represents the length of the random walk sequence, context_size represents the window size parameter for generating the context sequence from the random walk sequence, p represents the parameter for the random walk control to return the probability of the current vertex, q represents the parameter for the random walk control BFS or DFS, index_name represents the type parameter of the attribute index, index_op represents the operator parameter of the attribute index, and the optional values are equal / unequal / exist / not exist / greater than / less than / greater than or equal to / less than or equal to, attribute_value represents the attribute value parameter, which can be multiple values, separated by commas.
[0147] In the embodiment of the present disclosure, the random sampling process is: 1) according to the specified vertex set as the starting point of the walk, the neighbors that meet the edge type are screened out in the sample graph, and the attribute values of the neighbors, as well as the type of attribute index and the filtering conditions supported by the type of attribute index (operator of attribute index); 2) the target neighbors that meet the pre-set attribute index type and filtering conditions are screened out in the sample graph; 3) according to the parameter p that controls the probability of returning the current vertex and the parameter q that controls BFS or DFS, based on the target neighbor, the next walk vertex is sampled; 4) this walk vertex is used as the new walk starting point, and the above steps are repeated until the length of the walk sequence is reached; 5) a context sequence is generated according to the random walk sequence window size context_size to obtain sampling data.
[0148] In this disclosure, subgraph sampling refers to directly sampling to obtain a complete subgraph, which includes the attributes of points, edges, multi-hop neighbors, and points and edges. Subgraph sampling can make GNN sampling more efficient. The unified subgraph sampling interface is implemented as follows:
[0149] Subgraph(nodes, metapath, hops, index_name, index_op, attribute_value)
[0150] Among them, nodes represents the specified vertex set parameter, metapath represents the edge type parameter of each hop neighbor, hops represents the number parameter of each hop neighbor, index_name represents the type parameter of the attribute index, index_op represents the operator parameter of the attribute index, and the optional values are equal / unequal / exists / does not exist / greater than / less than / greater than or equal to / less than or equal to, attribute_value represents the attribute value, which can be multiple values, separated by commas.
[0151] In the disclosed embodiment, the process of subgraph sampling is as follows: 1) according to the specified vertex set as the center point of the subgraph, the neighbors of the edge type that meets the center point of the i-th hop are screened out in the sample graph, and the attribute values of the neighbors, as well as the type of the attribute index and the filtering conditions supported by the type of the attribute index (operator of the attribute index); 2) the target neighbors that meet the pre-set attribute index type and filtering conditions are screened out in the sample graph; 3) a probability distribution is constructed according to the weights of the screened target neighbors, 4) random sampling is performed multiple times based on this probability distribution until the number of the i-th hop is reached, 5) the vertex in 4) is used as the new center point, and the above steps are repeated until the length of hops is reached, and 6) all vertices are sampled as sampling data.
[0152] Figure 4 A flowchart of a graph learning method according to another embodiment of the present disclosure is schematically shown. Figure 2 The learning model in also supports unified custom models.
[0153] like Figure 4 As shown, the method further includes operations S301 to S302.
[0154] In operation S401, a unified custom model is constructed, the custom model includes a model_fn function and an input_fn function, the model_fn function is used to define the execution logic of the model, and the input_fn function is used to define the processed sampled data;
[0155] In operation S402, the train function is called to train the custom model as a learning model.
[0156] In this disclosure, the learning model supports a unified custom model, provides common graph algorithm Layers, and implements model componentization. The custom model is implemented as follows:
[0157]
[0158] When training the custom model, first implement the model_fn function and the input_fn function respectively, and then call the train function to start the custom model for training.
[0159] In one of the embodiments of the present disclosure, a learning model is trained using a Parameter Server and All reduce distributed training strategy.
[0160] In the present disclosure, in the Parameter Server architecture, the nodes in the cluster are divided into two categories: parameter server and worker. The parameter server stores the parameters of the model, while the worker is responsible for calculating the gradient of the parameters. In each iteration, the worker obtains the parameters from the parameter server and then returns the calculated gradient to the parameter server. The parameter server aggregates the gradients returned from the worker, then updates the parameters and broadcasts the new parameters to the worker.
[0161] The algorithm used in all-reduce distributed training is Ring-allreduce. Each device in the cluster is a worker and forms a ring. There is no central node to aggregate the gradients calculated by all workers. In an iterative process, each worker completes its own mini-batch training, calculates the gradient, and passes the gradient to the next worker in the ring. At the same time, it also receives the gradient from the previous worker.
[0162] Furthermore, the present disclosure can adopt multiple distributed training models of CPU and GPU, including single machine single card, single machine multiple cards, multiple machines single card, and multiple machines multiple cards.
[0163] Figure 5 A block diagram of a graph learning framework according to an embodiment of the present disclosure is schematically shown.
[0164] like Figure 5 As shown, the graph learning framework 500 includes a sampling module 510 , a processing module 520 , and an input module 530 .
[0165] The sampling module 510 is used to sample the sample graph using a preset interface including point and / or edge attribute index parameters to obtain sampling data. The preset interface is implemented using TensorFlow and PyTorch respectively.
[0166] The processing module 520 is used to process the sampled data using the Dataset and Transform provided by TensorFlow and PyTorch to obtain processed sampled data.
[0167] The input module 530 is used to input the processed sample data into the learning model so that the learning model can learn the sample graph.
[0168] In one embodiment of the present disclosure, the types of attribute indexes include Hash index and Range index;
[0169] Hash indexes support filtering conditions where vertex and / or edge attribute values are equal or unequal;
[0170] Range index supports any of the following filtering conditions: existence, non-existence, greater than, less than, greater than or equal to, or less than or equal to the vertex and / or edge attribute values;
[0171] The filtering condition is used to filter the points and / or edges of the sample graph.
[0172] In one embodiment of the present disclosure, the preset interface includes at least one of a point-edge sampling interface, a neighbor sampling interface, a random walk interface, and a subgraph sampling interface;
[0173] The sampling modules include:
[0174] An acquisition submodule, used to acquire a preset interface corresponding to the preset sampling type according to the preset sampling type;
[0175] The sampling submodule is used to implement the preset interface using TensorFlow and PyTorch respectively, sample the sample graph, and obtain sampling data.
[0176] Among them, when the preset sampling type includes point-edge sampling, obtain the point-edge sampling interface; when the preset sampling type includes neighbor sampling, obtain the neighbor sampling interface; when the preset sampling type includes random sampling, obtain the random sampling interface; when the preset sampling type includes sub-graph sampling, obtain the sub-graph sampling interface.
[0177] In one embodiment of the present disclosure, the graph learning framework 500 further includes:
[0178] A first screening module, used to screen out points and / or edges that meet the type of preset points and / or edges in the sample graph;
[0179] An acquisition module, used to obtain the attribute values of the points and / or edges screened out in the sample graph, as well as the pre-set attribute index type and the filtering conditions supported by the attribute index type;
[0180] The second screening module is used to screen out points and / or edges that meet the type and filtering conditions of the pre-set attribute index in the sample graph;
[0181] The data sampling module performs sampling of the points and / or edges according to a preset sampling type to obtain sampling data.
[0182] In one embodiment of the present disclosure, the preset interface further includes an attribute query interface, and the determination module includes:
[0183] The attribute acquisition submodule is used to obtain the attributes to be queried of the specified points and / or edges and the dimensions of the attributes to be queried by using the attribute query interface, wherein the attributes to be queried include at least one of a sparse value, a dense value and a string value;
[0184] The attribute interception submodule is used to intercept the attributes to be queried according to the dimensions of the attributes to be queried.
[0185] In one embodiment of the present disclosure, the graph learning framework 500 further includes:
[0186] A weight acquisition module is used to obtain the weights of the screened points and / or edges;
[0187] A graph construction module, used to construct a probability distribution graph based on the weights of the screened points and / or edges;
[0188] The sampling module is used to perform at least one random sampling on the probability distribution diagram to obtain sampling data.
[0189] In one embodiment of the present disclosure, the parameters of the point-edge sampling interface include the type and number of points or edges, the type of attribute index, the operator of the attribute index, and the attribute value.
[0190] The parameters of the neighbor sampling interface include vertex set, edge type, number, K value of Topk neighbors, attribute index type, attribute index operator, and attribute value.
[0191] The parameters of the attribute query interface include the set of vertices or edges, the attributes to be queried, and the dimensions of the attributes.
[0192] The parameters of the random walk interface include the specified vertex set, edge type, length of the random walk sequence, window size for generating context sequence from the random walk sequence, parameters for controlling the probability of returning the current vertex by the random walk, parameters for controlling the depth-first search or breadth-first search by the random walk, type of attribute index, attribute index operator, and attribute value.
[0193] The parameters of the subgraph sampling interface include the specified vertex set, the edge type of each hop neighbor, the number of each hop neighbors, the type of attribute index, the attribute index operator, and the attribute value.
[0194] In one of the embodiments of the present disclosure, the learning model supports DeepWalk model, Node2vec model, Line, MetaPath2Vec model, GraphSage model, and Graph Attention networks model.
[0195] In one embodiment of the present disclosure, the learning model supports a unified custom model, and the graph learning framework further includes:
[0196] The construction module is used to build a unified custom model. The custom model includes the model_fn function and the input_fn function. The model_fn function is used to define the execution logic of the model, and the input_fn function is used to define the processed sampling data.
[0197] The calling module is used to call the train function to train the custom model as a learning model.
[0198] In one of the embodiments of the present disclosure, a training model and a training module are also included, which are used to train the learning model using ParameterServer and All reduce distributed training strategies.
[0199] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0200] For example, any multiple of the sampling module 510, the processing module 520, and the input module 530 can be combined in one module / unit / sub-unit for implementation, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the sampling module 510, the processing module 520, and the input module 530 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, at least one of the sampling module 510 , the processing module 520 , and the input module 530 may be at least partially implemented as a computer program module, and when the computer program module is executed, the corresponding function may be executed.
[0201] It should be noted that the graph learning framework in the embodiments of the present disclosure corresponds to the graph learning method part in the embodiments of the present disclosure. The description of the graph learning system part specifically refers to the graph learning method part, which will not be repeated here.
[0202] Figure 6 A block diagram of a computer system suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. Figure 6 The computer system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0203] like Figure 6 As shown, the computer system 600 according to the embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage part 608 to the random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.
[0204] In RAM 603, various programs and data required for the operation of system 600 are stored. Processor 601, ROM 602 and RAM 603 are connected to each other through bus 604. Processor 601 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 602 and / or RAM 603. It should be noted that the program can also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0205] According to an embodiment of the present disclosure, the system 600 may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The system 600 may further include one or more of the following components connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0206] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0207] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0208] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0209] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 602 and / or the RAM 603 described above and / or one or more memories other than the ROM 602 and the RAM 603 .
[0210] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0211] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0212] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A graph learning method, comprising: Sampling the sample graph using a preset interface including vertex and / or edge attribute index parameters to obtain sampled data, wherein the preset interface is implemented using TensorFlow and PyTorch respectively; Process the sampled data using Dataset and Transform provided by TensorFlow and PyTorch to obtain processed sampled data; Inputting the processed sampling data into a learning model so that the learning model learns the sample graph; The sample graph is sampled using a preset interface including point and / or edge attribute index parameters, and the sampled data obtained includes: In the case where the preset interface includes a point-edge sampling interface, screening out points and / or edges that meet the types of preset points and / or edges in the sample graph; Obtaining attribute values of the points and / or edges screened out in the sample graph, as well as a preset attribute index type and filtering conditions supported by the attribute index type; Screening out points and / or edges in the sample graph that meet the type of the preset attribute index and the filtering condition; The points and / or edges are sampled using a preset sampling type to obtain the sampled data.
2. The method according to claim 1, wherein: The types of attribute indexes include Hash index and Range index; The Hash index supports filtering conditions where vertex and / or edge attribute values are equal or unequal; The Range index supports any one of the filtering conditions of existence, non-existence, greater than, less than, greater than or equal to, and less than or equal to of the vertex and / or edge attribute values; The filtering condition is used to filter the points and / or edges of the sample graph.
3. The method according to claim 1, wherein: The preset interface also includes at least one of a neighbor sampling interface, a random sampling interface and a subgraph sampling interface; The method of sampling the sample graph using a preset interface including point and / or edge attribute index parameters to obtain the sample data includes: According to a preset sampling type, obtaining a preset interface corresponding to the preset sampling type; Using TensorFlow and PyTorch to implement the preset interface respectively, sampling the sample graph to obtain sampling data; Among them, when the preset sampling type includes point-edge sampling, the point-edge sampling interface is obtained; when the preset sampling type includes neighbor sampling, the neighbor sampling interface is obtained; when the preset sampling type includes random sampling, the random sampling interface is obtained; when the preset sampling type includes sub-graph sampling, the sub-graph sampling interface is obtained.
4. The method according to claim 3, wherein: The preset interface also includes an attribute query interface, and the method includes: Using the attribute query interface, obtain the attribute to be queried of the specified point and / or edge, as well as the dimension of the attribute to be queried, wherein the attribute to be queried includes at least one of a sparse value, a dense value, and a string value; According to the dimension of the attribute to be queried, the attribute to be queried is intercepted.
5. The method according to claim 1, wherein: When the preset sampling type includes point-edge sampling, after obtaining the point-edge sampling interface, the method further includes: Obtaining weights of the screened points and / or edges; Constructing a probability distribution graph according to the weights of the screened points and / or edges; At least one random sampling is performed on the probability distribution graph to obtain the sampled data.
6. The method according to claim 4, wherein: The parameters of the point-edge sampling interface include the type and number of points or edges, the type of attribute index, the operator of the attribute index, and the attribute value; The parameters of the neighbor sampling interface include vertex set, edge type, number, K value of Topk neighbors, attribute index type, attribute index operator, and attribute value; The parameters of the attribute query interface include a set of vertices or edges, attributes to be queried, and dimensions of the attributes; The parameters of the random sampling interface include the specified vertex set, edge type, length of the random walk sequence, window size of the context sequence generated by the random walk sequence, parameters of the random walk control probability of returning the current vertex, parameters of the random walk control depth-first search or breadth-first search, type of attribute index, operator of attribute index, and attribute value; The parameters of the subgraph sampling interface include a specified vertex set, the type of edges of neighbors per hop, the number of neighbors per hop, the type of attribute index, the operator of the attribute index, and the attribute value.
7. According to the method of claim 1, the learning model supports DeepWalk model, Node2vec model, Line, MetaPath2Vec model, GraphSage model, and Graph Attention networks model.
8. The method according to claim 1, wherein the learning model supports a unified custom model, and the method further comprises: Build a unified custom model, the custom model includes a model_fn function and an input_fn function, the model_fn function is used to define the execution logic of the model, and the input_fn function is used to define the processed sampling data; The train function is called to train the custom model as the learning model.
9. A graph learning framework, comprising: A sampling module, used to sample the sample graph using a preset interface including vertex and / or edge attribute index parameters to obtain sampling data, wherein the preset interface is implemented using TensorFlow and PyTorch respectively; A processing module, used to process the sampled data using Dataset and Transform provided by TensorFlow and PyTorch to obtain processed sampled data; An input module, used for inputting the processed sample data into a learning model so that the learning model learns the sample graph; Wherein, the sampling module comprises: A first screening module, configured to screen out points and / or edges that meet the type of preset points and / or edges in the sample graph when the preset interface includes a point-edge sampling interface; An acquisition module, used to obtain the attribute values of the points and / or edges screened out in the sample graph, as well as the pre-set attribute index type and the filtering conditions supported by the attribute index type; The second screening module is used to screen out points and / or edges that meet the type and filtering conditions of the pre-set attribute index in the sample graph; The data sampling module performs sampling of the points and / or edges according to a preset sampling type to obtain sampling data.
10. A computer system comprising: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
11. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Data sampling and partitioning method for MapReduce system
CN102799486A
Multi-task deep feature space attitude face recognition method
CN110276274A