Personalized recommendation methods, systems, and electronic devices based on heterogeneous graph attention.
By constructing heterogeneous graphs and training embedding vectors using graph neural networks with multi-head attention mechanisms, the problem of the ineffective handling of the complexity of user-content interaction behavior in existing technologies is solved, and more reasonable and accurate personalized recommendations are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-06
- Publication Date
- 2026-03-13
AI Technical Summary
Existing personalized recommendation systems cannot effectively handle the various interactive behaviors between users and content, as well as their rich semantic information, resulting in inappropriate recommended content.
Heterogeneous graphs are constructed, including user-content heterogeneous graphs and content-content attribute heterogeneous graphs. Embedding vectors are trained using a graph neural network with a multi-head attention mechanism to predict the relevance between users and content. Personalized recommendations are then made by combining multiple types of interactive behaviors and content attributes.
It improves the rationality and accuracy of personalized recommendations, better reflects the complex interaction between users and content, and enhances recommendation effectiveness.
Smart Images

Figure CN116680475B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of personalized recommendation technology, and in particular to a personalized recommendation method, system, and electronic device based on heterogeneous graph attention. Background Technology
[0002] With the continuous advancement of network technology and the rapid increase in information volume, users can easily find the information they need on the internet. However, the mixture of a large amount of invalid and valid information increases the difficulty for users to filter information, making it crucial for them to quickly and effectively locate content of interest. To address this issue, personalized recommendation systems have emerged. Through efficient data mining and user interest analysis, these systems provide users with personalized information and decision support that aligns with their interests, thereby enhancing user experience and business value.
[0003] The core of personalized recommendation systems lies in high-precision algorithm models. In many real-world recommendation scenarios, there are often multiple interaction behaviors between users and items. Different interaction behaviors contain different information, and the relationships between different behaviors also contain rich semantic information. For example, in video recommendation scenarios, users interact with recommended content through behaviors such as liking, saving, forwarding, and disliking. Different interaction behaviors express different degrees of user preference for content, thus influencing the recommended content and style. Therefore, the rich semantic information contained within and between these multiple relationships is crucial for personalized recommendation scenarios. Previous studies have mostly considered user-content interaction under a single behavior, or considered user-recommended content interaction under multiple types of behaviors in a relatively independent or localized way. This is far from sufficient to reflect the complex interaction between users and items in the aforementioned real-world scenarios. Furthermore, to avoid processing heterogeneous graphs composed of multiple attribute associations between content, common features under this relationship are hidden when representing content-side relationships, and relationships are only established for content that simultaneously possesses the common feature. However, this approach cannot effectively distinguish between different types of relationships between content. For example, in short video recommendation scenarios, different videos may have attribute associations with the same author. Previously, the general approach was to express this correlation by directly establishing an edge connection between two content with the same author attribute, but this approach could not effectively express other attribute associations and weight relationships. Summary of the Invention
[0004] The purpose of this invention is to provide a personalized recommendation method, system, and electronic device based on heterogeneous graph attention, which can improve the rationality of personalized recommendation content.
[0005] To achieve the above objectives, the present invention provides the following solution:
[0006] A personalized recommendation method based on heterogeneous graph attention includes:
[0007] A heterogeneous graph is constructed based on the recommended content data of multiple users; the heterogeneous graph includes a user-content side heterogeneous graph and a content-content attribute side heterogeneous graph;
[0008] Determine the embedding vector representation of the heterogeneous graph; the embedding vector representation includes the user node embedding representation, the content node embedding representation, the content attribute node embedding representation, the embedding representation of multi-behavioral interaction edges between users and content, and the embedding representation of multi-type relationship edges between content and content attributes;
[0009] Using the embedded vector as input, a graph neural network incorporating a multi-head attention mechanism is trained to obtain the relevance prediction scores of the target user for different content.
[0010] The top 100 items with the highest relevance prediction scores are selected as the recommended content for the target user.
[0011] Optionally, the edges in the user-content heterogeneous graph and the content-content attribute heterogeneous graph are both bidirectional.
[0012] Optionally, determining the embedding vector representation of the heterogeneous graph includes:
[0013] Feature extraction is performed on the nodes in the heterogeneous graph to obtain node feature vectors; the nodes include: user nodes, content nodes, and content attribute nodes; the node feature vectors include user node feature vectors, content node feature vectors, and content attribute node feature vectors.
[0014] Based on the node feature vectors, determine the embedding vector representations of different nodes;
[0015] The embedding vector representations of different nodes are concatenated to obtain the node embedding representation; the node embedding representation includes user node embedding representation, content node embedding representation and content attribute node embedding representation;
[0016] The embedding representation of multi-behavioral interaction edges between users and content is obtained by performing time-encoded embedding vector processing on the multi-behavioral interaction edges between users and content.
[0017] Random initialization and embedding processing is performed on the multi-type relationship edges between content and content attributes to obtain the embedded representation of the multi-type relationship edges between content and content attributes.
[0018] Optionally, based on the node feature vectors, the embedding vector representations of different nodes are determined, including:
[0019] Determine any node as the current node;
[0020] The product of the numerical feature and the numerical weight vector corresponding to the current node is determined as the numerical feature embedding representation;
[0021] The product of the categorical feature and the categorical weight vector corresponding to the current node is determined as the categorical feature embedding representation;
[0022] The product of the continuous feature and the continuous weight vector corresponding to the current node is determined as the continuous feature embedding representation;
[0023] The trained Vit model is used to process the image modal features corresponding to the current node to obtain the image feature embedding representation;
[0024] The audio features corresponding to the current node are processed using the wav2vec 2.0 model trained by self-supervised learning to obtain the audio feature embedding representation;
[0025] By concatenating numerical feature embedding representations, categorical feature embedding representations, continuous feature embedding representations, image feature embedding representations, and audio feature embedding representations, the embedding vector representation of the current node is obtained.
[0026] Optionally, the loss function for the graph neural network incorporating multi-head attention is:
[0027]
[0028] in, The loss function; The pairwise loss function used for various types of user-content interaction behaviors; For the spectral loss function; W is the L2 regularization loss; kg W represents the weights of the graph loss function. L2 The weights are for L2 regularization loss.
[0029] Optionally, using the embedded vector as input, a graph neural network incorporating a multi-head attention mechanism is trained to obtain the relevance prediction score of the target user for different content, including:
[0030] For any attention head, the query vector and value vector are determined based on the embedding vector representation of the target node, and the key vector is determined based on the embedding vector representation of the source node. After performing similarity calculation and softmax transformation on the query vector and key vector, the weight coefficient matrix corresponding to the source node and the target node is obtained.
[0031] The weight coefficient matrices corresponding to multiple attention heads are linearly transformed and fused to obtain attention weight scores.
[0032] The product of the attention weight score and the value vector is determined as the change in the embedding vector representation of the target node;
[0033] Determine the weights of the changes in the embedding vector representation under different relationships;
[0034] The embedding update change of the target node is determined based on the change in the embedding vector representation under different relations and its weight, and then the updated embedding vector representation of the source node and the updated embedding vector representation of the target node are determined.
[0035] Based on the updated embedding vector representations of the source node and the updated embedding vector representation of the target node, the correlation prediction score from the source node to the target node is determined.
[0036] A personalized recommendation system based on heterogeneous graph attention includes:
[0037] The heterogeneous graph construction module is used to construct a heterogeneous graph based on the recommended content data of multiple users; the heterogeneous graph includes a user-content side heterogeneous graph and a content-content attribute side heterogeneous graph;
[0038] The embedding vector representation determination module is used to determine the embedding vector representation of the heterogeneous graph; the embedding vector representation includes the embedding representation of user nodes, the embedding representation of content nodes, the embedding representation of content attribute nodes, the embedding representation of multi-behavioral interaction edges between users and content, and the embedding representation of multi-type relationship edges between content and content attributes.
[0039] The relevance prediction score determination module is used to train a graph neural network with a multi-head attention mechanism, using the embedding vector as input, to obtain the relevance prediction score of the target user for different content.
[0040] The recommendation module is used to determine the top preset number of items with the highest relevance prediction scores as recommended content for the target user.
[0041] An electronic device includes a memory and a processor, the memory storing a computer program, and the processor running the computer program to cause the electronic device to perform a personalized recommendation method based on heterogeneous graph attention.
[0042] Optionally, the memory is a readable storage medium.
[0043] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0044] This invention provides a personalized recommendation method, system, and electronic device based on heterogeneous graph attention. It constructs a heterogeneous graph based on recommendation content data from multiple users. The heterogeneous graph includes a user-content-side heterogeneous graph and a content-content attribute-side heterogeneous graph. The embedding vector representation of the heterogeneous graph is determined. Using the embedding vector as input, a graph neural network incorporating a multi-head attention mechanism is trained to obtain the relevance prediction score for different content for the target user. The top preset number of content items with the highest relevance prediction scores are then selected as the target user's recommended content. This invention improves the rationality of personalized recommendation content by training a graph neural network incorporating a multi-head attention mechanism. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments 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.
[0046] Figure 1 This is a flowchart of the personalized recommendation method based on heterogeneous graph attention in Embodiment 1 of the present invention;
[0047] Figure 2 This is a diagram of the personalized recommendation algorithm architecture in Embodiment 1 of the present invention;
[0048] Figure 3 This is a schematic diagram of the feature embedding representation of users and content in Embodiment 1 of the present invention. Detailed Implementation
[0049] 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 embodiments of the present invention, and not all embodiments. 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.
[0050] The purpose of this invention is to provide a personalized recommendation method, system, and electronic device based on heterogeneous graph attention, which can improve the rationality of personalized recommendation content.
[0051] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0052] Example 1
[0053] like Figure 1 As shown, this embodiment provides a personalized recommendation method based on heterogeneous graph attention, including:
[0054] Step 101: Construct a heterogeneous graph based on the recommended content data of multiple users; the heterogeneous graph includes a user-content side heterogeneous graph and a content-content attribute side heterogeneous graph. The edges in both the user-content side heterogeneous graph and the content-content attribute side heterogeneous graph are bidirectional.
[0055] The heterogeneous graph construction module consists of two parts: user-content side heterogeneous graph construction and content-content attribute side heterogeneous graph construction.
[0056] User-Content Heterogeneous Graph Construction. When modeling the various interaction behaviors between users and recommended content, each user is modeled as a node VU of the same type, combined with nodes VI from the recommended content side to form a heterogeneous graph node structure between users and content. Edges EU are constructed based on the various interaction behaviors between users and recommended content (such as forwarding, commenting, and liking), where edges of the same interaction behavior are considered to be of the same type. This method yields a heterogeneous graph of multiple user-content behaviors, expressed as: GU = (VU + VI, EU).
[0057] Content-Attribute Heterogeneous Graph Construction. When modeling the heterogeneous graph on the content side, semantic information is considered. Frequently repeated features are extracted from the features of the recommended content and transformed into specific types of entities as graph nodes (VIs). The recommended content itself is also treated as a type of node (VI) in the graph. Finally, edges (EIs) of the heterogeneous graph are constructed based on the relationships between VI nodes and the extracted entity nodes (VEs). This method yields the content-side heterogeneous graph, which can be expressed as: GI = (VE + VI, EI).
[0058] Step 102: Determine the embedding vector representation of the heterogeneous graph; the embedding vector representation includes the embedding representation of user nodes, the embedding representation of content nodes, the embedding representation of content attribute nodes, the embedding representation of multi-behavioral interaction edges between users and content, and the embedding representation of multi-type relationship edges between content and content attributes.
[0059] Step 103: Using the embedding vector as input, train the graph neural network incorporating a multi-head attention mechanism (multi-head self-attention) to obtain the relevance prediction scores of the target user for different content. The loss function of the graph neural network incorporating the multi-head attention mechanism is:
[0060]
[0061] in, The loss function; The pairwise loss function used for various types of user-content interaction behaviors; For the spectral loss function; W is the L2 regularization loss; kg W represents the weights of the graph loss function. L2 The weights are for L2 regularization loss.
[0062] Step 104: Determine the top 100 items with the highest relevance prediction scores as the recommended content for the target user.
[0063] Step 102 includes:
[0064] Step 1021: Extract features from the nodes in the heterogeneous graph to obtain node feature vectors; the nodes include: user nodes, content nodes, and content attribute nodes; the node feature vectors include user node feature vectors, content node feature vectors, and content attribute node feature vectors.
[0065] Step 1022: Determine the embedding vector representation of different nodes based on the node feature vectors.
[0066] Step 1023: Concatenate the embedding vector representations of different nodes to obtain the node embedding representation; the node embedding representation includes the user node embedding representation, the content node embedding representation, and the content attribute node embedding representation.
[0067] Step 1024: Perform time-encoded embedding vector processing on the multi-behavior interaction edges between users and content to obtain the embedding representation of the multi-behavior interaction edges between users and content.
[0068] Step 1025: Perform random initialization embedding on the multi-type relationship edges between content and content attributes to obtain the embedded representation of the multi-type relationship edges between content and content attributes.
[0069] Step 1022 includes:
[0070] Step 10221: Determine any node as the current node.
[0071] Step 10222: Determine that the product of the numerical feature and the numerical weight vector corresponding to the current node is the numerical feature embedding representation.
[0072] Step 10223: Determine the product of the categorical feature and the categorical weight vector corresponding to the current node as the categorical feature embedding representation.
[0073] Step 10224: Determine that the product of the continuous feature and the continuous weight vector corresponding to the current node is the continuous feature embedding representation.
[0074] Step 10225: Use the trained Vit model to process the image modal features corresponding to the current node to obtain the image feature embedding representation.
[0075] Step 10226: Use the wav2vec 2.0 model trained by self-supervised learning to process the audio features corresponding to the current node to obtain the audio feature embedding representation.
[0076] Step 1022: Concatenate the numerical feature embedding representation, categorical feature embedding representation, continuous feature embedding representation, image feature embedding representation, and audio feature embedding representation to obtain the embedding vector representation of the current node.
[0077] like Figure 3 The feature extraction and embedding part based on the attention mechanism takes a heterogeneous graph network constructed by the heterogeneous graph construction module as input and outputs embedded representations of various nodes and edges in the heterogeneous graph. Specifically, it consists of the following two steps:
[0078] Feature extraction is performed on user nodes, content nodes, and content attribute nodes. This step uses different processing methods for different types of features and transforms them into a unified feature vector representation. Specifically, discrete features such as numerical, text, or multi-class features are represented using one-hot encoding; discrete or continuous features within a certain range, such as age, are divided into different segments using bucketing; and binary classification features such as gender are directly distinguished using 0 / 1. Finally, all features are concatenated to construct the feature vector representations of user u, content i, and attribute entity a. Where m, n, and k represent the number of features of user, content, and attribute entities, respectively.
[0079] Feature embedding representation of nodes and edges in a heterogeneous graph. This step involves creating an embedding matrix. The output feature vectors are then embedded into a unified, low-dimensional, dense vector space. Different embedding methods are used for different feature representations; specifically, for numerical features x... n , and the weight vector W n Multiplication yields the embedded representation, i.e., e n =W n x n For discrete categorical features, use the weight matrix W. m The category feature vector x is transformed into a one-hot encoded vector. m Multiply, we get e m =W m x m For continuous features, bucketing is performed and the constructed fully connected layer and weight matrix W are used to process them. kThe final output feature embedding representation is obtained through multiplication. Since the recommended content also includes multimodal features such as text, video, and audio, this step uses different pre-trained models to extract features from the content-side multimodal data and map them into a unified vector space. Specifically, for image modal content, the Vit model is used. This model is a mature pre-trained model in the field of image processing. It first segments and flattens the image, then feeds it into a transformer model and trains it based on a self-attention mechanism, ultimately obtaining the image embedding representation vector eg. For audio modal content, the WAV2VEC 2.0 model, a mature pre-trained model in the field of audio processing, is used. It learns representations of the input audio features through self-supervised learning and achieves the vectorized representation ee of the output audio. o ,like Figure 2 As shown. Finally, the feature vector embeddings corresponding to different nodes are concatenated to obtain the final user node feature embedding representation E. u Content node feature embedding representation E i Content attribute entity node embedding represents E a .
[0080] For the embedding representation of multi-behavioral interaction edges between users and content, the steps incorporate historical interaction time into the edge representation during the construction process. Specifically, firstly, a randomly initialized embedding dictionary is established at the time level. Specifically, a multi-level index dictionary is established according to different time granularities (e.g., hour, day, week, etc.). Then, the timestamp T of the user-content interaction is converted into a time window number, and the time embedding vector corresponding to the number is retrieved from the established time embedding dictionary and integrated. The process of converting the time number into the corresponding time embedding can be calculated using the following formula, where the time number l is divided into odd and even, represented as 2l and 2l+1 respectively, and processed using sine and cosine functions sin and cosine to generate the time-encoded embedding vector.
[0081]
[0082] For the embedding representation of multi-type relationship edges between content and content attributes, this paper uses randomly initialized embeddings to embed the relationships of different types and directions of edges based on semantic information. For example, if there are four relationships [a, b, c, d] in the graph, the embedding representation of multi-relation edges can be obtained after random initialization of the embeddings, e. e = [e1,e2,e3,e4]. The embedding representation obtained above is used in the model training in the following steps.
[0083] Step 103 includes:
[0084] Step 1031: For any attention head, determine the query vector and value vector based on the embedding vector representation of the target node, and determine the key vector based on the embedding vector representation of the source node. After performing similarity calculation and softmax transformation on the query vector and key vector, obtain the weight coefficient matrix corresponding to the source node and the target node.
[0085] Step 1032: Perform linear transformation and fusion processing on the weight coefficient matrices corresponding to multiple attention heads to obtain attention weight scores.
[0086] Step 1033: Determine the product of the attention weight score and the value vector as the change in the embedding vector representation of the target node.
[0087] Step 1034: Determine the weights of the changes in the embedding vector representation under different relations.
[0088] Step 1035: Determine the embedding update change of the target node based on the change in the embedding vector representation under different relations and its weight, and then determine the updated embedding vector representation of the source node and the updated embedding vector representation of the target node.
[0089] Step 1036: Determine the correlation prediction score from the source node to the target node based on the updated embedding vector representation of the source node and the updated embedding vector representation of the target node.
[0090] like Figure 2 The GNN Layer is a convolutional layer. The message passing and aggregation part, based on deep learning, utilizes the embedded representations of nodes and edges in the heterogeneous graph obtained in the previous section. By constructing an attention-based message passing and aggregation algorithm, it performs message passing and fusion between nodes in different directions: user-content, content-user, content-attribute entity, and attribute entity-content, and achieves a prediction score for the target node's preference. This part consists of two stages: the first stage is node neighborhood message passing, which transmits and injects partial information representations of the target node's neighboring nodes into the target node, enabling the target node to contain richer information; the second stage is the message aggregation and embedded representation update stage, which integrates all behaviors and relationships and updates node information.
[0091] Node neighborhood message passing layer. Since the heterogeneous graph constructed by the module is bidirectional, it uses content attribute entity nodes VE... k To content node VI j Taking message passing as an example, under a certain attribute relationship p∈P, the content attribute entity node is taken as the source node, and its embedding vector matrix is represented as E. a The content node is used as the target node, and its embedding vector matrix is represented as E. iUnder each attention head, the node representation vector is relevance-calculated through the attention module to obtain an attention score, and the attention scores obtained from all heads are concatenated. Specifically, E i With learnable matrix The query vector is obtained by multiplication, and the formula is: E a With learnable matrix Multiplying yields the key vector, the formula is: Where h(i)∈H represents the i-th head in the multi-head attention mechanism. After similarity calculation and softmax transformation of the query vector and key vector, the weight coefficient matrix corresponding to the content attribute entity node and the content node is obtained:
[0092]
[0093] Among them, the similarity matrix Specifically, it is expressed as follows:
[0094]
[0095] All attention points are concatenated and weighted using matrix W. O After performing a linear transformation, the final attention weight score, which integrates information from different subspaces, is obtained:
[0096]
[0097] After that, E i With the learnable matrix W V Multiplying them together yields the value vector V = E. i W V The change in the content node embedding representation vector under relation p is obtained by multiplying it with the weighted moments.
[0098]
[0099] Under the relation set P, the updated embedding representation change of the target node obtained under a single relation is mixed with the total information of the target content node obtained by fusing the updated node embedding changes obtained under different relations through message passing mechanisms. This results in the weighted representation under p after fusing all relations, calculated as follows:
[0100]
[0101] The weighted summation of all relation weights completes the message passing and aggregation process from content attribute entity nodes to target content nodes under different relations, ultimately determining the embedding update change of the content node under relation set P:
[0102]
[0103] By passing node messages in different directions through this message passing mechanism, we can also obtain the change in node embedding after content updates to user messages under the interaction behavior k∈K. Changes in the user's node embedding after content message updates And the change in node embedding after updating the content to the content attribute entity message under relation p∈P.
[0104] The message aggregation and embedding representation update layer. The model integrates all behaviors and relationships, ultimately obtaining user node representations that integrate all interaction behavior information, content attribute entity node representations that integrate multiple relationships, and content node representations that simultaneously integrate multiple types of interaction behaviors and multiple relationships.
[0105]
[0106] For content nodes, since both user nodes and content attribute entity nodes pass messages to them, this section merges the message content passed in both directions according to a certain weight ratio to calculate the final change of the content node, which includes information from both the user and content attribute sides. Here, α is the weight hyperparameter.
[0107] ΔE i =αΔE ui +(1-α)ΔE ai
[0108] To capture the high-order collaborative relationships between multiple behavioral interactions between users and content, and between various types of associations between content and content attributes, and to expand the model's receptive field to learn more information, the model uses a multi-layer network model. It adds the updated user node, content node, and attribute entity node embedding representations obtained from all layers after message passing and aggregation mechanisms, and then merges this sum with the initial node representation to obtain the final updated node representation, where l∈L represents the number of neural network layers.
[0109]
[0110]
[0111] To make personalized recommendations based on users' preference scores for recommended products, the model comprehensively considers user-side and content-side information. It then fuses the updated user-side and content-side node embeddings to obtain the final relevance prediction score between the user and the content.
[0112] Pr u,i =coS(U, I)
[0113] Model training and optimization. During the model training and loss optimization phases, the model loss function was designed to suit the characteristics of different training stages. The TransR translation model was used to incorporate spectral features into the loss function design. Furthermore, the model training loss function also employed a hybrid loss function based on pairwise and regularized loss to update and optimize the model. The loss function design is as follows:
[0114]
[0115] Specifically, the model uses a pairwise loss function to calculate the correlation between positive and negative samples for various types of user-content interaction behaviors, and uses the difference between them as one of the model's loss values. The specific calculation method is as follows:
[0116]
[0117] in, This is to avoid overfitting using L2 regularization loss. Furthermore, the model combines the TransR method with a traditional graph attention network to learn the node embedding vector relationships in heterogeneous graphs, enabling the model to handle heterogeneous information networks. This approach fully considers the information contained between different edges, effectively performing information propagation and message aggregation on heterogeneous graphs. For each triple (h, r, t), its graph loss function is expressed as:
[0118]
[0119] To verify the effectiveness of the algorithm proposed in this invention, the WeChat Big Data Challenge dataset, which reflects real-world recommendation scenarios, was used for validation. This dataset provides user behavior data on WeChat Video Account users' interactions with video content over a 14-day period, as well as a set of video attributes for multimodal content information. The algorithm uses Hit Ratio (HR) and Normalized Discounted Cumulative Gain (NDCG) as evaluation metrics and is compared with several classic baseline models. The experimental results are shown in Table 1.
[0120] Experimental results show that the algorithm model proposed in this invention achieves better performance than all benchmark models in comparison experiments with the recall ranking quantity K = [5, 10, 15, 20]. The best result among the benchmark models shows a 2.46% improvement in hit rate and a 2.17% improvement in NDCG. This indicates that the technical method of comprehensively considering multiple types of user-content interaction behaviors and multiple relationships between content and attributes, and extracting content attributes as entity nodes to construct heterogeneous graphs, can more effectively retain and embed more information. Furthermore, the use of a heterogeneous graph attention mechanism in model construction can uncover potential high-order features between relationships. Ultimately, this method achieves high-quality personalized recommendation tasks for target users under complex scenarios involving multiple types of user-content interactions and multiple types of content attribute associations.
[0121] Table 1 Experimental Results
[0122]
[0123] Example 2
[0124] To implement the method corresponding to Embodiment 1 above and achieve the corresponding functions and technical effects, a personalized recommendation system based on heterogeneous graph attention is provided below, including:
[0125] The heterogeneous graph construction module is used to construct heterogeneous graphs based on recommendation content data from multiple users; the heterogeneous graphs include user-content side heterogeneous graphs and content-content attribute side heterogeneous graphs.
[0126] The embedding vector representation determination module is used to determine the embedding vector representation of the heterogeneous graph. The embedding vector representation includes the embedding representation of user nodes, the embedding representation of content nodes, the embedding representation of content attribute nodes, the embedding representation of multi-behavioral interaction edges between users and content, and the embedding representation of multi-type relationship edges between content and content attributes.
[0127] The relevance prediction score determination module is used to train a graph neural network with a multi-head attention mechanism, taking the embedding vector as input, to obtain the relevance prediction score of the target user for different content.
[0128] The recommendation module is used to determine the top preset number of items with the highest relevance prediction scores as recommended content for the target user.
[0129] Example 3
[0130] This embodiment provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor runs the computer program to cause the electronic device to execute the personalized recommendation method based on heterogeneous graph attention described in Embodiment 1. Optionally, the memory is a readable storage medium.
[0131] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0132] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A personalized recommendation method based on heterogeneous graph attention, characterized in that, The method comprises: constructing a heterogeneous graph based on recommendation content data of multiple users; the heterogeneous graph comprises a user-content side heterogeneous graph and a content-content attribute side heterogeneous graph; determining an embedding vector representation of the heterogeneous graph; the embedding vector representation comprises user node embedding representation, content node embedding representation, content attribute node embedding representation, and embedding representation of user-content multi-behavior interaction edges, and embedding representation of content-content attribute multi-type relationship edges; training a graph neural network combined with a multi-head attention mechanism with the embedding vector as input to obtain a relevance prediction score of a target user for different content; determining the top pre-set number of content with the highest relevance prediction score as the recommendation content of the target user; the determination of the embedding vector representation of the heterogeneous graph comprises: extracting features of nodes in the heterogeneous graph to obtain node feature vectors; the nodes include user nodes, content nodes, and content attribute nodes; the node feature vectors include user node feature vectors, content node feature vectors, and content attribute node feature vectors; determining embedding vector representations of different nodes according to the node feature vectors; splicing the embedding vector representations of different nodes to obtain node embedding representations; the node embedding representations include user node embedding representation, content node embedding representation, and content attribute node embedding representation; performing time coding embedding vector processing on the user-content multi-behavior interaction edges to obtain the embedding representation of the user-content multi-behavior interaction edges; performing random initialization embedding processing on the content-content attribute multi-type relationship edges to obtain the embedding representation of the content-content attribute multi-type relationship edges; The loss function of the graph neural network combined with the multi-head attention mechanism is: wherein, is a loss function; is a pairwise loss function used for multi-type interaction behavior between users and contents; is a graph loss function; is an L2 regularization loss; is a graph loss function weight; is an L2 regularization loss weight; training the graph neural network combined with the multi-head attention mechanism with the embedding vector as input to obtain a relevance prediction score of a target user for different content, comprising: for any attention head, determining a query vector and a value vector according to the embedding vector representation of the target node, determining a key vector according to the embedding vector representation of the source side node, and after similarity calculation and softmax transformation of the query vector and the key vector, obtaining a weight coefficient matrix corresponding to the source side node and the target node; performing linear transformation and fusion processing on the weight coefficient matrices corresponding to the multiple attention heads to obtain attention weight scores; determining the product of the attention weight scores and the value vector as the change amount of the embedding vector representation of the target node; determining the weight of the change amount of the embedding vector representation under different relationships; determining the embedding update change amount of the target node according to the change amount of the embedding vector representation under different relationships and the weight, and further determining the embedding vector representation of the updated source side node and the embedding vector representation of the updated target node; determining the relevance prediction score of the source side node to the target node according to the embedding vector representation of the updated source side node and the embedding vector representation of the updated target node. 2.The personalized recommendation method based on heterogeneous graph attention of claim 1, characterized in that, The edges in the user-content side heterogeneous graph and the content-content attribute side heterogeneous graph are bidirectional interactions. 3.The personalized recommendation method based on heterogeneous graph attention of claim 1, characterized in that, determining the embedding vector representation of different nodes according to the node feature vectors comprises: determining any node as a current node; determining a product of the numerical feature corresponding to the current node and the numerical weight vector as a numerical feature embedding representation; determining a product of the categorical feature corresponding to the current node and the categorical weight vector as a categorical feature embedding representation; determining a product of the continuous feature corresponding to the current node and the continuous weight vector as a continuous feature embedding representation; processing the image modality feature corresponding to the current node by using the trained Vit model to obtain an image feature embedding representation; processing the audio feature corresponding to the current node by using the self-supervised learning trained wav2vec 2.0 model to obtain an audio feature embedding representation; splicing the numerical feature embedding representation, the categorical feature embedding representation, the continuous feature embedding representation, the image feature embedding representation and the audio feature embedding representation to obtain an embedding vector representation of the current node.
4. A personalized recommendation system based on heterogeneous graph attention, characterized in that, The personalized recommendation system based on the heterogeneous graph attention applies the personalized recommendation method based on the heterogeneous graph attention as claimed in any one of claims 1-3, and the personalized recommendation system based on the heterogeneous graph attention comprises: a heterogeneous graph construction module configured to construct a heterogeneous graph based on recommendation content data of a plurality of users; the heterogeneous graph comprises a user-content side heterogeneous graph and a content-content attribute side heterogeneous graph; an embedding vector representation determination module configured to determine an embedding vector representation of the heterogeneous graph; the embedding vector representation comprises a user node embedding representation, a content node embedding representation, a content attribute node embedding representation, and an embedding representation of a user-content inter-behavior interaction edge, and an embedding representation of a content-content attribute inter-type relationship edge; a relevance prediction score determination module configured to train a graph neural network combined with a multi-head attention mechanism by taking the embedding vector as input to obtain a relevance prediction score of a target user to different content; a recommendation module configured to determine a top pre-set number of content with the highest relevance prediction score as recommendation content of the target user.
5. An electronic device, comprising: The electronic device comprises a memory and a processor, the memory is configured to store a computer program, and the processor is configured to run the computer program to enable the electronic device to perform the personalized recommendation method based on the heterogeneous graph attention as claimed in any one of claims 1-3.
6. The electronic device of claim 5, wherein, The memory is a readable storage medium.