Long-tail recommendation method based on semantic enhancement and mixed attention
By fusing the user-item interaction graph and the knowledge graph, extracting new long-tail neighbors and using a hybrid attention mechanism to aggregate embedding vectors, the problem of existing recommendation systems being difficult to improve long-tail recommendation performance while maintaining recommendation accuracy is solved. More accurate and wider coverage of long-tail recommendations.
Patent Information
- Application Number
- CN202411357601.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-14
AI Technical Summary
While improving the long-tail recommendation performance, existing recommendation systems are difficult to maintain recommendation accuracy and cannot effectively capture user interests and long-tail features.
By fusing the user-item interaction graph and the knowledge graph into a collaborative knowledge graph, using semantic information to extract new long-tail neighbors of users and items, and aggregating long-tail embeddings and original embeddings through a hybrid attention mechanism, the final results of users and items are obtained. embedding vector.
While maintaining recommendation accuracy, it effectively improves long-tail recommendation performance, explores potential long-tail characteristics of users and items, and improves recommendation accuracy and coverage.
Smart Images

Figure CN119311965A_ABST
Abstract
Description
[0001] Technology Neighborhood
[0002] The present invention relates to the field of recommendation technology, and in particular to a long-tail recommendation method based on semantic enhancement and hybrid attention. Background Art
[0003] Recommendation systems are widely used in many areas of life, such as online shopping, short video recommendations, and various search engines. Long-tail recommendation methods aim to solve the "head effect" problem that is prevalent in traditional recommendation systems, that is, most of the recommended resources are concentrated on a few popular items, while a large number of less popular but potentially high-value long-tail items are ignored. With the diversification and personalization of user needs, the recommendation of long-tail items has become particularly important. The semantic information in the knowledge graph is used to enhance the recommendation effect, and the user's interests are accurately captured through the hybrid attention mechanism, which improves the accuracy and coverage of the recommendation of long-tail items, which not only helps to discover potential high-value items, but also improves user satisfaction and platform revenue. However, the existing neighbor selection directly selects the neighbors of users and items through interactive information. The neighbors obtained in this way contain too much information about popular items but cannot obtain long-tail features; the existing feature aggregation often aggregates the neighbors by assigning weights through the attention network, and cannot obtain the original feature information and long-tail feature information at the same time; that is, the existing methods need to sacrifice the recommendation accuracy while improving the performance of long-tail recommendations. How to improve the performance of long-tail recommendations while maintaining the recommendation accuracy has become an important problem facing the current long-tail recommendation field. Summary of the invention
[0004] In order to solve the above problems existing in the existing recommendation methods, the present invention provides a long-tail recommendation method based on semantic enhancement and hybrid attention.
[0005] The technical solution of the present invention is: a long-tail recommendation method based on semantic enhancement and hybrid attention, which is carried out in the following steps:
[0006] Step 1. Fuse the user-item interaction graph and the knowledge graph to obtain a collaborative knowledge graph
[0007] Combine the user-item interaction graph G1 = {(u,i)|u∈U,i∈I} and the knowledge graph
[0008] G2={(h,r,t)|h,t∈E,r∈R} is fused to obtain the collaborative knowledge graph G3={(h,r,t)|h,t∈E',r∈R'}. In the user-item interaction graph G1, (u,i) indicates that user u has interacted with item i, U={u1,u2,…,u |U|} represents the user set, I={i1,i2,…,i |I|} represents a set of items; in the knowledge graph G2, E = {h1,h2,…,h |E|} represents an entity set, R = {r1, r2, ..., r |R|} represents a set of relations; in the collaborative knowledge graph G3, E'=E∪U, R'=R∪{interaction}, |U| represents the total number of users, |I| represents the total number of items, |E| represents the total number of entities, and |R| represents the total number of relations; let the set of original neighbors of user u be N u ; Let the set of original neighbors of item i be N i ; Let the set of original neighbors of entity v be N v , according to the number of interactions of the items, all items are arranged in descending order, and the total number of interactions is accumulated starting from the item with the least number of interactions. The items in the set of items that account for 20% of the total number of interactions are defined as long-tail items;
[0009] Step 2. Use the semantic information contained in the collaborative graph to extract new long-tail neighbors for users and items respectively. Step 2.1 Extract new long-tail neighbors for users
[0010] From the items i∈N that user u has interacted with u Starting from, for each entity h∈N connected to item i i , calculate the semantic relevance p(u,i,h) of the user to entity h through item i according to formula (1), and select the top m entities with the highest semantic relevance as set E u ={h1,h2,…,h m};
[0011]
[0012] Among them, e u ,e i ,e h Respectively represent the embedding vectors of user u, item i, and entity h, T represents the matrix transpose operation, ⊙ represents the element product, and σ represents the activation function softmax;
[0013] Extract long-tail item neighbors for each user: For each selected entity h∈E u , according to formulas (2) and (3), calculate the user u’s access to item i∈N through entity h h The semantic association q(u,h,i);
[0014]
[0015] ω i =log τ pop(i) (3)
[0016] Among them, ω irepresents a scaling function that scales the semantic relevance based on the popularity of item i; τ is a hyperparameter used to control the degree of scaling; pop(i) represents the number of interactions of item i;
[0017] Select the long-tail item set with the highest semantic relevance, denoted as I u ={i1,i2,…,i m}, and use it as the long-tail neighbor of user u;
[0018] Step 2.2 Extract new long-tail neighbors for items
[0019] From the entities v∈N that have interacted with item i i Starting from, for each entity h∈N connected to entity v v , calculate the semantic relevance p(i,v,h) of the item through entity v to entity h according to formula (4), and select the first n entity nodes with the highest semantic relevance as set E i ={h1,h2,…,h n};
[0020]
[0021] Among them, e i ,e v ,e h Represent the embedding vectors of item i, entity v and entity h respectively, T represents the matrix transpose operation, ⊙ represents the element product, and σ represents the activation function softmax;
[0022] Extract long-tail item neighbors for each item: For each selected entity h∈E i , according to formulas (5) and (6), calculate the effect of item i on item i'∈N through entity h h The semantic association q(i,h,i');
[0023]
[0024] α i’ =log τ pop(i') (6)
[0025] Among them, α i’ represents a scaling function that scales the semantic relevance based on the popularity of item i'; τ is a hyperparameter used to control the degree of scaling; pop(i') is the number of interactions of item i'; the long-tail item set with the highest semantic relevance is selected as I i ={i1,i2,…,i n}, and use it as the long tail neighbor of item i;
[0026] Step 3. Aggregate the new long-tail neighbors and the original neighbors through a mixed attention consisting of relational attention and self-attention to obtain the final embedding vectors of users and items.
[0027] Step 3.1 Aggregate the long-tail neighbors of users and items through relational attention to obtain the long-tail embeddings of users and items: First, the attention weights generated based on different relations in the collaborative knowledge graph are as shown in formula (7),
[0028] π'(h,r,t)=(W r e t ) T tanh((W r e h +e r )) (7)
[0029] Where W r is a trainable transformation matrix based on the r relationship, e h ,e r ,e t They correspond to the head entity embedding, relation embedding, and tail entity embedding respectively. T represents the matrix transposition operation, and then the activation function softmax is used for normalization according to formula (8):
[0030]
[0031] For all triples with h as the head entity, we use formula (9) to perform weighted summation to obtain the neighbor embedding vector:
[0032]
[0033] The head entity node h can be a user node u, an item node i, or an entity node v. h represents the proximity of the head entity h, Represents the neighboring embedding vector of the head entity h; N h Use I u Instead, get the user's long-tail neighbor embedding N h Use I i Instead, we get the long-tail neighbor embedding of the item Perform relational attention aggregation on user u according to formula (10) to obtain the user's long-tail embedding e' u ;
[0034]
[0035] Among them, W1, W2 are trainable transformation matrices;
[0036] Perform relational attention aggregation on item i according to formula (11) to obtain the long-tail embedding e' of the itemi ;
[0037]
[0038] Among them, W3, W4 are trainable transformation matrices;
[0039] Step 3.2 Embed the obtained user long tail into e' u The original proximity N of the user u The user's final embedding vector is obtained by aggregation through self-attention Embed the obtained item long tail into e' i The original proximity N of the item i Aggregate the items through self-attention to get the final embedding vector
[0040] In the self-attention layer, use formulas (12), (13), and (14) to embed e for any node m m Three different vectors are obtained through three feature transformations:
[0041] Query m =W Q e m (12)
[0042] Key m =W K e m (13)
[0043] Value m =W V e m (14)
[0044] In the above formulas (12), (13) and (14), W Q ,W K ,W V is a trainable transformation matrix. For any two nodes m and n, they are first transformed using formulas (12), (13), and (14), and then the attention weight between nodes m and n is calculated using formula (15):
[0045] β m,n =Query m Key n (15)
[0046] The final embedding vector of the user is obtained by weighted summation of formulas (16) and (17): and the final embedding vector of the item
[0047]
[0048] Step 4. Final embedding vector of user and the final embedding vector of the item Perform the dot product, as shown in Formula 18:
[0049]
[0050] Get the predicted score y(u,i) of user u for item i, and recommend the top N items with the highest predicted scores to the user.
[0051] Compared with the prior art, the present invention effectively improves the long-tail recommendation performance while maintaining the recommendation accuracy, which is specifically reflected as follows: Different from the existing neighbor selection method, the present invention utilizes the rich semantic information in the collaborative knowledge graph to extract new long-tail neighbors of users and items respectively, thereby exploring the potential long-tail features of users and items; in addition, different from the existing aggregation method, the present invention utilizes relational attention and self-attention to form hybrid attention respectively, and aggregates the long-tail embedding and the original embedding through the hybrid attention, so that the final embedding vectors of users and items contain both the original feature information and the long-tail feature information. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 is a flow chart of an embodiment of the present invention.
[0053] Figure 2 It is a schematic diagram of the corresponding results of the Recall index of the method of the present invention and the existing method as the number of recommendations changes.
[0054] Figure 3 It is a schematic diagram of the corresponding results of the AD index of the method of the present invention and the existing method as the recommended number changes. DETAILED DESCRIPTION
[0055] A long-tail recommendation method based on semantic enhancement and hybrid attention of the present invention is as follows Figure 1 As shown, follow the steps below:
[0056] Step 1. Fuse the user-item interaction graph and the knowledge graph to obtain a collaborative knowledge graph
[0057] Combine the user-item interaction graph G1 = {(u,i)|u∈U,i∈I} and the knowledge graph
[0058] G2={(h,r,t)|h,t∈E,r∈R} is fused to obtain the collaborative knowledge graph G3={(h,r,t)|h,t∈E',r∈R'}. In the user-item interaction graph G1, (u,i) indicates that user u has interacted with item i, U={u1,u2,…,u |U|} represents the user set, I={i1,i2,…,i |I|} represents a set of items; in the knowledge graph G2, E = {h1,h2,…,h |E|} represents an entity set, R = {r1, r2, ..., r |R|} represents a set of relations; in the collaborative knowledge graph G3, E'=E∪U, R'=R∪{interaction}, |U| represents the total number of users, |I| represents the total number of items, |E| represents the total number of entities, and |R| represents the total number of relations; let the set of original neighbors of user u be N u ; Let the set of original neighbors of item i be N i ; Let the set of original neighbors of entity v be N v , according to the number of interactions of the items, all items are arranged in descending order, and the total number of interactions is accumulated starting from the item with the least number of interactions. The items in the set of items that account for 20% of the total number of interactions are defined as long-tail items;
[0059] In the user-item bipartite graph G1, U = {user 1, user 2, user 3, target user} represents the user set;
[0060] I = {item 1, item 2, item 3, item 4, item 5} represents a set of items;
[0061] In the knowledge graph G2:
[0062] ε = {item 1, item 2, item 3, item 4, item 5, entity 6, entity 7, entity 8, entity 9, entity 10} represents an entity set, and R = {relation 1, relation 2, relation 3} represents a relation set;
[0063] Then the user-item interaction graph G1 is shown in Table 1. In Table 1, the value corresponding to user u and item i is 1, which means that user u has an interaction relationship with item i, and 0 means that there is no interaction relationship;
[0064] Table 1
[0065] User\Item Item 1 Item 2 Item 3 Item 4 Item 5 User 1 0 1 1 0 1 User 2 1 1 1 0 1 User 3 1 0 1 1 1 Target Users 1 0 0 1 0
[0066] From Table 1, we can see that:
[0067] User 1's interactive items are {item 2, item 3, item 5};
[0068] User 2's interactive items are {item 1, item 2, item 3, item 5};
[0069] User 3's interactive items are {item 1, item 3, item 4, item 5};
[0070] The target user's interactive items are {item 1, item 4}.
[0071] The attribute information of the item in the knowledge graph G2 is shown in Table 2. A row of data in Table 2 represents that the head entity and the tail entity have a triple based on the relationship in the row. For example, the first row represents the triple <item 1, relationship 1, entity 6>;
[0072] Table 2
[0073] Head Entity relation Tail Entity Item 1 Relationship 1 Entity 6 Item 1 Relationship 2 Entity 7 Item 2 Relationship 1 Entity 8 Item 2 Relationship 1 Entity 6 Item 3 Relationship 3 Entity 9 Item 4 Relationship 2 Entity 7 Item 5 Relationship 1 Entity 6 Item 5 Relationship 1 Entity 10
[0074] From Table 2, we can see that:
[0075] Under relationship 1, (item 1, entity 6), (item 2, entity 8), (item 5, entity 6), and (item 5, entity 10) are connected;
[0076] Under relationship 2, (item 1, entity 7) and (item 4, entity 7) are connected;
[0077] Under relationship 3, (item 3, entity 9) is connected;
[0078] By combining the above user-item interaction graph G1 and knowledge graph G2, and defining the interaction relationship as relationship 4, we can obtain the collaborative knowledge graph G3, as shown in Table 3 below:
[0079] Table 3
[0080]
[0081]
[0082] From Table 3, we can see that:
[0083] The target user’s historical interaction item set is {item 1,,item 4};
[0084] The entity set connected to the above set is {entity 6, entity 7};
[0085] The item sets connected to the above entity set are {item 1, item 2, item 5} and {item 1, item 4} respectively.
[0086] Step 2. Use the semantic information contained in the collaborative graph to extract new long-tail neighbors for users and items respectively. Step 2.1 Extract new long-tail neighbors for users
[0087] From the items i∈N that user u has interacted with u Starting from, for each entity h∈N connected to item i i , calculate the semantic relevance p(u,i,h) of the user to entity h through item i according to formula (1), and select the top m entities with the highest semantic relevance as set E u ={h1,h2,…,hm};
[0088]
[0089] Among them, e u ,e i ,e h Respectively represent the embedding vectors of user u, item i, and entity h, T represents the matrix transpose operation, ⊙ represents the element product, and σ represents the activation function softmax;
[0090] Target user u t For example, the items that have been interacted with are {i1,i4}. Taking item i1 as an example, its adjacent entities are {h6,h7}. According to formula (1), the user u is calculated t The semantic association between entity h6 and entity h7, for example, user u t The semantic relevance of entity h6 is calculated as The same is true for entity h7. For all entities connected to items that the user has interacted with, the above steps are used to calculate the user's semantic relevance to these entity nodes;
[0091] Extract long-tail item neighbors for each user: For each selected entity h∈E u , according to formulas (2) and (3), calculate the user u’s access to item i∈N through entity h h The semantic association q(u,h,i);
[0092]
[0093] ω i =log τ pop(i) (3)
[0094] Among them, ω i represents a scaling function that scales the semantic relevance based on the popularity of item i; τ is a hyperparameter used to control the degree of scaling; pop(i) represents the number of interactions of item i;
[0095] Select the long-tail item set with the highest semantic relevance, denoted as I u ={i1,i2,…,i m}, and use it as the long-tail neighbor of user u;
[0096] Taking h6 as the target user’s favorite entity node, we use formula (2) to calculate the score of each item in the item set {item 1, item 2, item 5} connected to h6. For example, we calculate the score of the target user u t The degree of liking for item i1 is
[0097] Step 2.2 Extract new long-tail neighbors for items
[0098] From the entities v∈N that have interacted with item i i Starting from, for each entity h∈N connected to entity v v , calculate the semantic relevance p(i,v,h) of the item through entity v to entity h according to formula (4), and select the first n entity nodes with the highest semantic relevance as set E i ={h1,h2,…,h n};
[0099]
[0100] Among them, e i ,e v ,e h Represent the embedding vectors of item i, entity v and entity h respectively, T represents the matrix transpose operation, ⊙ represents the element product, and σ represents the activation function softmax;
[0101] Extract long-tail item neighbors for each item: For each selected entity h∈E i , according to formulas (5) and (6), calculate the effect of item i on item i'∈N through entity h h The semantic association q(i,h,i');
[0102]
[0103] α i’ =log τ pop(i') (6)
[0104] Among them, α i’ represents a scaling function that scales the semantic relevance based on the popularity of item i'; τ is a hyperparameter used to control the degree of scaling; pop(i') is the number of interactions of item i'; the long-tail item set with the highest semantic relevance is selected as I i ={i1,i2,…,i n}, and use it as the long tail neighbor of item i;
[0105] Step 3. Aggregate the new long-tail neighbors and the original neighbors through a mixed attention consisting of relational attention and self-attention to obtain the final embedding vectors of users and items.
[0106] Step 3.1 Aggregate the long-tail neighbors of users and items through relational attention to obtain the long-tail embeddings of users and items: First, the attention weights generated based on different relations in the collaborative knowledge graph are as shown in formula (7),
[0107] π'(h,r,t)=(Wr e t ) T tanh((W r e h +e r )) (7)
[0108] Where W r is a trainable transformation matrix based on the r relationship, e h ,e r ,e t They correspond to the head entity embedding, relation embedding, and tail entity embedding respectively. T represents the matrix transposition operation, and then the activation function softmax is used for normalization according to formula (8):
[0109]
[0110] For all triples with h as the head entity, we use formula (9) to perform weighted summation to obtain the neighbor embedding vector:
[0111]
[0112] The head entity node h can be a user node u, an item node i, or an entity node v. h represents the proximity of the head entity h, Represents the neighboring embedding vector of the head entity h; N h Use I u Instead, get the user's long-tail neighbor embedding N h Use I i Instead, we get the long-tail neighbor embedding of the item Perform relational attention aggregation on user u according to formula (10) to obtain the user's long-tail embedding e' u :
[0113]
[0114] Among them, W1, W2 are trainable transformation matrices;
[0115] Perform relational attention aggregation on item i according to formula (11) to obtain the long-tail embedding e' of the item i .
[0116]
[0117] Among them, W3, W4 are trainable transformation matrices;
[0118] Target user u t For example, the attention weight between it and item 1 is:
[0119] π(u t, relation 4, item 2) = (W 关系4 e 物品2 ) T tanh((W 关系4 e 目标用户 +e 关系4 ));
[0120] The attention weight between it and item 4 is:
[0121] π(u t , relation 4, item 3) = (W 关系4 e 物品3 ) T tanh((W 关系4 e 目标用户 +e 关系4 ));
[0122] u t The neighboring embedding vector of is:
[0123]
[0124] Final target user t The long-tail embedding of is:
[0125]
[0126] Step 3.2 Embed the obtained user long tail into e' u The original proximity N of the user u The user's final embedding vector is obtained by aggregation through self-attention Embed the obtained item long tail into e' i The original proximity N of the item i Aggregate the items through self-attention to get the final embedding vector
[0127] In the self-attention layer, use formulas (12), (13), and (14) to embed e for any node m m Three different vectors are obtained through three feature transformations:
[0128] Query m =W Q e m (12)
[0129] Key m =W K e m (13)
[0130] Value m =W V e m (14)
[0131] In the above formulas (12), (13) and (14), W Q ,W K ,W V is a trainable transformation matrix. For any two nodes m and n, they are first transformed using formulas (12), (13), and (14), and then the attention weight between nodes m and n is calculated using formula (15):
[0132] β m,n =Query m Key n (15)
[0133] The final embedding vector of the user is obtained by weighted summation of formulas (16) and (17): and the final embedding vector of the item
[0134]
[0135] Taking the target user as an example, the target user long-tail embedding e' obtained in step 3.1 目标用户 and its original neighbor 物品2 , e 物品4 As input to the self-attention layer:
[0136] Self-Attention represents a self-attention neural network. The target user aggregates its original neighboring feature information through self-attention and outputs it as the final embedding vector of the target user;
[0137] Step 4. Final embedding vector of user and the final embedding vector of the item Perform the dot product as shown in Formula 18:
[0138]
[0139] Get the predicted score y(u,i) of user u for item i, and recommend the top N items with the highest predicted scores to the user.
[0140] For example, get the final embedding vector of the target user Target user t Embedding vectors for non-interacted items i2, i3, and i5 and The final embedding vector of the target user is inner-producted with the embedding vectors of the uninteracted items i2, i3, and i5 to obtain user u t Predicted scores for items i2, i3, and i5 Select item i3 with the highest predicted score as the recommendation result and provide it to target user ut .
[0141] The method of the embodiment of the present invention is experimentally demonstrated, which specifically includes:
[0142] (1) Using public datasets
[0143] The user-item interaction dataset used in the present invention is LastFM, and the knowledge graph used is Freebase. The LastFM dataset contains 23,566 users, 48,123 songs, and 3,034,796 user-song interactions. The Freebase knowledge graph contains 58,266 entities, 9 relationships, and 464,567 triples. The present invention uses the names of songs for mapping, connects songs with the same name in LastFM and Freebase, and thus obtains a collaborative knowledge graph.
[0144] (2) Evaluation indicators
[0145] This paper uses Recall as the recommendation accuracy evaluation index of this experiment, and Aggregate Diversity (AD) as the long-tail recommendation performance evaluation index of this experiment. Recall can measure the recommendation performance of long-tail sequences by showing the recommendation accuracy. The higher the value, the higher the recommendation accuracy. The calculation formula is as follows:
[0146]
[0147] Among them, N r Represents the total number of items that the target user likes, N rs Indicates the number of items that the target user likes among the recommended items.
[0148] AD shows the diversity of recommendation results, thus reflecting the long-tail recommendation performance. The higher the value, the higher the long-tail recommendation performance. The calculation formula is as follows:
[0149] AD=|∪ u∈U {i∈Top u (N)}|
[0150] Among them, Top u (N) represents the N items finally recommended to user u.
[0151] Comparison and analysis of experimental results:
[0152] The proposed method is compared with the classic knowledge graph-based recommendation method KGAT (Knowledge Graph Attention Network for Recommendation). The recall results are as follows: Figure 2As shown in the experimental data, as the number of recommendations increases, the Recall result of the method of the present invention is significantly higher than that of the KGAT method. Since the larger the Recall value, the higher the recommendation accuracy, the method of the present invention can recommend items with higher accuracy than KGAT. Figure 3 As shown in the figure, the experimental data show that as the number of recommendations increases, the AD result of the method of the present invention is significantly higher than that of the KGAT method. Since the larger the AD value, the higher the recommendation diversity and the higher the long-tail recommendation performance, the method of the present invention can recommend more long-tail items than KGAT.
[0153] In summary, the present invention can improve the recommendation accuracy while recommending more long-tail items to target users.
Claims
1. A long-tail recommendation method based on semantic enhancement and hybrid attention, characterized by Follow the steps below: Step 1. Fuse the user-item interaction graph and the knowledge graph to obtain a collaborative knowledge graph Combine the user-item interaction graph G1 = {(u,i)|u∈U,i∈I} and the knowledge graph G2={(h,r,t)|h,t∈E,r∈R} is fused to obtain the collaborative knowledge graph G3={(h,r,t)|h,t∈E',r∈R'}. In the user-item interaction graph G1, (u,i) indicates that user u has interacted with item i, U={u1,u2,…,u |U| } represents the user set, I={i1,i2,…,i |I| } represents a set of items; in the knowledge graph G2, E = {h1,h2,…,h |E| } represents an entity set, R = {r1, r2, ..., r |R| } represents a set of relations; in the collaborative knowledge graph G3, E'=E∪U,R'=R∪{interaction}, |U| represents the total number of users, |I| represents the total number of items, |E| represents the total number of entities, and |R| represents the total number of relations; Let the set of original neighbors of user u be N u ; Let the set of original neighbors of item i be N i ; Let the set of original neighbors of entity v be N v , according to the number of interactions of the items, all items are arranged in descending order, and the total number of interactions is accumulated starting from the item with the least number of interactions. The items in the set of items that account for 20% of the total number of interactions are defined as long-tail items; Step 2. Use the semantic information contained in the collaborative graph to extract new long-tail neighbors for users and items respectively. Step 2.1 Extract new long-tail neighbors for users From the items i∈N that user u has interacted with u Starting from, for each entity h∈N connected to item i i , calculate the semantic relevance p(u,i,h) of the user to entity h through item i according to formula (1), and select the top m entities with the highest semantic relevance as set E u ={h1,h2,…,h m }; Among them, e u ,e i ,e h Respectively represent the embedding vectors of user u, item i, and entity h, T represents the matrix transpose operation, ⊙ represents the element product, and σ represents the activation function softmax; Extract long-tail item neighbors for each user: For each selected entity h∈E u , according to formulas (2) and (3), calculate the user u’s access to item i∈N through entity h h The semantic association q(u,h,i); ω i =log τ pop(i) (3) Among them, ω i represents a scaling function that scales the semantic relevance based on the popularity of item i; τ is a hyperparameter used to control the degree of scaling; pop(i) represents the number of interactions of item i; Select the long-tail item set with the highest semantic relevance, denoted as I u ={i1,i2,…,i m }, and use it as the long-tail neighbor of user u; Step 2.2 Extract new long-tail neighbors for items From the entities v∈N that have interacted with item i i Starting from, for each entity h∈N connected to entity v v , calculate the semantic relevance p(i,v,h) of the item through entity v to entity h according to formula (4), and select the first n entity nodes with the highest semantic relevance as set E i ={h1,h2,…,h n }; Among them, e i ,e v ,e h Represent the embedding vectors of item i, entity v and entity h respectively, T represents the matrix transpose operation, ⊙ represents the element product, and σ represents the activation function softmax; Extract long-tail item neighbors for each item: For each selected entity h∈E i , according to formulas (5) and (6), calculate the effect of item i on item i'∈N through entity h h The semantic association q(i,h,i'); a i’ =log τ pop(i') (6) Among them, α i’ represents a scaling function that scales the semantic relevance based on the popularity of item i'; τ is a hyperparameter used to control the degree of scaling; pop(i') is the number of interactions of item i'; the long-tail item set with the highest semantic relevance is selected as I i ={i1,i2,…,i n }, and use it as the long tail neighbor of item i; Step 3. Aggregate the new long-tail neighbors and the original neighbors through a mixed attention consisting of relational attention and self-attention to obtain the final embedding vectors of users and items. Step 3.1 Aggregate the long-tail neighbors of users and items through relational attention to obtain the long-tail embeddings of users and items: First, the attention weights generated based on different relations in the collaborative knowledge graph are as shown in formula (7), π'(h,r,t)=(W r e t ) T tanh((W r e h +e r )) (7) Where W r is a trainable transformation matrix based on the r relationship, e h ,e r ,e t They correspond to the head entity embedding, relation embedding, and tail entity embedding respectively. T represents the matrix transposition operation, and then the activation function softmax is used for normalization according to formula (8): For all triples with h as the head entity, we use formula (9) to perform weighted summation to obtain the neighbor embedding vector: The head entity node h can be a user node u, an item node i, or an entity node v. h represents the proximity of the head entity h, Represents the neighboring embedding vector of the head entity h; N h Use I u Instead, get the user's long-tail neighbor embedding N h Use I i Instead, we get the long-tail neighbor embedding of the item Perform relational attention aggregation on user u according to formula (10) to obtain the user's long-tail embedding e' u ; Among them, W1, W2 are trainable transformation matrices; Perform relational attention aggregation on item i according to formula (11) to obtain the long-tail embedding e' of the item i ; Among them, W3, W4 are trainable transformation matrices; Step 3.2 Embed the obtained user long tail into e' u The original proximity N of the user u The user's final embedding vector is obtained by aggregation through self-attention Embed the obtained item long tail into e' i The original proximity N of the item i Aggregate the items through self-attention to get the final embedding vector In the self-attention layer, use formulas (12), (13), and (14) to embed e for any node m m Three different vectors are obtained through three feature transformations: Query m =W Q e m (12) Key m =W K e m (13) Value m =W V e m (14) In the above formulas (12), (13) and (14), W Q ,W K ,W V is a trainable transformation matrix. For any two nodes m and n, they are first transformed using formulas (12), (13), and (14), and then the attention weight between nodes m and n is calculated using formula (15): β m,n =Query m Key n (15) The final embedding vector of the user is obtained by weighted summation of formulas (16) and (17): and the final embedding vector of the item Step 4. Final embedding vector of user and the final embedding vector of the item Perform the dot product, as shown in Formula 18: Get the predicted score y(u,i) of user u for item i, and recommend the top N items with the highest predicted scores to the user.
Citation Information
Cited By
Long-tail human movement prediction method and system based on adaptive graph marginal learning
CN121681908A