Content recommendation model training method and device, equipment and storage medium

By adopting the recommended loss function based on paired perspective and preset activation function in the recommendation model, the problem of insufficient accuracy and robustness of the existing recommended loss function is solved, and the performance and effect of the recommended model is improved, especially in personality In the recommended scenario.

CN118939872APending Publication Date: 2024-11-12HANGZHOU HIGH-TECH ZONE (BINJIANG) INSTITUTE OF BLOCKCHAIN & DATA SECURITY +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410866125.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

The existing recommendation loss function shows insufficient accuracy and robustness in the recommendation model, resulting in poor recommendation results, especially in the face of distribution drift and noise problems.

Method used

The recommended loss function is constructed based on pairwise perspectives and preset activation functions. By introducing the pairwise score difference of the recommended contents of positive and negative examples, a loss function closer to the evaluation indicators is designed to improve the performance of the recommended model.

Benefits of technology

It improves the accuracy and robustness of the recommendation loss function, enhances the adaptability of the recommendation model to personalized recommendation scenarios, and provides more accurate and robust recommendation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939872A_ABST
    Figure CN118939872A_ABST
Patent Text Reader

Abstract

The invention relates to a training method and device of a content recommendation model, equipment and a storage medium, and the method comprises the steps: obtaining a training sample and an initial recommendation model; the training sample comprises historical interaction data of a plurality of sample users and corresponding recommended contents; predicting the sample users based on the initial recommendation model to obtain a prediction score of each sample user and the corresponding recommendation content; constructing a recommendation loss function based on the paired view angles and a preset activation function; and based on the recommendation loss function, the prediction score and the historical interaction data, training an initial recommendation model to obtain a content recommendation model. Through the method, the recommendation loss function can be constructed based on the paired view angles and the preset activation function, and the performance of the recommendation loss function is improved, so that the recommendation effect of the recommendation model for recommending content to the user is improved, and the problem that the recommendation effect of the recommendation model is poor due to insufficient performance of the recommendation loss function is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a training method, apparatus, device and storage medium for a content recommendation model. Background Art

[0002] With the development of Internet technology, more and more users conduct various activities through online platforms such as e-commerce, streaming media, and social networks. The recommendation system aims to provide personalized recommendations to users and plays a core role in online platforms.

[0003] In practical applications, the recommendation system can achieve high performance and high robustness by designing a suitable recommendation loss function for the recommendation model. On the one hand, the recommendation loss function needs to be used as a proxy loss for the recommendation index, and it needs to ensure that the recommendation model has a sufficiently high accuracy. Lower loss means higher recommendation index. On the other hand, the recommendation loss function needs to ensure that the recommendation model has sufficient robustness to combat the common distribution drift (Out of Distribution, OOD) and noise problems in real recommendation scenarios. The existing recommendation loss function is not accurate enough, which leads to poor recommendation results of the recommendation model.

[0004] There is currently no effective solution to the problem that the recommendation loss function in related technologies has insufficient performance, resulting in poor recommendation results of the recommendation model. Summary of the invention

[0005] Based on this, it is necessary to provide a training method, device, equipment and storage medium for a content recommendation model that can improve the performance of the recommendation loss function to improve the recommendation effect in response to the above technical problems.

[0006] In a first aspect, a method for training a content recommendation model is provided in this embodiment, including:

[0007] Construct a recommendation loss function based on paired perspectives and preset activation functions;

[0008] Acquire training samples and an initial recommendation model; the training samples include historical interaction data between multiple sample users and corresponding recommended content;

[0009] Predicting the sample users based on the initial recommendation model to obtain a prediction score for each sample user and the corresponding recommended content;

[0010] Based on the recommendation loss function, the prediction score and the historical interaction data, the initial recommendation model is trained to obtain a content recommendation model.

[0011] In some embodiments, constructing a recommendation loss function based on paired perspectives and a preset activation function includes:

[0012] Determine positive recommendation content and negative recommendation content among all recommended content;

[0013] Determining a pairwise score difference between the positive example recommendation and the negative example recommendation;

[0014] Based on the pairwise score difference and the preset activation function, the recommendation loss function is constructed.

[0015] In some embodiments, determining the pairwise score difference between the positive example recommendation content and the negative example recommendation content includes:

[0016] Determining a positive example similarity score based on the sample user and the positive example recommended content;

[0017] Determining a negative example similarity score based on the sample user and the negative example recommended content;

[0018] The pairwise score difference is obtained according to the positive example similarity score and the negative example similarity score.

[0019] In some embodiments, the recommendation loss function for:

[0020]

