Knowledge graph-based coding recommendation method and device, equipment and medium
By acquiring multi-hop neighbors from the knowledge graph and performing random occlusion and sampling, combined with a spatial autoregressive model and a graph neural network, the problem of insufficient utilization of high-order information in knowledge graph encoding recommendation is solved, achieving more accurate and personalized recommendation results.
Patent Information
- Application Number
- CN202310456703.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-18
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2043-04-18
AI Technical Summary
Existing knowledge graph-based encoding recommendation methods suffer from high time complexity, sparsity and bias effects caused by random walks, and insufficient utilization of higher-order information on large-scale datasets, resulting in poor recommendation performance.
By acquiring the multi-hop neighbors of the target node, performing random occlusion and sampling, and using spatial autoregressive and graph neural network models, the representation vector of the target node is generated, and the encoding of the recommendation information is determined based on the user's historical interaction data.
It improves the accuracy and personalization of recommendations, alleviates the problem of over-smoothing, and achieves more efficient information utilization and personalized recommendations.
Smart Images

Figure CN116467466B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of knowledge graph technology and digital healthcare, and particularly to a knowledge graph-based coding recommendation method, apparatus, device, and medium. Background Technology
[0002] Knowledge graphs (KG), as a branch of artificial intelligence, have attracted widespread attention from academia and industry. With the rapid growth of knowledge graph scale, they play a key role in applications such as knowledge question answering, recommendation systems, and knowledge graph completion. For example, medical data is massive and complex, and building a medical knowledge graph can provide effective assistance to medical platforms.
[0003] A knowledge graph is a directed graph with real-world entities as nodes and relationships between entities as edges. In this graph, the head entity, the tail entity, and the directed edge connecting them form a triple, i.e., (head entity, relation, tail entity), indicating that the head and tail entities are connected through a relation. Although knowledge graphs are very effective in representing structured data, the fundamental symbolic nature of these triples makes them difficult to use on a large scale in many artificial intelligence applications. To address this issue, a new research direction called graph vector representation has been proposed in recent years. Methods including traditional shallow models and deep learning graph neural networks (GNNS) have broad applications in recommender systems.
[0004] However, shallow models, which rely on matrix factorization or random walks, typically suffer from high time complexity and cannot scale to large-scale knowledge graph datasets. Furthermore, random walks are inherently random and susceptible to the sparsity and bias of data samples, failing to fully utilize the proximity of neighbors in the sampled subgraph or sequence. This results in insufficient utilization of higher-order information in GNNS-based algorithms. Additionally, during network layering, over-smoothing can easily occur, potentially worsening the recommendation of long-tail items and thus limiting its expressiveness and scalability. Therefore, a knowledge graph-based encoding recommendation scheme is urgently needed. Summary of the Invention
[0005] This invention provides an artificial intelligence-based knowledge graph-based coding recommendation method, apparatus, computer equipment, and medium to solve the technical problems of inaccurate coding recommendations, severely insufficient recommendation capabilities, and consequently poor personalized recommendation effects.
[0006] Firstly, a knowledge graph-based encoding recommendation method is provided, including:
[0007] Obtain a knowledge graph carrying the target node, and sample the multi-hop neighbors of the target node in the knowledge graph to obtain a multi-hop neighbor set;
[0008] Randomly occlude the neighbor nodes corresponding to each hop in the multi-hop neighbor set to generate multiple different occluded neighbors for the target node;
[0009] The multiple different occluded neighbors are compared with the target node's input space autoregressive model to predict and determine the first representation vector of the target node's occluded neighbors;
[0010] The first representation vector of the occluded neighbor of the target node is input into the graph neural network model to determine the second representation vector of the target node;
[0011] The third representation vector belonging to the user is determined based on the user's historical interaction data and the graph neural network model.
[0012] The encoding corresponding to the recommendation information is determined based on the similarity between the second representation vector of the target node and the third representation vector of the user.
[0013] Secondly, a knowledge graph-based encoding recommendation device is provided, comprising:
[0014] The sampling module is used to acquire a knowledge graph carrying the target node and to sample the multi-hop neighbors of the target node in the knowledge graph to obtain a multi-hop neighbor set.
[0015] The occlusion module is used to randomly occlude the neighbor nodes corresponding to each hop in the multi-hop neighbor set, generating multiple different occluded neighbors for the target node.
[0016] The prediction module is used to predict the multiple different occluded neighbors and the target node by inputting the spatial autoregressive model, and determine the first representation vector of the occluded neighbors of the target node;
[0017] The first determining module is used to input the first representation vector of the occluded neighbor of the target node into the graph neural network model to determine the second representation vector of the target node;
[0018] The second determining module is used to determine a third representation vector belonging to the user based on the user's historical interaction data and the graph neural network model;
[0019] The encoding recommendation module is used to determine the encoding corresponding to the recommendation information based on the similarity between the second representation vector of the target node and the third representation vector of the user.
[0020] Thirdly, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described knowledge graph-based encoding recommendation method.
[0021] Fourthly, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the steps of the knowledge graph-based encoding recommendation method described above.
[0022] In the above-described scheme implemented by the knowledge graph-based encoding recommendation method, apparatus, computer equipment, and storage medium, a knowledge graph carrying the target node is obtained, and the multi-hop neighbors of the target node in the knowledge graph are sampled to obtain a multi-hop neighbor set. The neighbor nodes corresponding to each hop in the multi-hop neighbor set are randomly occluded to generate multiple different occluded neighbors for the target node. The multiple different occluded neighbors are then used to predict the target node using an input spatial autoregressive model to determine the first representation vector of the target node's occluded neighbors. This fully utilizes higher-order information and alleviates the problem of excessive smoothing caused by layer-by-layer transitions. The first representation vector of the target node's occluded neighbors is input into a graph neural network model to determine the second representation vector of the target node. A third representation vector belonging to the user is determined based on the user's historical interaction data and the graph neural network model. The encoding corresponding to the recommendation information is determined based on the similarity between the second representation vector of the target node and the third representation vector of the user. In this invention, by collecting the user's third representation vector in real time, it is beneficial to capture user preferences in a timely manner, perform personalized recommendations, improve recommendation quality, achieve accurate and effective push notifications, and bring a better user experience. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a schematic diagram of an application environment for a knowledge graph-based encoding recommendation method according to an embodiment of the present invention;
[0025] Figure 2 This is a flowchart illustrating a knowledge graph-based encoding recommendation method according to an embodiment of the present invention.
[0026] Figure 3 yes Figure 2 A schematic diagram of a specific implementation method for step S10;
[0027] Figure 4 yes Figure 2 A schematic diagram of a specific implementation method for step S20;
[0028] Figure 5 yes Figure 2 A flowchart illustrating a specific implementation method prior to step S30;
[0029] Figure 6 This is an embodiment of the present invention based on a knowledge graph topology connection graph;
[0030] Figure 7 This is a schematic diagram of a knowledge graph-based coding recommendation device according to an embodiment of the present invention;
[0031] Figure 8 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention;
[0032] Figure 9 This is another structural schematic diagram of a computer device according to one embodiment of the present invention. Detailed Implementation
[0033] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0034] The knowledge graph-based encoding recommendation method provided in this invention can be applied to, for example... Figure 1In this application environment, the client communicates with the server via a network. The server can obtain a knowledge graph carrying the target node and sample the multi-hop neighbors of the target node in the knowledge graph to obtain a multi-hop neighbor set. The server then randomly occludes the neighbor nodes corresponding to each hop in the multi-hop neighbor set to generate multiple different occluded neighbors for the target node. The server then uses the multiple different occluded neighbors and the target node to predict the target node using a spatial autoregressive model, determining the first representation vector of the target node's occluded neighbors. This fully utilizes higher-order information and alleviates the problem of excessive smoothing caused by layer-by-layer transitions. The first representation vector of the target node's occluded neighbors is input into a graph neural network model to determine the second representation vector of the target node. Based on the user's historical interaction data and the graph neural network model, a third representation vector belonging to the user is determined. Based on the similarity between the second representation vector of the target node and the third representation vector of the user, the encoding corresponding to the recommendation information is determined. In this invention, by collecting the user's third representation vector in real time, it is beneficial to capture user preferences in a timely manner, perform personalized recommendations, improve recommendation quality, achieve accurate and effective push notifications, and bring a better user experience. The client can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster consisting of multiple servers. The invention will be described in detail below through specific embodiments.
[0035] Please see Figure 2 As shown, Figure 2 A flowchart illustrating a knowledge graph-based encoding recommendation method provided in an embodiment of the present invention includes the following steps:
[0036] S10: Obtain the knowledge graph carrying the target node, and sample the multi-hop neighbors of the target node in the knowledge graph to obtain the multi-hop neighbor set;
[0037] The knowledge graph-based encoding recommendation method provided by this invention can be applied to scenarios such as knowledge question answering, recommendation systems, medical platforms, and knowledge graph completion. It can be applied to intelligent question answering engines such as intelligent customer service or intelligent assistants in various application scenarios. Intelligent question answering engines are usually implemented through a server. The server can obtain the knowledge graph carrying the target node in real time and obtain the multi-hop neighbor set by sampling the multi-hop neighbors of the target node in the knowledge graph.
[0038] For example, see [link to relevant document]. Figure 3 ,for Figure 2 A detailed flowchart of a specific implementation method for step S10 is shown below:
[0039] Step S11: Construct a knowledge graph and obtain a knowledge graph carrying the target node, wherein at least one candidate object is identified as the target node;
[0040] For example, a candidate object (i.e., a user object) can be used as a node, and a recommended item information can be used as a node. If there is a behavioral dataset of browsing behavior between the user object and the recommended item information, then the two nodes corresponding to the user object and the recommended item information can be connected by an edge, thereby generating a relationship graph, that is, generating a knowledge graph.
[0041] In other words, a node in the relationship graph corresponds to a user object or a recommended item. An edge in the relationship graph is used to indicate that there is browsing behavior between two connected nodes. The recommended item information includes, but is not limited to, articles, videos, music, etc.
[0042] Specifically, by acquiring the knowledge graph carrying the target node, it is beneficial to understand the relationship graph around the target node.
[0043] Step S12: Negatively sample the target node in the knowledge graph to determine the subgraph nodes and negative sample nodes that belong to the positive sample nodes and the adjacent nodes corresponding to the target node.
[0044] Negative sampling involves determining whether there is a pair of context words and target words between two target nodes and their adjacent nodes. If there is a pair, it is a positive sample (i.e., a subgraph node); otherwise, it is a negative sample (a negative sample node).
[0045] It should be noted that using a hard negative sampling strategy to sample target nodes in the knowledge graph increases the contrast loss of the sampling on the one hand, and enables the model to more accurately define the boundary between positive and negative samples on the other hand, which also improves the robustness of the subsequent spatial autoregressive model.
[0046] Step S13: Perform multi-hop sampling on the neighboring nodes around the target node based on the negative sample nodes, and determine the multi-hop neighbor set composed of the neighboring nodes corresponding to each hop.
[0047] Specifically, by dividing the nodes around the target node into subgraph nodes and negative sample nodes, and performing multi-hop sampling directly within the subgraph nodes, the multi-hop neighbor set consisting of the neighbor nodes corresponding to each hop can be quickly and accurately determined.
[0048] The above method can effectively improve the computational efficiency of querying multi-hop neighbor nodes in a large graph. For example, multi-hop neighbor sampling can be performed as follows: obtain the 0-hop neighbors of each node in the topology network corresponding to the knowledge graph to obtain the set of 0-hop neighbors of all nodes. When the first node is the specified node, calculate the set of k+1 hop neighbors of the first node through the following iterative calculation process, which includes the following steps a and b: Step a: obtain the set of k-hop neighbors of the first node; Step b: connect the two node pairs with the same k-hop destination node in the set of k-hop neighbors of the first node and the same starting node in the set of 0-hop neighbors of all nodes into a node pair. After completing the connection of the node pairs, the set of k+1 hop neighbors of the first node is obtained. When the number of hops k+1 in the set of k+1 hop neighbors of the first node is equal to kma, output the set of k+1 hop neighbors of the first node and the corresponding k+1 hop path. The multi-hop neighbor nodes of the first node can be obtained from the set of kma hop neighbors of the first node. Thus, the multi-hop neighbor set is obtained. In this embodiment of the invention, the calculation of multi-hop neighbor nodes can be completed through the connection operation between node pairs, which greatly improves the calculation efficiency of multi-hop neighbor nodes.
[0049] S20: Randomly occlude the neighbor nodes corresponding to each hop in the multi-hop neighbor set to generate multiple different occluded neighbors for the target node;
[0050] Please see Figure 4 ,for Figure 2 A schematic diagram of a specific implementation of step S20 is shown below, in which the neighbor nodes corresponding to each hop in the multi-hop neighbor set are randomly occluded to generate multiple different occluded neighbors for the target node, as detailed below:
[0051] S21: Determine adjacent nodes within a first preset distance from the target node as sub-graph nodes;
[0052] It should be understood that in the topological network corresponding to the knowledge graph, the target node and its neighboring nodes can be clearly determined. The judgment is made by the distance between the neighboring node and the target node. For example, the neighboring node whose distance from the target node is within a first preset distance is determined as the subgraph node, which is the positive sample node in this embodiment.
[0053] S22: Determine adjacent nodes that are within a second preset distance from the target node as negative sample nodes; wherein, based on the distance between the negative sample nodes and the target node, the negative sample nodes are divided into first negative sample nodes and second negative sample nodes;
[0054] It should be understood that the judgment is made by the distance between adjacent nodes and the target node. For example, adjacent nodes that are within a second preset distance from the target node are determined as negative sample nodes. The first negative sample node is a difficult negative sample node, which is far away from the target node within the second preset distance. The second negative sample node is an easy negative sample node, which is close to the target node within the second preset distance.
[0055] It should also be noted that difficult-to-bear sample nodes and easy-to-bear sample nodes represent the difficulty of the association relationship with the target node, respectively. For example, if the target node is a computer device, then the adjacent nodes are keyboards, mice, monitors, and computer device components, etc. Easy-to-bear sample nodes are items with low correlation, such as lunch boxes and takeout food. Conversely, difficult-to-bear sample nodes are items with correlation but not a positive correlation, such as televisions, stereos, and home appliances.
[0056] S23: Integrate the target node in the multi-hop neighbor set with the neighbor nodes around the target node to obtain a subgraph set, wherein the subgraph set is composed of subgraph nodes;
[0057] Specifically, since the neighbor nodes in the multi-hop neighbor set are all subgraph nodes, a subgraph set is obtained by integrating the subgraph nodes around the target node.
[0058] S24: Randomly occlude any neighbor node in the subgraph set to generate multiple different occluded neighbors for the target node.
[0059] For example, random occlusion of any neighboring node in the subgraph set can be performed by setting a preset probability, and the occluded neighboring node can be replaced with a special label, a random label, etc., which facilitates the subsequent obfuscation of the vector matrix and obtains more accurate training data.
[0060] The above approach first uses node sampling to sample the multi-hop neighbors of the target node. Then, in each hop, the neighboring nodes are randomly occluded, and the other surrounding neighboring nodes and the target node are flattened together and put into a unidirectional Transformer encoder. By directly integrating the multi-hop neighbor context into the target node for representation, the problem of over-smoothing caused by layer-by-layer is alleviated.
[0061] Furthermore, an autoregressive model is used to reinforce the target node to comparatively approximate the occluded neighbor. The entire occlusion and prediction process induces latent space capture of predicted neighbor nodes and preserves the integrity and higher-order information of the structure in a unified manner.
[0062] S30: Predict the first representation vector of the target node's occlusion neighbors by combining the multiple different occlusion neighbors with the target node's input spatial autoregressive model;
[0063] Please refer to Figure 5 ,for Figure 2 A schematic diagram of a specific implementation method before step S30 is provided. It should be noted that before predicting the first representation vector of the target node's occlusion neighbors using the multiple different occlusion neighbors and the target node's input spatial autoregressive model, the following steps are also included:
[0064] Step S31: Obtain the training dataset;
[0065] Specifically, the training dataset is used to train a spatial autoregressive model. The training dataset is labeled training data, such as initial representation vectors of multiple occluded neighbors, where the initial representation vectors are feature data represented in vector form.
[0066] Of course, to improve training accuracy, the training dataset can be divided into training, testing, and validation sets as needed. For example, the training dataset can be divided in an 8:1:1 ratio, which will not be elaborated here.
[0067] Step S32: Construct a network structure based on a spatial autoregressive model;
[0068] It should be noted that a spatial autoregressive model includes at least an encoder and an autoregressive module, but this is not a limitation here.
[0069] Optionally, the spatial autoregressive model includes at least an autoencoder, an autoregressive module, and a memory module. The autoencoder includes an encoder and a decoder. The autoencoder compresses the image into a latent space using the encoder, learns feature representations, and then uses the decoder to decode the feature representations from the latent space back into the image space. The autoregressive module processes the results of the encoder in the autoencoder and uses the features of the latent space to model the data and fit the true distribution. The memory module, located between the encoder and decoder in the autoencoder, stores the feature representations of the latent space. Then, feature representations that do not belong to the latent space are forcibly converted into the most relevant feature representations in memory by the memory module.
[0070] Step S33: Based on the preset contrastive learning loss function, determine the contrastive learning loss information according to the initial representation vectors of multiple occluded neighbors in the training dataset.
[0071] The expression for the contrastive learning loss function is as follows:
[0072]
[0073] In the formula, LVanilla-SAC To contrast the learning loss function, n i,h Let N be the number of occluded neighbors in the i-th layer when hopping h, τ be the temperature parameter in contrastive learning, and c be the number of occluded neighbors in the i-th layer when hopping h. p For predictive coding, b represents a neighboring node.
[0074] In this embodiment, the loss function of contrastive learning can be a self-supervised contrastive learning loss function or a supervised contrastive learning loss function. The nodes are encoded by the contrastive loss function, and the feature representation capability of the content features of the tail class image is enhanced by the contrastive learning loss function. This facilitates the subsequent recognition of tail class images based on the tail fusion features, thereby further avoiding the problem of poor recognition accuracy due to the small number of tail class image samples. It also avoids the existence of a certain number of sparse connected entities as the data volume of the recommendation system increases, which leads to increased data sparsity and the generation of long tail phenomenon.
[0075] Step S34: Optimize the representation vectors of multiple occluded neighbors in the training dataset using a bottleneck strategy to determine the neighbor information between the occluded neighbors and the target node that minimizes the occluded neighbors.
[0076] Specifically, as knowledge graph data increases, it leads to redundancy of similar data and increased complexity of local topology. To accurately predict occluded neighbors, a neighbor information bottleneck strategy is adopted to extract minimal sufficient information from surrounding neighbors and filter out irrelevant information, thereby reducing the number of feature graphs. For example:
[0077]
[0078] In the formula, x in ={n target ,n1,…,n i-1 ,n i+1 ,…,n k}, where β is a parameter used to control useful information, and θ is the Transformer encoding parameter; where,
[0079]
[0080] In this embodiment, in order to eliminate information redundancy in the neighborhood aggregation process, a neighborhood information bottleneck is designed, which is achieved by maximizing the mutual information between the target code and the occluded neighbors and imposing constraints on the mutual information between the target code and its surrounding neighbors.
[0081] Step S35: Based on the preset bilinear loss function, determine the bilinear loss information according to the initial representation vectors of multiple occluded neighbors in the optimized training dataset and the neighbor information.
[0082] In another embodiment, the expression for the bilinear loss function is:
[0083]
[0084] In the formula, L NIB The loss function is bilinear, N is the number of hops, k is the number of subgraph nodes excluding occluded neighbors, σ is a nonlinear activation function, and W1 and W2 correspond to c p and n i,hop The linear transformation matrix after bilinear fusion.
[0085] Specifically, new feature information is obtained by fusing at the same position using a bilinear loss function, then pooling is performed on the new feature information to obtain a feature matrix, the first dimension of the feature matrix is normalized, and then vectorized to obtain a fused feature vector.
[0086] In this embodiment, features obtained from different feature extractors are fused through bilinear fusion, which fully complements feature information from different dimensions and significantly improves classification performance.
[0087] Step S36: Train and obtain the spatial autoregressive model based on the bilinear loss information and the contrastive learning loss information.
[0088] It should be understood that the total loss function is L SAC =L Vanilla-SAC +ηL NIB , where η is the weight parameter. By jointly training the spatial autoregressive model, a spatial autoregressive model with higher prediction accuracy is obtained. This facilitates timely and accurate judgment of whether the spatial autoregressive model has been trained, thereby improving the generalization ability, feature representation ability, and readability of the generated tail fusion features, so as to facilitate subsequent prediction.
[0089] In another embodiment, the objective function for predicting the first representation vector of the occluded neighbors of the target node using the spatial autoregressive model is:
[0090] c p =f θ ({n target +p target ,n1+p1,…,n i-1 +p i-1 ,n i+1 +p i+1 ,…,n k +p k})
[0091] In the formula, p is the step index position, and c p For the predictive encoding of the output, n target For the target node, ptarget f is the target node-level hop index position. θ It is a Transformer encoder.
[0092] Specifically, to reduce noise interference, it is necessary to select negative sample pairs, and n i and c p In a subgraph, it is considered a positive sample, with c p n not in a subgraph i It is considered a negative sample.
[0093] Through the above approach, a novel and effective framework based on spatial autoregressive coding is built to solve the problem in a unified way, improve the scalability and robustness of the recommendation system, and push more accurate information that users are interested in.
[0094] In one possible implementation, in a medical application scenario, the training dataset is processed in the manner described above. The training dataset is medical data, such as personal health records, prescriptions, examination reports, etc. For example, each medical keyword in the training dataset and the relationship between each medical keyword are obtained. Based on the sample data of the training dataset and the relationship, the association strength between each medical keyword is calculated. Based on each medical keyword and the association strength, a medical knowledge graph is constructed.
[0095] In one possible implementation, a knowledge graph is constructed using the above method; the themes of medical record sample information are extracted as feature information of the medical records and stored in a database; for input electronic medical record information, medical record feature information is extracted; a subgraph vector containing medical common sense related to the electronic medical record is obtained from the knowledge graph; the feature information of the current medical record, the subgraph vector, and the feature information of medical records in the medical record information sample database are input into a trained neural network model to calculate the similarity between the current medical record and each medical record in the database; according to the similarity, a set number of similar cases are output. A medical domain knowledge graph-enhanced Siamese-transformer deep learning neural network model automatically extracts medical record features, maps medical records to the same vector space, and uses similarity calculation in this space to calculate the similarity between two medical records.
[0096] In this embodiment, by retrieving similar medical records, doctors can accurately statistically analyze similar cases, providing them with an effective reference when treating similar patients. This improves the traditional clinical decision-making process, which relies on doctors' own knowledge and experience; it helps provide doctors with medical record references.
[0097] S40: Input the first representation vector of the occluded neighbor of the target node into the graph neural network model to determine the second representation vector of the target node;
[0098] It should be noted that graph neural network models refer to a general term for algorithms that use neural networks to learn graph-structured data, extract and discover features and patterns in graph-structured data, and meet the needs of graph learning tasks such as clustering, classification, prediction, segmentation, and generation.
[0099] Specifically, by inputting the first representation vector of the occluded neighbor of the target node into a pre-constructed graph neural network model, the second representation vector of the target node is directly obtained.
[0100] It should be understood that inputting the first representation vector of the occluded neighbors of the target node into the graph neural network model to determine the second representation vector of the target node includes:
[0101] At least one candidate object in the knowledge graph is identified as the target node, and the neighbor nodes of the target node include the first-order neighbor nodes to the Nth-order neighbor nodes of the target node; where N is a positive integer greater than 2;
[0102] The N-1 order neighbor nodes of the target node and their corresponding first representation vectors of the N-1 order neighbor nodes are used as the input of the input layer of the graph neural network model to obtain the second representation vector of the N-1 order neighbor nodes output by the input layer.
[0103] The second representation vector of the N-1 order neighbor node and the first representation vector of each node from the target node to the N-2 order neighbor node are used as inputs to the aggregation layer of the graph neural network model to obtain the second representation vector of the target node output by the aggregation layer.
[0104] Optionally, the current sample and its corresponding sample label are determined; based on the current sample and the initial graph neural network model, the output information of the initial graph neural network model is obtained; based on the output information of the initial graph neural network model and the sample label, the loss function of the initial graph neural network model is determined, and the network parameters in the initial graph neural network model are adjusted based on the loss function until the graph neural network model meets the convergence condition. If the graph neural network model is a non-uniform graph neural network model, it analyzes the user's question information and provides the user with accurate and fast output of the answer information corresponding to the question, with fast question processing speed and high accuracy of the output answer.
[0105] S50: Determine the third representation vector belonging to the user based on the user's historical interaction data and the graph neural network model;
[0106] It should be noted that the third representation vector belonging to the user, determined based on the user's historical interaction data and the graph neural network model, includes:
[0107] Acquire user historical interaction data, which is a behavioral dataset formed by the data interaction between user profiles and recommendation information profiles;
[0108] Input the first representation vector of the user's behavior dataset, including the self node and the neighbor nodes of at least one historical object, into the graph neural network model to determine the third representation vector of at least one historical object output by the graph neural network model.
[0109] The third representation vector of the user is obtained based on the third representation vector of at least one of the historical objects.
[0110] Specifically, based on the behavioral dataset between users and recommended item information (i.e., recommendation information), several user attribute feature data are extracted from the information using preset regular expressions through the information from the aforementioned multiple dimensions; several user feature tags are generated based on the several user attribute feature data; user profiles are generated based on the user feature tags; similarly, recommendation information profiles are generated.
[0111] A collaborative filtering algorithm is used to generate a recommendation information-attribute matrix and a user-recommendation information rating matrix. For example, the recommendation information-attribute table is integrated to obtain the recommendation information-attribute matrix; user data is quantified to obtain a user-recommendation information rating table, and the data in the user-recommendation information rating table is integrated to obtain the user-recommendation information rating matrix; based on the user-recommendation information rating matrix, the user-recommendation information rating matrix is obtained; and by combining the recommendation information-attribute matrix and the user-recommendation information rating matrix, a third representation vector between users is obtained.
[0112] S60: Determine the encoding corresponding to the recommendation information based on the similarity between the second representation vector of the target node and the third representation vector of the user.
[0113] Specifically, cosine similarity is used to calculate the similarity between the second representation vector of the target node and the third representation vector of the user. Items with matching similarity from multiple historical objects in the behavior dataset are selected as recommendation information, and then the encoded information corresponding to the recommendation information is sent.
[0114] As can be seen, in the above scheme, the multiple different occluded neighbors are input into the target node's input space autoregressive model for prediction to determine the first representation vector of the target node's occluded neighbors. This fully utilizes higher-order information and alleviates the problem of excessive smoothing caused by layer-by-layer transitions. The first representation vector of the target node's occluded neighbors is input into the graph neural network model to determine the target node's second representation vector. The third representation vector belonging to the user is determined based on the user's historical interaction data and the graph neural network model. The encoding corresponding to the recommendation information is determined based on the similarity between the target node's second representation vector and the user's third representation vector. In this invention, by collecting the user's third representation vector in real time, it is beneficial to capture user preferences in a timely manner, perform personalized recommendations, improve recommendation quality, achieve accurate and effective push notifications, and bring a better user experience.
[0115] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0116] In one embodiment, a knowledge graph-based encoding recommendation device is provided, which corresponds one-to-one with the knowledge graph-based encoding recommendation method in the above embodiments. For example... Figure 7 As shown, the knowledge graph-based coding recommendation device includes a sampling module 101, an occlusion module 102, a prediction module 103, a first determination module 104, a second determination module 105, and a coding recommendation module 106.
[0117] The sampling module 101 is used to acquire a knowledge graph carrying the target node and sample the multi-hop neighbors of the target node in the knowledge graph to obtain a multi-hop neighbor set.
[0118] The occlusion module 102 is used to randomly occlude the neighbor nodes corresponding to each hop in the multi-hop neighbor set, and generate multiple different occluded neighbors for the target node.
[0119] Prediction module 103 is used to predict the multiple different occluded neighbors and the target node input spatial autoregressive model to determine the first representation vector of the target node's occluded neighbors;
[0120] The first determining module 104 is used to input the first representation vector of the occluded neighbor of the target node into the graph neural network model to determine the second representation vector of the target node;
[0121] The second determining module 105 is used to determine a third representation vector belonging to the user based on the user's historical interaction data and the graph neural network model.
[0122] The encoding recommendation module 106 is used to determine the encoding corresponding to the recommendation information based on the similarity between the second representation vector of the target node and the third representation vector of the user.
[0123] In one embodiment, the sampling module 101 is specifically used for:
[0124] The multi-hop neighbors of the target node in the knowledge graph are sampled to obtain a multi-hop neighbor set, including:
[0125] Construct a knowledge graph and obtain a knowledge graph carrying the target node, wherein at least one candidate object is identified as the target node;
[0126] Negative sampling is performed on the target node in the knowledge graph to determine whether the adjacent nodes corresponding to the target node belong to the subgraph nodes of the positive sample or the negative sample nodes.
[0127] Based on the negative sample nodes, multi-hop sampling is performed on the neighboring nodes around the target node to determine the multi-hop neighbor set consisting of the neighboring nodes corresponding to each hop.
[0128] In one embodiment, the occlusion module 102 is specifically used for:
[0129] The adjacent nodes that are within a first preset distance from the target node are determined as sub-graph nodes;
[0130] Negative sample nodes are defined as adjacent nodes that are within a second preset distance from the target node; wherein, based on the distance of the negative sample nodes from the target node, the negative sample nodes are divided into first negative sample nodes and second negative sample nodes.
[0131] The target node in the multi-hop neighbor set is integrated with the neighbor nodes around the target node to obtain a subgraph set, which is composed of subgraph nodes;
[0132] Randomly occlude any neighbor node in the subgraph set to generate multiple different occluded neighbors for the target node.
[0133] In one embodiment, a model building module is further included before the prediction module 103, specifically used for:
[0134] Obtain the training dataset;
[0135] Construct a network structure based on a spatial autoregressive model;
[0136] Based on a preset contrastive learning loss function, the contrastive learning loss information is determined according to the representation vectors of multiple initial occluded neighbors in the training dataset.
[0137] The bottleneck strategy is used to optimize the initial representation vectors of multiple occluded neighbors in the training dataset to determine the neighbor information between the occluded neighbors and the target node that minimizes the occluded neighbors.
[0138] Based on the preset bilinear loss function, the bilinear loss information is determined according to the initial representation vectors of multiple occluded neighbors in the optimized training dataset and the neighbor information.
[0139] The spatial autoregressive model is trained and obtained based on the bilinear loss information and the contrastive learning loss information.
[0140] In one embodiment, the expression for the contrastive learning loss function is:
[0141]
[0142] In the formula, L Vanilla-SAC To contrast the learning loss function, n i,h Let N be the number of occluded neighbors in the i-th layer when hopping h, τ be the temperature parameter in contrastive learning, and c be the number of occluded neighbors in the i-th layer when hopping h. p For predictive coding, n represents neighboring nodes.
[0143] In one embodiment, the expression for the bilinear loss function is:
[0144]
[0145] In the formula, L NIB The loss function is bilinear, N is the number of hops, k is the number of subgraph nodes excluding occluded neighbors, σ is a nonlinear activation function, and W1 and W2 correspond to c p and n i,hop The linear transformation matrix after bilinear fusion.
[0146] In one embodiment, the objective function for predicting the first representation vector of the occluded neighbors of the target node is:
[0147] c p =f θ ({n target +p target ,n1+p1,…,n i-1 +p i-1 ,n i+1 +p i+1 ,…,n k +p k})
[0148] In the formula, p is the step index position, and c p For the predictive encoding of the output, n target For the target node, p targetf is the target node-level hop index position. θ It is a Transformer encoder.
[0149] In one embodiment, the first determining module 104 includes:
[0150] At least one candidate object in the knowledge graph is identified as the target node, and the neighbor nodes of the target node include the first-order neighbor nodes to the Nth-order neighbor nodes of the target node; where N is a positive integer greater than 2;
[0151] The N-1 order neighbor nodes of the target node and their corresponding first representation vectors of the N-1 order neighbor nodes are used as the input of the input layer of the graph neural network model to obtain the second representation vector of the N-1 order neighbor nodes output by the input layer.
[0152] The second representation vector of the N-1 order neighbor node and the first representation vector of each node from the target node to the N-2 order neighbor node are used as inputs to the aggregation layer of the graph neural network model to obtain the second representation vector of the target node output by the aggregation layer.
[0153] In one embodiment, the second determining module 105 includes:
[0154] Acquire user historical interaction data, which is a behavioral dataset formed by the data interaction between user profiles and recommendation information profiles;
[0155] Input the first representation vector of the user's behavior dataset, including the self node and the neighbor nodes of at least one historical object, into the graph neural network model to determine the third representation vector of at least one historical object output by the graph neural network model.
[0156] The third representation vector of the user is obtained based on the third representation vector of at least one of the historical objects.
[0157] This invention provides a knowledge graph-based encoding recommendation device. It inputs multiple different occluded neighbors and the target node into a spatial autoregressive model for prediction, determining the first representation vector of the target node's occluded neighbors. This fully utilizes higher-order information and mitigates the over-smoothing problem caused by layer-by-layer processing. The first representation vector of the target node's occluded neighbors is then input into a graph neural network model to determine the target node's second representation vector. A third representation vector belonging to the user is determined based on the user's historical interaction data and the graph neural network model. Finally, the encoding corresponding to the recommendation information is determined based on the similarity between the target node's second representation vector and the user's third representation vector. In this invention, by collecting the user's third representation vector in real time, it is beneficial to capture user preferences promptly, perform personalized recommendations, improve recommendation quality, achieve accurate and effective push notifications, and bring a better user experience.
[0158] Specific limitations regarding the knowledge graph-based coding recommendation device can be found in the limitations of the intelligent question-answering method described above, and will not be repeated here. Each module in the aforementioned knowledge graph-based coding recommendation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0159] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a knowledge graph-based coding recommendation method on the server side.
[0160] In one embodiment, a computer device is provided, which may be a client, and its internal structure diagram may be as follows: Figure 9As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with an external server via a network connection. When executed by the processor, the computer program implements client-side functions or steps of a knowledge graph-based coding recommendation method.
[0161] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0162] Obtain a knowledge graph carrying the target node, and sample the multi-hop neighbors of the target node in the knowledge graph to obtain a multi-hop neighbor set;
[0163] Randomly occlude the neighbor nodes corresponding to each hop in the multi-hop neighbor set to generate multiple different occluded neighbors for the target node;
[0164] The multiple different occluded neighbors are compared with the target node's input space autoregressive model to predict and determine the first representation vector of the target node's occluded neighbors;
[0165] The first representation vector of the occluded neighbor of the target node is input into the graph neural network model to determine the second representation vector of the target node;
[0166] The third representation vector belonging to the user is determined based on the user's historical interaction data and the graph neural network model.
[0167] The encoding corresponding to the recommendation information is determined based on the similarity between the second representation vector of the target node and the third representation vector of the user.
[0168] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0169] Obtain a knowledge graph carrying the target node, and sample the multi-hop neighbors of the target node in the knowledge graph to obtain a multi-hop neighbor set;
[0170] Randomly occlude the neighbor nodes corresponding to each hop in the multi-hop neighbor set to generate multiple different occluded neighbors for the target node;
[0171] The multiple different occluded neighbors are compared with the target node's input space autoregressive model to predict and determine the first representation vector of the target node's occluded neighbors;
[0172] The first representation vector of the occluded neighbor of the target node is input into the graph neural network model to determine the second representation vector of the target node;
[0173] The third representation vector belonging to the user is determined based on the user's historical interaction data and the graph neural network model.
[0174] The encoding corresponding to the recommendation information is determined based on the similarity between the second representation vector of the target node and the third representation vector of the user.
[0175] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0176] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0177] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0178] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A knowledge graph-based encoding recommendation method, characterized in that, include: Obtain a knowledge graph carrying the target node, and sample the multi-hop neighbors of the target node in the knowledge graph to obtain a multi-hop neighbor set; Randomly occlude the neighbor nodes corresponding to each hop in the multi-hop neighbor set to generate multiple different occluded neighbors for the target node; The multiple different occluded neighbors are compared with the target node's input space autoregressive model to predict and determine the first representation vector of the target node's occluded neighbors; The first representation vector of the occluded neighbors of the target node is input into the graph neural network model to determine the second representation vector of the target node; The third representation vector belonging to the user is determined based on the user's historical interaction data and the graph neural network model. The encoding corresponding to the recommendation information is determined based on the similarity between the second representation vector of the target node and the third representation vector of the user.
2. The knowledge graph-based encoding recommendation method as described in claim 1, characterized in that, The multi-hop neighbors of the target node in the knowledge graph are sampled to obtain a multi-hop neighbor set, including: Construct a knowledge graph and obtain a knowledge graph carrying the target node, wherein at least one candidate object is identified as the target node; Negative sampling is performed on the target node in the knowledge graph to determine whether the adjacent nodes corresponding to the target node belong to the subgraph nodes of the positive sample or the negative sample nodes. Based on the negative sample nodes, multi-hop sampling is performed on the neighboring nodes around the target node to determine the multi-hop neighbor set consisting of the neighboring nodes corresponding to each hop.
3. The knowledge graph-based encoding recommendation method as described in claim 2, characterized in that, Randomly occlude the neighbor nodes corresponding to each hop in the multi-hop neighbor set to generate multiple different occluded neighbors for the target node, including: The adjacent nodes that are within a first preset distance from the target node are determined as sub-graph nodes; Negative sample nodes are defined as adjacent nodes that are within a second preset distance from the target node; wherein, based on the distance of the negative sample nodes from the target node, the negative sample nodes are divided into first negative sample nodes and second negative sample nodes. The target node in the multi-hop neighbor set is integrated with the neighbor nodes around the target node to obtain a subgraph set, which is composed of subgraph nodes; Randomly occlude any neighbor node in the subgraph set to generate multiple different occluded neighbors for the target node.
4. The knowledge graph-based encoding recommendation method as described in claim 1, characterized in that, Before determining the first representation vector of the target node's occluded neighbors by predicting the multiple different occluded neighbors with the target node's input spatial autoregressive model, the method further includes: Obtain the training dataset; Construct a network structure based on a spatial autoregressive model; Based on a preset contrastive learning loss function, the contrastive learning loss information is determined according to the initial representation vectors of multiple occluded neighbors in the training dataset. The bottleneck strategy is used to optimize the initial representation vectors of multiple occluded neighbors in the training dataset to determine the neighbor information between the occluded neighbors and the target node that minimizes the occluded neighbors. Based on the preset bilinear loss function, the bilinear loss information is determined according to the initial representation vectors of multiple occluded neighbors in the optimized training dataset and the neighbor information. The spatial autoregressive model is trained and obtained based on the bilinear loss information and the contrastive learning loss information.
5. The knowledge graph-based encoding recommendation method as described in claim 4, characterized in that, The expression for the contrastive learning loss function is: In the formula, To compare the learning loss function, For a level jump Time The shaded neighbor in the floor's neighboring area. The number of jumps. To compare the temperature parameters in the learning process, For predictive coding, For neighboring nodes.
6. The knowledge graph-based encoding recommendation method as described in claim 4, characterized in that, The expression for the bilinear loss function is: In the formula, It is a bilinear loss function. The number of jumps. It is a non-linear activation function. , The corresponding is and The linear transformation matrix after bilinear fusion. For a level jump Time The shaded neighbor in the floor's neighboring area. It is the set of nodes consisting of the target node and its unobstructed neighboring nodes. For predictive coding, This is the transpose of the predictive encoding.
7. The knowledge graph-based encoding recommendation method as described in claim 1, characterized in that, The objective function for predicting the first representation vector of the occluded neighbors of the target node is: c p =f θ ({n target +p target ,n1+p1,…,n i-1 +p i-1 ,n i+1 +p i+1 ,…,n k +p k }) In the formula, p is the step index position, and c p For the predictive encoding of the output, n target For the target node, p target f is the target node-level hop index position. θ For Transformer encoders, To remove neighboring nodes that are obscuring their neighbors, This refers to the hop index position corresponding to the neighbor node that has been removed from the occluded neighbor.
8. The knowledge graph-based encoding recommendation method as described in any one of claims 1-7, characterized in that, The first representation vector of the occluded neighbors of the target node is input into the graph neural network model to determine the second representation vector of the target node, including: At least one candidate object in the knowledge graph is identified as the target node, and the neighbor nodes of the target node include the first-order neighbor nodes to the Nth-order neighbor nodes of the target node; where N is a positive integer greater than 2; The N-1 order neighbor nodes of the target node and their corresponding first representation vectors of the N-1 order neighbor nodes are used as the input of the input layer of the graph neural network model to obtain the second representation vector of the N-1 order neighbor nodes output by the input layer. The second representation vector of the N-1 order neighbor node and the first representation vector of each node from the target node to the N-2 order neighbor node are used as inputs to the aggregation layer of the graph neural network model to obtain the second representation vector of the target node output by the aggregation layer.
9. The knowledge graph-based encoding recommendation method as described in any one of claims 1-7, characterized in that, The third representation vector belonging to the user is determined based on the user's historical interaction data and the graph neural network model, including: Acquire user historical interaction data, which is a behavioral dataset formed by the data interaction between user profiles and recommendation information profiles; Input the first representation vector of the user's behavior dataset, including the self node and the neighbor nodes of at least one historical object, into the graph neural network model to determine the third representation vector of at least one historical object output by the graph neural network model. The third representation vector of the user is obtained based on the third representation vector of at least one of the historical objects.
10. A knowledge graph-based encoding recommendation device, characterized in that, include: The sampling module is used to acquire a knowledge graph carrying the target node and to sample the multi-hop neighbors of the target node in the knowledge graph to obtain a multi-hop neighbor set. The occlusion module is used to randomly occlude the neighbor nodes corresponding to each hop in the multi-hop neighbor set, generating multiple different occluded neighbors for the target node. The prediction module is used to predict the multiple different occluded neighbors and the target node by inputting the spatial autoregressive model, and determine the first representation vector of the occluded neighbors of the target node; The first determining module is used to input the first representation vector of the occluded neighbors of the target node into the graph neural network model to determine the second representation vector of the target node; The second determining module is used to determine a third representation vector belonging to the user based on the user's historical interaction data and the graph neural network model; The encoding recommendation module is used to determine the encoding corresponding to the recommendation information based on the similarity between the second representation vector of the target node and the third representation vector of the user.
11. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the knowledge graph-based encoding recommendation method as described in any one of claims 1 to 9.
12. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the knowledge graph-based encoding recommendation method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Recommendation algorithm fusing knowledge graph convolutional network and user preference
CN113934936A
Cold start recommendation method fusing knowledge graph and relation perception comparative learning
CN115905722A