Complementary product recommendation method and device
By constructing user-item and user-user hypergraphs, using hypergraph attention network and community detection technology, the shopping preference similarity scores between users are calculated, and the complementarity of items is analyzed based on the cross-elastic theory of demand, the problem of poor complementary product recommendations in the existing recommendation system is solved, and more accurate complementary product recommendations are achieved.
Patent Information
- Application Number
- CN202510110036.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-23
AI Technical Summary
When integrating complementary relationships into recommendations, the existing recommendation system is understood as ‘co-purchase’, which is different from the complementary product concept in economics, resulting in poor recommendation results. A method that can improve the accuracy of complementary product recommendations is urgently needed.
By constructing user-item hypergraphs and user-user hypergraphs, using the hypergraph attention network to dynamically obtain node feature representations, divide communities with similar shopping preferences, calculate shopping preference similarity scores among users, predict users' ratings for items, and analyze the complementarity of items based on the cross-elastic theory of demand, and recommend complementary products.
This method can more accurately capture the complex relationship between users and items, improve the shopping preference similarity score between users, enhance the accuracy of complementary product recommendations, and thus improve the user's shopping experience.
Smart Images

Figure CN120031632A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for recommending complementary products. Background Art
[0002] In the new retail era, with the explosive growth of product information on e-commerce platforms, consumers often encounter the problem of increased search costs when looking for their favorite products. In order to meet this challenge, intelligent recommendation systems have emerged as a refreshing change. These intelligent systems can efficiently screen and filter massive amounts of product information and provide consumers with product information that meets their unique needs in a personalized way. This personalized recommendation not only effectively alleviates the pressure caused by information overload, but also greatly improves the efficiency of consumers' product retrieval.
[0003] At present, consumers pay more attention to the practicality and necessity of purchasing products, and many studies are also devoted to integrating the complementary relationship between commodities into the recommendation system to further enhance the practicality and accuracy of the recommendation system and improve the user's shopping experience. However, existing recommendation systems usually understand complementary relationships as "co-purchase", which is different from the concept of complementary products in economics, and the recommendation effect is not good.
[0004] Therefore, there is an urgent need for a method that can improve the accuracy of complementary product recommendations. Summary of the invention
[0005] Based on this, it is necessary to provide a complementary product recommendation method for the above technical problems. This method can improve the accuracy of complementary product recommendations.
[0006] The present invention adopts the following technical solutions:
[0007] The present invention provides a method for recommending complementary products, comprising:
[0008] Build a user-item hypergraph based on the interaction data between users and items, and build a user-user hypergraph based on the social relationships between users;
[0009] The node feature matrix and hypergraph structure in the user-item hypergraph and the user-user hypergraph are input into the hypergraph attention network to obtain an updated node feature representation; the updated node feature representation can represent the relationship between users and items;
[0010] Based on the updated node feature representation, multiple users are divided into different communities with similar shopping preferences;
[0011] In any community, the shopping preference similarity score between the target user and other users in the community is calculated based on the item sets that each user in the community likes and dislikes, and the first preset number of other users with the highest shopping preference similarity scores are regarded as the target user's neighboring users; the target user is any user in the community;
[0012] According to the ratings of each item by the neighboring users and the target user, as well as the shopping preference similarity scores between the target user and the neighboring users, the target user's rating prediction value for each item is obtained;
[0013] The second preset number of items with the highest predicted score values are taken as target items, and based on the cross elasticity of demand theory, a complementarity analysis is performed on the target items from all historically purchased items of the target user and neighboring users to obtain complementary products of the target items, and the complementary products of the target items are recommended to all users in the community where the target user is located.
[0014] Preferably, the node feature matrix includes a user feature vector and an item feature vector, the hypergraph structure includes a hypergraph association matrix and a node-hyperedge association matrix, and the hypergraph attention network is:
[0015] X (l+1) =HAN(X (l) ,G,X e );
[0016] Among them, X (l) is the input node feature matrix, G is the association matrix of the hypergraph, X e is the node-hyperedge association matrix, X (l+1) is the output of the hypergraph attention network;
[0017] The node-hyperedge association matrix is used as the input of the hypergraph attention network to dynamically obtain the high-order relationship between nodes. The node-hyperedge association matrix is:
[0018]
[0019] Among them, H ij is the node-hyperedge association matrix, σ is the activation function, N i Represents x i neighborhood, sim is the similarity measure between node i and node j, x i is the feature vector of node i, x j is the feature vector of node j, x k Except for the eigenvector x i and x j The feature vectors of other nodes except node i and node j, P is the projection matrix or transformation function, and k is the node other than node i and node j.
[0020] Preferably, according to the updated node feature representation, multiple users are divided into different communities with similar shopping preferences, specifically including:
[0021] In the modularity optimization operation, each user is considered as a separate community to build the initial network;
[0022] For each user in the community, the user is repeatedly moved out of the current community and added to other neighbor communities in the network cohesion operation, and the modularity change of the initial network after the user is moved is calculated. When the modularity change is maximized and positive, the user is determined to be transferred to the neighbor community, and multiple different communities are obtained; the node feature representation is referenced when calculating the modularity change;
[0023] Treat each of the multiple different communities as a node and build a network;
[0024] Repeat the modularity optimization operation and network cohesion operation on the network until the modularity reaches the optimal level, and obtain the final community division result; in the final community division result, users in each community have similar shopping preferences.
[0025] Preferably, the shopping preference similarity score between the target user and other users in the community is calculated as follows:
[0026]
[0027] Among them, SIM uv is the similarity score between user u and user v, L u and L v are a set of items liked by user u and user v respectively, N u and N v are a set of items that user u and user v dislike respectively, L uv is the set of items that both user u and user v like, N uv is the set of items that both user u and user v dislike, R ui is the rating score of the u-th user for the i-th item, R vi is the rating score of the vth user for the i-th item, R vk For the vth user to k The rating score of items, R uk is the rating score of the u-th user for the k-th item, R ui is the rating score of the u-th user for the i-th item.
[0028] Preferably, the target user's rating prediction values for different items are obtained based on the shopping preference similarity score and the target user's neighboring users, specifically including:
[0029] The shopping preference similarity scores are used to sort in descending order, and a preset number of other users who are ranked at the top are used as the neighbor user set of the target user;
[0030] According to the shopping preference similarity score and the set of neighboring users, the target user's rating prediction values for different items are obtained.
[0031] Preferably, the target user's predicted ratings for different items are calculated as follows:
[0032]
[0033] Among them, P ui is the predicted value of user u’s rating for the i-th item, R’ u is the average rating of item i by user u, R v ' is the average rating of item i by neighboring user v, T u is the set of neighboring users of user u, SIM uv is the similarity score between user u and user v, R vi is the rating of the vth user on the i-th item.
[0034] Preferably, according to the demand cross elasticity theory, a complementarity analysis is performed on the target item set from all historically purchased items of the target user and neighboring users to obtain complementary products of the target item set, specifically including:
[0035] Calculate the cross elasticity of demand between the target item and each historically purchased item;
[0036] The historically purchased items corresponding to the cross elasticity of demand values less than zero are determined as complementary products of the target item.
[0037] Preferably, the calculation formula for obtaining the demand cross elasticity value between the item and the candidate item is:
[0038]
[0039] Among them, E XY is the cross-price elasticity of demand, Q dX1 Q is the demand for commodity X before the price of commodity Y changes. dX2 is the demand for commodity X after the price of commodity Y changes, P Y1 is the price of commodity Y before the price change, P Y2 is the price corresponding to the price change of commodity Y, ΔQ dX Represents the change in demand for commodity X, ΔP Y Indicates the change in the price of commodity Y.
[0040] Preferably, the nodes in the user-item hypergraph are users and items, and the hyperedges in the user-item hypergraph are interaction information between users and items.
[0041] Preferably, the nodes in the user-user hypergraph are users, the hyperedges in the user-user hypergraph are behaviors of sharing items between users, and the weights of the hyperedges are the intimacy between users.
[0042] The present invention provides a complementary product recommendation device, comprising:
[0043] A construction module is used to construct a user-item hypergraph based on the interaction data between users and items, and to construct a user-user hypergraph based on the social relationships between users;
[0044] The acquisition module is used to input the node feature matrix and hypergraph structure in the user-item hypergraph and the user-user hypergraph into the hypergraph attention network to obtain an updated node feature representation; the updated node feature representation can represent the relationship between the user and the item;
[0045] A partitioning module, used to partition multiple users into different communities with similar shopping preferences based on the updated node feature representation;
[0046] A confirmation module is used to calculate the shopping preference similarity score between the target user and other users in the community in any community according to the item sets liked and the item sets disliked by each user in the community, and to select the first preset number of other users with the highest shopping preference similarity scores as the neighboring users of the target user; the target user is any user in the community;
[0047] The prediction module is used to obtain the target user's score prediction value for each item based on the scores of the neighboring users and the target user for each item, and the shopping preference similarity score between the target user and the neighboring users.
[0048] The recommendation module is used to select the second preset number of items with the highest predicted score values as target items, and based on the demand cross elasticity theory, perform complementarity analysis on the target items from all historically purchased items of the target user and neighboring users to obtain complementary products of the target items, and recommend the complementary products of the target items to all users in the community where the target user is located.
[0049] The present invention provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned complementary product recommendation method is implemented.
[0050] The present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the above-mentioned complementary product recommendation method is implemented.
[0051] At least one of the above technical solutions adopted by the present invention can achieve the following beneficial effects:
[0052] The user-item hypergraph and user-user hypergraph can capture the multi-hop and complex relationships between users and items, and between users. The node feature matrix and hypergraph structure in the user-item hypergraph and user-user hypergraph are input into the hypergraph attention network to obtain the updated node feature representation. The hypergraph attention network can assign attention weights according to the different importance of nodes, and thus better model the complex relationships between users and items and between users. Compared with the traditional method, the updated node feature representation can dynamically capture the complex relationship between users and items. According to the updated node feature representation, multiple users are divided into groups with similar Different communities with similar shopping preferences; in any community, the shopping preference similarity scores between the target user and other users in the community are calculated, and the similarity scores are used to sort in descending order, and the first preset number of other users ranked at the top are regarded as the neighboring users of the target user, and the neighboring users have similar shopping preferences; according to the shopping preference similarity scores and the neighboring users of the target user, the target user's score prediction values for different items are obtained, and the score prediction values are sorted in descending order, and the complementary analysis is performed on the second preset number of items ranked at the top to obtain complementary products, and the complementary products are recommended to all users in the community where the target user is located. This method can improve the accuracy of complementary product recommendations. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0054] Figure 1 A schematic diagram of a complementary product recommendation method provided by the present invention;
[0055] Figure 2 The user-item hypergraph provided by the present invention;
[0056] Figure 3 A user-user hypergraph provided by the present invention;
[0057] Figure 4 The hypergraph attention network architecture diagram provided by the present invention;
[0058] Figure 5 A schematic diagram of a social circle provided by the present invention;
[0059] Figure 6 A community network structure diagram provided by the present invention;
[0060] Figure 7 A social network diagram provided by the present invention;
[0061] Figure 8 The architecture diagram of the complementary product recommendation model based on demand cross elasticity and hypergraph provided by the present invention;
[0062] Fig. 9 The MAE comparison results of different clustering algorithms provided by the present invention;
[0063] Fig.10 The RMSE comparison results of different clustering algorithms provided by the present invention are as follows;
[0064] Fig.11 The MAE comparison results of different algorithms provided by the present invention;
[0065] Fig.12 The RMSE comparison results of different algorithms provided by the present invention are as follows;
[0066] Fig.13 The curve of the NDCG@10 model provided by the present invention changing with the number of network layers;
[0067] Fig.14 The curve of the model recall rate provided by the present invention changing with the number of network layers;
[0068] Fig.15 The curve of the NDCG@10 model provided by the present invention changing with the discard rate;
[0069] Fig.16 The curve of the model recall rate and the discard rate provided by the present invention;
[0070] Fig.17 A schematic diagram of a complementary product recommendation device provided by the present invention;
[0071] Fig.18 A schematic diagram of a computer device for implementing a complementary product recommendation method provided by the present invention. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0073] Devices such as desktop computers, servers, and notebook computers that implement the solution of the present invention. For the sake of convenience, the following description will only take the server as the execution subject.
[0074] The technical solutions provided by various embodiments of the present invention are described in detail below in conjunction with the accompanying drawings.
[0075] Figure 1 The following is a flow chart of a method for recommending a complementary product in the present invention, which specifically includes the following steps:
[0076] S101: construct a user-item hypergraph based on the interaction data between users and items, and construct a user-user hypergraph based on the social relationships between users.
[0077] In an exemplary embodiment, the nodes in the user-item hypergraph are users and items, and the hyperedges in the user-item hypergraph are interaction information between users and items.
[0078] Specifically, when designing a network-based recommendation algorithm, network design is a key step because the corresponding choice will affect the performance of the recommendation algorithm. Traditional networks can only represent paired point-to-point relationships, but hypergraphs can describe higher-order relationships involving three or more nodes. If the nodes connected by hyperedges are of the same type, the hypergraph is called "homogeneous", and if the nodes connected by hyperedges are of the same type, the hypergraph is called "heterogeneous". In the present invention, a heterogeneous hypergraph is established, in which hyperedges are related to users and items.
[0079] Set user set U = {U 1 ,U 2 ,...,U M}, item set I = {I 1 ,I 2 ,...,I N}, M represents the number of users, and N represents the number of items. Hyperedges are constructed based on the interaction information between users and items. In the user-item hypergraph, the set of users who have interacted with the same item constitutes a hyperedge. In this setting, the hyperedge connecting the project and the item corresponds to A user-item hyperedge G is defined as a tuple H g =(V,E,w), such as Figure 2 As shown in (a), E = {e 1 ,e 2 ,...,e M} is a set of hyperedges connecting nodes in V, and w = {w 1 ,w 2 ,...,w M} is the weight of the associated hyperedge, and the hyperedge weight can be assigned according to the user’s preference for the item. i The number of nodes on the edge is called the degree of the hyperedge. Calculate, such as Figure 2As shown in (b), H is the association matrix between nodes and hyperedges, h(V j ,e i ) is a member of the association matrix H between nodes and hyperedges. Therefore, if node V j It is super edge i , then h(V j ,e i )=1, if node V j Not super edge i , then h(V j ,e i )=0. A hyperedge is called “regular” if it has the same degree. The hypergraph defined in this paper consists of a user and the items that the user has rated in the past.
[0080] Define the weight of the i-th hyperedge as w i , the weight of the hyperedge is calculated as shown in formula (1):
[0081]
[0082] Among them, w i is the weight of the hyperedge, max(d(e)) is the maximum degree of all hyperedges, and min(d(e)) is the minimum degree of all hyperedges. i ) is the degree of the hyperedge.
[0083] By constructing the interaction information of users, items, and user-items into a hypergraph, we can better utilize this information for recommendation. The hypergraph can directly use all the interaction information for recommendation, alleviating the data sparsity and cold start problems. The feature representations of all nodes and hyperedges are combined into an input representation of the hypergraph, which can be fed into the hypergraph attention network for user-item recommendation tasks.
[0084] In an exemplary embodiment, the nodes in the user-user hypergraph are users, the hyperedges in the user-user hypergraph are behaviors of sharing items between users, and the weights of the hyperedges are the intimacy between users.
[0085] Specifically, social relations play a pivotal role in recommendation systems, and they can effectively improve the accuracy and personalization of recommendation results. By integrating the hypergraph attention mechanism and social relations, the recommendation model can more deeply explore the social connections between users and make full use of this information in the recommendation process. The social relationship hypergraph is the basis for building a recommendation system. In item recommendation, users can be regarded as nodes of the user-user hypergraph, and the behavior of sharing items between users can be regarded as the edges of the user-user hypergraph. The weight of the edge represents the intimacy between users, such as the number of common friends, the frequency of interaction, etc. These nodes and edges form a user-user hypergraph.
[0086] like Figure 3 As shown in (a), user u 1 、User u 2 and user u 3 There is a sharing or group buying relationship, so a hyperedge with three nodes is constructed. Similarly, all hyperedges and nodes form a user-user hypergraph G uu .like Figure 3 As shown in (b), H is the association matrix between nodes and hyperedges.
[0087] S102: Input the node feature matrix and hypergraph structure in the user-item hypergraph and the user-user hypergraph into the hypergraph attention network to obtain an updated node feature representation; the updated node feature representation can represent the relationship between the user and the item.
[0088] Hypergraphs can capture multi-hop, complex relationship patterns between users and items, and between users, and hypergraph attention networks can assign attention weights according to the different importance of nodes, thereby better modeling these high-order relationships. The calculation process of the Hypergraph Convolutional Network (HCN) can be divided into two processes: node-hyperedge and hyperedge-node. The hypergraph convolutional network is shown in formula (2):
[0089]
[0090] Among them, X (l+1) is the feature matrix of the node at layer l+1, X l is the feature matrix of the node at layer l, D v is the degree matrix of the vertices in the hypergraph, D e is the degree matrix of the hyperedge in the hypergraph, P,W∈R d×d is the weight matrix, d is the feature dimension, and H is the association matrix of the hypergraph.
[0091] Specifically, X l When l = 0, the feature of the node is equal to the original feature of the node, which corresponds to the initial embedding vector of the item or user in the present invention, D v is the degree matrix of the vertices in the hypergraph, that is, how many hyperedges each node in the hypergraph exists in, D e is the degree matrix of the hyperedge in the hypergraph, that is, how many nodes exist on each hyperedge. In HCN, D v and D e The matrix is normalized. P,W∈R d×d is the weight matrix, d is the feature dimension, and H is the association matrix of the hypergraph, which represents the relationship between nodes and hyperedges.
[0092] It can be seen that the convolution process of HCN is related to the association matrix H, and it cannot dynamically capture the complex relationship between nodes and hyperedges, especially in the recommendation scenario, where there are complex relationships between users and items and between users. Inspired by the graph attention network, the present invention designs a hypergraph attention network to dynamically capture the complex high-order relationship between users and items. The goal of the hypergraph attention is to learn a dynamic association matrix, thereby obtaining a dynamic transformation matrix to better reveal the intrinsic relationship between nodes.
[0093] In an exemplary embodiment, the node feature matrix includes a user feature vector and an item feature vector, the hypergraph structure includes a hypergraph association matrix and a node-hyperedge association matrix, and the hypergraph attention network is shown in formula (3):
[0094] X (l+1) =HAN(X (l) ,G,X e ) (3);
[0095] Among them, C (l) is the input node feature matrix, G is the association matrix of the hypergraph, X e is the node-hyperedge association matrix, X (l+1) is the output of the hypergraph attention network.
[0096] The node-hyperedge association matrix is used as the input of the hypergraph attention network to dynamically obtain the high-order relationship between nodes. The node-hyperedge association matrix is as shown in formula (4):
[0097]
[0098] Among them, H ij is the node-hyperedge association matrix, σ is the activation function, N i Represents x i neighborhood, sim is the similarity measure between node i and node j, x i is the feature vector of node i, x j is the feature vector of node j, x k Except for the eigenvector x i and x j The feature vectors of other nodes except node i and node j, P is the projection matrix or transformation function, and k is the node other than node i and node j.
[0099] Specifically, the neighborhood is the node with the same hyperedge, and P is used to convert the original node feature vector x i Transform or project to a new feature space. The purpose of this transformation is to better capture the relationship between nodes or to reduce the feature dimension to make the calculation more efficient. k is a node other than node i and node j.
[0100] Specifically, the architecture of the hypergraph attention network is as follows: Figure 4 As shown, Figure 4 The dotted ellipse on the left side of the figure represents the node set of the hypergraph. First, the input layer receives data from the hypergraph, marked as "X(l)". Then, the data is processed by an attention mechanism, which is responsible for determining which nodes or features are more important. Then, after the convolution operation, a new feature representation is output, recorded as "X(l+1)". Finally, the activation function σ acts on the output to obtain the final output result.
[0101] S103: Divide multiple users into different communities with similar shopping preferences according to the updated node feature representation.
[0102] In an exemplary embodiment, multiple users are divided into different communities with similar shopping preferences based on an updated node feature representation, specifically including: in a modularity optimization operation, each user is regarded as a separate community to construct an initial network; for each user in the community, the user is repeatedly moved out of the current community and added to other neighboring communities in a network cohesion operation, and the modularity change of the initial network after the user is moved is calculated. When the modularity change is maximized and positive, it is determined to transfer the user to the neighboring community to obtain multiple different communities; when calculating the modularity change, the updated node feature representation is referred to; each community in the multiple different communities is regarded as a node to construct a network; the modularity optimization operation and the network cohesion operation are repeated on the network until the modularity is optimal to obtain a final community division result; the users in each community in the final community division result have similar shopping preferences.
[0103] Specifically, each user has different social circles. In different social circles, due to different interests and hobbies, the selection of complementary products for the same item may be different. Therefore, the present invention uses the community detection method to divide users with similar interests into the same community. Product recommendations are made in different communities based on user preferences. Figure 5 As shown, the users have different interests and hobbies. Two of the users like playing video games, while the other two users like fitness, which leads to different social circles of users.
[0104] Community detection is a network clustering method that understands "community" as a collection of nodes with the same characteristics. Community detection technology is useful for social media algorithms, which can discover people with common interests and maintain close contact.
[0105] It is usually believed that a network structure such as Figure 6As shown in Figure 1, such a network structure presents a "large mixed and small concentrated" form, with some points forming small clusters, and the edges can also be divided into long and short forms. Figure 7 As an example, in the social network shown Figure 7 In the graph structure shown, people are divided according to the closeness of their relationships, forming some clusters. The thick lines represent close friends, while the thin lines represent acquaintances.
[0106] Modularity is used to indicate whether a graph is well divided into several communities and to detect the quality of graph segmentation. The community division of a network without connectivity corresponds to different modularity. The larger the modularity, the more reasonable the corresponding community division. The smaller the modularity, the more ambiguous the corresponding network community division. Divide the graph G into several parts to form a set S. The calculation method of Modularity is shown in formula (5):
[0107] ∑ s∈S |e∈s|-E|e∈s|(5);
[0108] Among them, s is a specific community identified in the network, e is the number of edges connecting nodes within community s, which represents the connection strength within the community, E is the expected value of the number of edges in community s in a random network, and S is all identified communities.
[0109] Specifically, s is a specific community identified in the network. This community is a subset of the network in which the nodes are considered to be interconnected. e is the number of edges connecting nodes within community s, which represents the connection strength within the community. E is the expected value of the number of edges in community s in a random network, which reflects how many edges may appear in the community in the absence of an actual community structure. S is all identified communities.
[0110] The number of edges that should be present may be related to expectations about community structure. For example, if it is assumed that nodes within communities are more densely connected, while nodes between communities are more sparsely connected, then the number of edges that should be present may be adjusted based on this assumption.
[0111] For each group in the split, when performing community detection, calculate the difference between the number of group edges and the number of edges that should be there, and sum them up. A nullmodel is needed as a control. For a graph G with n nodes and m edges, a graph with the same degree distribution is randomly generated, and the degree of each node is assumed to be k. i , then the calculation method of the sum of the degree of the graph is as shown in formula (6):
[0112]
[0113] Among them, n is the total number of nodes in the graph G, i is a node, k i is the degree of node i, that is, the number of edges directly connected to node i, m is the total number of edges in graph G, and the expected number of edges between two nodes i and j is
[0114] The calculation method of formula (6) can be used in both weighted and unweighted graphs, and thus the calculation method of the expected number of edges can be obtained. The calculation method of modularity is shown in formula (7):
[0115]
[0116] Among them, Q is the modularity score, which reflects the prominence of the community structure in the network, m is the total number of edges in the network, and A ij is an element of the adjacency matrix, indicating whether nodes i and j are adjacent. i and j are nodes, k i and k j is the degree of node i and node j, that is, the number of other nodes connected to node i and node j, c i and c j is the community label to which nodes i and j belong. If nodes i and j belong to the same community, c i =c j .
[0117] Typically, values greater than 0.3-0.7 are identified as an important community structure, and communities in the graph are found by maximizing Q.
[0118] The present invention adopts the Leuven algorithm for community detection, which is an algorithm for detecting communities in large networks. The Leuven algorithm maximizes the modularity score of each community, where modularity quantifies the quality of nodes assigned to the community, which means evaluating the density of nodes in the community and the degree of connection of nodes in a random network. In the Leuven algorithm, small communities are first found by locally optimizing modules on all nodes, and then each small community is grouped into a node and the previous step is repeated, that is, two stages are iteratively repeated: local movement of nodes and network aggregation.
[0119] In the initial stage, the algorithm assigns a unique community to each node in the network. Subsequently, for each node, the algorithm examines its neighbor nodes and calculates the modularity gain by moving the node out of the current community and joining the community to which the neighbor belongs. If the gain is positive and reaches the maximum, the node is transferred to the neighbor community; if there is no positive gain, the node retains the original community. This process is iterated for all nodes until the network is no longer optimized. When the local peak of modularity is reached, the first stage of the Leuven algorithm ends and enters the second stage. The Leuven algorithm regards the communities identified in the first stage as nodes of the new network and constructs a simplified network. After the second stage is completed, the Leuven algorithm performs the first stage operation on the newly generated simplified network again. This cycle continues until the network structure is stable and modularity is maximized.
[0120] S104: In any community, based on the item sets that each user in the community likes and dislikes, the shopping preference similarity scores between the target user and other users in the community are calculated, and the first preset number of other users with the highest ranking of shopping preference similarity scores are regarded as the neighboring users of the target user; the target user is any user in the community.
[0121] In order to determine the neighboring users of the target user, the present invention arranges the users in the same community in descending order according to the similarity, and selects a first preset number of other users with higher similarity as the neighboring users of the target user. In this process, only the items that the users like or dislike in common are considered, and those items that the users disagree on are excluded. Even if two users have different preferences, a high similarity may sometimes appear. For this reason, according to the characteristics of user preferences, the following user similarity calculation strategy is proposed. The first preset number can be set according to specific engineering practices, such as 10.
[0122] The calculation method of the shopping preference similarity score between the target user and other users in the community is shown in formula (8):
[0123]
[0124] Among them, SIM uv is the similarity score between user u and user v, L u and L v are a set of items liked by user u and user v respectively, N u and N v are a set of items that user u and user v dislike respectively, L uv is the set of items that both user u and user v like, N uv is the set of items that both user u and user v dislike, R ui is the rating score of the u-th user for the i-th item, R vi is the rating score of the vth user for the i-th item, Rvk For the vth user to k The rating score of items, R uk is the rating score of the u-th user for the k-th item, R ui is the rating score of the u-th user for the i-th item.
[0125] S105: According to the ratings of the neighboring users and the target user for each item, and the shopping preference similarity scores between the target user and the neighboring users, a predicted rating value of the target user for each item is obtained.
[0126] In an exemplary embodiment, based on the shopping preference similarity score and the target user's neighboring users, the target user's rating prediction values for different items are obtained, specifically including: using the shopping preference similarity score to sort in descending order, and taking the first preset number of other users who are ranked high as the target user's neighboring user set; based on the shopping preference similarity score and the neighboring user set, the target user's rating prediction values for different items are obtained.
[0127] Specifically, according to the neighboring users obtained in S104, the first preset number of users ranked high are used as the neighboring user set of the target user, and the first preset number can be set according to engineering practice, such as 10. According to the neighboring user set and the shopping preference similarity score obtained in S104, the target user's score prediction value for different items is obtained.
[0128] In order to better reflect the role of clustering and the new similarity measurement method, the calculation method of the target user's score prediction value for different items proposed in the present invention is shown in formula (9):
[0129]
[0130] Among them, P ui is the predicted value of user u’s rating for the i-th item, R’ u is the average rating of item i by user u, R v ' is the average rating of item i by neighboring user v, T u is the set of neighboring users of user u, R vi is the rating of the vth user on the i-th item, SIM uv is the similarity score between user u and user v.
[0131] R' u and R v The average rating is obtained because the user's rating of the item changes with the time of purchase, and the rating will also change accordingly. For example, when buying a mobile phone, the performance is excellent at the beginning, and the rating is high at this time, but as the usage time increases, the performance will change, and the rating will become lower.
[0132] S106: The second preset number of items with the highest predicted score values are selected as target items, and based on the cross elasticity of demand theory, a complementarity analysis is performed on the target items from all historically purchased items of the target user and neighboring users to obtain complementary products of the target items, and the complementary products of the target items are recommended to all users in the community where the target user is located.
[0133] There is at least one target item described in this section, and the following calculations are based on one target item.
[0134] In an exemplary embodiment, based on the demand cross elasticity theory, a complementarity analysis is performed on a target item set from all historically purchased items of the target user and neighboring users to obtain complementary products of the target item set, specifically including: calculating the demand cross elasticity value between the target item and each historically purchased item respectively; and determining the historically purchased items corresponding to the demand cross elasticity value less than zero as complementary products of the target item.
[0135] Specifically, a complementarity analysis is performed on a second preset number of items that are ranked high to obtain complementary products. The second preset number can be set according to engineering practice, for example, set to 5.
[0136] The present invention applies the demand cross elasticity theory to the complementary relationship of products and applies it to the recommendation system. The demand cross elasticity reflects the consumer's sensitivity to the change in the demand for a certain commodity in response to the change in the price of other commodities. The demand cross elasticity coefficient is defined as the percentage of the change in demand divided by the percentage of the change in the price of another commodity. If the demand cross elasticity coefficient is greater than 0, equal to 0 or less than 0, it means that the two commodities are respectively in a substitution, irrelevant or complementary relationship. The definition of the demand cross elasticity coefficient is shown in formula (10):
[0137]
[0138] Among them, E XY represents the cross-price elasticity of demand, Q dX represents the demand for commodity X, ΔQ dX represents the change in the demand for commodity X, P Y represents the price of commodity Y, ΔP Y Indicates the change in the price of commodity Y.
[0139] In actual calculations, the arc elasticity formula is usually used to calculate the demand cross elasticity coefficient. The calculation formula for obtaining the demand cross elasticity value coefficient between an item and a candidate item is shown in formula (11):
[0140]
[0141] Among them, EXY is the cross-price elasticity of demand, Q dX1 Q is the demand for commodity X before the price of commodity Y changes. dX2 is the demand for commodity X after the price of commodity Y changes, P Y1 is the price of commodity Y before the price change, P Y2 is the price corresponding to the price change of commodity Y, ΔQ dX Represents the change in demand for commodity X, ΔP Y Indicates the change in the price of commodity Y.
[0142] According to the analysis of demand cross elasticity coefficient, when E XY >0, the target item and the candidate item are substitutes for each other, E XY The larger the value of is, the stronger the substitutability between the target item and the candidate item is. XY The smaller the value of is, the weaker the substitutability between the target item and the candidate item is. XY <0, the target item and the candidate item are complementary to each other, |E XY The larger the value of |, the stronger the complementarity between the target item and the candidate item. XY The smaller | is, the weaker the complementarity between the target item and the candidate item is. XY =0, there is no cross relationship between the target item and the candidate items.
[0143] According to the theory of cross elasticity of demand, the increase in demand for a commodity is usually accompanied by an increase in demand for its complementary products. Based on this, a complementary analysis of commodities with high predicted scores can provide more comprehensive and value-added shopping recommendations for members of a specific community. For example, assuming that members of a community generally tend to buy a certain brand of coffee beans, recommending related complementary commodities such as coffee machines and coffee cups of this brand to this community will help consumers experience coffee culture more deeply and improve their shopping satisfaction. The present invention promotes the identified complementary commodity sequence to all users in the community where the target user is located, so as to optimize the shopping experience of users in the community where the target user is located.
[0144] In an exemplary embodiment, the present invention proposes a personalized recommendation model of complementary products based on hypergraphs and demand cross-elasticity (Hg-CR) model, which is based on a hypergraph framework. The overall structure of the model is as follows: Figure 8 shown.
[0145] The model proposed in this invention mainly includes four modules:
[0146] (1) Hypergraph construction: First, a user-product hypergraph is constructed based on the interaction data between users and products, where users and products are nodes and users’ purchase behaviors of products are hyperedges connecting nodes. Second, a user-user hypergraph is constructed based on the social relationships between users, where users are nodes and social connections between users are hyperedges.
[0147] (2) Hypergraph Attention Network: Construct a hypergraph attention network to dynamically capture high-order relationships in the user-product hypergraph and user-user hypergraph, and learn the influence weights between nodes.
[0148] (3) Community detection: Community detection algorithms are used to divide users into communities with similar preferences so that more accurate recommendations can be made within the same community.
[0149] (4) Complementary product recommendation: Within each community, product recommendations are made based on the similarity between users. The demand cross elasticity theory is used to analyze the complementary relationship of recommended products, and complementary product sequences are mined, ultimately recommending complementary products to all users in the community.
[0150] In an exemplary embodiment, the Amazon public dataset is used to verify the model proposed in the present invention. Table 1 shows the data statistics. AmazonProductCo-purchasingNetworkMetaData is a dataset consisting of product information data on the Amazon official website, totaling 548,552 items. The dataset contains rich user behavior data and product information, such as user comments (including ratings, texts, usefulness votes, etc.), product metadata (including descriptions, prices, original pictures, etc.), sales rankings, related products, and user-product / co-purchase maps, which provide a sufficient data basis for model training and evaluation.
[0151] Table 1
[0152] Number of products 548552 Product-Item Sides 1788725 Number of comments 7781990 Number of members in the product category 2,509,699 Average clustering coefficient 0.3967 Number of triangles 667129 Closed triangle ratio 0.07925 diameter 44 90% effective diameter 15
[0153] Before conducting research on personalized recommendation of complementary products based on demand cross elasticity and hypergraph, preprocessing the data set is a crucial step. The purpose of data preprocessing is to clean and transform the original data to make it suitable for model training and analysis. The detailed steps of data preprocessing are as follows:
[0154] (1) Data cleaning
[0155] Data cleaning is the first step of preprocessing, which aims to remove errors, duplications, and incomplete records in the data set. The specific steps include:
[0156] 1. Remove duplicates: By checking the data set, identify and delete duplicate records. This step can be expressed as removing duplicate records from the original data set D to obtain a non-duplicate data set D' to avoid bias in model training.
[0157] 2. Handling missing values: For missing data in a dataset, choose an appropriate strategy to fill in the missing data based on the characteristics of the data and the missing situation, such as using the mean, median or mode, or deleting records with missing values.
[0158] 3. Outlier detection: Identify outliers in the data set, which may be caused by input errors or extreme situations and may have an adverse effect on the training and performance of the model. Outlier detection can be achieved through statistical methods such as Z-score or IQR. The calculation of the standard score is shown in Formula 12:
[0159]
[0160] Among them, z is the standard score, x is the observed value, μ is the mean, and σ is the standard deviation.
[0161] Observations whose absolute value of the Z-score is greater than a certain threshold are considered outliers. The Z-score is a statistic that indicates the degree of deviation of a data point from the mean. Usually, Z-scores whose absolute value is greater than a certain threshold are considered outliers. Common thresholds include 2 or 3, which means that if the absolute value of the Z-score of a data point exceeds this threshold, it is considered a potential outlier.
[0162] (2) Feature Engineering
[0163] Feature engineering is a key step to improve model performance, including feature selection, feature extraction, and feature transformation.
[0164] 1. Feature selection: Filter out the feature subset that has the greatest impact on the model prediction target from the original feature set. By removing irrelevant or highly correlated features, the complexity of the model and the risk of overfitting can be effectively reduced.
[0165] 2. Feature extraction: Extract new features from existing data that may better represent the relationship between users and products.
[0166] 3. Feature conversion: Convert the original data into a format more suitable for model training to improve the training efficiency and prediction performance of the model.
[0167] (3) Data segmentation
[0168] Split the dataset into training and test sets to facilitate model training and evaluation. Typically, the dataset is divided into 80% training set and 20% test set.
[0169] In order to verify the performance of the algorithm proposed in the present invention, a variety of indicators are used. First, the mean absolute error (MAE) is considered. The calculation of the mean absolute error is shown in formula (13):
[0170]
[0171] Among them, MAE is the mean absolute error, R ui is the score of user u for the i-th item in the test set, P ui is the prediction score generated by the algorithm, M t is the score to be predicted in the test set.
[0172] Secondly, consider the root mean square error. The calculation formula of the root mean square error is shown in formula (14):
[0173]
[0174] Among them, RMSE is the root mean square error, R ui is the score of user u for the i-th item in the test set, P ui is the prediction score generated by the algorithm, M t is the score to be predicted in the test set.
[0175] Since recommendations need to be provided to target users after prediction, the following four indicators are used to verify the efficiency of the recommendations:
[0176] The calculation method of the correct proportion of complementary product predictions is shown in formula (15):
[0177]
[0178] Among them, P@k is the correct prediction ratio of products, |I| is the set of query products, Pred(v i ) is the product v i The predicted complementary product set, Gt(v i ) is the product v i The set of true complementary products, k represents the number of the first few prediction results considered, i is an element in the set I, where I is the set of query products, and I represents the set size of the query products, that is, how many different query products there are.
[0179] The accuracy of complementary product prediction is calculated as shown in formula (16):
[0180]
[0181] Among them, Recall@K is the accuracy of complementary product prediction, u is the target user, and Recall u@K is the Recall@K value for a specific user u, U te Represents the set of users in the test set.
[0182] F1@K is a comprehensive indicator of Precision@K and Recall@K, which is used to balance the precision and recall rate. It is shown in formula (17):
[0183]
[0184] Among them, F 1 @K is a comprehensive indicator of Precision@K and Recall@K, P@k is the proportion of correct product predictions, and Recall@K is the accuracy of complementary product predictions.
[0185] NDCG@K is the abbreviation of Normalized Discounted Cumulative Gain, which is an indicator to measure the quality of sorting. It not only considers the number of correct items (similar to recall rate), but also considers their ranking order. The higher the ranking, the greater the contribution of the correct items. The calculation method of NDCG@K is shown in formula (18):
[0186]
[0187] Among them, NDCG@K is an indicator to measure the sorting quality, U te represents the user set in the test set, Recall@K represents the recall when recommending K items to user u, K represents the length of the recommendation list, and NDCGl u @K is an indicator for measuring the ranking quality for user u.
[0188] The process of setting the hyperparameters selected in the training and prediction process of the Hg-CR model of the present invention is as follows:
[0189] (1) Dropout Rate: A dropout rate of 0.5 means that each neuron has a 50% probability of being deleted during training.
[0190] (2) The number of HAN layers is 2: The number of layers in the model in this article is 2, which means that the network contains two HAN layers.
[0191] (3) Batch size is 4096: The batch size is 4096, which means that 4096 samples will be used for training in each training iteration.
[0192] (4) Embedding dimension is 128: The embedding dimension refers to the number of dimensions of a node in the vector space. In this paper, the embedding dimension is 128, which means that each node is mapped to a 128-dimensional vector space.
[0193] (5) The number of training rounds is 300: The number of training rounds is 300, which means that the training dataset will be used for training 300 times.
[0194] (6) Initial learning rate: The learning rate is a very important hyperparameter in the neural network training process. It determines the step size of each weight update. The initial learning rate refers to the learning rate at the beginning of training. In this paper, the initial learning rate is 0.001.
[0195] (7) L2 regularization: L2 regularization is a regularization technique that prevents neural networks from overfitting by adding an L2 penalty term to the network's loss function to reduce the size of the weights.
[0196] In order to verify the effectiveness of the algorithm Hg-CR proposed in this paper, its performance is compared with the clustering-based recommendation algorithm and other recommendation algorithms.
[0197] In order to verify the performance of the community detection algorithm, it is compared with DPSO, K-Medoids, and FCM clustering algorithms. A brief introduction to the above benchmark algorithms is as follows:
[0198] (1) DPSO: Discrete Particle Swarm Optimization (DPSO) is a novel approach to identify clustering structures in signed social networks.
[0199] (2) K-Medoids: The K-Medoids clustering method is an improvement on the K-Means clustering algorithm. The difference lies in the selection of the center point. The center point selected by K-Means is the centroid of all points in the current class, that is, it is not a point in the cluster, while the center points selected by K-Medoids are all points in the cluster.
[0200] (3) FCM: FCM is a clustering algorithm that determines the degree to which each data point belongs to a cluster through membership.
[0201] In the experiment, only the clustering part of these algorithms is used, and the rest of the recommendation parts are based on the similarity measurement method proposed in this invention. In other words, in order to verify the effectiveness of clustering, the only difference between HG-CR and the other three algorithms is the clustering module. The number of neighbors selected in the real data set is [10, 30, 50, 70, 90], as shown in Figure 2. Fig. 9The figure shows the average MAE values of the four clustering algorithms. Among the four clustering algorithms, the Leuven algorithm proposed in the present invention has the smallest error. The average MAE values of the four clustering algorithms are 0.7162, 0.7228, 0.7272 and 0.7068 respectively. Fig.10 The figure shows the average RMSE values of the four clustering algorithms. Among the four clustering algorithms, the Leuven algorithm proposed in the present invention has the smallest error.
[0202] In addition, the present invention also compares the running time of different algorithms. The running time of different algorithms is shown in Table 2. All results are executed in the same environment. It can be obtained that the Leuven algorithm proposed in the present invention runs the fastest because the present invention distinguishes the items evaluated by users according to their preferences, so that users with similar interests can gather faster.
[0203] Table 2
[0204] DPSO K-Medoids FCM Louvain Amazon 24.9 19.0 16.2 9.5
[0205] In summary, by comparing the results of different clustering methods in real data sets, it is found that the algorithm proposed in the present invention has very obvious prediction performance. The above results show that DPSO is more sensitive to sparse data sets, while the Louvain algorithm proposed in the present invention always maintains excellent performance and is not sensitive to sparse data.
[0206] In order to further verify the prediction accuracy and recommendation performance of the recommendation proposed by the present invention, the recommended indicators, namely Precision@10, Recall@10, F1@10, and NDCG@10, are compared on real data sets. Compared with other benchmark recommendation algorithms, it is verified that the proposed community detection clustering algorithm based on hyperedge attention relationship and user preference can improve the recommendation performance. The benchmark algorithms are as follows:
[0207] (1) Neural Collaborative Filtering (NCF) based on deep neural network: This method is a recommendation method based on deep models, the core of which combines matrix decomposition (Generalized Method of Moments, GMF) and multilayer perceptron (Multilayer Perceptron, MLP).
[0208] (2) Low-rank Mahalanobis Transform (LMT): The first method to use the Mahalanobis embedding matrix to map product features into a low-dimensional space. The Euclidean distance is calculated based on the visual features of the products to determine the complementary relationship between products.
[0209] (3) Diversity Recommendations of Multi-modal Complementary Items (DR-MCI): A multi-modal complementary item diversity recommendation algorithm based on images, texts and ratings, which combines convolutional neural networks, text vectorization and Bayesian inference methods.
[0210] To verify the recommendation performance, the number of neighbors of a user is [10, 20, 30, 40, 50, 60, 70, 80, 90, 100].
[0211] On the Amazon dataset, when the number of similar neighbors of interest ranges from [10, 100], when the number of neighbors is 40, Hg-CR obtains the minimum MAE = 0.702 and the minimum RMSE = 0.985. Therefore, the most appropriate number of neighbors is 40. As shown in Table 3, mazon Comparison of evaluation indicators of different algorithms in the data set. As shown in Table 3, the performance indicators of the recommendation model Hg-cr proposed in this paper are compared with the NCF, LMT and DR-MCI recommendation algorithms under the same experimental environment and on the same Amazon data set. It is concluded that the Hg-CR algorithm proposed in this invention is superior in recommendation performance.
[0212] Table 3
[0213]
[0214] like Fig.11 and Fig.12 As shown in the figure, on the Amazon dataset, the MAE of NCF, LMT, and DRMC1 gradually decreases with the increase of the number of neighbors, indicating that the prediction accuracy improves with the increase of the number of neighbors. The MAE of HGCR is relatively low and does not change much, which means that the performance of the HGCR model is relatively stable under all the numbers of neighbors. The RMSE of all models first decreases and then stabilizes or slightly increases with the increase of the number of neighbors. The RMSE of LMT and DRMC1 is low and remains relatively stable under most of the numbers of neighbors. The RMSE of HGCR is the lowest, but it fluctuates greatly, especially when the number of neighbors is 20, there is an obvious trough. When the number of similar neighbors of interest ranges from [10, 100], when the number of neighbors is 40, Hg-CR obtains the minimum MAE = 0.702 and the minimum RMSE = 0.985. Therefore, the most suitable number of neighbors is 40. The results of the running time of different algorithms are shown in Table 4, all of which are executed in the same environment.
[0215] Table 4
[0216] NCF LMT DR-MCI Hg-CR Amazon 26.8 24.1 22.7 21.3
[0217] The experimental results show that the Hg-CR model has higher computational efficiency while ensuring accuracy. It can be seen that the Hg-CR model has a significant advantage in running time. The Hg-CR model distinguishes items by user preferences, which can aggregate users with similar interests more quickly, thereby improving the efficiency of community detection.
[0218] In this section, the recommendation performance of the Hg-CR model is analyzed as the hyperparameters change on the dataset. Two important hyperparameters in the network are selected: the number of network layers (layernumber) and the dropout rate (dropoutrate).
[0219] like Fig.13 and Fig.14 As shown in the figure, the performance of the Hg-CR model shows a trend of first increasing and then decreasing with the increase of the number of layers. Specifically, in the process of increasing the number of model layers from 1 to 4, both NDCG@10 and Recall@10 evaluation indicators show an increasing trend. However, after exceeding a certain critical number of layers, the growth rate of these indicators began to slow down and eventually decreased. In the early stage of increasing the number of layers, the representation ability of the model is enhanced, thereby improving the learning effect and driving the improvement of the evaluation indicators. However, too many layers will lead to an increase in model complexity, which may cause overfitting and weaken the generalization ability of the model, making the model perform well on the training set but poorly on the test set. In addition, too many layers may also bring problems such as gradient vanishing or gradient exploding, increasing the difficulty of training. Therefore, when setting the number of model layers, it is necessary to carefully weigh the enhancement of representation ability and the maintenance of generalization ability to find the best balance between the two.
[0220] like Fig.15 and Fig.16 As shown in the figure, in the Hg-CR model, as the discard rate increases, the two indicators NDCG@10 and Recall@10 show a trend of first increasing and then decreasing. The reason for this change is that when the discard rate is low, the model may tend to overfit the training data due to its higher complexity, which is not conducive to the performance of the model on unseen data. As the discard rate gradually increases, the complexity of the model decreases, which helps to improve the generalization ability of the model for unknown data. Therefore, increasing the discard rate within a certain range can enhance the generalization performance of the model. However, when the discard rate is too high, the activity of neurons decreases, which may cause the model to underfit.
[0221] In order to verify the effectiveness of each module in the model, this paper evaluates the impact of each module on the overall performance by conducting ablation experiments. Specifically, two sub-models are constructed by removing the hypergraph attention module (Hg-CR-A) and the community detection module (Hg-CR-B), and the performance changes are recorded to explore the role of each module. Table 5 is the comparison result of the ablation experiment. From Table 4, it can be seen that the two sub-models have different degrees of performance degradation on the dataset. Therefore, the hypergraph attention module and the community detection module have played a positive role in promoting the overall recommendation performance.
[0222] Table 5
[0223] Variants Precision@10 F1@10 Hg-CR-A 0.3848 0.1759 Hg-CR-B 0.3978 0.1959 Hg-CR 0.4558 0.2459
[0224] The Hg-CR-A sub-model removes the hypergraph attention module, which causes each node to lose the ability to integrate the information of its neighboring nodes. The average performance dropped by 7.1% on the P@10 index of the dataset. This result confirms the importance of information transfer for project feature extraction in the recommendation system. The attention mechanism can effectively capture and integrate multi-dimensional interests to generate more personalized recommendations. The Hg-CR-B sub-model loses 5.8% of its average performance on the P@10 index due to the lack of user preference clustering. This shows that by dividing users into different communities and making targeted predictions and recommendations, the recommendation system can better distinguish projects and thus improve overall performance.
[0225] The conclusion drawn by the present invention is as follows:
[0226] (1) By comparing different clustering analysis algorithms, it is not difficult to find that among the four clustering algorithms, the algorithm proposed in this paper has the smallest error.
[0227] (2) Comparing the running time of different algorithms, the algorithm proposed in this paper runs the fastest. This is because we differentiate the items evaluated by users according to their preferences, so that users with similar interests can be aggregated more quickly.
[0228] (3) Comparing different recommendation algorithms, the algorithm proposed in this paper outperforms NCF, LMT and DR-MCI in terms of Precision@10, Recall@10, F1@10 and NDCG@10. The results of NCF and LMT are comparable, and the recommendation performance of the algorithm proposed in this paper is significantly better than both.
[0229] (4) In the ablation experiment, the absence of the hypergraph attention module and the community detection module led to a decline in model performance, which also verified the effectiveness of the model in this paper.
[0230] Although the Hg-CR model has achieved remarkable results, it still has some limitations. For example, the model is mainly used in the field of product recommendation, and it can be expanded to other fields in the future. At the same time, the model may not be effective in recommending new users and new items, and further exploration is needed to solve the cold start problem. Future research can focus on data set expansion, application expansion, algorithm fusion, and cold start problem solving to improve the generalization ability, application scope, and recommendation effect of the model.
[0231] When applying a complementary product recommendation method provided by the present invention, it is not necessary to Figure 1 The steps are executed in the order shown. The specific execution order of the steps can be determined according to needs, and the present invention does not limit this.
[0232] The above is a complementary product recommendation method provided by one or more embodiments of the present invention. Based on the same idea, the present invention also provides a corresponding complementary product recommendation device, such as Fig.17 shown.
[0233] Fig.17 A schematic diagram of a complementary product recommendation device provided by the present invention includes:
[0234] A construction module 1701 is used to construct a user-item hypergraph based on the interaction data between users and items, and to construct a user-user hypergraph based on the social relationships between users;
[0235] The acquisition module 1702 is used to input the node feature matrix and the hypergraph structure in the user-item hypergraph and the user-user hypergraph into the hypergraph attention network to obtain an updated node feature representation; the updated node feature representation can represent the relationship between the user and the item;
[0236] A division module 1703, for dividing a plurality of users into different communities having similar shopping preferences according to the updated node feature representation;
[0237] The confirmation module 1704 is used to calculate the shopping preference similarity score between the target user and other users in the community in any community according to the item sets liked and the item sets disliked by each user in the community, and to select the first preset number of other users with the highest shopping preference similarity scores as the neighboring users of the target user; the target user is any user in the community;
[0238] The prediction module 1705 is used to obtain the predicted score value of each item by the target user according to the scores of each item by the neighboring users and the target user, and the shopping preference similarity score between the target user and the neighboring users.
[0239] The recommendation module 1706 is used to select the second preset number of items with the highest predicted score values as target items, and based on the demand cross elasticity theory, perform a complementarity analysis on the target items from all historically purchased items of the target user and neighboring users to obtain complementary products of the target items, and recommend the complementary products of the target items to all users in the community where the target user is located.
[0240] For the specific definition of a complementary product recommendation device, please refer to the definition of a complementary product recommendation method above, which will not be repeated here. Each module in the above-mentioned complementary product recommendation device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0241] The present invention also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 A complementary product recommendation method provided.
[0242] The present invention also provides Fig.18 The structural diagram of the computer device shown in FIG. Fig.18 As shown in the figure, at the hardware level, the computer device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 A complementary product recommendation method provided.
[0243] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0244] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of the present invention.
Claims
1. A method for recommending complementary products, characterized in that: include: Build a user-item hypergraph based on the interaction data between users and items, and build a user-user hypergraph based on the social relationships between users; Input the node feature matrix and the hypergraph structure in the user-item hypergraph and the user-user hypergraph into the hypergraph attention network to obtain an updated node feature representation; The updated node feature representation can represent the relationship between the user and the item; According to the updated node feature representation, multiple users are divided into different communities with similar shopping preferences; In any community, based on the item sets liked and the item sets disliked by each user in the community, the shopping preference similarity scores between the target user and other users in the community are calculated, and the first preset number of other users with the highest ranking shopping preference similarity scores are regarded as the neighboring users of the target user; The target user is any user in the community; Obtaining a predicted score value of each item by the target user according to the scores of each item by the neighboring users and the target user, and the shopping preference similarity score between the target user and the neighboring users; A second preset number of items with the highest predicted score values are taken as target items, and based on the cross elasticity of demand theory, a complementarity analysis is performed on the target items from all historically purchased items of the target user and the neighboring users to obtain complementary products of the target items, and the complementary products of the target items are recommended to all users in the community where the target user is located.
2. The method according to claim 1, characterized in that The node feature matrix includes a user feature vector and an item feature vector, the hypergraph structure includes a hypergraph association matrix and a node-hyperedge association matrix, and the hypergraph attention network is: X (l+1) =HAN(X (l) ,G,X e ); Among them, X (l) is the input node feature matrix, G is the association matrix of the hypergraph, X e is the node-hyperedge association matrix, X (l+1) is the output of the hypergraph attention network; The node-hyperedge association matrix is used as the input of the hypergraph attention network to dynamically obtain the high-order relationship between the nodes. The node-hyperedge association matrix is: Among them, H ij is the node-hyperedge association matrix, σ is the activation function, N i Represents x i neighborhood, sim is the similarity measure between node i and node j, x i is the feature vector of node i, x j is the feature vector of node j, x k For all except x i and x j The feature vectors of other nodes except node i and node j, P is the projection matrix or transformation function, and k is the node other than node i and node j.
3. The method according to claim 1, characterized in that The step of dividing the multiple users into different communities with similar shopping preferences according to the updated node feature representation specifically includes: In the modularity optimization operation, each user is considered as a separate community to build the initial network; For each user in the community, repeatedly move the user out of the current community and add the user to other neighbor communities in the network cohesion operation, calculate the modularity change of the initial network after moving the user, and when the modularity change is maximized and positive, determine to transfer the user to the neighbor community to obtain multiple different communities; refer to the updated node feature representation when calculating the modularity change; Considering each of the multiple different communities as a node, and constructing a network; The modularity optimization operation and the network cohesion operation are repeated on the network until the modularity reaches an optimum, thereby obtaining a final community division result; users in each community in the final community division result have similar shopping preferences.
4. The method according to claim 1, characterized in that The shopping preference similarity score between the target user and other users in the community is calculated as follows: Among them, SIM uv is the similarity score between user u and user v, L u and L v N is a set of items liked by user u and user v respectively. u and N v are a set of items that user u and user v dislike respectively, L uv is the set of items that both user u and user v like, N uv is the set of items that both user u and user v dislike, R ui is the rating score of the u-th user for the i-th item, R vi is the rating score of the vth user for the i-th item, R vk For the vth user to k The rating score of items, R uk is the rating score of the u-th user for the k-th item, R ui is the rating score of the u-th user for the i-th item.
5. The method according to claim 1, characterized in that The target user's predicted ratings for different items are calculated as follows: Among them, P ui is the predicted score of user u for the i-th item, R′ u is the average rating of item i given by user u, R v ′ is the average rating of item i by neighboring user v, T u is the set of neighboring users of user u, SIM uv is the similarity score between user u and user v, R vi is the rating of the vth user on the i-th item.
6. The method according to claim 1, characterized in that According to the demand cross elasticity theory, the target item set is subjected to a complementarity analysis from all historically purchased items of the target user and the neighboring users to obtain complementary products of the target item set, specifically including: Calculating the demand cross elasticity value between the target item and each historically purchased item respectively; The historically purchased items corresponding to when the demand cross elasticity value is less than zero are determined as complementary products of the target item.
7. The method according to claim 6, characterized in that The calculation formula for the cross elasticity of demand between the target item and each historically purchased item is: Among them, E XY is the cross elasticity of demand, Q dX1 Q is the demand for commodity X before the price of commodity Y changes. dX2 is the demand for commodity X after the price of commodity Y changes, P Y1 is the price of commodity Y before the price change, P Y2 is the price corresponding to the price change of commodity Y, ΔQ dX Represents the change in demand for commodity X, ΔP Y Indicates the change in the price of commodity Y, where commodity X refers to the target item and commodity Y refers to the historically purchased item.
8. The method according to claim 1, characterized in that The nodes in the user-item hypergraph are users and items, and the hyperedges in the user-item hypergraph are interaction information between the users and the items.
9. The method according to claim 1, characterized in that The nodes in the user-user hypergraph are users, the hyperedges in the user-user hypergraph are behaviors of sharing items between the users, and the weights of the hyperedges are the intimacy between the users.
10. A device for recommending complementary products, characterized in that: include: A construction module is used to construct a user-item hypergraph based on the interaction data between users and items, and to construct a user-user hypergraph based on the social relationships between users; An acquisition module, used to input the node feature matrix and the hypergraph structure in the user-item hypergraph and the user-user hypergraph into the hypergraph attention network to obtain an updated node feature representation; The updated node feature representation can represent the relationship between the user and the item; A partitioning module, configured to partition a plurality of users into different communities having similar shopping preferences according to the updated node feature representation; A confirmation module, configured to calculate, in any community, a shopping preference similarity score between a target user and other users in the community according to a set of items liked and a set of items disliked by each user in the community, and to select a first preset number of other users with higher rankings in shopping preference similarity scores as neighboring users of the target user; The target user is any user in the community; The prediction module is used to obtain the predicted score value of each item by the target user according to the scores of each item by the neighboring users and the target user, and the shopping preference similarity score between the target user and the neighboring users. The recommendation module is used to select a second preset number of items with the highest predicted score values as target items, and based on the demand cross elasticity theory, perform a complementarity analysis on the target items from all historically purchased items of the target user and the neighboring users to obtain complementary products of the target items, and recommend the complementary products of the target items to all users in the community where the target user is located.
Citation Information
Cited By
Contrast loss recommendation method and device for optimizing embedded weight based on attention mechanism
CN120580032A