[0021] Among them, u represents the user, Represents a user set, for each user The set of recommended content that interacts with user u is J represents the recommended content set; σ represents the preset activation function; τ represents the temperature coefficient hyperparameter; d uij represents the pairwise score difference, i represents the positive recommendation content, and j represents the negative recommendation content.

[0022] In some embodiments, the type of the preset activation function includes any one of a linear rectification function, a hyperbolic tangent function, and an inverse tangent function.

[0023] In some embodiments, the predicting the sample users based on the initial recommendation model to obtain a prediction score for each sample user and the corresponding recommended content includes:

[0024] Based on the initial recommendation model and the historical interaction data, feature extraction is performed on the sample user and the recommended content to obtain a user embedding vector and a recommended content embedding vector respectively;

[0025] The user embedding vector and the recommended content embedding vector are predicted based on the initial recommendation model to obtain the prediction score.

[0026] In some of the embodiments, it also includes:

[0027] Responding to user access requests;

[0028] Based on the content recommendation model, obtaining predicted scores of the user and the recommended content;

[0029] Based on the predicted score, a recommendation result is returned from the recommended content, and the recommendation result is displayed to the user.

[0030] In a second aspect, a training device for a content recommendation model is provided in this embodiment, including:

[0031] An acquisition module is used to acquire training samples and an initial recommendation model; the training samples include historical interaction data between multiple sample users and corresponding recommended content;

[0032] A processing module, configured to predict the sample users based on the initial recommendation model, and obtain a prediction score for each sample user and the corresponding recommended content;

[0033] A training module is used to construct a recommendation loss function based on paired perspectives and a preset activation function; based on the recommendation loss function, the predicted score and the historical interaction data, the initial recommendation model is trained to obtain a content recommendation model.

[0034] In a third aspect, a computer device is provided in this embodiment, 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 training method of the content recommendation model described in the first aspect is implemented.

[0035] In a fourth aspect, a storage medium is provided in this embodiment, on which a computer program is stored, and when the program is executed by a processor, the training method of the content recommendation model described in the first aspect above is implemented.

[0036] Compared with the related art, the training method, device, equipment and storage medium of the content recommendation model provided in this embodiment obtains training samples and an initial recommendation model; the training samples include historical interaction data of multiple sample users and corresponding recommended content; the sample users are predicted based on the initial recommendation model to obtain the predicted score of each sample user and the corresponding recommended content; the recommendation loss function is constructed based on paired perspectives and preset activation functions; the initial recommendation model is trained based on the recommendation loss function, the predicted score and the historical interaction data to obtain a content recommendation model. Through this embodiment, a recommendation loss function can be constructed based on paired perspectives and preset activation functions to improve the performance of the recommendation loss function, thereby improving the recommendation effect of the recommendation model in recommending content to users, and solving the problem that the recommendation loss function performance is insufficient, resulting in poor recommendation effect of the recommendation model.

[0037] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0039] Figure 1 is a hardware structure block diagram of a terminal of a content recommendation model training method in an embodiment;

[0040] Figure 2 is a flowchart of a method for training a content recommendation model in an embodiment;

[0041] Figure 3 is a comparison diagram of different preset activation functions in an embodiment;

[0042] Figure 4 is a comparison chart of the recommended loss functions PSL-tanh, PSL-relu, and PSL-atan and the existing SL loss function in an embodiment;

[0043] Figure 5 is a flowchart of a content recommendation method in an embodiment;

[0044] Figure 6 The structure block diagram of a training device for a content recommendation model in an embodiment.

[0045] In the figure: 102, processor; 104, memory; 106, transmission device; 108, input and output device; 10, acquisition module; 20, processing module; 30, training module. DETAILED DESCRIPTION

[0046] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.

[0047] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the", "these" and the like in this application do not represent quantitative restrictions, and they can be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. Usually, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0048] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, Figure 1 is a hardware structure block diagram of a terminal of the content recommendation model training method in this embodiment. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 and memory 104 for storing data, wherein processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA. The above terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0049] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the training method of the content recommendation model in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0050] The transmission device 106 is used to receive or send data via a network. The above network includes a wireless network provided by the communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.

[0051] With the development of Internet technology, more and more users conduct various activities through online platforms such as e-commerce, streaming media, and social networks. The recommendation system aims to provide personalized recommendations to users and plays a core role in online platforms.

