Disclosure of Invention
The invention aims to overcome the defects of the prior art, provides an intelligent recommendation method and device with cooperative precision and diversity, and aims to solve the contradiction between diversity and precision in the prior art.
The method combines static and dynamic attentiveness to adaptively allocate the importance of each layer of information, enhance the capability of capturing local and high-order structural information by the model, alleviate the overcomplete problem existing in deep GNN, 3. Cross-view information fusion weight strategy, grasp the essential attribute of the object from multiple view angles by fusing the category information and the value information of the object, dynamically adjust the importance of different objects, realize finer balance of popular object and long-tail object, 4. Long-tail oriented contrast learning optimization training module, integrate contrast learning into the frame by dynamic sampling and noise disturbance embedded in space, enhance the representation learning capability of the long-tail object, and promote the diversified learning effect. Overall, this approach achieves an excellent tradeoff of recommendation accuracy and diversity.
The first aspect of the invention relates to an intelligent recommendation method with cooperative precision and diversity, which comprises the following steps:
s1, loading a data set containing interaction records of a user and an article;
s2, initializing user and article embedding, and distributing a randomly initialized embedding vector for each user and article, wherein the dimension is d;
s3, constructing a bipartite graph of the user and the article, wherein the user and the article are used as nodes, and the interaction relationship is used as an edge;
s4, screening neighbors of the nodes by using a category-aware neighbor selection strategy to generate a category-balanced neighbor subset;
S5, information aggregation is carried out on neighbor subsets with balanced categories by using a lightweight graph rolling network, multi-layer embedding is carried out by using a layered dynamic attention module for weighting fusion, information of different layers is balanced, and user and article embedding vectors are updated;
S6, adopting a multi-task combined training strategy, adjusting Bayesian personalized loss based on self-adaptive fusion weight, and simultaneously combining main task Bayesian personalized loss and auxiliary task comparison learning to train and optimize;
and S7, calculating the inner product between the user and the article based on the finally trained user embedding and article embedding to obtain the scores of the user on the articles, and selecting K articles with the highest scores as recommendation lists to be presented to the user.
Further, step S4 includes:
The method aims at improving embedding representativeness and diversity in a recommendation system by optimizing a neighbor selection process. The traditional sub-nearest neighbor selection method generally uses a greedy algorithm to maximize the maximum entropy function, the algorithm starts from an empty set S u, i epsilon N u\Su with maximized marginal gain is selected each time, and a diversity nearest neighbor subset is obtained after k steps of greedy selection. This presents a implicit problem in that when categories are severely unbalanced, if greedy strategies are chosen for maximum similarity and representativeness, the model will tend to choose those hot categories that cover more nodes on the similarity measure, since these hot categories occupy the majority of the entire neighborhood Nu, and cold items tend to be ignored relatively speaking because of the smaller marginal gain, which is particularly pronounced when k is smaller. In order to solve the above problem, the method optimizes the original neighbor searching process, introduces a class equalization penalty term to adjust the original maximum entropy function, so that the distribution S u of the selected subset class is as close as possible to the distribution of the neighborhood N u, and the final function is defined as follows:
The higher the function value of the adjusted maximum entropy function f (S u), the more effectively the selected subset can represent the whole neighbor set, and the diversity and the balance of the categories can be maintained. Wherein the method comprises the steps of A penalty term is expressed that reduces the difference between the proportion of the current category in the selected set and the target proportion, and when a popular category node is selected too much, the penalty term increases, weakening the entropy gain of that category, thereby reducing its probability of selection in the next step, and reducing its probability of selection in the next step. sim (i, i ′) represents the similarity between the two terms, and in the method, the mahalanobis distance is used for measuring the similarity between samples, so that after k steps of selection, a diversified and balanced neighbor subset of each user is obtained and used for subsequent information aggregation operation.
Further, step S5 includes:
S51, adopting a lightweight graph convolution LGC as a basic GNN layer, directly aggregating and diversifying information of neighbor nodes, updating embedded representations of users and articles in different layers, wherein a specific embedded updating formula is as follows:
Wherein S u and S i respectively represent neighbor sets of a user u and an article i obtained through category-aware neighbor selection; The normalization factor is used for avoiding overlarge embedded characterization values caused by multiple aggregation operations, controllable uniform disturbance is added in the layer-by-layer information aggregation process, and the generated embedded is stored as an intermediate layer and used as a subsequent comparison learning view.
S52, in the graph neural network, different layers generate embedments by aggregating information from neighbor nodes with different hop counts, and the first layer mainly aggregates information from l-hop neighbors, and the hierarchical aggregation provides opportunities for introducing diversified information from low-order neighbors and high-order neighbors. However, conventional layer attention mechanisms typically rely on static weight assignments, which makes it difficult to adaptively capture Gao Jielin centered diversity information, over-rely on low-order neighbors, and further limit the diversity of the recommendation. In order to overcome the limitation, the method provides a multi-level dynamic perception attention module, comprehensively considers dynamic and static attention, and considers the personalized characteristics and the overall stability of the node from the global and local perspectives. The static attention weight is calculated based on a common layer attention mechanism and is used for measuring the importance of embedding of each layer, and the parameter W Att∈Rd of the attention weight is set, wherein the specific calculation formula is as follows:
The weight calculation of the dynamic attention mechanism is based on the initial embedding e (0) and each layer embedding e (l) of the node, and the hierarchical bias b (l) is combined to capture the personalized characteristics of the node, and the design can reflect the core characteristics of the node more accurately without being interfered by neighbor information. The specific formula is as follows:
Where the function g (x, y, z) = < x, y > +z, the personalization information and the hierarchy information are combined by inner product, and the perceptibility between layers is enhanced by the hierarchy bias. The final attention weight assignment is determined by both static and dynamic weights, and the final embedding of node u (node i is also the same) is expressed as:
The dynamic attention mechanism effectively captures the personalized needs of the nodes, while the static attention mechanism ensures the global stability among layers. Compared with the traditional method, the method effectively relieves the problem that the traditional layer attention mechanism excessively depends on low-order neighbors, improves diversity and information coverage range, and simultaneously relieves the problem of excessive smoothness in deep GNN.
Further, step S6 includes:
S61, fusing article value information and category information on the premise of keeping category weighting and improving long-tail attention, further capturing essential information of the fused article, and calculating final weights of the article fusion value information and the category information;
and S62, adjusting the loss calculation of the main task according to the weight of the article after fusing the value and the category information, guiding and comparing the sample sampling of the learning task based on the weight, and finally carrying out joint optimization training on the main task and the auxiliary task.
Still further, step S61 includes:
Optimizing the average loss of all samples in the recommendation system may ignore long tail categories, resulting in insufficient diversity of recommendation results. To alleviate this problem, conventional strategies typically calculate weights based on categories, assign lower weights to trending categories, assign higher weights to trending categories, and re-weight computational losses, thereby increasing the attention of the model to items of the trending categories, and increasing diversity. However, this "one-shot" approach ignores the difference in items within the category that the existence of otherwise valuable good items in the hot category should not be stressed on a contemporaneous basis, while uneven quality in the cold category, too general computational weighting, may result in unnecessary noise. Therefore, the method provides a weight adjustment strategy for fusing the article type and the value information, and the article value factor v (i) is introduced to further distinguish the similar articles on the premise of improving the long tail attention degree by keeping the type weighting. The model can be helped to jump out of the limitation of the item category information view angle by combining the value information view angle of the item, and further the essential information of the fusion item is captured, so that the accuracy and the diversity are more reasonably weighted. The item value factor v (i), which may be measured by the frequency of user interactions of the item, such as click-through rate, number of purchases, etc. The final weight W opt (i) has the following formula:
Wherein the method comprises the steps of The method is normalized class weight, reflects the scarcity of the class, and is higher as the number of class samples is smaller, v (i) is the interactive value of the object i, such as normalized user click times or purchase times, and alpha is an adjusting parameter used for controlling the influence of the object interactive value on the final weight.
Still further, step S62 includes:
Long tail items are often difficult to adequately capture because of the sparse number of user interactions, resulting in model preference and focusing phenomena on the flowing items. Aiming at the problem, the method introduces a contrast learning task based on the optimization of the main task BPR to improve the uniformity and the robustness of the embedded distribution, thereby enhancing the representation and the capturing capability of the model on long-tail objects. The core idea is to combine a dynamic sampling cooling mechanism to sample subsets on the basis of obtaining class balance weight W opt (i), and focus on cold class or long-tail objects through the contrast learning of uniform noise disturbance, so that the generalization capability and recommendation diversity of the model are improved. Specifically, items are weighted with weights W opt (i) to promote the probability of entry of long-tailed and higher value items when the subset is sampled, while setting a dynamic sampling upper limit for each item. When the sampling frequency of an article in the comparison learning subset reaches the upper limit, the method can reduce the subsequent probability of entering the article or temporarily reject the article from the candidate set. Through the current limiting mechanism, excessive attention given to individual long-tail high-value articles by contrast learning can be prevented, proper global balance of subsets is ensured to be maintained when diversity is improved, and then finer-granularity hierarchical information alignment is realized by means of uniform disturbance noise and cross-layer contrast learning encouragement models. The optimized joint loss function is as follows:
In the method of the invention, not only is the characterization z i of the final layer focused on for a given user-article pair, but the intermediate layer is also embedded Incorporating the contrast target enables model embedding in the representation space to capture more stereoscopic features by implementing contrast learning between multiple levels of embedded representations. And finally, when the loss is calculated, combining a main task (BPR) and Contrast Learning (CL), wherein the main task loss is focused on optimizing the preference sequence of positive and negative samples of a user so as to improve the recommendation accuracy, and the contrast learning loss aims at enhancing the diversity and the robustness of the representation space and improving the capturing capability of long-tail articles. And mu is a balance parameter and is used for controlling the contribution degree of the contrast learning loss in the whole optimization process, and when mu is increased, the influence of contrast learning is increased, so that the representation capability and diversity of long-tail articles are further promoted. Through the combined training mode, the model can be combined with multi-level embedded multi-view signals, so that good performance can be kept on the recommended precision level, and diversity and robustness can be effectively improved.
The second aspect of the invention relates to an intelligent recommendation device of cooperative diversity and accuracy, comprising a memory and one or more processors, wherein executable codes are stored in the memory, and the one or more processors are used for realizing the intelligent recommendation method of cooperative diversity and accuracy of the invention when executing the executable codes.
A third aspect of the present invention relates to a computer readable storage medium having stored thereon a program which, when executed by a processor, implements the intelligent recommendation method of collaborative diversity and accuracy of the present invention.
The method has the innovation points that a class-aware neighbor selection strategy is introduced, equalization and diversification of neighborhood classes are realized through dynamic adjustment of a maximum entropy function, a hierarchical dynamic perception attention mechanism is adopted, information weights of all layers are distributed in a self-adaptive mode, the problem of excessive smoothness of a deep model is effectively solved, a cross-view information fusion strategy is provided by combining object class and value information to optimize weight distribution, a long-tail oriented contrast learning optimization module is designed, and the representation capacity and the diversity learning effect of long-tail objects are enhanced. Through the multi-task combined optimization training, the method breaks through the trade-off limitation of the traditional algorithm between accuracy and diversity, and greatly improves the recommendation quality and user experience.
The method has the advantages that a category-aware neighbor selection strategy, a hierarchical dynamic attention mechanism and a cross-view information fusion strategy are introduced, the trade-off of accuracy and diversity in a recommendation system is optimized, the diversity and individuation of recommended contents are remarkably improved, the Bayesian individuation sequencing is combined with auxiliary tasks comprising long-tail guide comparison learning optimization modules by adopting a multi-task combined training strategy, the representation capacity of long-tail projects and the generalization of models are enhanced, meanwhile, a lightweight graph convolution network is adopted, the calculation complexity is effectively reduced, the training efficiency of the models is improved, the content exploration experience and the platform viscosity of users are remarkably improved while the recommendation accuracy is ensured, and higher technical innovation and application value are presented.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
Example 1
As shown in fig. 1, an intelligent recommendation method with cooperative accuracy and diversity includes the following specific steps:
step S1, loading a data set containing user interaction records with the article
In some embodiments, the disclosed dataset may be obtained from a website such as Kaggle, which typically contains information such as user id, item id, timestamp, etc.;
Step S2, initializing user and article embedding
Based on the loaded data set, an initial embedded vector is generated for each user and item, with the vector dimension set to d. Vector initialization may use a random distribution or pre-trained model, for example, by matrix decomposition methods to generate initial values. These embedded vectors are used to represent features of the user and the item, which will be updated dynamically in response to training. The user-item ID is mapped to a look-up table E (0) of dense vectors, from which the corresponding embedded representation can be derived by indexing, the initial embedded look-up table for the user and item is as follows:
step S3, constructing a user-object bipartite graph
And extracting the relation between the user and the object from the interaction record of the user, and constructing a bipartite graph. The user node and the article node are respectively used as two types of nodes of the bipartite graph, the interaction behavior of the user and the article is used as an edge, and the weight of each edge can be set according to the interaction strength (such as the click times or the purchase frequency).
Step S4, screening neighbors of the nodes by using a category-aware neighbor selection strategy to generate a category-balanced neighbor subset
The invention uses a new class balance neighbor selection strategy to adjust the original neighbor searching process, introduces a class balance punishment item, enables the distribution S u of the selected subset class to be as close as possible to the distribution of the neighborhood N u, measures the diversity through the adjusted maximum entropy function, and defines the final function as follows:
The higher the value of f (S u) function, the more the selected neighbor subset is represented, which not only can effectively represent the whole neighbor set, but also can maintain the diversity and the balance of the categories. Wherein the method comprises the steps of And expressing a penalty term for adjusting the difference between the proportion of the current category in the selected set and the target proportion, wherein when the nodes of the popular category are excessively selected, the penalty term is increased, the entropy gain of the category is weakened, the selection probability of the class in the next step is reduced, the distribution of the finally selected neighbor nodes is enabled to be as close to the initial neighborhood distribution as possible through the function design, and the diversified and balanced neighbor subsets of each user can be obtained through the selection after the adjustment of k steps.
S5, information aggregation is carried out on the neighbor subsets with balanced categories by using a lightweight graph rolling network, and multi-layer embedding is weighted and fused by using a layered dynamic attention module
The lightweight graph convolution LGC is adopted as a basic GNN layer, the information of diversified and balanced neighbor nodes is directly aggregated, the embedded representation of users and objects in different layers is updated, and a specific embedded updating formula is as follows:
wherein S u and S i respectively represent neighbor sets of the user u and the object i obtained through category perception selection, and the aggregation process is that of the category perception information in fig. 1, and meanwhile, uniformly controllable disturbance is added to the embedding to serve as an intermediate layer to be stored and used as a subsequent comparison learning view. In the graph neural network, different layers generate embeddings by aggregating information from neighbor nodes of different hop counts, and the first layer mainly aggregates information from l-hop neighbors. After the LGC obtains embedded representation of aggregation neighbor information of different layers, the method uses a dynamic and static combined attention mechanism, comprehensively considers global and local view angles, and takes the personalized characteristics and the overall stability of the node into consideration. The static attention weight is calculated based on a common layer attention mechanism to measure the importance of each layer of embedding. The dynamic attention mechanism adopts node initial embedding to assist in generating dynamic attention weight, so that the model can consider the essential characteristics and diversity targets of the nodes when multi-layer embedding is aggregated. The specific formula is as follows:
Where the function g (x, y, z) = < x, y > +z, the personalization information and the hierarchy information are combined by inner product, and the perceptibility between layers is enhanced by the hierarchy bias. The final attention weight assignment is determined by both static and dynamic weights, and the final embedding of node u (node i is also the same) is expressed as:
s6, adopting a multi-task combined training strategy, combining the Bayesian personalized loss of the main task and the contrast learning of the auxiliary task to train and optimize
As shown in fig. 2, aiming at the defects existing in category weight calculation, the method provides an adjustment strategy combining the category of the article and the value information, and introduces the value factor v (i) of the article to further divide the category of the article on the premise of keeping the category weight and improving the long tail attention. The item value factor may be calculated based on the frequency of user interactions (e.g., clicks, purchases) of the item, and the adjusted weight W opt (i) may be calculated as:
And adjusting the loss calculation of the main task according to the weight of the article after fusing the value and the category information, and guiding the sample sampling of the comparison learning task based on the weight. In the sampling process, the probability of entry of an article is adjusted according to the weight W opt (i), meanwhile, a dynamic sampling upper limit is set for each article, and when the sampling frequency of an article in the comparison learning subset reaches the upper limit, the subsequent probability of entry is reduced or the article is temporarily removed from the candidate set. Through the current limiting mechanism, excessive attention to individual long-tail high-value articles by contrast learning can be prevented, and proper global balance of subsets is ensured when diversity is improved. Through cross-layer contrast learning, the intermediate layer and the final embedded layer representation of the record retained in step S5 are presented as two different views of the contrast learning, encouraging the model to achieve finer granularity of hierarchical information alignment. And finally, carrying out joint optimization training on the main task and the auxiliary task. The specific loss function is designed as follows:
in the present method, not only is the characterization z i of the final layer focused on for a given user-object pair, but the embedding of the intermediate layer Incorporating the contrast target enables model embedding in the representation space to capture more stereoscopic features by implementing contrast learning between multiple levels of embedded representations. And finally, when the loss is calculated, combining a main task (BPR) and Contrast Learning (CL), wherein the main task loss is focused on optimizing the preference sequence of positive and negative samples of a user so as to improve the recommendation accuracy, and the contrast learning loss aims at enhancing the diversity and the robustness of the representation space and improving the capturing capability of long-tail articles. Through the combined training mode, the model can be combined with multi-level embedded multi-view signals, so that good performance can be kept on the recommended precision level, and diversity and robustness can be effectively improved.
Step S7, calculating the inner product between the user and the object based on the finally trained user embedding and object embedding to obtain the scores of the user on the objects, and recommending the K objects with the highest scores to the user
Finally, the trained embedded representations e u and e i are reserved, the interaction probability between the items can be obtained through inner product calculation, the inner product result represents the relevance score of the user u and the item i, and the higher the score is, the greater the interest degree of the user in the item is. Specifically, for each user u, a set of matching degree scores is obtained by calculating the relevance scores of the user u and all candidate items, a recommendation result is output according to the descending order, K items with the highest scores are usually intercepted and output as a final recommendation result, and the output form of the recommendation result can be an item list or a specific commodity display page.
Example 2
Referring to fig. 3, the present embodiment relates to an intelligent recommendation apparatus for collaborative diversity and accuracy, which includes a memory and one or more processors, wherein executable codes are stored in the memory, and the one or more processors are used for implementing the intelligent recommendation method for collaborative diversity and accuracy of embodiment 1 when executing the executable codes.
Example 3
The present embodiment relates to a computer-readable storage medium having stored thereon a program which, when executed by a processor, implements the intelligent recommendation method of collaborative diversity and accuracy of embodiment 1.
It should be noted that, although the examples described above are illustrative, this is not a limitation of the present invention, and thus the present invention is not limited to the above-described specific embodiments. Other embodiments, which are apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein, are considered to be within the scope of the invention as claimed.