An item recommendation method, device, and storage medium
By constructing knowledge graphs and heterogeneous graph neural networks, and training models with long-term and short-term interest data, the problem of capturing users' long-term and short-term interests and social influences in existing recommendation systems is solved, thereby improving the accuracy and interpretability of personalized recommendations.
Patent Information
- Application Number
- CN202210110849.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-29
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2042-01-29
AI Technical Summary
Existing recommendation systems struggle to simultaneously capture users' long-term and short-term interests, as well as the influence of their social friends, resulting in insufficient recommendation accuracy and interpretability.
By constructing a knowledge graph and using heterogeneous graph neural networks to learn the relationships between users and friends, projects and categories, and by combining long-term and short-term interest data to train the model, we can capture users' long-term stable interests and short-term dynamic preferences, while taking into account social influences.
It enables personalized recommendations with social attributes, improving recommendation accuracy and interpretability.
Smart Images

Figure CN114491267B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application mainly relates to the technical field of data analysis, and particularly relates to a recommendation method and device of an article and a storage medium. BACKGROUND
[0002] As an information filtering system, the recommendation system can not only effectively solve the problem of information overload, but also has certain practical significance for promoting production and improving the quality of life. How to use deep learning technology to learn the inherent essential features of users and articles from various complex multi-dimensional data, and build a model that is more in line with the interests and needs of users, in order to improve the performance of the recommendation algorithm and user satisfaction, has always been the common concern of the academic and industrial circles.
[0003] However, it is a challenging task to fully and accurately capture the user's interest in potential items. First of all, the user's interest features can be divided into long-term stable personal hobbies and short-term dynamic changing current preferences, which reflect different contents and have different effects on users. Moreover, the user may also be influenced by friends in the social network, such as the user asking for the advice of friends or following the interaction behavior of friends for the items that the user is not familiar with. Therefore, how to consider the long-term and short-term interests of users and the influence of social friends in the recommendation model is an urgent problem to be solved. SUMMARY
[0004] The technical problem to be solved by the present application is to provide a recommendation method and device of an article and a storage medium to solve the problems of the prior art.
[0005] The technical solution of the present application to solve the above technical problem is as follows: a recommendation method of an article, comprising the following steps:
[0006] S1: importing a historical long-term interest data set of all target users and a historical short-term interest data set corresponding to each target user from a preset database;
[0007] S2: performing data preprocessing on the historical long-term interest data set to obtain a long-term interest data training set;
[0008] S3: constructing a training model, training the training model according to the long-term interest data training set and all historical short-term interest data sets, and obtaining a target recommendation model;
[0009] S4: importing a long-term interest data validation set and a short-term interest data validation set, inputting the long-term interest data validation set and the short-term interest data validation set into the target recommendation model, and obtaining a recommendation result of an article according to the target recommendation model.
[0010] Another technical solution of the present application to solve the above technical problems is as follows: An article recommendation device comprises:
[0011] A dataset obtaining module is configured to import historical long-term interest datasets of all target users and historical short-term interest datasets corresponding to each target user from a preset database;
[0012] A dataset preprocessing module is configured to perform data preprocessing on the historical long-term interest datasets to obtain a long-term interest data training set;
[0013] A model training module is configured to construct a training model, train the training model according to the long-term interest data training set and all historical short-term interest datasets, and obtain a target recommendation model;
[0014] A recommendation result obtaining module is configured to import a long-term interest data validation set and a short-term interest data validation set, input the long-term interest data validation set and the short-term interest data validation set into the target recommendation model, and obtain an article recommendation result according to the target recommendation model.
[0015] Another technical solution of the present application to solve the above technical problems is as follows: An article recommendation device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, an article recommendation method as described above is implemented.
[0016] Another technical solution of the present application to solve the above technical problems is as follows: A computer readable storage medium stores a computer program, and when the computer program is executed by a processor, an article recommendation method as described above is implemented.
[0017] The present application has the following beneficial effects: The long-term interest data training set is obtained by performing data preprocessing on the historical long-term interest datasets, the training model is constructed, the training model is trained according to the long-term interest data training set and all historical short-term interest datasets, the target recommendation model is obtained, the long-term interest data validation set and the short-term interest data validation set are input into the target recommendation model, and the article recommendation result is obtained according to the target recommendation model, which can mine the long-term stable general interest and short-term dynamic preference of a user, capture the influence of social friend interest preference on the user, realize personalized recommendation with social attributes, and improve the recommendation accuracy and interpretability. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1 A flowchart of an article recommendation method provided by an embodiment of the present application is shown in the figure;
[0019] Figure 2A module block diagram of an article recommendation device is provided for an embodiment of the present application. DETAILED DESCRIPTION
[0020] The principles and features of the present application are described below in conjunction with the accompanying drawings, which are provided only for explanation of the present application and are not intended to limit the scope of the present application.
[0021] Figure 1 A flowchart of an article recommendation method is provided for an embodiment of the present application.
[0022] As shown in the figure, an article recommendation method comprises the following steps: Figure 1 S1: importing a historical long-term interest dataset of all target users and a historical short-term interest dataset corresponding to each target user from a preset database;
[0023] S2: performing data preprocessing on the historical long-term interest dataset to obtain a long-term interest data training set;
[0024] S3: constructing a training model, training the training model according to the long-term interest data training set and all historical short-term interest datasets, and obtaining a target recommendation model;
[0025] S4: importing a long-term interest data validation set and a short-term interest data validation set, inputting the long-term interest data validation set and the short-term interest data validation set into the target recommendation model, and obtaining an article recommendation result according to the target recommendation model.
[0026] It should be understood that the data preprocessing is data cleaning and preprocessing work.
[0027] In the above embodiment, the long-term interest data training set is obtained by data preprocessing on the historical long-term interest dataset, a training model is constructed, the training model is trained according to the long-term interest data training set and all historical short-term interest datasets, a target recommendation model is obtained, the long-term interest data validation set and the short-term interest data validation set are input into the target recommendation model, and an article recommendation result is obtained according to the target recommendation model. This can mine the user's own long-term stable general interest and short-term dynamic preference, capture the influence of social friend interest preference on the user, realize personalized recommendation with social attributes, and improve the recommendation accuracy and interpretability.
[0028] Optionally, as an embodiment of the present application, the long-term interest data training set comprises a plurality of long-term interaction record data, a plurality of label data and a plurality of relationship data, and the process of step S3 comprises:
[0029]
[0030] constructing a knowledge graph by all long-term interaction record data, all label data and all relationship data, the knowledge graph comprising a plurality of target user nodes corresponding to the target users, a plurality of target user feature vectors to be processed corresponding to each of the target user nodes, a plurality of target user directed edges corresponding to each of the target user nodes, a plurality of long-term item nodes corresponding to each of the target users, a plurality of long-term item feature vectors to be processed corresponding to each of the long-term item nodes, and a plurality of long-term item directed edges corresponding to each of the long-term item nodes;
[0031] analyzing each of the target user nodes, the target user feature vectors to be processed corresponding to each of the target user nodes, and the target user directed edges corresponding to each of the target user nodes for long-term interest feature vectors to obtain long-term interest feature vectors corresponding to each of the target users;
[0032] analyzing each of the long-term item nodes, the long-term item feature vectors to be processed corresponding to each of the long-term item nodes, and the long-term item directed edges corresponding to each of the long-term item nodes for long-term item feature vectors to obtain long-term item feature vectors corresponding to each of the long-term item nodes;
[0033] analyzing each of the historical short-term interest data sets for short-term interest feature vectors to obtain short-term interest feature vectors corresponding to each of the target users;
[0034] performing feature fusion analysis on each of the long-term interest feature vectors and the short-term interest feature vectors corresponding to each of the target users to obtain global feature vectors corresponding to each of the target users;
[0035] analyzing each of the global feature vectors and the long-term item feature vectors corresponding to each of the target users for target probabilities to obtain target probabilities corresponding to each of the target users;
[0036] importing real labels corresponding to each of the target users, calculating loss values for each of the target probabilities and each of the real labels corresponding to the target users to obtain loss values corresponding to each of the target users;
[0037] updating parameters of the training model according to the plurality of loss values, and returning to step S1 until a preset number of iterations is reached, and then taking the updated training model as a target recommendation model.
[0038] It should be understood that the parameters in steps S1 to S4 are continuously iteratively updated by back propagation and gradient descent algorithm to minimize the loss value, thereby completing the training of the entire model.
[0039] It should be understood that the related data is used to construct a knowledge graph containing three types of relationships: target users and social friends, target users and interactive items, and items and their categories.
[0040] It should be understood that the long-term interaction record data of all users and items in a long time period, the label data of the category to which each item belongs, and the relationship data of each user and social object are derived from the database (i.e., the preset database). The meanings of “interaction”, “item”, and “relationship” in different application scenarios can be different: the “interaction” can be a purchase / view / collection behavior, the “item” can be a commodity / video / music / news / food content, and the “relationship” can be one-way or two-way attention.
[0041] It should be understood that the knowledge graph is subjected to feature learning through a heterogeneous graph neural network to obtain the long-term interest feature vector containing user social influence and the item feature vector (i.e., the long-term item feature vector) containing rich semantics.
[0042] Specifically, the three types of data (i.e., the long-term interaction record data, the label data, and the relationship data) are constructed into a graph form of nodes and edges according to the following assumptions to obtain a knowledge graph :
[0043] Assumption 1: In the knowledge graph , there are three types of nodes and three types of edges. The node set has a user node set U, an item node set I, and a category node set A. The edge set has Edge(U, U), Edge(I, U), and Edge(A, I). The u-th user node is represented as u ∈ U, the i-th item node is represented as i ∈ I, and the a-th category is represented as a ∈ A.
[0044] Assumption 2: The direction of the edge represents the direction of information transmission, → represents one-way transmission, represents two-way transmission, and edge(v, u) represents that the node v and the node u have an edge relationship, and the direction is v→u.
[0045] Assumption 3: If user u follows user v and v does not follow user u, a one-way edge is constructed, represented as edge(v→u). If user u and v follow each other, a two-way edge is constructed, represented as The weight of the edge is the similarity between the feature vectors of the two nodes u and v, representing the interest similarity of the two users.
[0046] Assumption 4: If user u has interacted with item i, a two-way edge is constructed, represented as The weight of the edge is the number of times or the score of u interacting with i.
[0047] Hypothesis 5: If item i belongs to category a, then construct a one-way edge denoted as edge(a→i) with weight 1.
[0048] It should be understood that by constructing the knowledge graph The rich potential associations and semantic content from the user and friends, the user and the item, and the item and the category are mined, the long-term interest features containing the user social influence and the item features with rich semantics are learned, and the long-term stable general interest of the user is captured.
[0049] In the above embodiment, the training of the target recommendation model is obtained by training the model through the long-term interest data training set and all the historical short-term interest data sets, the general interest of the user and the short-term dynamic preference are mined, the influence of the social friend interest preference on the user is captured, and the personalized recommendation with the social attribute is realized.
[0050] Optionally, as an embodiment of the present application, the process of analyzing the long-term interest feature vector of each target user node, the target user feature vector corresponding to each target user node, and the plurality of target user directed edges corresponding to each target user node, comprises:
[0051] Respectively, the random initialization processing is performed on each target user feature vector to obtain the target user initial feature vector corresponding to each target user;
[0052] The long-term interest feature vector of each target user node, the target user initial feature vector corresponding to each target user, and the plurality of target user directed edges corresponding to each target user node are respectively aggregated by the first formula to obtain the long-term interest feature vector corresponding to each target user, and the first formula is:
[0053]
[0054] Wherein,
[0055] Wherein, S(n1,u)=softmax(q1 T σ'(W 11 H[n1]+W 12 H[u]+b1)),M(n1,u)=W n1u H[n1]+b n1u ,
[0056] Wherein, u is a target user node, is a long-term interest feature vector, and sigma is a ReLU activation function, q1, W 11, W 12 , b1, W3, b3, W n1u , b n1u are all learnable parameters, H[u] is the target user initial feature vector of the target user node u, N[u] is the target user neighbor feature vector, n1 is the neighbor node of the target user node u, edge(n1, u) is the directed edge of the target user, Ein(u) is the set of directed edges pointing to the target user node u, S(n1, u) is the importance score of the neighbor node n1 passing to the target user node u, M(n1, u) is the message passing from the neighbor node n1 to the target user node u along the directed edge edge(n1, u), σ' is the sigmoid activation function, softmax is the softmax function, H[n1] is the target user initial feature vector of the neighbor node n1.
[0057] It should be understood that the values of the feature vectors of various nodes in the knowledge graph are randomly initialized (i.e. the target user feature vector to be processed), to obtain the initial feature vectors H[u] (i.e. the target user initial feature vector), H[i] (i.e. the long-term item initial feature vector), H[a] respectively. Then a heterogeneous graph neural network (HGNN for short) is used to learn the features of the target user nodes and item nodes in the graph according to the message passing and aggregation mechanism.
[0058] Specifically, for the target user node, the features of the neighbor nodes of the target node (i.e. the target user node) are aggregated first to obtain a neighbor feature vector N[u] containing the feature information of multiple neighbor nodes, as follows:
[0059] S(n1, u) = softmax(q1 T σ'(W 11 H[n1] + W 12 H[u] + b1)
[0060] M(n1, u) = W n1u H[n1] + b n1u
[0061] where n1 represents a neighbor node of the user node, H[n1] is the initial feature vector of the neighbor node (i.e. the target user initial feature vector). E in (u) represents the set of edges pointing to the user node u, M(n, u) represents the message passing from the neighbor n1 to u along the edge edge(n, u). S(n, u) represents the importance score (the value range is 0 to 1) of the message passed by the neighbor n1. q1, W 11 , W 12 , Wn1u , b n1u , b1are learnable parameters, σ' is a sigmoid activation function, and softmax is a softmax function.
[0062] Specifically, the initial feature vector H[u] of the target user node (i.e., the initial feature vector of the target user) and the corresponding neighbor feature vector N[u] are aggregated to obtain an updated feature vector (i.e., the long-term interest feature vector), as follows:
[0063]
[0064] where σ is a ReLU activation function, and W3, b3are learnable parameters.
[0065] It should be understood that for a user node u, the updated feature vector (i.e., the long-term interest feature vector) captures the long-term interest preference and social influence of the user. Let The long-term interest feature vector of the user social influence U Long is a set of long-term interest feature vectors of all users.
[0066] In the above embodiment, the long-term interest feature vector is obtained by respectively analyzing each target user node, the target user feature vector to be processed, and the long-term interest feature vector of the plurality of target user directed edges, which mines the rich potential associations and semantic content from the user and friends, the user and the project, and the project and the category, learns the long-term interest feature containing the user social influence, and captures the long-term stable general interest of the target user.
[0067] Optionally, as an embodiment of the present application, the process of respectively analyzing each of the long-term project nodes, the long-term project feature vector to be processed corresponding to each of the long-term project nodes, and the plurality of long-term project directed edges corresponding to each of the long-term project nodes to obtain the long-term project feature vector corresponding to each of the long-term project nodes comprises:
[0068] respectively, the long-term project feature vector to be processed is randomly initialized to obtain the long-term project initial feature vector corresponding to each of the long-term project nodes;
[0069] The long-term project feature vector is aggregated by the second formula respectively on each of the long-term project nodes, the long-term project initial feature vector corresponding to each of the long-term project nodes, and the plurality of long-term project directed edges corresponding to each of the long-term project nodes to obtain the long-term project feature vector corresponding to each of the long-term project nodes, and the second formula is:
[0070]
[0071] wherein,
[0072] wherein, S(n2,i) = softmax(q2 T σ'(W 21 H[n2] + W 22 H[i] + b2)), M(n2,i) = W n2i H[n2] + b n2i ,
[0073] wherein, i is a long-term item node, is a long-term item feature vector of the long-term item node i, and σ is a ReLU activation function, q2, W 21 , W 22 , b2, W4, b4, W n2i , b n2i are all learnable parameters, H[i] is a long-term item initial feature vector of the long-term item node i, N[i] is a long-term item neighbor feature vector, n2 is a neighbor node of the long-term item node i, edge(n2,i) is a long-term item directed edge, E in (i) is a set of edges directed to the long-term item node i, S(n2,i) is an importance score of the neighbor node n2 passed to the long-term item node i, M(n2,i) is a message passed from the neighbor node n2 to the long-term item node i along the directed edge edge(n2,i), σ' is a sigmoid activation function, softmax is a softmax function, and H[n2] is a long-term item initial feature vector of the neighbor node n2.
[0074] It should be understood that the values of the feature vectors of various nodes in the knowledge graph are randomly initialized, i.e. the to-be-processed long-term item feature vectors, to obtain initial feature vectors H[u] (i.e. the target user initial feature vector), H[i] (i.e. the long-term item initial feature vector), and H[a] respectively. Then, a heterogeneous graph neural network (HGNN for short) is used to learn the features of the target user nodes and item nodes in the graph according to a message passing and aggregation mechanism.
[0075] It should be understood that the random initialization process refers to the same data processing steps as the random initialization process of the target user initial feature vector, but only the to-be-processed long-term item feature vector or the target user initial feature vector is input into the data processing step of random initialization.
[0076] Specifically, for the item node (i.e., the long-term item node), the features of the neighbor nodes (i.e., the long-term item node) are aggregated first to obtain a neighbor feature vector N[i] containing multiple neighbor feature information of the long-term item node, as follows:
[0077] S(n2,i) = softmax(q2 T σ'(W 21 H[n2] + W 22 H[i] + b2)
[0078] M(n2,i) = W n2i H[n2] + b n2i
[0079] wherein n2 represents the neighbor node of the long-term item node, and H[n2] is the initial feature vector of the respective neighbor node (i.e., the long-term item initial feature vector).E in (i) represents a set of edges pointing to the long-term item node i, and M(n,i) represents a message transmitted from the neighbor n2 to i along the edge edge(n,i). S(n,i) represents the importance score (the numerical range is 0 to 1) of the message transmitted from the neighbor n2 to i, q2, W 21 , W n2i , b n2i , W 22 , b2 are all learnable parameters, and σ' is a sigmoid activation function, and softmax is a softmax function.
[0080] Specifically, the initial feature vector H[i] of the item node (i.e., the long-term item initial feature vector) and the corresponding neighbor feature vector N[i] are aggregated to obtain an updated feature vector (i.e., the long-term item feature vector), as follows:
[0081]
[0082] wherein σ is a ReLU activation function, and W4, b4 are all learnable parameters.
[0083] It should be understood that for the item node i (i.e., the long-term item node), the updated feature vector (i.e., the long-term item feature vector) captures the semantic features of the interaction behavior of the target user and the item and the category attributes of the item. Let the item feature vector I i ∈I Rich can be obtained, and I Rich is a set of all item feature vectors containing rich semantics.
[0084] In the above embodiments, the long-term item feature vectors are obtained by respectively analyzing each long-term item node, the to-be-processed long-term item feature vector, and the long-term item feature vector of the plurality of long-term item directed edges, rich potential associations and semantic content from the user and the friend, the user and the item, and the item and the category are mined, item features with rich semantics are learned, and the recommendation accuracy and interpretability are improved.
[0085] Optionally, as an embodiment of the present application, the historical short-term interest data set includes a plurality of short-term interaction record data and a plurality of interaction times corresponding to each short-term interaction record data, and the process of respectively analyzing each historical short-term interest data set to obtain a short-term interest feature vector corresponding to each target user includes:
[0086] Respectively, data cleaning is performed on each short-term interaction record data to obtain cleaned short-term interaction record data corresponding to each short-term interaction record data;
[0087] According to the interaction time, a conversation sequence is constructed through a plurality of cleaned short-term interaction record data corresponding to each target user to obtain a conversation sequence corresponding to each target user;
[0088] A conversation graph corresponding to each target user is constructed through each conversation sequence, and the conversation graph includes a short-term item initial feature vector set;
[0089] Based on a graph neural network model, feature learning is performed on each short-term item initial feature vector set to obtain an updated short-term item feature vector set corresponding to each target user, specifically:
[0090] The third formula is used to calculate the updated short-term item feature vector set of each short-term item initial feature vector set to obtain the updated short-term item feature vector set corresponding to each target user, and the third formula is:
[0091]
[0092] Wherein, L_GNN() is a multi-layer graph neural network model, I u is a short-term item initial feature vector set, is an updated short-term item feature vector set;
[0093] The fourth formula is used to calculate the graph attention aggregation of the updated short-term item feature vector in each updated short-term item feature vector set to obtain a short-term interest feature vector corresponding to each target user, and the fourth formula is:
[0094]
[0095] wherein,
[0096] wherein q3, W 31 , W 32 , b3 are learnable parameters, and σ' is a sigmoid activation function, is a short-term interest feature vector, is an updated short-term item feature vector, is a contribution degree, and V is the total number of updated short-term item feature vectors.
[0097] It should be understood that the items interacted by the user in the recent period (i.e., the short-term interaction record data) are converted into a session graph, and the content in the graph is learned by using a graph neural network model to obtain a short-term interest feature vector containing the current dynamic interest of the user.
[0098] It should be understood that the graph neural network model can be any graph neural network and its variants, such as advanced models such as GCN, GAT, etc., which have strong expandability.
[0099] It should be understood that the interaction items of the user (i.e., the cleaned short-term interaction record data) are constructed in the form of a session sequence (i.e., the session sequence) according to the time sequence (i.e., the interaction time) in which they occur, and are formalized as S u = (i1 u ,i2 u ,...,i T u ). Wherein S u represents the current session sequence of the u-th user (i.e., the target user), represents the t-th interaction item (i.e., the cleaned short-term interaction record data) in the sequence, and the length of the session sequence is T.
[0100] Specifically, according to the session sequence S u , a session graph G u = (V u ,E u ) containing multiple nodes and edges is constructed. Wherein V u represents the node set in the session graph G u of the user u, and each node corresponds to an item (i u t ∈V u ) in the sequence S u ; the initial feature of the node is the long-term item feature vector and satisfies the relationship I u is the Vu The corresponding set of feature vectors; E u Then it means G u The set of edges in the middle is constructed based on whether the interaction times of two nodes occur in adjacent moments, such as i1 u and i2 u If they occur at adjacent times, then there is an edge (i1) between them. u i2 u The relationship between i1 and i2 is as follows: u and i3 u There is no edge relationship between them.
[0101] It should be understood that graph neural network models (such as GCN, GAT, etc.) are used to process the session graph G of user u through message passing and aggregation mechanisms. u Feature learning is performed on the nodes (i.e., the initial feature vector set of the short-term project) to obtain the updated feature vector set. (i.e., the updated set of short-term project feature vectors).
[0102] It should be understood that, for the aforementioned session graph G u The updated feature vector of each item (i.e., the updated short-term item feature vector). Performing graph attention aggregation operation yields a total feature vector. That is, a short-term interest feature vector containing the user's current dynamic interests.
[0103] It should be understood that in the fourth formula, U Short This represents the set of short-term interest feature vectors for all users. Represents the session graph G u The feature vector of the t-th item (i.e., the updated short-term project feature vector) relative to the total feature vector The contribution level of the short-term interest feature vector (i.e., the value from 0 to 1); The feature vector corresponding to the last item in the session sequence (i.e., the updated short-term item feature vector); q3, W 31 W 32 b3 and b' are both learnable parameters, and σ' is the sigmoid activation function.
[0104] In the above embodiments, short-term interest feature vectors are obtained by analyzing the short-term interest feature vectors of each historical short-term interest dataset, capturing the user's short-term dynamic preferences. This can be applied to personalized recommendation tasks in various fields, improving recommendation accuracy and interpretability.
[0105] Optionally, as one embodiment of the present application, the process of performing feature fusion analysis on each of the long-term interest feature vectors and the short-term interest feature vectors corresponding to each of the target users respectively to obtain a global feature vector corresponding to each of the target users comprises:
[0106] each of the long-term interest feature vectors is mapped by a fifth formula to obtain a mapped long-term interest feature vector corresponding to each of the target users, the fifth formula being:
[0107]
[0108] wherein, is the mapped long-term interest feature vector, W L is a parameter matrix, is the long-term interest feature vector, b L is a bias term, and tanh is a tanh activation function;
[0109] each of the short-term interest feature vectors is mapped by a sixth formula to obtain a mapped short-term interest feature vector corresponding to each of the target users, the sixth formula being:
[0110]
[0111] wherein, is the mapped short-term interest feature vector, W S is a parameter matrix, is the short-term interest feature vector, b S is a bias term, and tanh is a tanh activation function;
[0112] each of the mapped long-term interest feature vectors and the mapped short-term interest feature vectors corresponding to each of the target users is fused by a seventh formula to obtain a global feature vector corresponding to each of the target users, the seventh formula being:
[0113]
[0114] wherein,
[0115] wherein, U u Global is the global feature vector, z u is a gating vector, is a Hadamard product, is a vector concatenation, and is a sigmoid activation function, W z is a parameter matrix, is the mapped short-term interest feature vector, to map the long-term interest feature vector.
[0116] It should be understood that the long-term interest feature vector and the short-term interest feature vector are respectively subjected to nonlinear transformation, so that they are mapped from the original vector space to the same new vector space
[0117] It should be understood that and are respectively parameter matrices for the spatial mapping of U Long (i.e. the long-term interest feature vector) and U Short (i.e. the short-term interest feature vector).
[0118] It should be understood that the transformed long-term interest feature of the user (i.e. the mapped long-term interest feature vector) and the short-term interest feature (i.e. the mapped short-term interest feature vector) are subjected to feature fusion, so as to obtain a feature vector U Global (i.e. the global feature vector) representing the global preference of the user.
[0119] It should be understood that in the seventh formula, is a gating vector (with a numerical range of 0-1), which is used to control the contribution of different features to the overall output.
[0120] In the above embodiment, the global feature vector is obtained by respectively performing feature fusion analysis on each long-term interest feature vector and short-term interest feature vector, which combines the long-term stable general preference of the user and the short-term dynamic preference, and realizes personalized recommendation with social attributes.
[0121] Optionally, as an embodiment of the present application, the process of respectively performing target probability analysis on each global feature vector and a plurality of long-term item feature vectors corresponding to each target user, to obtain a target probability corresponding to each target user, comprises:
[0122] Each global feature vector and each long-term item feature vector corresponding to each target user is subjected to probability score calculation by the eighth formula, to obtain a plurality of probability scores corresponding to each target user, and a plurality of probability scores corresponding to each target user are respectively collected, so as to obtain a probability score set corresponding to each target user, the eighth formula being:
[0123]
[0124] wherein p ui is a probability score, U u Globala global feature vector, a long-term item feature vector;
[0125] Each of the probability score sets is normalized to obtain a target probability corresponding to each of the target users.
[0126] It should be understood that in order to predict the next step of the user to interact with the item, it is necessary to calculate the probability of each item being interacted with. For each item i (i.e., the long-term item node), its feature vector is the item feature vector i rich ∈I Rich (i.e., the long-term item feature vector), and then the dot product is performed with the global feature representation u global ∈U Global of the target user u (i.e., the target user) to obtain the probability score p ui ∈P UI (i.e., the probability score) that the next interaction content of the user u (i.e., the target user) is the item i (i.e., the long-term item node).
[0127] It should be understood that the scores in P UI (i.e., the probability score set) are normalized using a softmax function to obtain the final probability distribution of the item (i.e., the target probability), that is,
[0128] In the above embodiment, the probability score set is calculated by the eighth formula for each global feature vector and each long-term item feature vector, and the target probability is obtained by normalizing each probability score set, thereby improving the recommendation accuracy and interpretability.
[0129] Optionally, as an embodiment of the present application, the process of calculating the loss value for each of the target probability and each real label corresponding to the target user to obtain the loss value corresponding to each of the target users comprises:
[0130] The loss value is calculated for each of the target probability and each real label corresponding to the target user by the ninth formula to obtain the loss value corresponding to each of the target users, and the ninth formula is:
[0131]
[0132] wherein, is the loss value, y is the real label, is the target probability, and T is the vector transpose.
[0133] It should be understood that the probability distribution is calculated by a cross-entropy loss function (i.e. the target probability) and the true label y.
[0134] It should be understood that in the ninth formula, the content of y is a one-hot vector.
[0135] In the above embodiment, the loss value is calculated by the loss value of each target probability and each true label respectively, which can realize personalized recommendation with social attributes and improve the recommendation accuracy and interpretability.
[0136] Optionally, as an embodiment of the present application, it also includes recommending the items with top-K probability as the candidate items of the next interaction item to the target user according to the target probability.
[0137] Optionally, as another embodiment of the present application, the present application can be applied to personalized recommendation tasks in various fields by constructing a knowledge graph using long-term historical data and a session graph using short-term interaction data, respectively capturing the long-term stable general interests of users containing social influence and short-term dynamic preferences, and has advantages in recommendation accuracy and interpretability due to considering various influencing factors.
[0138] Figure 2 A module block diagram of an article recommendation device according to an embodiment of the present application is provided.
[0139] Optionally, as another embodiment of the present application, as shown in Figure 2 An article recommendation device includes:
[0140] A data set acquisition module is configured to import a historical long-term interest data set of all target users and a historical short-term interest data set corresponding to each target user from a preset database;
[0141] A data set preprocessing module is configured to perform data preprocessing on the historical long-term interest data set to obtain a long-term interest data training set;
[0142] A model training module is configured to construct a training model, train the training model according to the long-term interest data training set and all historical short-term interest data sets, and obtain a target recommendation model;
[0143] A recommendation result obtaining module is configured to import a long-term interest data verification set and a short-term interest data verification set, input the long-term interest data verification set and the short-term interest data verification set into the target recommendation model, and obtain an article recommendation result according to the target recommendation model.
[0144] Optionally, another embodiment of the present application provides an article recommendation device, 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 article recommendation method as described above is realized. The device can be a computer or the like.
[0145] Optionally, another embodiment of the present application provides a computer readable storage medium, the computer readable storage medium stores a computer program, when the computer program is executed by a processor, the article recommendation method as described above is realized.
[0146] It should be noted that, in this paper, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or equipment.
[0147] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above described device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be described here.
[0148] In several embodiments provided in the present 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 only schematic, for example, the division of units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0149] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or they can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment of the present application.
[0150] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software functional unit.
[0151] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part of the prior art that contributes, or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0152] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method of recommending an article, characterized by, The method comprises the following steps: S1: importing a historical long-term interest data set of all target users and a historical short-term interest data set corresponding to each target user from a preset database; S2: performing data preprocessing on the historical long-term interest data set to obtain a long-term interest data training set; S3: constructing a training model, training the training model according to the long-term interest data training set and all historical short-term interest data sets, and obtaining a target recommendation model; S4: importing a long-term interest data verification set and a short-term interest data verification set, inputting the long-term interest data verification set and the short-term interest data verification set into the target recommendation model, and obtaining a recommendation result of an item according to the target recommendation model; The long-term interest data training set comprises a plurality of long-term interaction record data, a plurality of label data and a plurality of relationship data, and the process of step S3 comprises: constructing a knowledge graph through all long-term interaction record data, all label data and all relationship data, wherein the knowledge graph comprises a plurality of target user nodes corresponding to the target users, a target user feature vector to be processed corresponding to each target user node, a plurality of target user directed edges corresponding to each target user node, a plurality of long-term item nodes corresponding to each target user, a long-term item feature vector to be processed corresponding to each long-term item node, and a plurality of long-term item directed edges corresponding to each long-term item node; analyzing a long-term interest feature vector of each target user node, a target user feature vector to be processed corresponding to each target user node and a plurality of target user directed edges corresponding to each target user node, respectively, to obtain a long-term interest feature vector corresponding to each target user; analyzing a long-term item feature vector of each long-term item node, a long-term item feature vector to be processed corresponding to each long-term item node and a plurality of long-term item directed edges corresponding to each long-term item node, respectively, to obtain a long-term item feature vector corresponding to each long-term item node; analyzing a short-term interest feature vector of each historical short-term interest data set, respectively, to obtain a short-term interest feature vector corresponding to each target user; performing feature fusion analysis on each long-term interest feature vector and a short-term interest feature vector corresponding to each target user, respectively, to obtain a global feature vector corresponding to each target user; analyzing a target probability of each global feature vector and a plurality of long-term item feature vectors corresponding to each target user, respectively, to obtain a target probability corresponding to each target user; importing a real label corresponding to each target user, and calculating a loss value of each target probability and each real label corresponding to the target user, respectively, to obtain a loss value corresponding to each target user; According to the plurality of loss values, the training model is updated in parameters, and step S1 is returned until a preset iteration number is reached, and then the updated training model is taken as a target recommendation model; The process of analyzing the long-term interest feature vector of each target user node, the to-be-processed target user feature vector corresponding to each target user node, and the plurality of target user directed edges corresponding to each target user node includes: Respectively, the to-be-processed target user feature vector is randomly initialized to obtain the target user initial feature vector corresponding to each target user; The long-term interest feature vector corresponding to each target user is obtained by performing feature aggregation on each target user node, the target user initial feature vector corresponding to each target user, and the plurality of target user directed edges corresponding to each target user node through a first formula, and the first formula is: , wherein , wherein , , wherein, is a target user node, is a long-term interest feature vector, is a ReLU activation function, , , , , , , , are all learnable parameters, is a target user node is a target user initial feature vector of the target user node is a target user neighbor feature vector, is a neighbor node of the target user node , is a target user directed edge, is a set of directed edges whose direction points to the target user node , is an importance score of the neighbor node passed to the target user node , is a message passed from the neighbor node to the target user node along the directed edge , is a sigmoid activation function, is a softmax function, is a target user initial feature vector of the neighbor node .
2. The item recommendation method of claim 1, wherein, The process of analyzing the long-term item feature vector of each long-term item node, the to-be-processed long-term item feature vector corresponding to each long-term item node, and the plurality of long-term item directed edges corresponding to each long-term item node includes: Respectively, the to-be-processed long-term item feature vector is randomly initialized to obtain the long-term item initial feature vector corresponding to each long-term item node; The long-term item feature vector corresponding to each long-term item node is obtained by performing feature aggregation on each long-term item node, the long-term item initial feature vector corresponding to each long-term item node, and the plurality of long-term item directed edges corresponding to each long-term item node through a second formula, and the second formula is: , wherein , wherein , , wherein is a long-term project node, is a long-term project node is a long-term project feature vector of is a ReLU activation function, , , , , , , , are all learnable parameters, is a long-term project initial feature vector of is a long-term project neighbor feature vector of is a neighbor node of is a long-term project node is a neighbor node of is a long-term project directed edge, is a set of edges whose direction points to is a long-term project node is an importance score passed from to is a long-term project node is a message passed from to is a long-term project node is a long-term project node is a sigmoid activation function, is a softmax function, is a long-term project initial feature vector of is a neighbor node 3. The item recommendation method of claim 1, wherein, The process of analyzing the short-term interest feature vector of each historical short-term interest data set to obtain the short-term interest feature vector corresponding to each target user includes: Respectively, the short-term interaction record data is cleaned to obtain cleaned short-term interaction record data corresponding to each short-term interaction record data; According to the interaction time, a session sequence corresponding to each target user is constructed through the plurality of cleaned short-term interaction record data corresponding to each target user, respectively. A session graph corresponding to each target user is constructed through each session sequence, and the session graph includes a short-term item initial feature vector set; Based on a graph neural network model, feature learning is performed on each short-term item initial feature vector set to obtain an updated short-term item feature vector set corresponding to each target user, specifically: The calculation of the updated short-term item feature vector set of each of the short-term item initial feature vector sets is performed through a third formula, and the third formula is: , wherein, is a multi-layer graph neural network model, is a set of initial feature vectors of short-term projects, is a set of updated feature vectors of short-term projects; The graph attention aggregation of the updated short-term item feature vectors in each of the updated short-term item feature vector sets is calculated through a fourth formula, and the short-term interest feature vector corresponding to each of the target users is obtained, and the fourth formula is: , wherein , wherein, , , , are all learnable parameters, is a sigmoid activation function, is a short-term interest feature vector, is an updated short-term item feature vector, is a contribution degree, is a total number of updated short-term item feature vectors.
4. The item recommendation method of claim 1, wherein, The process of performing feature fusion analysis on each of the long-term interest feature vectors and the short-term interest feature vectors corresponding to each of the target users to obtain the global feature vector corresponding to each of the target users comprises: Each of the long-term interest feature vectors is mapped through a fifth formula to obtain the mapped long-term interest feature vector corresponding to each of the target users, and the fifth formula is: , wherein, is a mapped long-term interest feature vector, , is a parameter matrix, is a long-term interest feature vector, is a bias term, is a tanh activation function; Each of the short-term interest feature vectors is mapped through a sixth formula to obtain the mapped short-term interest feature vector corresponding to each of the target users, and the sixth formula is: , wherein, is a mapped short-term interest feature vector, , is a parameter matrix, is a short-term interest feature vector, is a bias term, is a tanh activation function; Each of the mapped long-term interest feature vectors and the mapped short-term interest feature vectors corresponding to each of the target users is fused through a seventh formula to obtain the global feature vector corresponding to each of the target users, and the seventh formula is: , wherein , wherein, is a global feature vector, is a gating vector, is a Hadamard product, is a vector concatenation, is a sigmoid activation function, , is a parameter matrix, is a mapped short-term interest feature vector, is a mapped long-term interest feature vector.
5. The item recommendation method according to claim 1 or 2, characterized in that, The process of analyzing the target probability of each of the global feature vectors and the long-term item feature vectors corresponding to each of the target users to obtain the target probability corresponding to each of the target users comprises: The probability score of each of the global feature vectors and the long-term item feature vectors corresponding to each of the target users is calculated through an eighth formula to obtain a plurality of probability scores corresponding to each of the target users, and the plurality of probability scores corresponding to each of the target users are collected to obtain a probability score set corresponding to each of the target users, and the eighth formula is: , wherein, is a probability score, is a global feature vector, is a long-term item feature vector; Each of the probability score sets is normalized to obtain the target probability corresponding to each of the target users.
6. The item recommendation method of claim 1, wherein, The process of calculating the loss value of each of the target probabilities and the real labels corresponding to each of the target users to obtain the loss value corresponding to each of the target users comprises: The loss value of each of the target probabilities and the real labels corresponding to each of the target users is calculated through a ninth formula to obtain the loss value corresponding to each of the target users, and the ninth formula is: , wherein, is a loss value, is a true label, is a target probability, is a vector transpose.
7. An article recommendation apparatus characterized by comprising: It comprises: The data set acquisition module is used for importing the historical long-term interest data set of all target users and the historical short-term interest data set corresponding to each target user from a preset database; The data set preprocessing module is used for data preprocessing of the historical long-term interest data set to obtain a long-term interest data training set; The model training module is used for constructing a training model, training the training model according to the long-term interest data training set and all historical short-term interest data sets, and obtaining a target recommendation model; The model training module is used for constructing a training model, training the training model according to the long-term interest data training set and all historical short-term interest data sets, and obtaining a target recommendation model; The recommendation result obtaining module is configured to import the long-term interest data verification set and the short-term interest data verification set, input the long-term interest data verification set and the short-term interest data verification set into the target recommendation model, and obtain a recommendation result of an item according to the target recommendation model. The long-term interest data training set includes a plurality of long-term interaction record data, a plurality of label data and a plurality of relationship data, and the model training module is specifically configured to: construct a knowledge graph through all the long-term interaction record data, all the label data and all the relationship data, wherein the knowledge graph includes a plurality of target user nodes corresponding to the target user, a target user feature vector to be processed corresponding to each target user node, a plurality of target user directed edges corresponding to each target user node, a plurality of long-term item nodes corresponding to each target user, a long-term item feature vector to be processed corresponding to each long-term item node, and a plurality of long-term item directed edges corresponding to each long-term item node; analyze the long-term interest feature vector for each target user node, the target user feature vector to be processed corresponding to each target user node, and the plurality of target user directed edges corresponding to each target user node, to obtain a long-term interest feature vector corresponding to each target user; analyze the long-term item feature vector for each long-term item node, the long-term item feature vector to be processed corresponding to each long-term item node, and the plurality of long-term item directed edges corresponding to each long-term item node, to obtain a long-term item feature vector corresponding to each long-term item node; analyze the short-term interest feature vector for each historical short-term interest data set, to obtain a short-term interest feature vector corresponding to each target user; analyze the feature fusion for each long-term interest feature vector and the short-term interest feature vector corresponding to each target user, to obtain a global feature vector corresponding to each target user; analyze the target probability for each global feature vector and the plurality of long-term item feature vectors corresponding to each target user, to obtain a target probability corresponding to each target user; import the real label corresponding to each target user, calculate the loss value for each target probability and each real label corresponding to the target user, and obtain a loss value corresponding to each target user; update the parameters of the training model according to the plurality of loss values, and return the data set obtaining module until a preset iteration number is reached, and then use the updated training model as the target recommendation model; In the model training module, the process of analyzing the long-term interest feature vector for each target user node, the target user feature vector to be processed corresponding to each target user node, and the plurality of target user directed edges corresponding to each target user node to obtain a long-term interest feature vector corresponding to each target user includes: respectively, the target user initial feature vectors corresponding to each of the target users are obtained by performing random initialization processing on each of the target user feature vectors to be processed; respectively, the long-term interest feature vectors corresponding to each of the target users are obtained by performing feature aggregation of long-term interest feature vectors on each of the target user nodes, the target user initial feature vectors corresponding to each of the target users, and the plurality of target user directed edges corresponding to each of the target user nodes, the first formula being: , wherein , wherein , , wherein, is a target user node, is a long-term interest feature vector, is a ReLU activation function, , , , , , , , are all learnable parameters, is a target user initial feature vector of a target user node , is a target user neighbor feature vector, is a neighbor node of a target user node , is a target user directed edge, is a set of directed edges whose direction points to a target user node , is an importance score of a neighbor node passed to a target user node , is a message passed from a neighbor node to a target user node in the direction of a directed edge , is a sigmoid activation function, is a softmax function, is a target user initial feature vector of a neighbor node .
8. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 7. When the computer program is executed by the processor, the recommendation method of the article is realized as claimed in any one of claims 1 to 6.