[0052] In practical applications, the recommendation system can achieve high performance and high robustness by designing a suitable recommendation loss function for the recommendation model. On the one hand, the recommendation loss function needs to be used as a proxy loss for the recommendation index, and it needs to ensure that the recommendation model has a sufficiently high accuracy. A lower loss means a higher recommendation index. On the other hand, the recommendation loss function needs to ensure that the recommendation model has sufficient robustness to combat the common distribution drift (OOD) and noise problems in real recommendation scenarios. Existing recommendation loss functions mainly include single-point losses (PL) such as BCE (Binary Cross-Entropy Loss), MSE (Minimum Classification Errorloss), pairwise losses (PL) such as BPR (Bayesian Personalized Ranking), and Softmax Loss (SL). Their accuracy and robustness are insufficient, which leads to poor recommendation effects of the recommendation model.

[0053] In this embodiment, a training method for a content recommendation model is provided. Figure 2 is a flow chart of the training method of the content recommendation model in this embodiment. Figure 2 As shown, the method comprises the following steps:

[0054] Step S210, obtaining training samples and an initial recommendation model; the training samples include historical interaction data between a plurality of sample users and corresponding recommended content.

[0055] Specifically, in this embodiment, historical interaction data between sample users and recommended content in the content recommendation scenario is obtained as training samples. Sample users can be users of Internet application platforms. For example, if the application platform is an e-commerce shopping platform, sample users can be users who use the e-commerce shopping platform to shop, and the recommended content is commodities; for example, if the application platform is a social platform, sample users can be users of the social platform, and the recommended content is content posted on the social platform.

[0056] Historical interaction data can be the usage data of sample users on the application platform, which is in the form of data pairs of users and recommended content, indicating that users have interacted with recommended content. For example, it represents the historical interaction data between sample users and recommended products on e-commerce shopping platforms, including but not limited to clicks, browsing, favorites, orders, consultations, etc.; for example, the historical interaction data between sample users and recommended content on social platforms, including but not limited to clicks, browsing, favorites, comments, etc. In addition, the training samples can also include basic information such as the age and gender of the sample users, as well as the attributes, tags, and other information of the recommended content.

[0057] The initial recommendation model is pre-built. The initial recommendation model can be a collaborative filtering model, a recommendation model based on graph neural network, etc. The collaborative filtering model uses the commonly used matrix factorization (MF) as the backbone network. The recommendation model based on graph neural network can use LightGCN (Light Graph Convolutional Network), XSimGCL (eXtremely Simple Graph Contrastive Learning), etc.

[0058] Step S220 , predicting the sample users based on the initial recommendation model, and obtaining a prediction score for each sample user and the corresponding recommended content.

[0059] Specifically, the sample users are input into the initial recommendation model, and features of the sample users and all recommended contents on the application platform are extracted in the initial recommendation model. The sample users and all recommended contents are mapped to embedding vectors of the same dimension. The embedding vectors can be used as representations of the sample users and recommended contents in the feature space.

[0060] Based on the embedding vectors of the sample user and all the recommended content, the prediction scores of each sample user and the corresponding recommended content are calculated respectively. The prediction score is used to measure the relevance or similarity between the sample user and each recommended content, which can be a similarity score. For example, when the recommended content is a product, the prediction score of each sample user and the corresponding recommended content can be understood as the sample user's interest in the product. The higher the prediction score, the higher the sample user's interest in the product.

[0061] Step S230: construct a recommendation loss function based on paired perspectives and a preset activation function.

[0062] Specifically, DCG (Discounted Cumulative Gain) and MRR (Mean Reciprocal Rank) are the most commonly used evaluation indicators to measure the accuracy of the recommendation model. Since it may be difficult to optimize the evaluation indicator directly (for example, the evaluation indicator is not differentiable and the calculation complexity is high), a function related to the evaluation indicator and with better mathematical properties can be used as a substitute, namely, the proxy loss function. The proxy loss function is used as a substitute for the evaluation indicator. Training to minimize the proxy loss is equivalent to maximizing the DCG indicator, thereby ensuring the accuracy of the recommendation model.

[0063] The commonly used Softmax loss function (SL) is a proxy loss function for the DCG evaluation index, which usually has high accuracy. However, the Softmax loss function uses an exponential function to approximate the step function in the DCG index. On the one hand, it causes obvious errors when the similarity difference between positive examples, negative examples and users is large, which will lead to a decrease in the accuracy of the loss function. On the other hand, the exponential function makes the loss function very sensitive to noise, making it difficult to adapt to the widespread false negative samples in personalized recommendation scenarios, which will affect the performance of the loss function.

