Link prediction method and device, program product, equipment and storage medium
By adding threshold checking and sub-graph connection mechanisms to link prediction, the long-tail problem on the number of common neighbors in link prediction is solved, and the accuracy and service quality of link prediction are improved.
Patent Information
- Application Number
- CN202410985093.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2025-01-14
AI Technical Summary
The existing link prediction methods have long tail problems in the dimension of the number of common neighbors, resulting in low link prediction accuracy between nodes with fewer common neighbors, affecting the satisfaction of business processing results.
By determining the number of common neighbors in the subgraph of two objects, if it is less than the threshold, add joint edges between the subgraphs so that they are not less than the threshold, and input the subgraph into the business model to predict whether there is an intersection between the objects. , filter edges with pre-trained models and multiple version models to improve accuracy.
The accuracy of link prediction and service quality are improved, so that the prediction accuracy between nodes with fewer common neighbors is close to the accuracy between nodes with more common neighbors, solving the long tail problem.
Smart Images

Figure CN119311972A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of artificial intelligence technology, and in particular, to a link prediction method and apparatus, program product, device, and storage medium. Background Art
[0002] In recent years, artificial intelligence technology has developed rapidly, and technological innovation has been launched in many fields, which has brought great convenience to people's work and life. For example, the link prediction method can construct a subgraph representing the intersection object based on the data of the predicted object, and then predict whether there is an intersection between the two predicted objects based on the subgraph of any two predicted objects. For example, if the two predicted objects are both enterprises, it can be predicted whether there is a business intersection between the two enterprises. For another example, if the two predicted objects are both people, it can be predicted whether there is a social relationship between the two people. For another example, if the two predicted objects are people and goods, it can be predicted whether the person has a demand for the goods.
[0003] However, the accuracy of the link prediction method in the related technology needs to be improved, resulting in that the processing results of the related services are difficult to satisfy users. Summary of the invention
[0004] In view of this, one or more embodiments of the present specification provide a link prediction method and apparatus, a program product, a device, and a storage medium.
[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:
[0006] According to a first aspect of one or more embodiments of this specification, a link prediction method is proposed, the method comprising:
[0007] Determine a common neighboring node of a node representing the first object in a subgraph of the first object and a node representing the second object in a subgraph of the second object, wherein the subgraph of the first object and the subgraph of the second object each include a plurality of nodes and a plurality of edges, each node represents an object, and an edge between any two nodes represents that the objects represented by the two nodes have an intersection;
[0008] If the number of common neighboring nodes between the node representing the first object and the node representing the second object is less than a quantity threshold, at least one connecting edge is added between the subgraph of the first node and the subgraph of the second node, so that the number of common neighboring nodes between the node representing the first object and the node representing the second object is not less than the quantity threshold;
[0009] The subgraph of the first object and the subgraph of the second object are input into a business model to determine whether there is an intersection between the first object and the second object.
[0010] In one or more embodiments of the present specification, adding at least one edge between the subgraph of the first node and the subgraph of the second node so that the number of common neighbor nodes is not less than the number threshold includes:
[0011] An edge is added between a neighbor node of the first node and the second node, and an edge is added between a neighbor node of the second node and the first node.
[0012] In one or more embodiments of this specification, the method further includes:
[0013] For each edge added between the subgraph of the first node and the subgraph of the second node, input the subgraphs of the two nodes connected by the edge into the pre-trained model to obtain the confidence of the edge;
[0014] If the confidence of the edge is greater than the confidence threshold, retain the edge;
[0015] If the confidence of the edge is not greater than the confidence threshold, the edge is deleted.
[0016] In one or more embodiments of this specification, the method further includes:
[0017] For each edge added between the subgraph of the first node and the subgraph of the second node, inputting the subgraphs of the two nodes connected by the edge into multiple versions of pre-trained models to obtain multiple confidences of the edge;
[0018] If the variance of the multiple confidences of the edge is less than the variance threshold, retain the edge;
[0019] If the variance of multiple confidences of the edge is not less than the variance threshold, the edge is deleted.
[0020] In one or more embodiments of this specification, the business model is trained in the following manner:
[0021] According to the subgraphs of two sample nodes of multiple sample node pairs in the full graph of the training data set, pre-training the prediction model for multiple rounds and saving it as a pre-trained model;
[0022] Determine common neighboring nodes of the two sample nodes according to the subgraphs of the two sample nodes of the sample node pair, and if the number of common neighboring nodes of the two sample nodes is less than a quantity threshold, add at least one connecting edge between the subgraphs of the two sample nodes so that the number of common neighboring nodes of the two sample nodes is not less than the quantity threshold;
[0023] According to the subgraph of two sample nodes of multiple sample node pairs in the full graph of the data set or the subgraph after adding at least one connecting edge, the pre-trained model is trained for multiple rounds until it converges and is saved as a business model.
[0024] In one or more embodiments of the present specification, adding at least one edge between the subgraphs of the two sample nodes so that the number of the common neighbor nodes is not less than the number threshold includes:
[0025] An edge is added between a neighbor node of one of the two sample nodes and the other sample node of the two sample nodes, and an edge is added between a neighbor node of the other sample node of the two sample nodes and one of the two sample nodes.
[0026] In one or more embodiments of this specification, the training process of the prediction model further includes:
[0027] For each edge added between the subgraphs of the two sample nodes, the subgraphs of the two nodes connected by the edge are input into the pre-trained model to obtain the confidence of the edge;
[0028] If the confidence of the edge is greater than the confidence threshold, retain the edge;
[0029] If the confidence of the edge is not greater than the confidence threshold, the edge is deleted.
[0030] In one or more embodiments of this specification, the step of saving the pre-training result of the prediction model includes:
[0031] Saving the pre-training results of the prediction model in multiple rounds as multiple versions of pre-training models;
[0032] The training process of the business model also includes:
[0033] For each edge added between the subgraphs of the two sample nodes, the subgraphs of the two nodes connected by the edge are input into multiple versions of pre-trained models to obtain multiple confidences of the edge;
[0034] If the variance of the multiple confidences of the edge is less than the variance threshold, retain the edge;
[0035] If the variance of multiple confidences of the edge is not less than the variance threshold, the edge is deleted.
[0036] In one or more embodiments of the present specification, the pre-training model is pre-trained for multiple rounds according to a subgraph of two sample nodes of a plurality of sample node pairs in the full graph of the data set or a subgraph after adding at least one connecting edge, until it converges and is saved as a business model, including:
[0037] Inputting the subgraph of the two sample nodes or the subgraph after adding at least one connecting edge into the pre-trained model to obtain a feature vector output by the pre-trained model and a classification result, wherein the classification result includes whether the two sample nodes have an intersection or do not have an intersection;
[0038] Determine the classification loss according to whether there is an intersection label between the two sample nodes and the classification result, and determine the central loss according to the feature vector and the central feature of the classification result;
[0039] The comprehensive loss is determined according to the classification loss and the center loss, and the network parameters of the pre-trained model are adjusted according to the comprehensive loss until it converges and is saved as a business model.
[0040] In one or more embodiments of this specification, the training process of the business model further includes:
[0041] The central feature of the classification result is updated according to the feature vector.
[0042] According to a second aspect of one or more embodiments of this specification, a link prediction device is provided, the device comprising:
[0043] A determination module, configured to determine a common neighboring node of a node representing the first object in a subgraph of the first object and a node representing the second object in a subgraph of the second object, wherein the subgraph of the first object and the subgraph of the second object each include a plurality of nodes and a plurality of edges, each node represents an object, and an edge between any two nodes represents that the objects represented by the two nodes have an intersection;
[0044] an adding module, configured to add at least one edge between a subgraph of the first node and a subgraph of the second node if the number of common neighboring nodes of the node representing the first object and the node representing the second object is less than a quantity threshold, so that the number of common neighboring nodes of the node representing the first object and the node representing the second object is not less than the quantity threshold;
[0045] A prediction module is used to input the subgraph of the first object and the subgraph of the second object into a business model to determine whether there is an intersection between the first object and the second object.
[0046] In one or more embodiments of the present specification, the adding module is used to add at least one edge between the subgraph of the first node and the subgraph of the second node so that the number of common neighbor nodes is not less than the number threshold, and is used to:
[0047] An edge is added between a neighbor node of the first node and the second node, and an edge is added between a neighbor node of the second node and the first node.
[0048] In one or more embodiments of the present specification, the device further comprises a screening module, which is used to:
[0049] For each edge added between the subgraph of the first node and the subgraph of the second node, input the subgraphs of the two nodes connected by the edge into the pre-trained model to obtain the confidence of the edge;
[0050] If the confidence of the edge is greater than the confidence threshold, retain the edge;
[0051] If the confidence of the edge is not greater than the confidence threshold, the edge is deleted.
[0052] In one or more embodiments of the present specification, the device further comprises a screening module, which is used to:
[0053] For each edge added between the subgraph of the first node and the subgraph of the second node, inputting the subgraphs of the two nodes connected by the edge into multiple versions of pre-trained models to obtain multiple confidences of the edge;
[0054] If the variance of the multiple confidences of the edge is less than the variance threshold, retain the edge;
[0055] If the variance of multiple confidences of the edge is not less than the variance threshold, the edge is deleted.
[0056] In one or more embodiments of this specification, the business model is trained in the following manner:
[0057] According to the subgraphs of two sample nodes of multiple sample node pairs in the full graph of the training data set, pre-training the prediction model for multiple rounds and saving it as a pre-trained model;
[0058] Determine common neighboring nodes of the two sample nodes according to the subgraphs of the two sample nodes of the sample node pair, and if the number of common neighboring nodes of the two sample nodes is less than a quantity threshold, add at least one connecting edge between the subgraphs of the two sample nodes so that the number of common neighboring nodes of the two sample nodes is not less than the quantity threshold;
[0059] According to the subgraph of two sample nodes of multiple sample node pairs in the full graph of the data set or the subgraph after adding at least one connecting edge, the pre-trained model is trained for multiple rounds until it converges and is saved as a business model.
[0060] In one or more embodiments of the present specification, adding at least one edge between the subgraphs of the two sample nodes so that the number of the common neighbor nodes is not less than the number threshold includes:
[0061] An edge is added between a neighbor node of one of the two sample nodes and the other sample node of the two sample nodes, and an edge is added between a neighbor node of the other sample node of the two sample nodes and one of the two sample nodes.
[0062] In one or more embodiments of this specification, the training process of the prediction model further includes:
[0063] For each edge added between the subgraphs of the two sample nodes, the subgraphs of the two nodes connected by the edge are input into the pre-trained model to obtain the confidence of the edge;
[0064] If the confidence of the edge is greater than the confidence threshold, retain the edge;
[0065] If the confidence of the edge is not greater than the confidence threshold, the edge is deleted.
[0066] In one or more embodiments of this specification, the saving as a pre-trained model includes:
[0067] Saving the pre-training results of the prediction model in multiple rounds as multiple versions of pre-training models;
[0068] The training process of the business model also includes:
[0069] For each edge added between the subgraphs of the two sample nodes, the subgraphs of the two nodes connected by the edge are input into multiple versions of pre-trained models to obtain multiple confidences of the edge;
[0070] If the variance of the multiple confidences of the edge is less than the variance threshold, retain the edge;
[0071] If the variance of multiple confidences of the edge is not less than the variance threshold, the edge is deleted.
[0072] In one or more embodiments of the present specification, the pre-training model is pre-trained for multiple rounds according to a subgraph of two sample nodes of a plurality of sample node pairs in the full graph of the data set or a subgraph after adding at least one connecting edge, until it converges and is saved as a business model, including:
[0073] Inputting the subgraph of the two sample nodes or the subgraph after adding at least one connecting edge into the pre-trained model to obtain a feature vector output by the pre-trained model and a classification result, wherein the classification result includes whether the two sample nodes have an intersection or do not have an intersection;
[0074] Determine the classification loss according to whether there is an intersection label between the two sample nodes and the classification result, and determine the central loss according to the feature vector and the central feature of the classification result;
[0075] The comprehensive loss is determined according to the classification loss and the center loss, and the network parameters of the pre-trained model are adjusted according to the comprehensive loss until it converges and is saved as a business model.
[0076] In one or more embodiments of this specification, the training process of the business model further includes:
[0077] The central feature of the classification result is updated according to the feature vector.
[0078] According to a fifth aspect of one or more embodiments of the present specification, a computer program product is proposed, comprising a computer program / instruction, which implements the steps of the method described in the first aspect when executed by a processor.
[0079] According to a sixth aspect of one or more embodiments of this specification, an electronic device is provided, including:
[0080] processor;
[0081] a memory for storing processor-executable instructions;
[0082] The processor implements the method as described in the first aspect by running the executable instructions.
[0083] According to a seventh aspect of one or more embodiments of the present specification, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
[0084] The technical solutions provided by the embodiments of this specification may have the following beneficial effects:
[0085] The link prediction method provided in the embodiment of the present specification determines whether there is an intersection between the first object and the second object based on the subgraph of the first object and the subgraph of the second object, that is, before predicting whether there is a link between the node representing the first object in the subgraph of the first object and the node representing the second object in the subgraph of the second object, first determines the number of common neighboring nodes between the node representing the first object and the node representing the second object. If the number is not less than the number threshold, it is directly determined whether there is an intersection between the first object and the second object based on the subgraph of the first object and the subgraph of the second object. If the number is less than the number threshold, a connecting edge is added between the subgraph of the first object and the subgraph of the second object so that the number is not less than the number threshold, and then the subgraph of the first object and the subgraph of the second object are input into the business model to determine whether there is an intersection between the first object and the second object, thereby avoiding the long tail problem of the link prediction technology in the dimension of the number of common neighboring nodes, so that the link prediction accuracy between nodes with fewer common neighboring nodes can also reach the link prediction accuracy between nodes with more common neighboring nodes, thereby improving the accuracy of link prediction and the service quality of the link prediction business as a whole. BRIEF DESCRIPTION OF THE DRAWINGS
[0086] Figure 1 It is a schematic diagram of the relationship between the accuracy and the two dimensions of degree and the number of common neighbor nodes when the GCN model and the SEAL model provided by an exemplary embodiment perform link prediction on the three data sets of Cora, Citeseer and Pubmed.
[0087] Figure 2 It is a schematic diagram of the architecture of an application provided by an exemplary embodiment.
[0088] Figure 3 It is a flowchart of a link prediction method provided by an exemplary embodiment.
[0089] Figure 4 is a schematic diagram of two sub-graphs provided by an exemplary embodiment.
[0090] Figure 5 It is a schematic diagram of adding a connection edge between two subgraphs provided by an exemplary embodiment.
[0091] Figure 6 It is a flowchart of a prediction model training process provided by an exemplary embodiment.
[0092] Figure 7 It is a structural schematic diagram of a device provided by an exemplary embodiment.
[0093] Figure 8 It is a block diagram of a link prediction apparatus provided by an exemplary embodiment. DETAILED DESCRIPTION
[0094] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0095] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0096] First, some concepts involved in this specification are explained.
[0097] Long-tailed distribution: Long-tailed distribution is a type of probability distribution, which describes that the probability of an event gradually decreases as a certain metric increases. In machine learning models, generally speaking, there are many samples in a certain category and few samples in other categories. Therefore, long-tailed distribution will lead to long-tail problems - that is, the prediction accuracy of the head (category with many samples) is high, and the prediction accuracy of the tail (category with few samples) is low.
[0098] Link prediction: predicting whether two nodes in a graph are connected.
[0099] Common neighbors: If a node in the graph is a one-hop neighbor of two other nodes, then the node is a common neighbor of the other two nodes.
[0100] Subgraph: Relative to the full graph of the data set, a subgraph is a subgraph consisting of a node itself and its N-hop neighboring nodes, where N is generally 1 or 2.
[0101] In recent years, artificial intelligence technology has developed rapidly, and technological innovation has been launched in many fields, which has brought great convenience to people's work and life. For example, the link prediction method can construct a subgraph representing the intersection object based on the data of the predicted object, and then predict whether there is an intersection between the two predicted objects based on the subgraph of any two predicted objects. For example, if the two predicted objects are both enterprises, it can be predicted whether there is a business intersection between the two enterprises. For another example, if the two predicted objects are both people, it can be predicted whether there is a social relationship between the two people. For another example, if the two predicted objects are people and goods, it can be predicted whether the person has a demand for the goods.
[0102] However, the accuracy of the link prediction method in the related technology needs to be improved, resulting in that the processing results of the related services are difficult to satisfy users.
[0103] Based on this, at least one embodiment of the present specification provides a link prediction method, which can predict whether there is an intersection between two objects based on the subgraphs of the two objects, and the content of the intersection is consistent with the type of object. For example, the intersection between enterprises is business transactions, financial transactions, etc., the intersection between people is social relationships, and the intersection between people and goods is shopping needs, etc.
[0104] The method is designed by the applicant based on the long-tail problem existing in the link prediction field discovered by the applicant. Specifically, link prediction has a long-tail problem in the dimension of the number of common neighboring nodes, that is, the link prediction accuracy between nodes with a large number of common neighboring nodes (i.e., head nodes) is higher, while the link prediction accuracy between nodes with a small number of common neighboring nodes (i.e., tail nodes) is lower.
[0105] Please refer to the attached Figure 1 The relationship between the accuracy of the GCN model and the SEAL model when performing link prediction on the three datasets of Cora, Citeseer and Pubmed is shown in Figure 1, and the relationship between the degree (node pair degree, i.e., the number of neighboring nodes of a node pair, the sum of the number of neighboring nodes of the two nodes in the node pair) and the number of common neighboring nodes (i.e., the number of common neighboring nodes of the two nodes in the node pair). Figure 1 Figure a shows the statistical results of the degree of nodes in the full graph of the Cora dataset (i.e., a bar graph), the relationship between the accuracy of link prediction performed by the GCN model on the Cora dataset and the degree (i.e., a dotted line), and the relationship between the accuracy of link prediction performed by the SEAL model on the Cora dataset and the degree (i.e., a solid line); Figure 1Figure b shows the statistical results of the degree of nodes in the full graph of the Cora dataset (i.e., a bar graph), the relationship between the accuracy of link prediction performed by the GCN model on the Cora dataset and the number of common neighboring nodes (i.e., a dotted line), and the relationship between the accuracy of link prediction performed by the SEAL model on the Cora dataset and the number of common neighboring nodes (i.e., a solid line); Figure 1 Figure c shows the statistical results of the degree of nodes in the full graph of the Citeseer dataset (i.e., a bar graph), the relationship between the accuracy of link prediction performed by the GCN model on the Citeseer dataset and the degree (i.e., a dotted line), and the relationship between the accuracy of link prediction performed by the SEAL model on the Citeseer dataset and the degree (i.e., a solid line); Figure 1 Figure d shows the statistical results of the degree of nodes in the full graph of the Citeseer dataset (i.e., a bar graph), the relationship between the accuracy of link prediction performed by the GCN model on the Citeseer dataset and the number of common neighboring nodes (i.e., a dotted line), and the relationship between the accuracy of link prediction performed by the SEAL model on the Citeseer dataset and the number of common neighboring nodes (i.e., a solid line); Figure 1 Figure e shows the statistical results of the degree of nodes in the full graph of the Pubmed dataset (i.e., a bar graph), the relationship between the accuracy of link prediction performed by the GCN model on the Pubmed dataset and the degree (i.e., a dotted line), and the relationship between the accuracy of link prediction performed by the SEAL model on the Pubmed dataset and the degree (i.e., a solid line); Appendix Figure 1 Figure f shows the statistical results of the degree of nodes in the full graph of the Pubmed dataset (i.e., a bar graph), the relationship between the accuracy of link prediction performed by the GCN model on the Pubmed dataset and the number of common neighboring nodes (i.e., a dotted line), and the relationship between the accuracy of link prediction performed by the SEAL model on the Pubmed dataset and the number of common neighboring nodes (i.e., a solid line). Figure 1 It can be seen that link prediction does not have a long tail problem in the dimension of degree, but has a long tail problem in the dimension of the number of common neighboring nodes.
[0106] For example, this method can be applied to Figure 2 The client 100 of the application shown, that is, the functions provided by the method are integrated in the client 100, so that the client 100 can locally apply the method to predict whether there is an intersection between objects, and execute business based on the prediction results, thereby improving the business processing level. Among them, the client 100 can be a program installed in the user terminal to provide services to the user, and the client 100 includes but is not limited to an application APP, a web page, a small program, a plug-in or a component, etc.; Figure 2As shown, the user terminal includes but is not limited to smart phones, personal digital assistants, tablet computers, personal computers, laptops, virtual reality terminal devices, augmented reality terminal devices, etc.
[0107] For example, this method can be applied to Figure 2 The server 200 of the application shown, that is, the functions provided by the method are deployed on the server 200, and the client 100 can notify the server 200 of the objects involved when executing the business, so that the server 200 can predict whether there is an intersection between the above-mentioned objects based on the method, and execute the business based on the prediction result, and finally feed back the business execution result to the client 100. The server 200 can use its computing power advantage to improve the image and video processing effect of the method. Among them, the server 200 can be a program installed in the background device to provide services to users. Figure 2 As shown, the background device can be a server, which can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0108] Among them, the application in the above example can be a financial application. When it processes the transfer business between two companies, it can judge whether the two companies have an intersection based on this method, such as whether they have an upstream and downstream relationship in the supply chain. If so, the transfer is executed, otherwise the transfer is rejected.
[0109] Alternatively, the application in the above example can be a social application. When processing the friend recommendation business, it can determine which users have intersections with the target user based on this method, such as having a friend relationship, and recommend these users to the target user to improve its user adding efficiency and application usage experience.
[0110] Alternatively, the application in the above example can be a shopping application. When processing the product recommendation business, it can determine which products have intersections with the target users based on this method, such as purchasing needs, and recommend these products to the target users, so as to improve the user's efficiency in screening products and the exposure of products, and improve the user and merchant experience.
[0111] Please refer to the attached Figure 3 , which exemplarily shows the process of the link prediction method, including steps S201 to S203.
[0112] In step S301, determine the common neighboring nodes of the node representing the first object in the subgraph of the first object and the node representing the second object in the subgraph of the second object, wherein the subgraph of the first object and the subgraph of the second object both include multiple nodes and multiple edges, each node represents an object, and the edge between any two nodes represents that the objects represented by the two nodes have an intersection.
[0113] There is no restriction on the types of the first object and the second object, and the two can be the same or different, for example, their types can be enterprises, people, commodities, etc. The number of neighboring node hops of the subgraph of the first object and the subgraph of the second object is the same, that is, the subgraph of the first object includes the node representing the first object and all N-hop neighboring nodes of the node, as well as the edges between these nodes; the subgraph of the second object includes the node representing the second object and all N-hop neighboring nodes of the node, as well as the edges between these nodes, and N is 1 or 2.
[0114] Among them, the subgraph of the first object is constructed based on the data of the first object. For example, if the first object is an enterprise, its data may include enterprises with intersections (such as upstream and downstream enterprises in the supply chain, subsidiaries, parent companies, companies with the same shareholders, etc.), people (corporate legal persons, corporate executives, corporate holding persons, enterprises, etc.), commodities (commodities generated by the enterprise, commodities purchased by the enterprise, commodities sold by the enterprise, etc.), etc. The enterprises, people, commodities and other objects involved in these data will become nodes in the subgraph of the first object, and these nodes will be connected according to the relationship between the represented objects.
[0115] Among them, the subgraph of the second object is constructed based on the data of the second object. For example, if the second object is an enterprise, its data may include enterprises with intersections (such as upstream and downstream enterprises in the supply chain, subsidiaries, parent companies, companies with the same shareholders, etc.), people (corporate legal persons, corporate executives, corporate holding persons, enterprises, etc.), commodities (commodities generated by the enterprise, commodities purchased by the enterprise, commodities sold by the enterprise, etc.), etc. The enterprises, people, commodities and other objects involved in these data will become nodes in the subgraph of the second object, and these nodes will be connected according to the relationship between the objects represented.
[0116] It should be understood that the subgraph of the first object and the subgraph of the second object may be independent of each other, or connected as a whole due to partial overlap.
[0117] If a certain node is both a one-hop neighbor node of a node representing a first object and a one-hop neighbor node of a node representing a second object, then the node is a common neighbor node of the node representing the first object and the node representing the second object.
[0118] Please refer to the attached Figure 4, which exemplarily shows a subgraph of a first object and a subgraph of a second object. The two subgraphs are connected as a whole due to partial overlap. In the figure, V1 represents the first object, V2 represents the second object, V1, V3, V4, and V5 are the first subgraph, V2, V4, and V5 are the second subgraph, and V4 and V5 are common neighboring nodes of V1 and V2.
[0119] Please refer to the attached Figure 5 In the figure, a exemplarily shows a subgraph of the first object and a subgraph of the second object. The two subgraphs are independent of each other. In the figure, V1 represents the first object, V2 represents the second object, V1, V3, V4, and V5 are the first subgraph, and V2, V6, and V7 are the second subgraph. V1 and V2 have no common neighboring nodes.
[0120] In step S302, if the number of common neighboring nodes between the node representing the first object and the node representing the second object is less than a quantity threshold, at least one connecting edge is added between the subgraph of the first node and the subgraph of the second node so that the number of common neighboring nodes between the node representing the first object and the node representing the second object is not less than the quantity threshold.
[0121] The quantity threshold may be preset, for example, set to 1.
[0122] Exemplarily, at least one edge may be added between the subgraph of the first node and the subgraph of the second node in the following manner: adding an edge between the neighbor node of the first node and the second node, and adding an edge between the neighbor node of the second node and the first node. That is, adding an edge between the subgraph of the first object and the subgraph of the second object according to the following formula:
[0123]
[0124] In the above formula, ε o The set of edges added between the subgraph of node u and the subgraph of node v, N u is the set of one-hop neighbor nodes of node u, N v is the set of one-hop neighbor nodes of node v.
[0125] For example, Figure 4 The number of common neighbor nodes between V1 and V2 in the above example is 2, which is not less than 1. Therefore, there is no need to add Figure 4 Add an edge between two subgraphs in .
[0126] For example, Figure 5 The number of common neighbor nodes between V1 and V2 in a is 0, which is less than 1, so edges are added between V1 and V6, V1 and V7, V2 and V3, V2 and V4, and V2 and V5 respectively.
[0127] This example adds edges between two nodes and each other's neighboring nodes, thereby increasing the number of common neighboring nodes of the two nodes and avoiding adding edges between all nodes that do not have edges, which wastes computing power and increases noise.
[0128] Furthermore, the method can also further screen the edges added in the example as candidate edges, thereby further reducing noise, that is, removing the edges between nodes that do not have links in the candidate edge set, so as to further improve the accuracy of the added edges. For example, the edges added in this step can be screened in the manner provided in any of the following optional examples.
[0129] Optional Example 1
[0130] The method may also include: for each edge added between the subgraph of the first node and the subgraph of the second node, inputting the subgraph of the two nodes connected by the edge into the pre-trained model to obtain the confidence of the edge; if the confidence of the edge is greater than a confidence threshold, retaining the edge; if the confidence of the edge is not greater than the confidence threshold, deleting the edge.
[0131] The business model is a prediction model that undergoes multiple rounds of pre-training and multiple rounds of training until convergence. The specific details of pre-training and training will be described in detail in other embodiments below and will not be repeated here. The result of the last round of pre-training of the prediction model can be called a pre-trained model.
[0132] Among them, the confidence output by the pre-trained model represents the confidence that there is a link between the two nodes connected by the edge.
[0133] The method provided in this example can reduce the noise in the added links, improve the accuracy of the added links, and reduce the computing power consumption of subsequent business models when performing link prediction.
[0134] Optional Example 2
[0135] The method may also include: for each edge added between the subgraph of the first node and the subgraph of the second node, inputting the subgraphs of the two nodes connected by the edge into multiple versions of pre-trained models to obtain multiple confidences of the edge; if the variance of the multiple confidences of the edge is less than a variance threshold, retaining the edge; if the variance of the multiple confidences of the edge is not less than the variance threshold, deleting the edge.
[0136] Among them, the business model is obtained by the prediction model through multiple rounds of pre-training and multiple rounds of training in sequence until convergence. The specific details of pre-training and training will be described in detail in other embodiments below, and will not be repeated here. The pre-training results of different rounds can be called different versions of pre-training models. In this preferred example, the last round can be used as the starting point, and the pre-training results of multiple rounds can be selected at fixed intervals, and the subgraph of the two nodes connected by the edge can be input into the pre-training results of the selected round to obtain the confidence of the output of the pre-training results of each round. For example, after 100 rounds of pre-training, the subgraph of the two nodes connected by the edge can be input into the pre-training results of the 100th, 80th, 60th, 40th, and 20th rounds to obtain the confidence of the output of the pre-training results of these rounds.
[0137] Among them, the confidence output by each version of the pre-trained model represents the confidence that there is a link between the two nodes connected by the edge.
[0138] The applicant has found that the variance of the confidence scores of nodes that actually have links in different versions of pre-trained models is often small. Therefore, the method provided in this example can reduce the noise in the added links, improve the accuracy of the added links, and reduce the computing power consumption of subsequent business models when performing link predictions.
[0139] Optional Example 3
[0140] The method may also include: for each edge added between the subgraph of the first node and the subgraph of the second node, inputting the subgraphs of the two nodes connected by the edge into multiple versions of pre-trained models to obtain multiple confidences of the edge; if the confidence output by the pre-training result of the last round is greater than the confidence threshold, and the variance of the multiple confidences output by multiple versions is less than the variance threshold, retaining the edge; if the confidence output by the pre-training result of the last round is not greater than the confidence threshold, or the variance of the multiple confidences output by multiple versions is not less than the variance threshold, deleting the edge.
[0141] Among them, the business model is obtained by the prediction model undergoing multiple rounds of pre-training and multiple rounds of training in sequence until convergence. The specific details of pre-training and training will be described in detail in other embodiments below and will not be repeated here. The pre-training results of different rounds can be called different versions of pre-training models. In this preferred example, the last round can be used as the starting point, and the pre-training results of multiple rounds can be selected at fixed intervals, and the subgraph of the two nodes connected by the edge can be input into the pre-training results of the selected round to obtain the confidence of the pre-training results output of each round.
[0142] Among them, the confidence output by each version of the pre-trained model represents the confidence that there is a link between the two nodes connected by the edge.
[0143] This example combines the filtering conditions of the above two examples. Compared with the above two examples, it can further reduce the noise in the added links, improve the accuracy of the added links, and reduce the computing power consumption of subsequent business models when performing link prediction.
[0144] For example, Figure 5 The edges added between V1 and V6, V1 and V7, V2 and V3, V2 and V4, and V2 and V5 in a form a candidate edge set. After screening by any of the above optional examples, the edge between V1 and V6 and the edge between V3 and V2 are retained to form an additional edge set. Figure 5 The result shown in b is that the subgraph of the first object and the subgraph of the second object are connected as a whole. At this time, V3 and V6 become common neighbor nodes between V1 and V2.
[0145] In step S303, the subgraph of the first object and the subgraph of the second object are input into a business model to determine whether the first object and the second object have an intersection.
[0146] For example, the business model will output the confidence that there is a link between the node representing the first object and the node representing the second object based on the subgraph of the first object and the subgraph of the second object, and then determine whether there is an intersection between the first object and the second object based on the confidence. For example, if the confidence is greater than the classification threshold, it is determined that there is an intersection between the first and second objects; otherwise, it is determined that there is no intersection between the first and second objects.
[0147] It should be understood that this step determines whether the first object and the second object have an intersection when the number of common neighbor nodes of the node representing the first object and the node representing the second object is not less than the number threshold.
[0148] For example, in this step, the attached Figure 4 The subgraph of the first object and the subgraph of the second object shown are input into the business model to determine whether the first object and the second object have an intersection. That is, if the number of common neighbor nodes of the node representing the first object and the node representing the second object is not less than the number threshold without adding edges, the subgraph of the first object and the subgraph of the second object are directly input into the business model to determine whether the first object and the second object have an intersection.
[0149] For another example, in this step, the attached Figure 5The result of adding the edge between V1 and V6 and the edge between V3 and V2 between the subgraph of the first object and the subgraph of the second object shown in b is input into the business model to determine whether the first object and the second object have an intersection. That is, if the number of common neighboring nodes of the node representing the first object and the node representing the second object is originally less than the number threshold, then after adding an edge between the subgraph of the first object and the subgraph of the second object, the subgraph of the first object and the subgraph of the second object after adding the edge can be input into the business model to determine whether the first object and the second object have an intersection.
[0150] The link prediction method provided in the embodiments of the present specification determines whether there is an intersection between the first object and the second object based on the subgraph of the first object and the subgraph of the second object, that is, before predicting whether there is a link between the node representing the first object in the subgraph of the first object and the node representing the second object in the subgraph of the second object, first determines the number of common neighboring nodes between the node representing the first object and the node representing the second object. If the number is not less than the number threshold, directly determines whether there is an intersection between the first object and the second object based on the subgraph of the first object and the subgraph of the second object. If the number is less than the number threshold, add edges between the subgraph of the first object and the subgraph of the second object so that the number is not less than the number threshold, and then inputs the subgraph of the first object and the subgraph of the second object into the business model to determine whether there is an intersection between the first object and the second object, thereby avoiding the long-tail problem of the link prediction technology in the dimension of the number of common neighboring nodes, so that the link prediction accuracy between nodes with fewer common neighboring nodes can also reach the link prediction accuracy between nodes with more common neighboring nodes, thereby improving the accuracy of link prediction and the service quality of the link prediction business as a whole.
[0151] In some embodiments of the present disclosure, the business model is as follows: Figure 6 The training is obtained in the manner shown, including steps S601 to S603.
[0152] In step S601, the prediction model is pre-trained for multiple rounds based on the subgraphs of two sample nodes of multiple sample node pairs in the full graph of the training data set, and is saved as a pre-trained model.
[0153] The full graph of the training data set includes a mesh structure consisting of multiple sample nodes and multiple edges, wherein sample nodes that do not have edges with each other form sample node pairs, and the sample node pairs have labels for characterizing whether there is an intersection between the two sample nodes. The training data set can be constructed based on basic data sets such as the Cora data set, the Citeseer data set, and the Pubmed data set. For example, if some edges in the basic data set are removed, the sample node pairs composed of the sample nodes at both ends of the removed edges are positive samples, that is, the label is that there is an intersection between the two sample nodes; other sample node pairs are negative samples, that is, the label is that there is no intersection between the two sample nodes.
[0154] The subgraph of the sample node may be an N-hop subgraph of the sample node, that is, the subgraph of the sample node composed of the sample node and all its N-hop neighboring nodes is extracted from the whole graph, and N is 1 or 2. For each pair of sample nodes, the subgraphs of the two sample nodes in the pair of sample nodes may be extracted in the above manner to be used in this step. It should be understood that the subgraphs of the two sample nodes may be independent of each other, or may be connected as a whole due to partial overlap.
[0155] Exemplarily, this step may save the pre-training results of the prediction model in multiple rounds as multiple versions of pre-training models.
[0156] Exemplarily, in this step, all sample node pairs in the full graph of the sample data set can be divided into multiple batches in each round, and the prediction model can be pre-trained with each batch in turn to complete one round of pre-training. Specifically, for each sample node pair in each batch, the prediction model can be pre-trained in the following manner:
[0157] First, the subgraph of the two sample nodes is input into the prediction model to obtain a feature vector output by the prediction model and a classification result, wherein the classification result includes whether the two sample nodes have an intersection or not.
[0158] Next, the classification loss is determined according to whether there is an intersection label between the two sample nodes and the classification result, and the central loss is determined according to the feature vector and the central feature of the classification result.
[0159] Among them, the central feature of each classification result can be initialized (for example, randomly initialized) before the start of the first round of pre-training, and after the feature vector is obtained at each sample node and the central loss is calculated with the central feature of the corresponding category, the central feature of the corresponding category is updated using the obtained feature vector, so that the central feature of each category is always at the center of all the feature vectors of the category that have been obtained. In other words, after the central loss is calculated in this step, the central feature of the classification result can also be updated according to the feature vector.
[0160] Finally, a comprehensive loss is determined according to the classification loss and the center loss, and network parameters of the prediction model are adjusted according to the comprehensive loss.
[0161] For example, the classification loss and the center loss are weighted summed to obtain the comprehensive loss.
[0162] For example, based on the comprehensive loss, the network parameters of the prediction model can be adjusted in the direction of reducing the loss function (i.e., the gradient direction) by back propagation.
[0163] In step S602, the common neighboring nodes of the two sample nodes of the sample node pair are determined according to the subgraphs of the two sample nodes; if the number of the common neighboring nodes of the two sample nodes is less than a quantity threshold, at least one connecting edge is added between the subgraphs of the two sample nodes so that the number of the common neighboring nodes of the two sample nodes is not less than the quantity threshold.
[0164] The quantity threshold may be preset, for example, set to 1.
[0165] Exemplarily, at least one edge may be added between the subgraphs of two sample nodes in the following manner: an edge is added between a neighbor node of one of the two sample nodes and the other of the two sample nodes, and an edge is added between a neighbor node of the other of the two sample nodes and one of the two sample nodes. That is, an edge is added between the subgraphs of two sample nodes according to the following formula:
[0166]
[0167] In the above formula, ε o N is the edge set added between the subgraph of sample node u and the subgraph of sample node v. u is the set of one-hop neighbor nodes of sample node u, N v is the set of one-hop neighboring nodes of the sample node v.
[0168] This example adds edges between two sample nodes and each other's neighboring nodes, thereby increasing the number of common neighboring nodes of the two sample nodes and avoiding adding edges between all nodes that do not have edges, which wastes computing power and increases noise.
[0169] Furthermore, the method can also further screen the edges added in the example as candidate edges, thereby further reducing noise, that is, removing the edges between sample nodes that do not have links in the candidate edge set, so as to further improve the accuracy of the added edges. For example, the edges added in this step can be screened in the manner provided in any of the following optional examples.
[0170] Optional Example 1
[0171] The training process of the business model also includes: for each edge added between the subgraphs of the two sample nodes, inputting the subgraphs of the two nodes connected by the edge into the pre-trained model to obtain the confidence of the edge; if the confidence of the edge is greater than a confidence threshold, retaining the edge; if the confidence of the edge is not greater than the confidence threshold, deleting the edge.
[0172] It can be seen from step S601 that the prediction model undergoes multiple rounds of pre-training in sequence to form a pre-trained model.
[0173] Among them, the confidence output by the pre-trained model represents the confidence that there is a link between the two nodes connected by the edge.
[0174] The method provided in this example can reduce the noise in the added edges, improve the accuracy of the added edges, and reduce the computing power consumption during the subsequent training of the pre-trained model.
[0175] Optional Example 2
[0176] The training process of the business model also includes: for each edge added between the subgraphs of the two sample nodes, inputting the subgraphs of the two nodes connected by the edge into multiple versions of the pre-trained model to obtain multiple confidences of the edge; if the variance of the multiple confidences of the edge is less than the variance threshold, retaining the edge; if the variance of the multiple confidences of the edge is not less than the variance threshold, deleting the edge.
[0177] It can be seen from step S601 that the prediction model undergoes multiple rounds of pre-training in sequence, and the pre-training results of different rounds can be called different versions of the pre-training model. In this preferred example, the last round can be used as the starting point, and multiple rounds of pre-training results can be selected at fixed intervals, and the subgraph of the two nodes connected by the edge can be input into the pre-training results of the selected round to obtain the confidence of the pre-training results output of each round. For example, after 100 rounds of pre-training, the subgraph of the two nodes connected by the edge can be input into the pre-training results of the 100th, 80th, 60th, 40th, and 20th rounds to obtain the confidence of the pre-training results output of these rounds.
[0178] Among them, the confidence output by each version of the pre-trained model represents the confidence that there is a link between the two nodes connected by the edge.
[0179] The applicant has found that the variance of the confidence output by nodes that actually have links in different versions of pre-trained models is often small. Therefore, the method provided in this example can reduce the noise in the added links, improve the accuracy of the added links, and reduce the computing power consumption during subsequent pre-trained model training.
[0180] Optional Example 3
[0181] The training process of the prediction model also includes: for each edge added between the subgraphs of the two sample nodes, the subgraphs of the two nodes connected by the edge are input into multiple versions of the pre-trained model to obtain multiple confidences of the edge; if the confidence output by the pre-training result of the last round is greater than the confidence threshold, and the variance of the multiple confidences output by the multiple versions is less than the variance threshold, the edge is retained; if the confidence output by the pre-training result of the last round is not greater than the confidence threshold, or the variance of the multiple confidences output by the multiple versions is not less than the variance threshold, the edge is deleted.
[0182] It can be seen from step S601 that the prediction model undergoes multiple rounds of pre-training in sequence, and the pre-training results of different rounds can be called different versions of the pre-training model. In this preferred example, the last round can be used as the starting point, and multiple rounds of pre-training results can be selected at fixed intervals, and the subgraph of the two nodes connected by the edge can be input into the pre-training results of the selected round to obtain the confidence of the pre-training results output of each round. For example, after 100 rounds of pre-training, the subgraph of the two nodes connected by the edge can be input into the pre-training results of the 100th, 80th, 60th, 40th, and 20th rounds to obtain the confidence of the pre-training results output of these rounds.
[0183] Among them, the confidence output by each version of the pre-trained model represents the confidence that there is a link between the two nodes connected by the edge.
[0184] This example combines the filtering conditions of the above two examples. Compared with the above two examples, it can further reduce the noise in the added edges, improve the accuracy of the added edges, and reduce the computing power consumption during subsequent pre-training model training.
[0185] In step S603, the pre-trained model is trained for multiple rounds according to a subgraph of two sample nodes of multiple sample node pairs in the full graph of the data set or a subgraph after adding at least one connecting edge, and is saved as a business model after convergence.
[0186] It should be understood that in this step, the number of common neighbor nodes of the two sample nodes of all sample node pairs is not less than the number threshold, because the number of common neighbor nodes of the two sample nodes of some sample node pairs is not less than the number threshold, and the number of common neighbor nodes of the two sample nodes of the remaining sample node pairs is originally less than the number threshold, but the edges have been added in step S602, so that the number of common neighbor nodes is not less than the number threshold. Therefore, if the number of common neighbor nodes of the two sample nodes of a certain sample node pair is not less than the number threshold, then in this step, when the pre-trained model is trained based on the sample node pair, the pre-trained model is trained for multiple rounds according to the subgraph of the two sample nodes of the sample node pair; if the number of common neighbor nodes of the two sample nodes of a certain sample node pair is less than the number threshold, then in this step, when the pre-trained model is trained based on the sample node pair, the pre-trained model is trained for multiple rounds according to the subgraph of the two sample nodes of the sample node pair after adding at least one edge (i.e., the edge added in step S602).
[0187] Exemplarily, in this step, all sample node pairs in the full graph of the sample data set can be divided into multiple batches in each round, and the pre-training results of the prediction model are trained with each batch in turn to complete one round of pre-training. Specifically, for each sample node pair in each batch, the pre-training model can be trained in the following manner:
[0188] First, a subgraph of the two sample nodes or a subgraph after adding at least one connecting edge is input into a pre-trained model to obtain a feature vector output by the pre-trained model and a classification result, wherein the classification result includes whether the two sample nodes have an intersection or not.
[0189] Next, the classification loss is determined according to whether there is an intersection label between the two sample nodes and the classification result, and the central loss is determined according to the feature vector and the central feature of the classification result.
[0190] Among them, after the feature vector is obtained for each sample node and the central feature of the corresponding category is calculated with the central loss, the central feature of the corresponding category can be updated using the obtained feature vector so that the central feature of each category is always at the center of all the feature vectors of the category that have been obtained. In other words, after the central loss is calculated in this step, the central feature of the classification result can also be updated according to the feature vector.
[0191] Finally, the comprehensive loss is determined according to the classification loss and the center loss, and the network parameters of the pre-trained model are adjusted according to the comprehensive loss until convergence and then saved as a business model.
[0192] For example, the classification loss and the center loss are weighted summed to obtain the comprehensive loss.
[0193] For example, based on the comprehensive loss, the network parameters of the pre-trained model can be adjusted in the direction of reducing the loss function (i.e., the gradient direction) by back-propagation.
[0194] In this embodiment, the prediction model is pre-trained and trained in sequence using the training data set, and before training, edges are added between the subgraphs of the sample node pairs whose number of common neighbor nodes is less than the threshold, so that the number of their common neighbor nodes is not less than the threshold, thereby avoiding the long-tail problem of the link prediction of the pre-trained model in the dimension of the number of common neighbor nodes, and improving the training effect of the pre-trained model. Moreover, the model is adjusted based on the classification loss and the center loss during the pre-training and training processes, thereby further improving the pre-training effect and the training effect, as well as the convergence speed of the training.
[0195] Figure 7 is a schematic structural diagram of a device provided by an exemplary embodiment. Figure 7 At the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and may also include hardware required for other tasks. One or more embodiments of this specification may be implemented based on software, such as the processor 702 reading the corresponding computer program from the non-volatile memory 710 into the memory 708 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0196] Please refer to Figure 8 , the link prediction device can be applied to Figure 7 In the device shown in the figure, the technical solution of this specification is implemented. The link prediction device may include:
[0197] A determination module 801 is used to determine a common neighboring node of a node representing the first object in a subgraph of the first object and a node representing the second object in a subgraph of the second object, wherein the subgraph of the first object and the subgraph of the second object both include a plurality of nodes and a plurality of edges, each node represents an object, and an edge between any two nodes represents that the objects represented by the two nodes have an intersection;
[0198] An adding module 802 is used to add at least one edge between a subgraph of the first node and a subgraph of the second node if the number of common neighboring nodes of the node representing the first object and the node representing the second object is less than a quantity threshold, so that the number of common neighboring nodes of the node representing the first object and the node representing the second object is not less than the quantity threshold;
[0199] The prediction module 803 is configured to input the subgraph of the first object and the subgraph of the second object into a business model to determine whether the first object and the second object have an intersection.
[0200] In one or more embodiments of the present specification, the adding module is used to add at least one edge between the subgraph of the first node and the subgraph of the second node so that the number of common neighbor nodes is not less than the number threshold, and is used to:
[0201] An edge is added between a neighbor node of the first node and the second node, and an edge is added between a neighbor node of the second node and the first node.
[0202] In one or more embodiments of the present specification, the device further comprises a screening module, which is used to:
[0203] For each edge added between the subgraph of the first node and the subgraph of the second node, input the subgraphs of the two nodes connected by the edge into the pre-trained model to obtain the confidence of the edge;
[0204] If the confidence of the edge is greater than the confidence threshold, retain the edge;
[0205] If the confidence of the edge is not greater than the confidence threshold, the edge is deleted.
[0206] In one or more embodiments of the present specification, the device further comprises a screening module, which is used to:
[0207] For each edge added between the subgraph of the first node and the subgraph of the second node, inputting the subgraphs of the two nodes connected by the edge into multiple versions of pre-trained models to obtain multiple confidences of the edge;
[0208] If the variance of the multiple confidences of the edge is less than the variance threshold, retain the edge;
[0209] If the variance of multiple confidences of the edge is not less than the variance threshold, the edge is deleted.
[0210] In one or more embodiments of this specification, the business model is trained in the following manner:
[0211] According to the subgraphs of two sample nodes of multiple sample node pairs in the full graph of the training data set, pre-training the prediction model for multiple rounds and saving it as a pre-trained model;
[0212] Determine common neighboring nodes of the two sample nodes according to the subgraphs of the two sample nodes of the sample node pair, and if the number of common neighboring nodes of the two sample nodes is less than a quantity threshold, add at least one connecting edge between the subgraphs of the two sample nodes so that the number of common neighboring nodes of the two sample nodes is not less than the quantity threshold;
[0213] According to the subgraph of two sample nodes of multiple sample node pairs in the full graph of the data set or the subgraph after adding at least one connecting edge, the pre-trained model is trained for multiple rounds until it converges and is saved as a business model.
[0214] In one or more embodiments of the present specification, adding at least one edge between the subgraphs of the two sample nodes so that the number of the common neighbor nodes is not less than the number threshold includes:
[0215] An edge is added between a neighbor node of one of the two sample nodes and the other sample node of the two sample nodes, and an edge is added between a neighbor node of the other sample node of the two sample nodes and one of the two sample nodes.
[0216] In one or more embodiments of this specification, the training process of the prediction model further includes:
[0217] For each edge added between the subgraphs of the two sample nodes, the subgraphs of the two nodes connected by the edge are input into the pre-trained model to obtain the confidence of the edge;
[0218] If the confidence of the edge is greater than the confidence threshold, retain the edge;
[0219] If the confidence of the edge is not greater than the confidence threshold, the edge is deleted.
[0220] In one or more embodiments of this specification, the saving as a pre-trained model includes:
[0221] Saving the pre-training results of the prediction model in multiple rounds as multiple versions of pre-training models;
[0222] The training process of the business model also includes:
[0223] For each edge added between the subgraphs of the two sample nodes, the subgraphs of the two nodes connected by the edge are input into multiple versions of pre-trained models to obtain multiple confidences of the edge;
[0224] If the variance of the multiple confidences of the edge is less than the variance threshold, retain the edge;
[0225] If the variance of multiple confidences of the edge is not less than the variance threshold, the edge is deleted.
[0226] In one or more embodiments of the present specification, the pre-training model is pre-trained for multiple rounds according to a subgraph of two sample nodes of a plurality of sample node pairs in the full graph of the data set or a subgraph after adding at least one connecting edge, until it converges and is saved as a business model, including:
[0227] Inputting the subgraph of the two sample nodes or the subgraph after adding at least one connecting edge into the pre-trained model to obtain a feature vector output by the pre-trained model and a classification result, wherein the classification result includes whether the two sample nodes have an intersection or do not have an intersection;
[0228] Determine the classification loss according to whether there is an intersection label between the two sample nodes and the classification result, and determine the central loss according to the feature vector and the central feature of the classification result;
[0229] The comprehensive loss is determined according to the classification loss and the center loss, and the network parameters of the pre-trained model are adjusted according to the comprehensive loss until it converges and is saved as a business model.
[0230] In one or more embodiments of this specification, the training process of the business model further includes:
[0231] Update the central feature of the classification result according to the feature vector
[0232] One or more embodiments of the present specification also provide a computer program product, including a computer program / instruction, which implements the steps of the method provided in any of the above embodiments when executed by a processor.
[0233] One or more embodiments of the present specification further provide a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method provided in any of the above embodiments.
[0234] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0235] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0236] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0237] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0238] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0239] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0240] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0241] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0242] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0243] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.
Claims
1. A link prediction method, the method comprising: Determine a common neighboring node of a node representing the first object in a subgraph of the first object and a node representing the second object in a subgraph of the second object, wherein the subgraph of the first object and the subgraph of the second object each include a plurality of nodes and a plurality of edges, each node represents an object, and an edge between any two nodes represents that the objects represented by the two nodes have an intersection; If the number of common neighboring nodes between the node representing the first object and the node representing the second object is less than a quantity threshold, at least one connecting edge is added between the subgraph of the first node and the subgraph of the second node, so that the number of common neighboring nodes between the node representing the first object and the node representing the second object is not less than the quantity threshold; The subgraph of the first object and the subgraph of the second object are input into a business model to determine whether there is an intersection between the first object and the second object.
2. The link prediction method according to claim 1, wherein adding at least one edge between the subgraph of the first node and the subgraph of the second node so that the number of the common neighbor nodes is not less than the number threshold comprises: An edge is added between a neighbor node of the first node and the second node, and an edge is added between a neighbor node of the second node and the first node.
3. The link prediction method according to claim 2, further comprising: For each edge added between the subgraph of the first node and the subgraph of the second node, input the subgraphs of the two nodes connected by the edge into the pre-trained model to obtain the confidence of the edge; If the confidence of the edge is greater than the confidence threshold, retain the edge; If the confidence of the edge is not greater than the confidence threshold, the edge is deleted.
4. The link prediction method according to claim 2, further comprising: For each edge added between the subgraph of the first node and the subgraph of the second node, inputting the subgraphs of the two nodes connected by the edge into multiple versions of pre-trained models to obtain multiple confidences of the edge; If the variance of the multiple confidences of the edge is less than the variance threshold, retain the edge; If the variance of multiple confidences of the edge is not less than the variance threshold, the edge is deleted.
5. The link prediction method according to claim 1, wherein the business model is trained in the following manner: According to the subgraphs of two sample nodes of multiple sample node pairs in the full graph of the training data set, the prediction model is pre-trained for multiple rounds and saved as a pre-trained model; Determine common neighboring nodes of the two sample nodes according to the subgraphs of the two sample nodes of the sample node pair, and if the number of common neighboring nodes of the two sample nodes is less than a quantity threshold, add at least one connecting edge between the subgraphs of the two sample nodes so that the number of common neighboring nodes of the two sample nodes is not less than the quantity threshold; According to the subgraph of two sample nodes of multiple sample node pairs in the full graph of the data set or the subgraph after adding at least one connecting edge, the pre-trained model is trained for multiple rounds until it converges and is saved as a business model.
6. The link prediction method according to claim 5, wherein adding at least one edge between the subgraphs of the two sample nodes so that the number of the common neighbor nodes is not less than the number threshold comprises: An edge is added between a neighbor node of one of the two sample nodes and the other sample node of the two sample nodes, and an edge is added between a neighbor node of the other sample node of the two sample nodes and one of the two sample nodes.
7. The link prediction method according to claim 6, wherein the training process of the business model further comprises: For each edge added between the subgraphs of the two sample nodes, the subgraphs of the two nodes connected by the edge are input into the pre-trained model to obtain the confidence of the edge; If the confidence of the edge is greater than the confidence threshold, retain the edge; If the confidence of the edge is not greater than the confidence threshold, the edge is deleted.
8. The link prediction method according to claim 6, wherein the storing as a pre-trained model comprises: Saving the pre-training results of the prediction model in multiple rounds as multiple versions of pre-training models; The training process of the business model also includes: For each edge added between the subgraphs of the two sample nodes, the subgraphs of the two nodes connected by the edge are input into multiple versions of pre-trained models to obtain multiple confidences of the edge; If the variance of the multiple confidences of the edge is less than the variance threshold, retain the edge; If the variance of multiple confidences of the edge is not less than the variance threshold, the edge is deleted.
9. The link prediction method according to claim 5, wherein the pre-training model is pre-trained for multiple rounds according to the subgraph of two sample nodes of the plurality of sample node pairs in the full graph of the data set or the subgraph after adding at least one connecting edge, until it is saved as a business model after convergence, comprising: Inputting the subgraph of the two sample nodes or the subgraph after adding at least one connecting edge into the pre-trained model to obtain a feature vector output by the pre-trained model and a classification result, wherein the classification result includes whether the two sample nodes have an intersection or do not have an intersection; Determine the classification loss according to whether there is an intersection label between the two sample nodes and the classification result, and determine the central loss according to the feature vector and the central feature of the classification result; The comprehensive loss is determined according to the classification loss and the center loss, and the network parameters of the pre-trained model are adjusted according to the comprehensive loss until it converges and is saved as a business model.
10. The link prediction method according to claim 9, wherein the training process of the business model further comprises: The central feature of the classification result is updated according to the feature vector.
11. A link prediction device, comprising: A determination module, configured to determine a common neighboring node of a node representing the first object in a subgraph of the first object and a node representing the second object in a subgraph of the second object, wherein the subgraph of the first object and the subgraph of the second object each include a plurality of nodes and a plurality of edges, each node represents an object, and an edge between any two nodes represents that the objects represented by the two nodes have an intersection; an adding module, configured to add at least one edge between a subgraph of the first node and a subgraph of the second node if the number of common neighboring nodes of the node representing the first object and the node representing the second object is less than a quantity threshold, so that the number of common neighboring nodes of the node representing the first object and the node representing the second object is not less than the quantity threshold; A prediction module is used to input the subgraph of the first object and the subgraph of the second object into a business model to determine whether there is an intersection between the first object and the second object.
12. A computer program product comprising a computer program / instructions, which when executed by a processor implement the steps of the method according to any one of claims 1 to 10.
13. An electronic device comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 10 by running the executable instructions.
14. A computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 10.