A social recommendation method, device, system and storage medium
By screening target similarities and neighbor node sets in social networks and building a training model, the problem of insufficient utilization of high-order relationships in traditional social recommendations is solved, and more accurate user preference prediction and content recommendation are achieved.
Patent Information
- Application Number
- CN202310524272.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-10
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2043-05-10
AI Technical Summary
Traditional social recommendation methods fail to fully utilize high-order social relationships, resulting in inaccurate recommendation results. In addition, the number of user neighbors in social networks is limited and the quality of relationships varies greatly, which affects user preference prediction.
By screening target similarity and neighbor node sets from social networks, a training model is constructed, and the recommendation model is trained using user-item ratings to recommend content and friends that meet user needs.
The accuracy of social recommendations is improved, potential interests and needs are explored, and the recommendation results are more in line with user needs.
Smart Images

Figure CN116701778B_ABST
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the field of data recommendation technology, and specifically to a social recommendation method, device, system and storage medium. Background Art
[0002] Social recommendation leverages social network data and user behavior data to recommend interesting content and friends. It is widely used in fields such as social media and e-commerce. Higher-order social relationships refer to indirect connections between users, such as shared friends or interests. Compared to direct relationships, these relationships are more complex and implicit, but also more representative and trustworthy.
[0003] In the real world, users' choices and preferences are influenced not only by direct relationships but also by higher-order relationships, a phenomenon known as the spread of social influence. For example, a book a user likes may influence the decisions of others through word-of-mouth communication. With the prevalence of social networks, this influence is further amplified by word-of-mouth.
[0004] However, traditional social recommendation methods primarily rely on direct social relationships between users (such as friends, fans, and followings), and fail to fully utilize information from higher-order social relationships. Furthermore, real-world social network data exhibits a long-tail distribution, meaning most users have a limited number of first-order neighbors. The quality of social relationships within social networks varies, meaning not all relationships are suitable for recommendation tasks. Unreliable neighbors can negatively impact user preferences. Social relationship data suffers from data sparsity. Most recommendation methods assume that higher-order relationships are equally important to different users, rarely considering the fact that they can vary in importance. These factors can lead to inaccurate social recommendation results. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a social recommendation method, device, system and storage medium in response to the shortcomings of the existing technology.
[0006] The present invention solves the above technical problems with the following technical solution: A social recommendation method comprising the following steps:
[0007] Obtaining user data from a social network, the user data including a plurality of original user nodes, a plurality of original item nodes, a set of original neighbor nodes corresponding to each of the original user nodes, and a plurality of user-item ratings corresponding to each of the original user nodes;
[0008] Filtering target similarities of multiple original user nodes and target neighbor node sets of multiple original user nodes from all the original neighbor node sets according to all the user-item scores;
[0009] Constructing a training model, and training the training model based on all the original user nodes, all the original project nodes, the target similarities of all the original user nodes, the target neighbor node sets of all the original user nodes, and all the user-project scores to obtain a recommendation model;
[0010] Importing a plurality of user nodes to be recommended and a plurality of item nodes to be recommended, recommending the plurality of user nodes to be recommended and the plurality of item nodes to be recommended by the recommendation model, and obtaining a social recommendation result.
[0011] Another technical solution of the present invention to solve the above technical problem is as follows: a social recommendation device, comprising:
[0012] a data acquisition module, configured to obtain user data from a social network, the user data including a plurality of original user nodes, a plurality of original item nodes, a set of original neighbor nodes corresponding to each of the original user nodes, and a plurality of user-item ratings corresponding to each of the original user nodes;
[0013] A screening module, configured to screen target similarities of a plurality of original user nodes and target neighbor node sets of a plurality of original user nodes from all the original neighbor node sets according to all the user-item scores;
[0014] A training module is used to construct a training model, and train the training model based on all the original user nodes, all the original project nodes, the target similarities of all the original user nodes, the target neighbor node sets of all the original user nodes, and all the user-project scores to obtain a recommendation model;
[0015] The recommendation result obtaining module is used to import multiple user nodes to be recommended and multiple item nodes to be recommended, and recommend the multiple user nodes to be recommended and the multiple item nodes to be recommended through the recommendation model to obtain social recommendation results.
[0016] Based on the above social recommendation method, the present invention also provides a social recommendation system.
[0017] Another technical solution of the present invention to solve the above technical problem is as follows: A social recommendation system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the social recommendation method described above is implemented.
[0018] Based on the above social recommendation method, the present invention also provides a computer-readable storage medium.
[0019] Another technical solution of the present invention to solve the above technical problem is as follows: a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the social recommendation method as described above is implemented.
[0020] The beneficial effects of the present invention are as follows: target similarity and target neighbor node set are screened out from the original neighbor node set through user-item ratings, a recommendation model is obtained by training the training model based on the original user node, original item node, target similarity, target neighbor node set and user-item ratings, and social recommendation results are obtained by recommending the user node to be recommended and the item node to be recommended through the recommendation model, thereby mining potential interests and needs, thereby recommending content and friends that better meet user needs, improving the effect of social recommendation, and making the recommendation results more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A flowchart of a social recommendation method provided by an embodiment of the present invention;
[0022] Figure 2 This is a module block diagram of a social recommendation device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The principles and features of the present invention are described below with reference to the accompanying drawings. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.
[0024] Figure 1 A flowchart of a social recommendation method provided by an embodiment of the present invention.
[0025] like Figure 1 As shown, a social recommendation method includes the following steps:
[0026] Obtaining user data from a social network, the user data including a plurality of original user nodes, a plurality of original item nodes, a set of original neighbor nodes corresponding to each of the original user nodes, and a plurality of user-item ratings corresponding to each of the original user nodes;
[0027] Filtering target similarities of multiple original user nodes and target neighbor node sets of multiple original user nodes from all the original neighbor node sets according to all the user-item scores;
[0028] Constructing a training model, and training the training model based on all the original user nodes, all the original project nodes, the target similarities of all the original user nodes, the target neighbor node sets of all the original user nodes, and all the user-project scores to obtain a recommendation model;
[0029] Importing a plurality of user nodes to be recommended and a plurality of item nodes to be recommended, recommending the plurality of user nodes to be recommended and the plurality of item nodes to be recommended by the recommendation model, and obtaining a social recommendation result.
[0030] It should be understood that after obtaining the training model (ie, the recommendation model), the user's next item interaction behavior is predicted based on the training model (ie, the recommendation model), and items are recommended to the user.
[0031] In the above embodiment, the target similarity and the target neighbor node set are filtered out from the original neighbor node set through the user-item score, and the recommendation model is obtained by training the training model based on the original user node, the original item node, the target similarity, the target neighbor node set and the user-item score. The social recommendation result is obtained by recommending the user node to be recommended and the item node to be recommended through the recommendation model, and the potential interests and needs are excavated, so as to recommend content and friends that better meet the user needs, thereby improving the effect of social recommendation and making the recommendation results more accurate.
[0032] Optionally, as an embodiment of the present invention, the process of screening target similarities of multiple original user nodes and target neighbor node sets of multiple original user nodes from all the original neighbor node sets according to all the user-item scores includes:
[0033] Counting the total number of each of the original neighbor node sets respectively to obtain the total number of original neighbor nodes corresponding to each of the original user nodes;
[0034] Determine whether the total number of original neighbor nodes is greater than or equal to the preset total number of neighbor nodes; if so, use the original neighbor node set corresponding to the total number of original neighbor nodes as the first set of neighbor nodes to be processed for the original user node; if not, use the original neighbor node set corresponding to the total number of original neighbor nodes as the second set of neighbor nodes to be processed for the original user node;
[0035] respectively taking the first to-be-processed neighbor node set of each of the original user nodes and the first to-be-processed neighbor node set of any remaining original user node or the second to-be-processed neighbor node set of the original user node as a group to obtain a plurality of first to-be-processed neighbor node groups;
[0036] respectively taking the second to-be-processed neighbor node set of each of the original user nodes and the first to-be-processed neighbor node set of any remaining original user node or the second to-be-processed neighbor node set of the original user node as a group to obtain a plurality of second to-be-processed neighbor node groups;
[0037] Performing similarity calculations on each of the first to-be-processed neighbor node groups, each of the second to-be-processed neighbor node groups, and the user-item score corresponding to each of the original user nodes, respectively, to obtain a first target similarity corresponding to each of the first to-be-processed neighbor node groups and a second target similarity corresponding to each of the second to-be-processed neighbor node groups;
[0038] If the first target similarity is greater than or equal to a preset similarity, all the first to-be-processed neighbor nodes in the first to-be-processed neighbor node group corresponding to the first target similarity are collected to obtain a first target neighbor node set corresponding to the first to-be-processed neighbor node group;
[0039] Sorting all the second target similarities in descending order to obtain a plurality of sorted target similarities;
[0040] All the second to-be-processed neighbor nodes in the second to-be-processed neighbor node group corresponding to the first N sorted target similarities are used as the second target neighbor node set corresponding to the second to-be-processed neighbor node group;
[0041] The target similarity of the original user node includes a first target similarity corresponding to each of the first to-be-processed neighbor node groups and a second target similarity corresponding to each of the second to-be-processed neighbor node groups;
[0042] The target neighbor node set of the original user node includes a first target neighbor node set corresponding to the first to-be-processed neighbor node group and a second target neighbor node set corresponding to the second to-be-processed neighbor node group.
[0043] It should be understood that the filtered social network may have data sparseness. In order to alleviate this problem, similar users need to be added to the social network as neighbors.
[0044] It should be understood that N represents the total number of presets, which can be 1, 2, 3...
[0045] It should be understood that the remaining first set of neighbor nodes to be processed of any of the original user nodes or the second set of neighbor nodes to be processed of the original user node refers to the first set of neighbor nodes to be processed of any original user node other than the first set of neighbor nodes to be processed of the current original user node or the second set of neighbor nodes to be processed of the current original user node.
[0046] In the above embodiment, the target similarities of multiple original user nodes and the target neighbor node sets of multiple original user nodes are screened out from the original neighbor node set based on the user-item ratings, which can alleviate the data sparsity phenomenon, improve the effect of social recommendation, and make the recommendation results more accurate.
[0047] Optionally, as an embodiment of the present invention, the process of respectively calculating similarities for each of the first to-be-processed neighbor node groups, each of the second to-be-processed neighbor node groups, and the user-item ratings corresponding to each of the original user nodes, and obtaining a first target similarity corresponding to each of the first to-be-processed neighbor node groups and a second target similarity corresponding to each of the second to-be-processed neighbor node groups includes:
[0048] The similarities of each of the first to-be-processed neighbor node groups and each of the second to-be-processed neighbor node groups are calculated respectively by the first formula, and the first structural similarities corresponding to each of the first to-be-processed neighbor node groups and the second structural similarities corresponding to each of the second to-be-processed neighbor node groups are obtained accordingly. The first formula is:
[0049]
[0050] Among them, Structure_Sim(u i ,u j ) is the first structural similarity or the second structural similarity, G ui is the original user node u in the first neighbor node group to be processed i The original user node u in the first set of neighbor nodes to be processed or the second set of neighbor nodes to be processed i The second set of neighbor nodes to be processed, G uj The original user node u in the first neighbor node group to be processed or the second neighbor node group to be processed j The first set of neighbor nodes to be processed or the second set of neighbor nodes to be processed;
[0051] Performing vectorization processing on each of the user-item scores to obtain a user-item score vector corresponding to each of the original user nodes;
[0052] The similarities of the user-item rating vectors corresponding to the original user nodes in each of the first to-be-processed neighbor node groups and the user-item rating vectors corresponding to the original user nodes in each of the second to-be-processed neighbor node groups are calculated respectively by the second formula, and the first preference structure similarities corresponding to each of the first to-be-processed neighbor node groups and the second preference similarities corresponding to each of the second to-be-processed neighbor node groups are obtained accordingly. The second formula is:
[0053]
[0054] Among them, Preference_Sim(u i ,u j ) is the first preference similarity or the second preference similarity, is the original user node u in the first neighbor node group to be processed i The corresponding user-item rating vector or the original user node u in the second neighbor node group to be processed i The corresponding user-item rating vector, The original user node u in the first neighbor node group to be processed or the second neighbor node group to be processed j The corresponding user-item rating vector;
[0055] The weighted sum of each of the first structural similarities, each of the second structural similarities, the preference structural similarities corresponding to each of the first to-be-processed neighbor node groups, and the second preference similarities corresponding to each of the second to-be-processed neighbor node groups is calculated respectively by the third formula, and the first target similarity corresponding to each of the first to-be-processed neighbor node groups and the second target similarity corresponding to each of the second to-be-processed neighbor node groups are obtained accordingly. The third formula is:
[0056]
[0057] Among them, General_Sim(u i ,u j ) is the first target similarity or the second target similarity, Structure_Sim(u i ,u j ) is the first structural similarity or the second structural similarity, Preference_Sim(u i ,u j ) is the first preference similarity or the second preference similarity, w1 and w2 are both weight parameters.
[0058] It should be understood that calculating the users' social structure similarity (i.e., the first structure similarity and the second structure similarity) and personal preference similarity (i.e., the first preference structure similarity and the second preference structure similarity) can effectively filter out dissimilar relationships and mine potential reliable relationships between users.
[0059] It should be understood that the structural similarity (i.e., the first structural similarity and the second structural similarity), preference similarity (i.e., the first preference structural similarity and the second preference structural similarity) and overall similarity (i.e., the first target similarity and the second target similarity) between all users are calculated according to the formula.
[0060] Specifically, the structural similarity (i.e., the first structural similarity and the second structural similarity) is defined as the similarity between two users in social structure calculated using the Jaccard similarity coefficient, and the calculation formula is:
[0061]
[0062] Among them, G ui and G uj is user u i and u j The first-order neighbor set (ie, the first to-be-processed neighbor node set and / or the second to-be-processed neighbor node set).
[0063] It should be understood that preference similarity (i.e., the first preference structure similarity and the second preference structure similarity) is defined as the degree of similarity between two users in historical interaction items calculated using cosine similarity, and the calculation formula is:
[0064]
[0065] in, Represents user u i and u j The given item rating vector (i.e. the user item rating vector), and Represents user u i and u j The modulus of the given item rating vector.
[0066] Specifically, the overall similarity (i.e., the first target similarity and the second target similarity) is defined as the comprehensive similarity of users on the social network and the user-item interaction network. The calculation formula is:
[0067]
[0068] Among them, w1 and w2 represent the weight parameters of structural similarity and preference similarity.
[0069] In the above embodiment, the first target similarity and the second target similarity are calculated for the similarities of the first group of neighbor nodes to be processed, the second group of neighbor nodes to be processed, and the user project ratings, respectively, which effectively filters out dissimilar relationships, mines potential reliable relationships between users, improves the effect of social recommendation, and makes the recommendation results more accurate.
[0070] Optionally, as an embodiment of the present invention, the process of constructing a training model, training the training model based on all the original user nodes, all the original item nodes, the target similarities of all the original user nodes, the target neighbor node sets of all the original user nodes, and all the user-item scores to obtain a recommendation model includes:
[0071] Obtaining the number of iterations, performing vectorization processing on each of the original user nodes, each of the original item nodes, and each of the target neighbor node sets of the original user nodes, respectively, to obtain an original user vector corresponding to each of the original user nodes, an original item vector corresponding to each of the original item nodes, and a target neighbor vector corresponding to each of the original user nodes;
[0072] Performing attention analysis on each of the original user vectors, the target neighbor vector corresponding to each of the original user nodes, and the target similarities of multiple original user nodes according to the number of iterations, to obtain multiple to-be-processed neighbor vectors corresponding to each of the original user nodes and multiple target attention scores corresponding to each of the original user nodes;
[0073] Performing prediction analysis on the plurality of original item vectors according to the plurality of to-be-processed neighbor vectors corresponding to the respective original user nodes and the plurality of target attention scores corresponding to the respective original user nodes, to obtain a plurality of prediction scores corresponding to the respective original user nodes;
[0074] Counting the number of all original project nodes to obtain the total number of original project nodes;
[0075] Performing a loss function analysis on the total number of original project nodes, all the predicted scores, and all the user project scores to obtain a target loss function;
[0076] The parameters of the training model are updated according to the target loss function to obtain a recommendation model.
[0077] It should be understood that user representation learning requires combining user embeddings with embeddings propagated from the user’s high-order neighbors. This way, a user’s preferences can be inferred not only from her direct neighbors but also from her high-order neighbors, which helps address the social sparsity problem.
[0078] In the above embodiment, the recommendation model is obtained by training the training model based on the original user node, the original project node, the target similarity, the target neighbor node set and the user project score, which helps to solve the social sparsity problem, thereby recommending content and friends that better meet the user's needs, improving the effect of social recommendation, and making the recommendation results more accurate.
[0079] Optionally, as an embodiment of the present invention, the process of performing attention analysis on each of the original user vectors, the target neighbor vector corresponding to each of the original user nodes, and the target similarities of multiple original user nodes according to the number of iterations to obtain multiple to-be-processed neighbor vectors corresponding to each of the original user nodes and multiple target attention scores corresponding to each of the original user nodes includes:
[0080] Each of the original user vectors, the target neighbor vector corresponding to each of the original user nodes, and the target similarities of multiple original user nodes are aggregated using the fourth formula and the number of iterations to obtain a neighbor vector to be processed corresponding to each of the original user nodes. The neighbor vector to be processed is used as the original user vector for the next number of iterations until the number of iterations is reached, thereby obtaining multiple neighbor vectors to be processed corresponding to each of the original user nodes. The fourth formula is:
[0081]
[0082] in,
[0083] in, The original user node u for the kth iteration i The corresponding neighbor vector to be processed, is the original user node u i With the original user node u j The target similarity, The original user node u for the kth iteration i With the original user node u j Neighbor aggregation vector of is the original user node u i The corresponding target neighbor vector, is the original user node u j The corresponding target neighbor vector, The original user node u for the kth iteration j The corresponding original user vector, The original user node u for the first iteration j The corresponding original user vector, W k is the kth iteration trainable matrix, is the propagation information attenuation factor;
[0084] The attention scores of the neighbor vectors to be processed corresponding to each of the original user nodes are calculated respectively by the fifth formula and the number of iterations to obtain multiple initial attention scores corresponding to each of the original user nodes. The fifth formula is:
[0085]
[0086] in, The original user node u for the kth iteration i The corresponding raw attention score, The original user node u for the first iteration i The corresponding neighbor vector to be processed, The original user node u for the kth iteration i The corresponding neighbor vector to be processed, Relu is the activation function;
[0087] Each of the initial attention scores is normalized separately to obtain multiple target attention scores corresponding to each of the original user nodes.
[0088] It should be understood that before constructing a user's high-order neighbor embedding, it is necessary to first construct the user's first-order neighbor embedding. The user's first-order neighbor embedding is generated through two steps: embedding propagation and embedding aggregation.
[0089] Specifically, user u j to u i The propagation embedding of is defined as follows:
[0090]
[0091] in and Represents user u i and u j The number of first-order neighbor sets (i.e., the target neighbor vector), W represents a trainable matrix for learning features and converting the embedding vector, Represents the propagation information attenuation factor, which is used to define user u j For user u i The impact of Represents user u i The first-order neighbor u j The user's initial embedding representation (i.e., the original user vector).
[0092] After embedding propagation, the user ux's neighbors and the user itself need to be embedded and aggregated. Because neighbors with different social structures and personal preferences have different influences on users, the overall similarity is used as the weight of the neighbor's influence on the user. The embedding aggregation is defined as follows:
[0093]
[0094] in Indicates that for user u i The output embedding of the first layer of graph convolution (i.e., the neighbor vector to be processed), Represents user u i and neighbor uj The overall similarity of (i.e., the target similarity), Represents user u j to u i The propagation embedding (i.e., the neighbor aggregation vector) of the user can be obtained by using the hyperbolic function tanh as the nonlinear activation function to obtain the user's first-order neighbor embedding (ie, the neighbor vector to be processed), that is, the first-order neighbor influence of the user.
[0095] Specifically, constructing the user’s high-order neighbor embedding requires stacking more graph convolution layers to obtain the influence of the user’s high-order neighbors. Specifically, by stacking k GCN layers, aggregating the k-order neighbor embeddings, and encoding the information into the target user embedding, we can get the user u i The k-order neighbor embeddings are used to construct user representation learning. For example, the embedding of user u1 initially contains only its own features. After each propagation step, user u1 aggregates information from its neighbors. After three rounds of influence propagation, the user representation embedding of user u1 contains both its own features and the features of its third-order neighbors.
[0096] The specific formula for embedding user high-order neighbors is as follows:
[0097]
[0098]
[0099] Where W k is a trainable weight matrix, is the (k-1)th GCN layer user u j The output embedding of (i.e., the original user vector), Represents the propagation information attenuation factor, which is used to define user u j For user u i The impact of Represents user u i and neighbor u j The overall similarity of is the user's k-order neighbor embedding (ie, the neighbor vector to be processed).
[0100] It should be understood that the importance of high-order user relationships is significantly different for a user with a large number of neighbors compared to a user with only a few. Therefore, the number of neighbors considered for each user varies, and the attention mechanism is used to dynamically evaluate the weight of each order of user relationships. Specifically, this is done by calculating the weighted sum of the output embeddings of different layers.
[0101] Specifically, the original user embedding and output embedding of the mth layer are first projected to the hidden layer, and then activated with the ReLU function, the hidden layer is converted into the attention score a' through the vector h ilFinally, these scores are normalized by the softmax function to obtain the contribution of each order neighbor to the user's preference. The attention mechanism formula used is:
[0102]
[0103]
[0104] where a il is a learnable parameter that represents the feature learned on the k-th neighbor for user u i importance. Represents user u i Original feature embedding, Represents user u i High-order neighbor features, A1 and A2 are learnable weighted matrices, which are used to represent the weights of user features and k-order neighbor features respectively. Relu represents the activation function and softmax represents the normalization function.
[0105] In the above embodiment, attention analysis of the original user vector, target neighbor vector, and target similarity is performed according to the number of iterations to obtain the neighbor vector to be processed and the target attention score, which helps to solve the social sparsity problem, thereby recommending content and friends that better meet user needs, improving the effect of social recommendation, and making the recommendation results more accurate.
[0106] Optionally, as an embodiment of the present invention, the process of performing predictive analysis on the multiple original item vectors based on the multiple to-be-processed neighbor vectors corresponding to the respective original user nodes and the multiple target attention scores corresponding to the respective original user nodes to obtain the multiple predicted scores corresponding to the respective original user nodes includes:
[0107] The target user vector corresponding to each original user node is obtained by respectively calculating the multiple to-be-processed neighbor vectors corresponding to each original user node and the multiple target attention score user vectors corresponding to each original user node through the sixth formula. The sixth formula is:
[0108]
[0109] in, is the original user node u i The corresponding target user vector, The original user node u for the kth iteration i The corresponding target attention score, The original user node u for the kth iteration i The corresponding neighbor vector to be processed, l is the number of iterations;
[0110] The predicted scores of each target user vector and each original item vector are calculated respectively by the seventh formula to obtain multiple predicted scores corresponding to each original user node. The seventh formula is:
[0111]
[0112] in, is the original user node u i The corresponding target user vector and the original item node n m The predicted rating of the corresponding original item vector, is the original user node u i The corresponding target user vector, is the original project node n m The corresponding original item vector.
[0113] It should be understood that after aggregating the user's high-order neighbor embeddings, the user's final representation (i.e., the target user vector) is obtained.
[0114] It should be understood that the final user representation (ie, the target user vector) is calculated using the following formula:
[0115]
[0116] where a il Represents user u i The feature weights learned on the l-th order neighbors (i.e., the target attention scores), Represents user u i The l-th order neighbor feature (ie, the neighbor vector to be processed) of .
[0117] Specifically, finally, the user u is calculated by the following formula i For target project i j Prediction score:
[0118]
[0119] in represents the final user representation (i.e., the target user vector) obtained by aggregating the user's k-order neighbor embeddings, Indicates project i j The initial embedding of the items (i.e., the original item vector).
[0120] In the above embodiment, a prediction score is obtained by predicting and analyzing the original item vector based on the neighbor vector to be processed and the target attention score, thereby exploring potential interests and needs, thereby recommending content and friends that better meet user needs, improving the effect of social recommendations, and making the recommendation results more accurate.
[0121] Optionally, as an embodiment of the present invention, the process of performing loss function analysis on the total number of original project nodes, all the predicted scores, and all the user-project scores to obtain a target loss function includes:
[0122] The loss function of the total number of original project nodes, all the predicted scores, and all the user-project scores is calculated by the eighth formula to obtain the initial loss function. The eighth formula is:
[0123]
[0124] Among them, Loss is the initial loss function, is the original user node u i The corresponding target user vector and the original item node n m The predicted rating of the corresponding original item vector, is the original user node u i With the original item node n m The user project score is , O is the total number of original project nodes;
[0125] The initial loss function is optimized using the RMSprop algorithm to obtain the target loss function.
[0126] It should be understood that after obtaining the predicted score, it is necessary to use the loss function to perform model training. When the output loss value tends to be stable, the training model (ie, the recommendation model) is obtained.
[0127] Specifically, the loss function (i.e., the target loss function) is defined as follows:
[0128]
[0129] Where |O| is the number of observed items (i.e., the total number of original item nodes), is user u i For Project i j The prediction score of is user u i For Project i j The true rating of (i.e., the user-item rating).
[0130] It should be understood that RMSProp (i.e., the RMSprop algorithm) is mainly intended to solve the problem of excessive learning rate decay in the AdaGrad method - AdaGrad shrinks the learning rate according to the entire history of the squared gradient, which may make the learning rate too small before reaching the local minimum and difficult to continue training; RMSProp uses exponential decay averaging (recursively defined) to discard distant history, allowing it to converge quickly after finding a certain "convex" structure; in addition, RMSProp also adds a hyperparameter ρ to control the decay rate.
[0131] In the above embodiment, a loss function analysis is performed on the total number of original project nodes, all predicted scores, and all user project scores to obtain a target loss function, thereby exploring potential interests and needs, thereby recommending content and friends that better meet user needs, improving the effectiveness of social recommendations, and making recommendation results more accurate.
[0132] Optionally, as another embodiment of the present invention, the present invention obtains the user's original consumption data through the network, calculates the similarity of the user's social structure and personal preferences, and constructs a new social network with reliable high-order relationships; constructs the user's initial embedding and the user's high-order neighbor embedding, and combines the two to construct the user representation; uses the attention mechanism to dynamically evaluate the weight of each order of user relationships, and weights the user representation to obtain the user's final representation; obtains the user's project prediction score through the user's final representation, and then performs model training and optimization to achieve more accurate recommendation results.
[0133] Optionally, as another embodiment of the present invention, after obtaining user data from a social network, the present invention calculates the user's social structure similarity and personal preference similarity, effectively filters out dissimilar relationships, and mines potential reliable relationships between users. Specifically, the structural similarity, preference similarity, and overall similarity between all users are calculated according to the formula, and then the overall similarity between each user and its neighbor is compared with the similarity threshold T1 obtained by training. If it is lower than the similarity threshold T1, the neighbor user is removed from the user's neighbor set, otherwise it is retained. However, the filtered social network may have data sparsity. In order to alleviate this problem, similar users need to be added as neighbors to the social network. Specifically, after obtaining the preference similarity between all users, the preference similarity between each user and its non-neighbor is compared with the preference threshold T2 obtained by training. If it is higher than the preference threshold T2, the non-neighbor is added to the user's neighbor set, thereby constructing a new social network with reliable high-order relationships.
[0134] Alternatively, as another embodiment of the present invention, the present invention constructs user representation in two steps: constructing user initial embedding and constructing user high-order neighbor embedding. In constructing user initial embedding, randomly initialize the user and item embedding vectors to obtain the user initial embedding. and project initial embedding Before constructing a user's high-order neighbor embedding, we first need to construct the user's first-order neighbor embedding. The user's first-order neighbor embedding is generated through two steps: embedding propagation and embedding aggregation.
[0135] Alternatively, as another embodiment of the present invention, in order to prevent unreliable neighbors from negatively impacting user preferences in social recommendations, the present invention requires filtering out unreliable user relationships. First, the user's raw consumption data is obtained through the network, and the user's social structure similarity and personal preference similarity are calculated. This effectively filters out dissimilar relationships, mines potential reliable relationships between users, and constructs a new social network with reliable high-order relationships.
[0136] To fully leverage high-order social relationship information and alleviate social sparsity, we construct user initial embeddings and user high-order neighbor embeddings, combining them to construct user representations. To construct user initial embeddings, we randomly initialize user and item embedding vectors to obtain user initial embeddings and item initial embeddings. To construct user high-order neighbor embeddings, we first generate user first-order neighbor embeddings through two steps: embedding propagation and embedding aggregation. We then recursively stack additional graph convolutional layers on the user first-order neighbor embeddings, effectively infusing the influence of high-order relationships into the target user embedding to obtain the user high-order neighbor embedding. Finally, we construct the user representation embedding.
[0137] To address the phenomenon that high-order relationships have different importances for different users, the attention mechanism is used to dynamically evaluate the weight of each order of user relationships. First, the original user embedding and output embedding of the kth layer are projected to the hidden layer. Then, after activation using the Relu function, the hidden layer is converted into an attention score through a vector. Finally, these scores are normalized using the softmax function to obtain the contribution of each order neighbor to the user's preference. Finally, the contribution score of each order neighbor to the user's preference is weighted by the user representation to obtain the user's final representation embedding. After embedding the user's final representation into the initial embedding of the project to obtain the predicted score, the model is trained according to the loss function. When the output loss value tends to be stable, the trained model is obtained. Finally, based on the trained model, the user's next project interaction behavior is predicted, and more accurate project results are recommended to the user.
[0138] Optionally, as another embodiment of the present invention, the beneficial effects of the present invention are as follows:
[0139] By making full use of the information of high-order social relationships in social networks, in addition to distinguishing the importance of different neighbors of the same order to users, we also distinguish the importance of relationships of different orders to users. This can more effectively obtain user preferences and achieve more accurate recommendation results.
[0140] Optionally, as another embodiment of the present invention, the present invention includes the following steps:
[0141] Step S1: Obtain the user's original consumption data through the network and clean the data;
[0142] Step S2: Calculate the user's social structure similarity and personal preference similarity, find the user's reliable neighbors, and build a new social network with reliable high-order relationships;
[0143] Step S3: Construct user initial embedding;
[0144] Step S4: Construct user high-order neighbor embedding;
[0145] Step S5: The attention mechanism dynamically evaluates the weight of each order neighbor;
[0146] Step S6: construct the final user representation;
[0147] Step S7: Rating prediction;
[0148] Step S8: Perform model training according to the loss function;
[0149] Step S9: Recommend items to the user based on the trained model.
[0150] Figure 2 This is a module block diagram of a social recommendation device provided by an embodiment of the present invention.
[0151] Alternatively, as another embodiment of the present invention, Figure 2 As shown, a social recommendation device includes:
[0152] a data acquisition module, configured to obtain user data from a social network, the user data including a plurality of original user nodes, a plurality of original item nodes, a set of original neighbor nodes corresponding to each of the original user nodes, and a plurality of user-item ratings corresponding to each of the original user nodes;
[0153] A screening module, configured to screen target similarities of a plurality of original user nodes and target neighbor node sets of a plurality of original user nodes from all the original neighbor node sets according to all the user-item scores;
[0154] A training module is used to construct a training model, and train the training model based on all the original user nodes, all the original project nodes, the target similarities of all the original user nodes, the target neighbor node sets of all the original user nodes, and all the user-project scores to obtain a recommendation model;
[0155] The recommendation result obtaining module is used to import multiple user nodes to be recommended and multiple item nodes to be recommended, and recommend the multiple user nodes to be recommended and the multiple item nodes to be recommended through the recommendation model to obtain social recommendation results.
[0156] Alternatively, another embodiment of the present invention provides a social recommendation system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the social recommendation method described above is implemented. The system may be a computer or other system.
[0157] Optionally, another embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the social recommendation method as described above is implemented.
[0158] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus.
[0159] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0160] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is merely a logical functional division. In actual implementation, other division methods may be used, such as combining or integrating multiple units or components into another system, or ignoring or not implementing certain features.
[0161] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected based on actual needs to achieve the objectives of the embodiments of the present invention.
[0162] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0163] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.
[0164] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A social recommendation method, characterized in that: The steps include: Obtaining user data from a social network, the user data including a plurality of original user nodes, a plurality of original item nodes, a set of original neighbor nodes corresponding to each of the original user nodes, and a plurality of user-item ratings corresponding to each of the original user nodes; Filtering target similarities of multiple original user nodes and target neighbor node sets of multiple original user nodes from all the original neighbor node sets according to all the user-item scores; Constructing a training model, and training the training model based on all the original user nodes, all the original project nodes, the target similarities of all the original user nodes, the target neighbor node sets of all the original user nodes, and all the user-project scores to obtain a recommendation model; Importing a plurality of user nodes to be recommended and a plurality of item nodes to be recommended, recommending the plurality of user nodes to be recommended and the plurality of item nodes to be recommended by the recommendation model, and obtaining a social recommendation result; The process of constructing a training model and training the training model according to all the original user nodes, all the original item nodes, the target similarities of all the original user nodes, the target neighbor node sets of all the original user nodes, and all the user-item scores to obtain a recommendation model includes: Obtaining the number of iterations, performing vectorization processing on each of the original user nodes, each of the original item nodes, and each of the target neighbor node sets of the original user nodes, respectively, to obtain an original user vector corresponding to each of the original user nodes, an original item vector corresponding to each of the original item nodes, and a target neighbor vector corresponding to each of the original user nodes; Performing attention analysis on each of the original user vectors, the target neighbor vector corresponding to each of the original user nodes, and the target similarities of multiple original user nodes according to the number of iterations, to obtain multiple to-be-processed neighbor vectors corresponding to each of the original user nodes and multiple target attention scores corresponding to each of the original user nodes; The process of performing attention analysis on each of the original user vectors, the target neighbor vector corresponding to each of the original user nodes, and the target similarities of multiple original user nodes according to the number of iterations to obtain multiple to-be-processed neighbor vectors corresponding to each of the original user nodes and multiple target attention scores corresponding to each of the original user nodes includes: Each of the original user vectors, the target neighbor vector corresponding to each of the original user nodes, and the target similarities of multiple original user nodes are aggregated using the fourth formula and the number of iterations to obtain a neighbor vector to be processed corresponding to each of the original user nodes. The neighbor vector to be processed is used as the original user vector for the next number of iterations until the number of iterations is reached, thereby obtaining multiple neighbor vectors to be processed corresponding to each of the original user nodes. The fourth formula is: in, in, The original user node u for the kth iteration i The corresponding neighbor vector to be processed, is the original user node u i With the original user node u j The target similarity, The original user node u for the kth iteration i With the original user node u j Neighbor aggregation vector of is the original user node u i The corresponding target neighbor vector, is the original user node u j The corresponding target neighbor vector, The original user node u for the kth iteration j The corresponding original user vector, The original user node u for the first iteration j The corresponding original user vector, W k is the kth iteration trainable matrix, is the propagation information attenuation factor; The attention scores of the neighbor vectors to be processed corresponding to each of the original user nodes are calculated respectively by the fifth formula and the number of iterations to obtain multiple initial attention scores corresponding to each of the original user nodes. The fifth formula is: in, The original user node u for the kth iteration i The corresponding raw attention score, The original user node u for the first iteration i The corresponding neighbor vector to be processed, The original user node u for the kth iteration i The corresponding neighbor vector to be processed, Relu is the activation function; Each of the initial attention scores is normalized separately to obtain multiple target attention scores corresponding to each of the original user nodes.
2. The social recommendation method according to claim 1, characterized in that The process of screening target similarities of multiple original user nodes and target neighbor node sets of multiple original user nodes from all the original neighbor node sets according to all the user-item scores includes: Counting the total number of each of the original neighbor node sets respectively to obtain the total number of original neighbor nodes corresponding to each of the original user nodes; Determine whether the total number of original neighbor nodes is greater than or equal to the preset total number of neighbor nodes; if so, use the original neighbor node set corresponding to the total number of original neighbor nodes as the first set of neighbor nodes to be processed for the original user node; if not, use the original neighbor node set corresponding to the total number of original neighbor nodes as the second set of neighbor nodes to be processed for the original user node; respectively taking the first to-be-processed neighbor node set of each of the original user nodes and the first to-be-processed neighbor node set of any remaining original user node or the second to-be-processed neighbor node set of the original user node as a group to obtain a plurality of first to-be-processed neighbor node groups; respectively taking the second to-be-processed neighbor node set of each of the original user nodes and the first to-be-processed neighbor node set of any remaining original user node or the second to-be-processed neighbor node set of the original user node as a group to obtain a plurality of second to-be-processed neighbor node groups; Performing similarity calculations on each of the first to-be-processed neighbor node groups, each of the second to-be-processed neighbor node groups, and the user-item score corresponding to each of the original user nodes, respectively, to obtain a first target similarity corresponding to each of the first to-be-processed neighbor node groups and a second target similarity corresponding to each of the second to-be-processed neighbor node groups; If the first target similarity is greater than or equal to a preset similarity, all the first to-be-processed neighbor nodes in the first to-be-processed neighbor node group corresponding to the first target similarity are collected to obtain a first target neighbor node set corresponding to the first to-be-processed neighbor node group; Sorting all the second target similarities in descending order to obtain a plurality of sorted target similarities; All the second to-be-processed neighbor nodes in the second to-be-processed neighbor node group corresponding to the first N sorted target similarities are used as the second target neighbor node set corresponding to the second to-be-processed neighbor node group; The target similarity of the original user node includes a first target similarity corresponding to each of the first to-be-processed neighbor node groups and a second target similarity corresponding to each of the second to-be-processed neighbor node groups; The target neighbor node set of the original user node includes a first target neighbor node set corresponding to the first to-be-processed neighbor node group and a second target neighbor node set corresponding to the second to-be-processed neighbor node group.
3. The social recommendation method according to claim 2, characterized in that The process of respectively calculating the similarity of each of the first to-be-processed neighbor node groups, each of the second to-be-processed neighbor node groups, and the user-item score corresponding to each of the original user nodes, and obtaining a first target similarity corresponding to each of the first to-be-processed neighbor node groups and a second target similarity corresponding to each of the second to-be-processed neighbor node groups includes: The similarities of each of the first to-be-processed neighbor node groups and each of the second to-be-processed neighbor node groups are calculated respectively by the first formula, and the first structural similarities corresponding to each of the first to-be-processed neighbor node groups and the second structural similarities corresponding to each of the second to-be-processed neighbor node groups are obtained accordingly. The first formula is: Among them, Structure_Sim(u i ,u j ) is the first structural similarity or the second structural similarity, G ui is the original user node u in the first neighbor node group to be processed i The original user node u in the first set of neighbor nodes to be processed or the second set of neighbor nodes to be processed i The second set of neighbor nodes to be processed, G uj The original user node u in the first neighbor node group to be processed or the second neighbor node group to be processed j The first set of neighbor nodes to be processed or the second set of neighbor nodes to be processed; Performing vectorization processing on each of the user-item scores to obtain a user-item score vector corresponding to each of the original user nodes; The similarities of the user-item rating vectors corresponding to the original user nodes in each of the first to-be-processed neighbor node groups and the user-item rating vectors corresponding to the original user nodes in each of the second to-be-processed neighbor node groups are calculated respectively by the second formula, and the first preference structure similarities corresponding to each of the first to-be-processed neighbor node groups and the second preference similarities corresponding to each of the second to-be-processed neighbor node groups are obtained accordingly. The second formula is: Among them, Preference_Sim(u i ,u j ) is the first preference similarity or the second preference similarity, is the original user node u in the first neighbor node group to be processed i The corresponding user-item rating vector or the original user node u in the second neighbor node group to be processed i The corresponding user-item rating vector, The original user node u in the first neighbor node group to be processed or the second neighbor node group to be processed j The corresponding user-item rating vector; The weighted sum of each of the first structural similarities, each of the second structural similarities, the preference structural similarities corresponding to each of the first to-be-processed neighbor node groups, and the second preference similarities corresponding to each of the second to-be-processed neighbor node groups is calculated respectively by the third formula, and the first target similarity corresponding to each of the first to-be-processed neighbor node groups and the second target similarity corresponding to each of the second to-be-processed neighbor node groups are obtained accordingly. The third formula is: Among them, General_Sim(u i ,u j ) is the first target similarity or the second target similarity, Structure_Sim(u i ,u j ) is the first structural similarity or the second structural similarity, Preference_Sim(u i ,u j ) is the first preference similarity or the second preference similarity, w1 and w2 are both weight parameters.
4. The social recommendation method according to claim 1, wherein: The process of constructing a training model and training the training model according to all the original user nodes, all the original item nodes, the target similarities of all the original user nodes, the target neighbor node sets of all the original user nodes, and all the user-item scores to obtain a recommendation model includes: Performing prediction analysis on the plurality of original item vectors according to the plurality of to-be-processed neighbor vectors corresponding to the respective original user nodes and the plurality of target attention scores corresponding to the respective original user nodes, to obtain a plurality of prediction scores corresponding to the respective original user nodes; Counting the number of all original project nodes to obtain the total number of original project nodes; Performing a loss function analysis on the total number of original project nodes, all the predicted scores, and all the user project scores to obtain a target loss function; The parameters of the training model are updated according to the target loss function to obtain a recommendation model.
5. The social recommendation method according to claim 4, characterized in that The process of performing prediction analysis on the plurality of original item vectors according to the plurality of to-be-processed neighbor vectors corresponding to the respective original user nodes and the plurality of target attention scores corresponding to the respective original user nodes to obtain the plurality of prediction scores corresponding to the respective original user nodes comprises: The target user vector corresponding to each original user node is obtained by respectively calculating the multiple to-be-processed neighbor vectors corresponding to each original user node and the multiple target attention score user vectors corresponding to each original user node through the sixth formula. The sixth formula is: in, is the original user node u i The corresponding target user vector, The original user node u for the kth iteration i The corresponding target attention score, The original user node u for the kth iteration i The corresponding neighbor vector to be processed, l is the number of iterations; The predicted scores of each target user vector and each original item vector are calculated respectively by the seventh formula to obtain multiple predicted scores corresponding to each original user node. The seventh formula is: in, is the original user node u i The corresponding target user vector and the original item node n m The predicted rating of the corresponding original item vector, is the original user node u i The corresponding target user vector, is the original project node n m The corresponding original item vector.
6. The social recommendation method according to claim 4, characterized in that The process of performing loss function analysis on the total number of original project nodes, all the predicted scores, and all the user project scores to obtain a target loss function includes: The loss function of the total number of original project nodes, all the predicted scores, and all the user-project scores is calculated by the eighth formula to obtain the initial loss function. The eighth formula is: Among them, Loss is the initial loss function, is the original user node u i The corresponding target user vector and the original item node n m The predicted rating of the corresponding original item vector, is the original user node u i With the original item node n m The user project score is , O is the total number of original project nodes; The initial loss function is optimized using the RMSprop algorithm to obtain the target loss function.
7. A social recommendation device, characterized in that: include: a data acquisition module, configured to obtain user data from a social network, the user data including a plurality of original user nodes, a plurality of original item nodes, a set of original neighbor nodes corresponding to each of the original user nodes, and a plurality of user-item ratings corresponding to each of the original user nodes; A screening module, configured to screen target similarities of multiple original user nodes and target neighbor node sets of multiple original user nodes from all the original neighbor node sets according to all the user-item scores; A training module is used to construct a training model, and train the training model based on all the original user nodes, all the original project nodes, the target similarities of all the original user nodes, the target neighbor node sets of all the original user nodes, and all the user-project scores to obtain a recommendation model; The recommendation result obtaining module is used to import multiple user nodes to be recommended and multiple item nodes to be recommended, and recommend the multiple user nodes to be recommended and the multiple item nodes to be recommended through the recommendation model to obtain social recommendation results.
8. A social recommendation system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the social recommendation method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the social recommendation method according to any one of claims 1 to 6 is implemented.