[0064] In this embodiment, a recommendation loss function is constructed based on a paired perspective and a preset activation function. A paired item of the predicted score of the positive recommended content and the negative recommended content can be introduced into the recommendation loss function, wherein the positive recommended content is the recommended content that the sample user is interested in, and the negative recommended content is the recommended content that the sample user is not interested in. In this way, the recommendation loss function can directly focus on the partial order relationship between the positive recommended content and the negative recommended content, better learn the recommended content that is more relevant to the user, and is more suitable for ranking learning in the recommendation scenario. On the basis of the paired perspective, by designing a reasonable preset activation function, the constructed recommendation loss function is made closer to the evaluation index to improve the performance of the recommendation loss function.

[0065] Step S240, based on the recommendation loss function, the prediction score and the historical interaction data, the initial recommendation model is trained to obtain a content recommendation model.

[0066] Specifically, based on the recommendation loss function, the recommendation loss between the predicted score of the recommended content and the actual score in the historical interaction data is calculated. The predicted score includes the predicted scores of the positive recommended content and the negative recommended content. Based on the recommendation loss calculated each time, the initial recommendation model is trained until the recommendation loss function converges or the maximum number of training rounds is reached, and the content recommendation model is obtained. By maximizing the predicted score of the positive recommended content and minimizing the predicted score of the negative recommended content during the training process, the model can continuously optimize its recommendation effect.

[0067] The recommendation loss function is used as a proxy loss for the evaluation index to guide the training and optimization of the model. The model parameters are optimized by minimizing the recommendation loss function, maximizing the model's evaluation index, that is, maximizing the predicted score of the positive recommendation content and minimizing the predicted score of the negative recommendation content. The model can continuously optimize its recommendation effect, and in the personalized recommendation scenario, the personalized recommendation results for users are more accurate. Optionally, during the training of the content recommendation model, the Adam optimizer is used to update the model parameters to adaptively learn the learning rate of each model parameter and accelerate the optimization process, including setting the temperature coefficient hyperparameters of the Adam optimizer, such as the learning rate and the L2 regularization coefficient (weight decay).

[0068] The above steps are performed by obtaining training samples and an initial recommendation model; the training samples include historical interaction data between multiple sample users and corresponding recommended content; a recommendation loss function is constructed based on a paired perspective and a preset activation function; sample users are predicted based on the initial recommendation model to obtain a predicted score between each sample user and the corresponding recommended content; the initial recommendation model is trained based on the recommendation loss function, the predicted score and the historical interaction data to obtain a content recommendation model. Through this embodiment, a recommendation loss function is constructed based on a paired perspective and a preset activation function, and paired items of positive recommended content and negative recommended content can be introduced into the recommendation loss function, and a more reasonable preset activation function can be designed to make the recommendation loss function closer to the evaluation index of the recommendation model, thereby improving the performance and recommendation effect of the recommendation model, especially in a personalized recommendation scenario, providing users of the application platform with more interesting recommended content, solving the problem of insufficient performance of the recommendation loss function, resulting in poor recommendation effect of the recommendation model.

[0069] The content recommendation model training method provided in the embodiment of the present application can be applied to artificial intelligence technology. For example, a content recommendation model is provided for application scenarios such as e-commerce platforms, streaming media, and social platforms, and the content recommendation model is used to predict recommended content that users may be interested in, such as products, tweets, tourist attractions, etc.

[0070] In some embodiments, constructing a recommendation loss function based on paired viewpoints and a preset activation function in step S230 includes the following steps:

[0071] Step S231: determining positive recommended content and negative recommended content from all recommended content.

[0072] Specifically, for all recommended content on the application platform, positive recommended content is recommended content that sample users are interested in, that is, recommended content that has been interacted with in the historical interaction data of the training samples, and negative recommended content is recommended content that sample users are not interested in, that is, unobserved interactions that do not appear in the historical interaction data.

[0073] Step S232: determining the pairwise score difference between the positive example recommended content and the negative example recommended content.

[0074] Specifically, by extracting features from the sample users and all the recommended content on the application platform in the initial recommendation model, the sample users and all the recommended content are mapped to embedding vectors of the same dimension, and the prediction scores of each sample user and the corresponding recommended content are calculated based on the embedding vectors of the sample users and all the recommended content. The prediction scores include the prediction scores of the positive recommended content and the negative recommended content, and the pairwise score difference is determined based on the prediction scores of the positive recommended content and the negative recommended content. The prediction score can be the similarity score of the sample user and the recommended content, and the similarity score is specifically determined based on the cosine similarity of the embedding vectors of the sample user and the recommended content.

[0075] Step S233: construct a recommendation loss function based on the pairwise score difference and the preset activation function.

[0076] Specifically, a pair of predicted scores of positive and negative recommended content, i.e., paired score difference, is introduced into the recommendation loss function, where positive recommended content is the recommended content that the sample user is interested in, and negative recommended content is the recommended content that the sample user is not interested in. In this way, the recommendation loss function can directly focus on the relationship between positive and negative recommended content, and better learn recommended content that is more relevant to the user. Based on the paired perspective, by designing a reasonable preset activation function and replacing the exponential function in the existing Softmax loss function, the constructed recommendation loss function is closer to the evaluation index, so as to improve the performance of the recommendation loss function.

[0077] By constructing a recommendation loss function based on paired perspectives and preset activation functions in this application, and replacing the existing exponential function with a preset activation function, the constructed recommendation loss function is made closer to the evaluation index to improve the performance of the recommendation loss function, and the recommendation model is made to clearly identify positive and negative recommended content, so that better learning can be performed and the performance of the content recommendation model can be improved.

[0078] In some embodiments, determining the pairwise score difference between the positive example recommended content and the negative example recommended content in step S232 includes the following steps:

[0079] According to the sample user and the positive example recommended content, the positive example similarity score is determined; according to the sample user and the negative example recommended content, the negative example similarity score is determined; according to the positive example similarity score and the negative example similarity score, the pairwise score difference is obtained.

[0080] Specifically, by extracting features from the sample user and all the recommended content on the application platform in the initial recommendation model, the sample user and all the recommended content are mapped to embedding vectors of the same dimension. Based on the embedding vectors of the sample user and the positive recommended content, the cosine similarity between the embedding vectors is calculated to determine the positive similarity score. Based on the embedding vectors of the sample user and the negative recommended content, the cosine similarity between the embedding vectors is calculated to determine the negative similarity score. Based on the calculated difference between the positive similarity score and the negative similarity score, the pairwise score difference is obtained.

[0081] The following are the pairwise score differences d uij An expression of:

[0082] d uij =f(u,j)-f(u,i);

[0083] Among them, u represents the user, i represents the positive example recommended content, and j represents the negative example recommended content; f(u, j) represents the negative example similarity score, and f(u, i) represents the positive example similarity score.

[0084] Optionally, the cosine similarity between the embedding vectors of the sample user and the recommended content may be scaled, and the scaled cosine similarity may be used as a similarity score to facilitate calculation.

[0085] By determining the pairwise score difference according to the similarity scores between the sample user and the recommended content in this embodiment, the pairwise score difference can be used as a pairwise item in the recommendation loss function to improve the performance of the recommendation loss function.

[0086] In some of the embodiments, the recommended loss function in the above embodiments is for:

[0087]

[0088] Among them, u represents the user, Represents a user set, for each user The set of recommended content that interacts with user u is J represents the recommended content set; σ represents the preset activation function; τ represents the temperature coefficient hyperparameter; d uij represents the pairwise score difference, i represents the positive recommendation content, and j represents the negative recommendation content.

[0089] Specifically, the paired perspective-based recommendation loss function (Pairwise SoftmaxLoss, PSL) defined in this embodiment introduces a paired perspective through the paired score difference between the positive example recommendation content and the negative example recommendation content, and generalizes the Softmax loss function.

[0090] In some of the embodiments, the type of the preset activation function includes any one of a linear rectification function (relu), a hyperbolic tangent function (tanh), and an inverse tangent function (arctan).

[0091] Specifically, the preset activation function includes paired score differences. The expressions of three preset activation functions σ are given in Table 1 below, where PSL-tanh, PSL-relu, and PSL-atan in the left column of Table 1 represent recommended loss functions for selecting different preset activation functions, and the right column of Table 1 are preset activation functions set according to the linear rectification function (relu), the hyperbolic tangent function (tanh), and the inverse tangent function (arctan), respectively.

[0092] Table 1:

[0093] PSL Activation function σ PSL-tanh <![CDATA[σ Atan =tanh(d uij )+1]]> PSL-relu <![CDATA[σ Relu =ReLU(d uij +1)<!-- 7 --> ]]> PSL-atan <![CDATA[σ Tanh =arctan(d uij )+1]]>

[0094] The following describes the performance of various aspects of the preset activation function:

[0095] By properly choosing the activation function σ, the above recommended loss function PSL can be a DCG proxy loss that is tighter than SL. The following formula proves that when σ is the upper bound approximation function of the Heaviside step function δ(·), PSL is the proxy loss for the DCG and MRR indicators:

[0096]

[0097] Among them, u represents the user, DCG(u) represents the DCG proxy loss; for each user The set of recommended content that interacts with user u is Represents the recommendation loss function. This formula indicates that minimizing the recommendation loss function is equivalent to maximizing the indicator DCG. Therefore, the above recommendation loss function can be used as a proxy loss for the evaluation indicator DCG.

[0098] Figure 3 is a comparison diagram of different preset activation functions in this embodiment, such as Figure 3 As shown, the horizontal axis represents the pairwise score difference d uij , the vertical axis represents the preset activation function σ, and the different colors from top to bottom in the legend represent the step function δ(·), the expected function exp(·), and the preset activation function σ in this embodiment. Tanh , σ Relu , σ Atan It can be seen that the preset activation function approximates the Heaviside step function δ(·) more closely than the expected function exp(·). Correspondingly, the recommended loss function in this embodiment also better approaches the evaluation index.

[0099] By properly selecting the activation function, the above-mentioned recommended loss function PSL can readjust the gradient weight distribution to improve the robustness to noise. Specifically, the recommended loss function PSL should reduce the noise samples (e.g., d uij When the paired score difference is large, it can be regarded as a noise sample, that is, a false negative sample), thereby improving the sensitivity and robustness.

[0100] Figure 4 is a comparison chart of the recommended loss functions PSL-tanh, PSL-relu, and PSL-atan in this embodiment and the existing SL loss function, such as Figure 4 As shown, the horizontal axis represents the pairwise score difference d uij , the ordinate represents the gradient of the recommendation loss function with respect to the pairwise score difference The different colors from top to bottom in the legend represent the SL loss function, and in this embodiment, σ Tanh , σ Relu , σ Atan As the recommended loss functions of the preset activation functions, PSL-tanh, PSL-relu, and PSL-atan, it can be seen that the recommended loss function in this embodiment can significantly reduce the gradient weight of false negative samples, thereby improving the robustness to noise.

[0101] The recommended loss function PSL is a DRO (Distributionally Robust Optimization) extension of the BPR loss function, which has robustness against OOD (distribution drift). Specifically, PSL can be interpreted as a loss function that applies distributed robust optimization (DRO) under KL (Kullback-Leibler Divergence) divergence to the pairwise loss BPR.

[0102] Finally, the recommended loss function PSL does not require the introduction of any additional parameters or temperature coefficient hyperparameters. Its computational complexity is consistent with the existing SL loss and has higher training and inference efficiency.

[0103] The recommendation loss function constructed in this embodiment is closer to the evaluation indicators (DCG, MRR, etc.) and has higher accuracy. Compared with the existing exponential function as the activation function in the loss function, it can effectively alleviate the sensitivity to noise samples (such as false negative samples), that is, it adjusts the distribution of gradient weights, so that the gradient of noise samples is reduced, the noise resistance is stronger, more robust, and it will not increase the computational complexity, effectively improving the performance of the recommendation loss function in all aspects.

[0104] After testing on multiple open source datasets (Amazon-Book, Amazon-CD, Amazon-Electronic, Amazon-Movie, Gowalla, Yelp2018), the recommendation performance evaluation indicators Recall@20 (recall rate) and NDCG@20 (normalized discounted cumulative gain) were calculated. The recommendation loss function PSL has improved performance in accuracy, robustness and noise resistance compared to the SL loss function, which can improve the recommendation effect of the content recommendation model in practical application scenarios such as personalized recommendation.

[0105] In some embodiments, the step S220 predicts the sample users based on the initial recommendation model to obtain the prediction score of each sample user and the corresponding recommended content, including the following steps:

[0106] Step S221, based on the initial recommendation model and historical interaction data, feature extraction is performed on sample users and recommended content to obtain user embedding vectors and recommended content embedding vectors respectively;

[0107] Step S222: predict the user embedding vector and the recommended content embedding vector based on the initial recommendation model to obtain a prediction score.

[0108] Specifically, by extracting features of sample users and all recommended contents on the application platform in the initial recommendation model, the sample users and all recommended contents are mapped into embedding vectors of the same dimension, and user embedding vectors and recommended content embedding vectors are obtained respectively. The embedding vectors can be used as representations of sample users and recommended contents in the feature space.

[0109] Based on the initial recommendation model, the user embedding vector and the recommended content embedding vector are predicted to obtain the predicted score of each sample user and the corresponding recommended content. The predicted score can be a similarity score, which indicates the relevance between each user and each recommended content, so as to distinguish the recommended content that the user is interested in and the recommended content that the user is not interested in. For example, when the recommended content is a product, the predicted score of each sample user and the corresponding recommended content can be understood as the sample user's interest in the product. The higher the predicted score, the higher the sample user's interest in the product.

[0110] In this embodiment, the prediction score is obtained through the initial recommendation model, and the recommendation loss of each round can be calculated according to the prediction score, so as to train the model.

[0111] In some of the embodiments, applying the above content recommendation model to a personalized recommendation scenario further includes the following steps:

[0112] Respond to the user's access request; based on the content recommendation model, obtain the predicted score of the user and the recommended content; based on the predicted score, return the recommendation result from the recommended content, and display the recommendation result to the user.

[0113] Specifically, when a user logs in or accesses the application platform, the application platform responds to the user's access request and calculates the predicted score between the user and all recommended content based on the content recommendation model. The predicted score can specifically be a similarity score to represent the correlation between the user and the recommended content.

[0114] Based on the predicted score, the recommendation results are returned from all the recommended contents and displayed to the user on the page of the application platform. For each user, each recommended content has a corresponding predicted score. Optionally, all the recommended contents are sorted based on the predicted score, and a certain number of recommended contents are selected as the recommended results to be displayed to the user, so as to provide personalized content recommendations for the user. For example, if the application platform is an e-commerce shopping platform, the recommended content is commodities, and the recommended results finally displayed to the user are commodities with a high degree of interest to the user; for example, if the application platform is a social platform, the recommended content is the content posted on the social platform, and the recommended results finally displayed to the user are media content, tweets, etc. with a high degree of interest to the user.

[0115] By applying the above content recommendation model to the personalized recommendation scenario in this embodiment, the accuracy and effect of personalized recommendation can be improved, more content of interest to users can be provided, and the user experience can be improved.

[0116] Taking the application of the above content recommendation model to the product recommendation scenario of an e-commerce website as an example, the user is a user who logs in to the e-commerce website.

[0117] Responding to user access requests;

[0118] By training a complete content recommendation model, we extract features of users and all products on e-commerce websites, and obtain the user embedding vector of users and the recommended content embedding vector of all products respectively;

[0119] Calculate the prediction score between the user's user embedding vector and the recommended content embedding vectors of all items, that is, cosine similarity;

[0120] Based on the predicted score of each product, all products are sorted, and a certain number of products with higher predicted scores are selected as recommendation results and displayed to users.

[0121] The present embodiment is described and illustrated below through preferred embodiments.

[0122] Figure 5 is a flow chart of the content recommendation method in this embodiment. Figure 5As shown, the method comprises the following steps:

[0123] Step S510, obtaining training samples and an initial recommendation model; the training samples include historical interaction data between a plurality of sample users and corresponding recommended content.

[0124] Step S520: predicting the sample users based on the initial recommendation model to obtain a prediction score for each sample user and the corresponding recommended content.

[0125] Step S530, determining the positive similarity score according to the predicted scores of the sample user and the positive recommended content; determining the negative similarity score according to the predicted scores of the sample user and the negative recommended content; and obtaining the pairwise score difference according to the positive similarity score and the negative similarity score.

[0126] Step S540: construct a recommendation loss function based on the pairwise score difference and the preset activation function.

[0127] The preset activation function includes any one of a linear rectification function, a hyperbolic tangent function, and an inverse tangent function.

[0128] Step S550: Based on the recommendation loss function, the prediction score and the historical interaction data, an initial recommendation model is trained to obtain a content recommendation model.

[0129] Step S560, in response to the user's access request to the application platform, obtaining a predicted score of the user and the recommended content based on the content recommendation model;

[0130] Step S570: Return the recommendation result from the recommended content based on the predicted score, and display the recommendation result to the user.

[0131] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in a different order than here. For example, the training process of the content recommendation model can be completed in advance.

[0132] In this embodiment, a training device for a content recommendation model is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. The terms "module", "unit", "sub-unit", etc. used below can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and conceivable.

[0133] Figure 6 is a structural block diagram of the training device of the content recommendation model of this embodiment, such as Figure 6 As shown, the device comprises:

[0134] The acquisition module 10 is used to acquire training samples and an initial recommendation model; the training samples include historical interaction data between multiple sample users and corresponding recommended content;

[0135] The processing module 20 is used to predict the sample users based on the initial recommendation model to obtain the prediction score of each sample user and the corresponding recommended content;

[0136] The training module 30 is used to construct a recommendation loss function based on paired perspectives and a preset activation function; based on the recommendation loss function, the predicted score and the historical interaction data, the initial recommendation model is trained to obtain a content recommendation model.

[0137] Through the device provided in this embodiment, a recommendation loss function is constructed based on paired perspectives and preset activation functions, and paired items of positive recommended content and negative recommended content can be introduced into the recommendation loss function. In addition, a more reasonable preset activation function is designed to make the recommendation loss function closer to the evaluation index of the recommendation model, thereby improving the performance and recommendation effect of the recommendation model, especially in personalized recommendation scenarios, providing users of the application platform with more interesting recommended content, and solving the problem of insufficient performance of the recommendation loss function, which leads to poor recommendation effect of the recommendation model.

[0138] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0139] In this embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0140] Optionally, the computer device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0141] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and will not be repeated in this embodiment.

[0142] In addition, in combination with the training method of the content recommendation model provided in the above embodiments, a storage medium may also be provided in this embodiment to implement the content recommendation model. The storage medium stores a computer program; when the computer program is executed by a processor, the content recommendation model training method of any one of the above embodiments is implemented.

[0143] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0144] It should be understood that the specific embodiments described herein are only used to explain the application, rather than to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of this application.

[0145] Obviously, the drawings are only some examples or embodiments of the present application. For ordinary technicians in the field, the present application can also be applied to other similar situations based on these drawings without creative work. In addition, it is understandable that although the work done in this development process may be complicated and lengthy, for ordinary technicians in the field, certain changes in design, manufacturing or production based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient content disclosed in this application.

[0146] The term "embodiment" in this application refers to a specific feature, structure or characteristic described in conjunction with the embodiment that can be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. It is clearly or implicitly understood by those of ordinary skill in the art that the embodiments described in this application can be combined with other embodiments without conflict.

[0147] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the scope of protection of the present application. Therefore, the scope of protection of the present application shall be subject to the attached claims.

Claims

1. A training method for a content recommendation model, It is characterized in that include: Obtain training samples and initial recommendation models; The training samples include historical interaction data between multiple sample users and corresponding recommended content; Predicting the sample users based on the initial recommendation model to obtain a prediction score for each sample user and the corresponding recommended content; Construct a recommendation loss function based on paired perspectives and preset activation functions; Based on the recommendation loss function, the prediction score and the historical interaction data, the initial recommendation model is trained to obtain a content recommendation model.

2. The method for training a content recommendation model according to claim 1, It is characterized in that The construction of the recommendation loss function based on paired perspectives and a preset activation function includes: Determine positive recommendation content and negative recommendation content among all recommended content; Determining a pairwise score difference between the positive example recommendation and the negative example recommendation; Based on the pairwise score difference and the preset activation function, the recommendation loss function is constructed.

3. The training method of the content recommendation model according to claim 2, It is characterized in that The determining the pairwise score difference between the positive example recommended content and the negative example recommended content includes: Determining a positive example similarity score based on the sample user and the positive example recommended content; Determining a negative example similarity score based on the sample user and the negative example recommended content; The pairwise score difference is obtained according to the positive example similarity score and the negative example similarity score.

4. The training method of the content recommendation model according to claim 1, It is characterized in that The recommendation loss function for: Among them, u represents the user, Represents a user set, for each user The set of recommended content that interacts with user u is J represents the recommended content set; σ represents the preset activation function; τ represents the temperature coefficient hyperparameter; d uij represents the pairwise score difference, i represents the positive recommendation content, and j represents the negative recommendation content.

5. The method for training a content recommendation model according to any one of claims 1 to 4, It is characterized in that The type of the preset activation function includes any one of a linear rectification function, a hyperbolic tangent function, and an inverse tangent function.

6. The method for training a content recommendation model according to claim 1, It is characterized in that The predicting the sample users based on the initial recommendation model to obtain a prediction score of each sample user and the corresponding recommended content includes: Based on the initial recommendation model and the historical interaction data, feature extraction is performed on the sample user and the recommended content to obtain a user embedding vector and a recommended content embedding vector respectively; The user embedding vector and the recommended content embedding vector are predicted based on the initial recommendation model to obtain the prediction score.

7. The method for training a content recommendation model according to claim 1, It is characterized in that Also includes: Responding to user access requests; Based on the content recommendation model, obtaining predicted scores of the user and the recommended content; Based on the predicted score, a recommendation result is returned from the recommended content, and the recommendation result is displayed to the user.

8. A training device for a content recommendation model, It is characterized in that include: An acquisition module is used to obtain training samples and initial recommendation models; The training samples include historical interaction data between multiple sample users and corresponding recommended content; A processing module, configured to predict the sample users based on the initial recommendation model, and obtain a prediction score for each sample user and the corresponding recommended content; A training module is used to construct a recommendation loss function based on paired perspectives and a preset activation function; based on the recommendation loss function, the predicted score and the historical interaction data, the initial recommendation model is trained to obtain a content recommendation model.

9. A computer device comprising a memory and a processor, It is characterized in that A computer program is stored in the memory, and the processor is configured to run the computer program to execute the content recommendation model training method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the content recommendation model training method described in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Natural gas demand prediction method and system based on comparative learning

    CN120046773A