Resource recommendation model training method, resource recommendation method, device and equipment
By adding noise to the resource recommendation model and combining user preference information for denoising processing, the problems of singleness and insufficient accuracy of resource recommendation in the existing technology are solved, and more accurate and diversified resource recommendation is achieved.
Patent Information
- Application Number
- CN202410705186.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-23
AI Technical Summary
Existing resource recommendation models cannot accurately capture the diversity of user interests, resulting in recommended resources that are too single and inaccurate, and cannot effectively handle resources that users interact less but are actually interested in.
By adding noise to the initial characteristics of the sample resources, denoising is performed based on the user's multiple resource preference information, the loss is calculated and the model is trained, and a target resource recommendation model is generated to improve the diversity and accuracy of resource recommendation.
The resource recommendation model can better capture user preferences, recommend more diverse, richer resources that are in line with user preferences, and improve the accuracy of recommendations.
Smart Images

Figure CN118535801A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a training method for a resource recommendation model, a resource recommendation method, a device and equipment. Background Art
[0002] With the development of computer technology, the promotion method of recommending resources to users through the Internet has become increasingly popular. For example, food delivery platforms recommend meals to users, multimedia platforms recommend videos to users, shopping platforms recommend clothes to users, etc. How to accurately recommend resources to users is the focus of research in this field.
[0003] In the related art, a discriminant paradigm is usually adopted. That is, through a resource recommendation model, one or more fixed dense vectors are determined to represent the user according to the resources with which the user interacts more, so as to automatically generate personalized resource recommendations for the user using these vectors.
[0004] However, in the above technical solution, as long as the user input to the model remains unchanged, the output recommended resources are also certain, which limits the diversity of user interests and cannot accurately grasp the potential distribution of user interests. For example, some resources may have less interaction with users due to exposure bias, but this does not mean that the resource is not of interest to the user. Therefore, the recommended resources in the above technical solution are relatively single and not accurate enough. Summary of the invention
[0005] The present disclosure provides a resource recommendation model training method, resource recommendation method, device and equipment, which are conducive to the resource recommendation model to recommend more diverse, rich and target-oriented resources. The technical solution of the present disclosure is as follows:
[0006] According to one aspect of an embodiment of the present disclosure, a method for training a resource recommendation model is provided, comprising:
[0007] By using the initial resource recommendation model, adding noise to a first resource feature of a sample resource to obtain a second resource feature of the sample resource, wherein the sample resource is a resource with which the sample object has interacted, and the first resource feature is used to represent the content of the sample resource;
[0008] Based on multiple resource preference information of the sample object, denoising the second resource feature to obtain a third resource feature of the sample resource, wherein the multiple resource preference information is used to represent multiple resource types preferred by the sample object;
[0009] Determine a first loss according to the first resource feature and the third resource feature, where the first loss is used to represent the difference between the resource generated by the initial resource recommendation model and the real resource;
[0010] Based on the first loss, the initial resource recommendation model is trained to obtain a target resource recommendation model for recommending resources.
[0011] According to one aspect of an embodiment of the present disclosure, a resource recommendation method is provided, including:
[0012] Inputting Gaussian noise into a target resource recommendation model, and performing denoising processing on the Gaussian noise based on multiple resource preference information of an object to obtain resource features, wherein the target resource recommendation model is trained based on the training method of the resource recommendation model, the multiple resource preference information is used to represent multiple resource types corresponding to the object, and the resource features are used to represent the characteristics of the resources preferred by the object;
[0013] Based on the resource characteristics, recommend resources to the object.
[0014] According to another aspect of an embodiment of the present disclosure, a training device for a resource recommendation model is provided, comprising:
[0015] A first processing unit is configured to add noise to a first resource feature of a sample resource through an initial resource recommendation model to obtain a second resource feature of the sample resource, wherein the sample resource is a resource that a sample object has interacted with, and the first resource feature is used to represent content of the sample resource;
[0016] A second processing unit is configured to perform denoising processing on the second resource feature based on multiple resource preference information of the sample object to obtain a third resource feature of the sample resource, wherein the multiple resource preference information is used to represent multiple resource types corresponding to the sample object;
[0017] A first determining unit is configured to determine a first loss according to the first resource feature and the third resource feature, where the first loss is used to represent a difference between a resource generated by the initial resource recommendation model and a real resource;
[0018] The training unit is configured to perform training on the initial resource recommendation model based on the first loss to obtain a target resource recommendation model for recommending resources.
[0019] In some embodiments, the apparatus further comprises:
[0020] The second determination unit is configured to determine a historical behavior sequence of the sample object based on the interaction time point of the sample object with respect to the sample resource, wherein the historical behavior sequence includes resources interacted with before the sample object interacted with the sample resource and the behavior of the sample object with respect to the interacted resources; and determine multiple resource preference information of the sample object based on the historical behavior sequence.
[0021] In some embodiments, the second determination unit is configured to obtain resources with positive interaction behavior from the historical behavior sequence of the sample object, wherein the positive interaction behavior is a behavior of providing positive feedback to the resources; and determine multiple resource preference information of the sample object based on the resources with positive interaction behavior.
[0022] In some embodiments, the first processing unit includes:
[0023] A first processing subunit is configured to map the initial resource characteristics of the sample resource onto a unit sphere to obtain the first resource characteristics;
[0024] The second processing sub-unit is configured to add noise to the first resource feature based on Gaussian noise and a noise adding step number to obtain the second resource feature, where the noise adding step number is used to indicate the number of times Gaussian noise is added.
[0025] In some embodiments, the second processing sub-unit is configured to perform random sampling in the slice space of the first resource feature to obtain a noise vector of Gaussian noise; determine an offset distance based on the noise vector of the Gaussian noise and the number of noise adding steps, and the offset distance is used to represent the total intensity of the noise to be added to the first resource feature; and add the offset distance to the noise component in the first resource feature in the direction indicated by the noise vector of the Gaussian noise to obtain the second resource feature, where the noise component is a component in the first resource feature that is in the direction indicated by the noise vector.
[0026] In some embodiments, the second processing sub-unit is configured to determine a noise adding parameter based on the noise adding step length and a preset noise adding function, wherein the noise adding parameter is used to represent the intensity of each noise added, and the preset noise adding function is used to represent the correlation between the number of times noise is added and the intensity of each noise added; and the product of the length of the noise vector of the Gaussian noise and the number of noise adding steps is used as the offset distance.
[0027] In some embodiments, the second processing unit is configured to execute the diffusion enhancement module in the initial resource recommendation model, and perform multiple denoising processes on the second resource feature based on the denoising steps, taking the multiple resource preference information as conditions, to obtain the third resource feature, where the denoising steps are used to represent the number of times Gaussian noise is removed from the second resource feature.
[0028] In some embodiments, the apparatus further comprises:
[0029] A third processing unit is configured to score the third resource feature of the sample resource based on the first resource feature of the sample resource to obtain a first score, where the first score is used to indicate whether the resource generated by the initial resource recommendation model meets the preference of the sample object;
[0030] a fourth processing unit, configured to score the third resource feature of the sample resource based on multiple negative resources of the sample object to obtain a second score, wherein the negative resource is a resource that the sample object has not interacted with or a resource that the sample object has triggered a negative interaction behavior, wherein the negative interaction behavior is a behavior of providing negative feedback to the resource, and the second score is used to indicate that the resource generated by the initial resource recommendation model does not meet the preference of the sample object;
[0031] A third determining unit is configured to determine a second loss based on the first score and the second score, where the second loss is used to indicate that the resources generated by the initial resource recommendation model meet the preferences of the sample object;
[0032] The training unit is configured to train the initial resource recommendation model based on the first loss and the second loss to obtain the target resource recommendation model.
[0033] In some embodiments, the third processing unit is configured to perform an inner product calculation on the first resource feature and the third resource feature to obtain the first score.
[0034] In some embodiments, the third determination unit is configured to perform the summation of the first score and the second score to obtain a total score; calculate the ratio between the first score and the total score, and the ratio is used to represent the probability that the resources generated by the initial resource recommendation model meet the preferences of the sample object; and use the negative logarithm of the ratio as the second loss.
[0035] According to another aspect of an embodiment of the present disclosure, a resource recommendation device is provided, including:
[0036] A processing unit is configured to execute inputting Gaussian noise into a target resource recommendation model, and based on a plurality of resource preference information of an object, denoising the Gaussian noise to obtain a resource feature, wherein the target resource recommendation model is trained by a training device for a resource recommendation model according to any one of the above, the plurality of resource preference information is used to represent a plurality of resource types corresponding to the object, and the resource feature is used to represent a feature of a resource preferred by the object;
[0037] The recommendation unit is configured to recommend resources to the object based on the resource features.
[0038] In some embodiments, the processing unit is configured to execute the diffusion enhancement module in the target resource recommendation model, take the multiple resource preference information as conditions, and based on the number of denoising steps, perform multiple denoising processes on the Gaussian noise to obtain the resource characteristics, the number of denoising steps is used to indicate the denoising degree of the Gaussian noise, and the number of denoising processes is equal to the number of denoising steps.
[0039] In some embodiments, the recommendation unit is configured to determine the similarity between the resource feature and the resource features of the multiple resources based on the resource feature and the resource features of the multiple resources; and recommend resources to the object based on the similarity between the resource feature and the resource features of the multiple resources.
[0040] According to another aspect of an embodiment of the present disclosure, an electronic device is provided, the electronic device comprising:
[0041] one or more processors;
[0042] A memory for storing program codes executable by the processor;
[0043] The processor is configured to execute the program code to implement the above-mentioned resource recommendation model training method or resource recommendation method.
[0044] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When the program code in the computer-readable storage medium is executed by a processor of an electronic device, the electronic device can execute the above-mentioned resource recommendation model training method or resource recommendation method.
[0045] According to another aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program / instruction, which implements the above-mentioned resource recommendation model training method or resource recommendation method when executed by a processor.
[0046] The disclosed embodiment provides a method for training a resource recommendation model. In the training process of the resource recommendation model, noise is first added to a first resource feature of a sample resource to obtain a second resource feature so as to blur the original characteristics of the sample resource. Then, based on multiple resource preference information of the sample object, the second resource feature is denoised to predict the original characteristics of the sample resource. Since the multiple resource preference information reflects multiple resource types preferred by the sample object, the resource recommendation model can predict the characteristics of the resources preferred by the sample object from multiple preference aspects of the sample object, so that the third resource feature predicted by the resource recommendation model can fit the multiple resource types preferred by the sample object. Since the third resource feature fits any resource type, it is the characteristic of the resource preferred by the sample object. Therefore, it is convenient for the resource recommendation model to predict resources that fit each resource type preferred by the sample object according to the multiple resource preference information, which is conducive to the resource recommendation model to recommend more diverse, rich and object-preferred resources. Moreover, the model is trained by using the resource features predicted by the model and the real resource features of the sample resources, which further ensures that the resources predicted by the resource recommendation model are more and more in line with the real preferences of the sample object, thereby improving the accuracy of the resource recommendation model. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0048] Figure 1 It is a schematic diagram of an implementation environment of a training method for a resource recommendation model according to an exemplary embodiment.
[0049] Figure 2 The figure is a flowchart of a method for training a resource recommendation model according to an exemplary embodiment.
[0050] Figure 3 The figure is a flowchart of another method for training a resource recommendation model according to an exemplary embodiment.
[0051] Figure 4 The diagram is a schematic diagram of a resource recommendation model according to an exemplary embodiment.
[0052] Figure 5 The figure is a flowchart of a resource recommendation method according to an exemplary embodiment.
[0053] Figure 6 The figure is a block diagram of a training device for a resource recommendation model according to an exemplary embodiment.
[0054] Figure 7The figure is a block diagram of a resource recommendation device according to an exemplary embodiment.
[0055] Figure 8 It is a structural block diagram of a terminal provided according to an embodiment of the present application.
[0056] Fig. 9 It is a block diagram of a server according to an exemplary embodiment. DETAILED DESCRIPTION
[0057] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0058] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0059] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions. For example, the resources involved in this disclosure are all obtained with full authorization.
[0060] Figure 1 FIG. 1 is a schematic diagram of an implementation environment of a method for training a resource recommendation model according to an exemplary embodiment. Figure 1, the implementation environment specifically includes: a terminal 101 and a server 102. The terminal 101 is at least one of a smart phone, a smart watch, a desktop computer, a laptop, an MP3 player, an MP4 player, and a laptop computer. An application that supports the provision of resources is running on the terminal 101. The application can be a multimedia application, a social application, a shopping application, or a browser, etc., and the present disclosure does not limit this. The user can log in to the application through the terminal 101 to obtain the services provided by the application. The terminal 101 can be connected to the server 102 through a wireless network or a wired network, and can then receive resources pushed by the server 102. The user can interact with the resources through the terminal 101. For example, the user can click on the resource, watch the resource, share the resource, like the resource, etc. The terminal 101 can obtain the user's behavior sequence for the resource and send the behavior sequence to the server 102, so that the server 102 can train the resource recommendation model according to the user's behavior sequence.
[0061] The terminal 101 generally refers to one of a plurality of terminals, and the present embodiment is described by taking the terminal 101 as an example. Those skilled in the art may know that the number of the above terminals may be more or less. For example, the above terminals may be several, or the above terminals may be dozens or hundreds, or a greater number. The present embodiment does not limit the number and device type of the terminals.
[0062] The server 102 is at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. The server 102 can be connected to the terminal 101 and other terminals via a wireless network or a wired network. The server 102 is used to provide background services for applications that provide resources. The server 102 can receive behavior sequences sent by multiple terminals 101. Then, the server 102 can train the resource recommendation model based on the behavior sequence. Then, the server 102 can recommend resources to the user based on the trained resource recommendation model. In some embodiments, the number of the above servers can be more or less, and the embodiments of the present disclosure are not limited to this. Of course, the server 102 also includes other functional servers to provide more comprehensive and diversified services.
[0063] Figure 2 is a flowchart of a method for training a resource recommendation model according to an exemplary embodiment. Figure 2 , the training method of the resource recommendation model is applied to the server, including the following steps:
[0064] In step 201, the server adds noise to the first resource feature of the sample resource through the initial resource recommendation model to obtain the second resource feature of the sample resource. The sample resource is a resource that the sample object has interacted with, and the first resource feature is used to represent the content of the sample resource.
[0065] In the embodiments of the present disclosure, the initial resource recommendation model can be constructed based on the diffusion model, and the embodiments of the present disclosure do not limit the structure of the initial resource recommendation model. Sample resources can be multimedia resources such as videos, articles or audio, or they can be material resources such as food, clothing or daily necessities, etc., and the embodiments of the present disclosure do not limit this. Sample resources are resources whose sample objects have triggered interactive behaviors. The interactive behavior can be click behavior, viewing behavior, like behavior, comment behavior, sharing behavior or collection behavior, etc., and the embodiments of the present disclosure do not limit this.
[0066] The server trains the initial resource recommendation model through sample resources so that the initial resource recommendation model learns the ability to recommend resources. During the model training process, the server extracts features of the sample resources through the initial resource recommendation model to obtain the first resource feature, and adds noise to the first resource feature to obtain the second resource feature. The first resource feature reflects the characteristics of the resources that the sample object likes (preferred) in real situations. By adding noise to the first resource feature, the original characteristics of the sample resource are blurred.
[0067] In step 202, the server performs denoising processing on the second resource feature based on multiple resource preference information of the sample object to obtain a third resource feature of the sample resource, where the multiple resource preference information is used to represent multiple resource types corresponding to the sample object.
[0068] In the disclosed embodiment, "multiple resource types corresponding to the sample object" refers to the resource types preferred by the sample object. Multiple resource preference information can reflect the characteristics of the resources liked by the sample object. The essence of each resource preference information is a feature vector, which can also be called "interest representation", which is used to represent multiple resource types that the sample object is interested in (preferred). Among them, "like or interest" can be reflected by the interactive behavior of the sample object on the resource. For example, if the sample object clicks, likes, collects, shares, makes positive comments, and the browsing time reaches the time threshold for a certain resource, it means that the sample object likes the resource, or the sample object is interested in the resource. The server uses the resource recommendation model and the multiple resource preference information of the sample object to denoise the second resource feature of the first resource to obtain the third resource feature of the sample resource. That is, the server restores the resource feature of the sample resource through the resource recommendation model with the multiple resource preference information of the sample object as a condition (reference). The third resource feature is the resource feature of the sample resource restored (generated or predicted) by the resource recommendation model.
[0069] In step 203, the server determines a first loss according to the first resource feature and the third resource feature, where the first loss is used to represent the difference between the resources generated by the initial resource recommendation model and the real resources.
[0070] In the embodiment of the present disclosure, the server calculates the difference between the first resource feature and the third resource feature through the initial resource recommendation model, and uses the difference as the first loss. The server can calculate the first loss by using the mean squared error function (MSE), and the embodiment of the present disclosure does not limit the calculation method of the first loss.
[0071] In step 204, the server trains the initial resource recommendation model based on the first loss to obtain a target resource recommendation model for recommending resources.
[0072] In the disclosed embodiment, the server trains the initial resource recommendation model with the goal of minimizing the first loss. The first resource feature reflects the characteristics of the sample resource that the sample object likes in real situations. The third resource feature reflects the characteristics of the sample resource predicted by the resource recommendation model. That is, the server trains the resource recommendation model by minimizing the difference between the resource features predicted by the resource recommendation model and the real resource features of the sample resource, so that the resources predicted by the resource recommendation model are more and more in line with the preferences of the sample object.
[0073] The disclosed embodiment provides a method for training a resource recommendation model. In the training process of the resource recommendation model, noise is first added to a first resource feature of a sample resource to obtain a second resource feature so as to blur the original feature of the sample resource. Then, based on a plurality of resource preference information of the sample object, the second resource feature is denoised to predict the original feature of the sample resource. Since the plurality of resource preference information reflects the plurality of resource types preferred by the sample object, the resource recommendation model can predict the features of the resource preferred by the sample object from the plurality of aspects of the sample object's preferences, so that the third resource feature predicted by the resource recommendation model can fit the plurality of resource types preferred by the sample object. Since the third resource feature fits any resource type, it is the feature of the resource preferred by the sample object. Therefore, the resource recommendation model can predict the resources of each resource type that fits the sample object's preference according to the plurality of resource preference information, so that the resource recommendation model can recommend more diverse, rich and object-preferred resources. Furthermore, the model is trained by using the resource features predicted by the model and the real resource features of the sample resource, so that the resources predicted by the resource recommendation model are more and more in line with the real preferences of the sample object, thereby improving the accuracy of the resource recommendation model.
[0074] In some embodiments, the method further comprises:
[0075] Determine a historical behavior sequence of the sample object based on the interaction time point of the sample object with respect to the sample resource, wherein the historical behavior sequence includes resources that interacted with the sample object before the interaction with the sample resource and behaviors of the sample object with respect to the interacted resources;
[0076] Based on the historical behavior sequence, multiple resource preference information of the sample object is determined.
[0077] The solution provided by the embodiment of the present disclosure can accurately reflect the sample object's preference for resources when interacting with the sample resource to a certain extent because the resources that have interacted with the sample object before the sample object interacted with the sample resource. Therefore, for the sample resources participating in the model training, multiple resource preference information of the sample object can be accurately determined based on the resources that have interacted with the sample object before the sample object interacted with the sample resource, which is beneficial for the subsequent resource recommendation model to accurately predict the characteristics of the sample resource based on multiple resource preference information.
[0078] In some embodiments, based on the historical behavior sequence, multiple resource preference information of the sample object is determined, including:
[0079] From the historical behavior sequence of the sample object, obtain resources with positive interaction behavior, which is the behavior of providing positive feedback to the resource;
[0080] Based on the resources with positive interaction behaviors, multiple resource preference information of the sample object is determined.
[0081] The solution provided by the embodiment of the present disclosure, since positive interaction behavior can positively reflect the resources preferred by the sample object, determines multiple resource preference information of the sample object according to the resources with positive interaction behavior in the historical behavior sequence of the sample object, so that the multiple resource preference information can accurately reflect the resource type preferred by the sample object, which is beneficial for the subsequent resource recommendation model to accurately predict the characteristics of the sample resources based on the multiple resource preference information.
[0082] In some embodiments, adding noise to a first resource feature of a sample resource to obtain a second resource feature of the sample resource includes:
[0083] Mapping the initial resource characteristics of the sample resource onto the unit sphere to obtain the first resource characteristics;
[0084] Based on Gaussian noise and the number of noise adding steps, noise is added to the first resource feature to obtain a second resource feature, where the number of noise adding steps is used to indicate the number of times the Gaussian noise is added.
[0085] The solution provided by the embodiment of the present disclosure maps the resource characteristics of the sample resources onto a unit sphere, and adds multiple Gaussian noises to the resource characteristics of the sample resources on the unit sphere according to the number of noise adding steps. This not only blurs the original characteristics of the sample resources, but also, because the resource characteristics of the sample resources are always on the unit sphere, the modulus length of the resource characteristics of the sample resources is fixed during the model training process. The model training is not affected by the modulus length of the resource characteristics, and only the similarity (inner product) between the predicted resource characteristics and the actual resource characteristics needs to be paid attention to, which is beneficial to improving the training efficiency of the resource recommendation model.
[0086] In some embodiments, adding noise to the first resource feature based on Gaussian noise and the number of noise adding steps to obtain the second resource feature includes:
[0087] In the slice space of the first resource feature, random sampling is performed to obtain a noise vector of Gaussian noise;
[0088] Based on the noise vector and the number of noise adding steps of the Gaussian noise, an offset distance is determined, where the offset distance is used to represent the total intensity of the noise to be added to the first resource feature;
[0089] According to the direction indicated by the noise vector of the Gaussian noise, the offset distance is added to the noise component in the first resource feature to obtain the second resource feature, where the noise component is the component in the first resource feature in the direction indicated by the noise vector.
[0090] The solution provided by the embodiment of the present disclosure samples a Gaussian noise in the cross-sectional space of the resource feature of the sample resource, determines the intensity of the noise to be added to the resource feature of the sample resource, that is, the offset distance, according to the noise vector of the Gaussian noise and the number of noise adding steps, and then controls the resource feature of the sample resource to move on the unit sphere according to the direction indicated by the noise vector of the Gaussian noise, so as to add Gaussian noise of intensity corresponding to the offset distance to the resource feature, so as to blur the original characteristics of the sample resource as much as possible, so as to facilitate improving the prediction ability of the resource recommendation model for prediction based on the completely blurred resource feature (equivalent to a noise) for the subsequent resource recommendation model.
[0091] In some embodiments, determining the offset distance based on the noise vector and the number of noise adding steps of the Gaussian noise includes:
[0092] Based on the noise adding step length and the preset noise adding function, a noise adding parameter is determined, the noise adding parameter is used to represent the intensity of each noise added, and the preset noise adding function is used to represent the correlation between the number of times the noise is added and the intensity of each noise added;
[0093] The product of the length of the noise vector of the Gaussian noise and the number of noise addition steps is used as the offset distance.
[0094] The solution provided by the embodiment of the present disclosure, since the preset noise adding function reflects the correlation between the number of times noise is added and the intensity of the noise added each time, makes it possible to accurately determine the noise adding parameters corresponding to the noise adding step length according to the preset noise adding function, thereby more accurately determining the total intensity of the noise to be added to the resource characteristics of the sample resource.
[0095] In some embodiments, based on multiple resource preference information, the second resource feature is subjected to denoising to obtain a third resource feature of the sample resource, including:
[0096] Through the diffusion enhancement module in the initial resource recommendation model, with multiple resource preference information as conditions, based on the denoising steps, the second resource feature is denoised multiple times to obtain the third resource feature. The denoising steps are used to indicate the number of times the Gaussian noise is removed from the second resource feature.
[0097] The solution provided by the embodiment of the present disclosure enables the resource recommendation model to predict the characteristics of the resources that the sample object likes based on the sample object's preferences in multiple aspects, since the multiple resource preference information reflects the multiple resource types preferred by the sample object. This enables the third resource feature predicted by the resource recommendation model to fit the multiple resource types preferred by the sample object. Since the third resource feature fits any resource type, it is the characteristic of the resource that the sample object likes. Therefore, the resource recommendation model can predict resources that fit each resource type that the sample object likes based on the multiple resource preference information, which helps the resource recommendation model recommend more diverse, richer resources that meet the object's preferences.
[0098] In some embodiments, the method further comprises:
[0099] Based on the first resource feature of the sample resource, the third resource feature of the sample resource is scored to obtain a first score, where the first score is used to indicate the degree to which the resource generated by the initial resource recommendation model meets the preference of the sample object;
[0100] Based on multiple negative resources of the sample object, the third resource feature of the sample resource is scored to obtain a second score. The negative resource is a resource that the sample object has not interacted with or a resource that the sample object has triggered a negative interaction behavior. The negative interaction behavior is the behavior of providing negative feedback to the resource. The second score is used to indicate the degree to which the resource generated by the initial resource recommendation model does not meet the sample object's preference;
[0101] Based on the first score and the second score, determining a second loss, the second loss being used to indicate that the resources generated by the initial resource recommendation model meet the preferences of the sample object;
[0102] Based on the first loss, the initial resource recommendation model is trained to obtain a target resource recommendation model for recommending resources, including:
[0103] Based on the first loss and the second loss, the initial resource recommendation model is trained to obtain the target resource recommendation model.
[0104] In the solution provided by the embodiment of the present disclosure, sample resources are resources with which the sample object has triggered positive interaction behaviors, which can be regarded as resources that the sample object likes, that is, positive samples; negative resources are resources with which the sample object has not interacted or resources with which the sample object has triggered negative interaction behaviors, which can be regarded as multiple negative resources that are resources that the sample object does not like, that is, negative samples; through positive and negative samples, the resource features predicted by the resource recommendation model are scored, so that it is possible to accurately determine whether the resources generated by the resource recommendation model meet the preferences of the sample object, that is, the second loss accurately reflects the situation that the resources generated by the resource recommendation model meet the preferences of the sample object, and the resource recommendation model is trained through the first loss and the second loss, which ensures that the resources predicted by the resource recommendation model are more and more in line with the actual preferences of the sample object, thereby improving the accuracy of the resource recommendation model.
[0105] In some embodiments, scoring the third resource feature of the sample resource based on the first resource feature of the sample resource to obtain a first score includes:
[0106] An inner product is calculated for the first resource characteristic and the third resource characteristic to obtain a first score.
[0107] The solution provided by the embodiment of the present disclosure obtains a first score by calculating the inner product of the first resource feature and the third resource feature, so that the first score can accurately reflect the similarity between the first resource feature and the third resource feature, that is, the first score can accurately reflect the situation that the resources generated by the resource recommendation model meet the preferences of the sample object.
[0108] In some embodiments, determining the second loss based on the first score and the second score includes:
[0109] Add the first score and the second score to obtain a total score;
[0110] Calculate the ratio between the first score and the total score, where the ratio is used to indicate the probability that the resources generated by the initial resource recommendation model meet the preferences of the sample object;
[0111] The negative logarithm of the ratio is used as the second loss.
[0112] The solution provided by the embodiment of the present disclosure, by dividing the first score by the sum of the first score and the second score, makes the ratio able to accurately reflect the probability that the resources generated by the resource recommendation model meet the sample object preferences, and by using the negative logarithm of the ratio as the second loss, the second loss is minimized during the model training process, thereby gradually improving the probability that the resources generated by the resource recommendation model meet the sample object preferences, that is, making the probability that the resources predicted by the resource recommendation model meet the object preferences greater, thereby improving the accuracy of the resource recommendation model.
[0113] Above Figure 2 The following is only a basic process of the present disclosure. The solution provided by the present disclosure is further described based on a specific implementation method. Figure 3 FIG. 1 is a flowchart of another method for training a resource recommendation model according to an exemplary embodiment. Figure 3 , the method comprising:
[0114] In step 301, the server obtains multiple resource preference information of the sample object, where the multiple resource preference information is used to represent multiple resource types corresponding to the sample object.
[0115] In an embodiment of the present disclosure, the server may determine multiple resource preference information of the sample object based on the resources that interact with the sample object. That is, the server analyzes multiple resource types that the sample object likes based on the resources that the sample object interacts with. If the resource is a multimedia resource such as a video, article, or audio, the resource type may be the theme or field to which the content in the multimedia resource belongs, the style of the multimedia resource, or the language of the content in the multimedia resource, etc., and the embodiment of the present disclosure does not limit this. If the resource is an item resource such as food, clothing, or daily necessities, the resource type may be the application field of the item resource, the style of the item resource, or the source of the item resource, etc., and the embodiment of the present disclosure does not limit this.
[0116] Specifically, resources that have triggered positive interaction behaviors of the sample object can be regarded as resources preferred by the sample object. Positive interaction behaviors can be click behaviors, like behaviors, collection behaviors, sharing behaviors, browsing behaviors (such as the browsing time for resources reaches a time threshold) and comment behaviors used to express positive evaluations, etc., which are not limited in the embodiments of the present disclosure. In other words, positive interaction behaviors are behaviors that provide positive feedback to resources. Accordingly, the server can determine the resources preferred by the sample object based on the positive interaction behaviors of the sample object with respect to the resources, thereby determining multiple resource preference information based on the types of resources preferred by the sample object. For example, the server can determine a resource preference information of the sample object based on the type of resources collected by the sample object.
[0117] The opposite of positive interaction behavior is negative interaction behavior. Negative interaction behavior can be reporting behavior, "not interested" behavior triggered by resources, etc., which is not limited in the embodiments of the present disclosure. In other words, negative interaction behavior is the behavior of providing negative feedback to resources. Resources that have triggered negative interaction behaviors by sample objects can be regarded as resources that the sample objects do not like (or are not interested in). The server can determine the resources that the sample objects do not like based on the negative interaction behaviors of the sample objects with respect to the resources, and thereby determine the types of resources that the sample objects do not like based on the types of resources that the sample objects do not like.
[0118] In some embodiments, the server can determine multiple resource preference information of the sample object based on the sample resources participating in the model training. Accordingly, the process of the server determining multiple resource preference information is as follows: the server determines the historical behavior sequence of the sample object based on the interaction time point of the sample object for the sample resource. The historical behavior sequence includes the resources that the sample object interacted with before the interaction with the sample resource and the behavior of the sample object on the interacted resources. Then, the server determines multiple resource preference information of the sample object based on the historical behavior sequence. That is, the server can determine the historical behavior sequence that can reflect the attitude (preference) of the sample object towards the sample resource based on the sample resources participating in the model training. In other words, for any sample resource participating in the model training, the server can determine multiple resource types that the sample object likes based on the historical behavior sequence before the sample resource. The solution provided by the embodiment of the present disclosure can accurately reflect the sample object's preference for resources when interacting with the sample resource to a certain extent because the resources that have interacted with the sample object before the sample object interacted with the sample resource. Therefore, for the sample resources participating in the model training, multiple resource preference information of the sample object can be accurately determined based on the resources that have interacted with the sample object before the sample object interacted with the sample resource, which is beneficial for the subsequent resource recommendation model to accurately predict the characteristics of the sample resource based on multiple resource preference information.
[0119] Among them, in the process of determining multiple resource preference information of sample objects based on historical behavior sequences, the server can obtain resources with positive interactive behaviors from the historical behavior sequences of sample objects; then, the server determines multiple resource preference information of sample objects based on the resources with positive interactive behaviors. Positive interactive behavior is a behavior that provides positive feedback to resources. The solution provided by the embodiment of the present disclosure, since positive interactive behavior can positively reflect the resources preferred by sample objects, multiple resource preference information of sample objects is determined based on the resources with positive interactive behaviors in the historical behavior sequences of sample objects, so that multiple resource preference information can accurately reflect the resource types preferred by sample objects, which is beneficial for subsequent resource recommendation models to accurately predict the characteristics of sample resources based on multiple resource preference information.
[0120] In some embodiments, the server can determine multiple resource preference information of the sample object through the initial resource recommendation model. The initial resource recommendation model includes a guidance extraction module (Guidance Extraction Module). The server can input the historical behavior sequence of the sample object into the guidance extraction module of the initial resource recommendation model, perform feature extraction on multiple resources in the historical behavior sequence through the guidance extraction module, and then output multiple resource preference information. Among them, the guidance extraction model can use the ComiRec method to determine multiple resource preference information of the sample object, which is not limited in the embodiments of the present disclosure. The multiple resource preference information can be 4, and the embodiments of the present disclosure do not limit the number of resource preference information.
[0121] In step 302, the server adds noise to the first resource feature of the sample resource through the initial resource recommendation model to obtain the second resource feature of the sample resource. The sample resource is a resource that the sample object has interacted with, and the first resource feature is used to represent the content of the sample resource.
[0122] In the disclosed embodiment, the server extracts features of the sample resource through the initial resource recommendation model to obtain a first resource feature, and adds noise to the first resource feature to obtain a second resource feature. That is, the server blurs the original characteristics of the sample resource by adding noise to the resource feature of the sample resource in the real situation. The disclosed embodiment does not limit the method of adding noise.
[0123] In some embodiments, the server may use a spherical geodesic walk to add noise to the resource features of the sample resources. Accordingly, the process of the server adding noise to the first resource feature of the sample resource includes: the server maps the initial resource feature of the sample resource onto the unit sphere to obtain the first resource feature. Then, the server adds noise to the first resource feature based on Gaussian noise and the number of noise adding steps to obtain the second resource feature. The number of noise adding steps is used to indicate the number of times Gaussian noise is added. The solution provided by the embodiment of the present disclosure maps the resource features of the sample resource onto the unit sphere, and according to the number of noise adding steps, multiple Gaussian noises are added to the resource features of the sample resource on the unit sphere, which can not only blur the original characteristics of the sample resource, but also because the resource features of the sample resource are always on the unit sphere, the modulus length of the resource features of the sample resource is fixed during the model training process, and the model training is not affected by the modulus length of the resource features. It is only necessary to focus on the similarity (inner product) between the predicted resource features and the real resource features, which is conducive to improving the training efficiency of the resource recommendation model.
[0124] Among them, the server can randomly sample a number t from the interval (0, T] and use the number t as the number of noise adding steps. The number of noise adding steps can affect the intensity of the noise added to the resource characteristics of the sample resource. That is, the more noise adding steps, the stronger (more) the noise added to the first resource characteristic; the fewer noise adding steps, the weaker (less) the noise added to the first resource characteristic.
[0125] In some embodiments, the process of adding noise to the first resource feature by the server through Gaussian noise and the number of noise adding steps is as follows: in the section space of the first resource feature, the server performs random sampling to obtain a noise vector of Gaussian noise. Then, the server determines the offset distance based on the noise vector of Gaussian noise and the number of noise adding steps. The offset distance is used to represent the total intensity of the noise to be added to the first resource feature. Then, the server adds the offset distance to the noise component in the first resource feature in the direction indicated by the noise vector of Gaussian noise to obtain the second resource feature. The noise adding component is the component in the first resource feature that is in the direction indicated by the noise vector. The solution provided by the embodiment of the present disclosure samples a Gaussian noise in the cross-sectional space of the resource feature of the sample resource, determines the intensity of the noise to be added to the resource feature of the sample resource, that is, the offset distance, according to the noise vector of the Gaussian noise and the number of noise adding steps, and then controls the resource feature of the sample resource to move on the unit sphere according to the direction indicated by the noise vector of the Gaussian noise, so as to add Gaussian noise of intensity corresponding to the offset distance to the resource feature, so as to blur the original characteristics of the sample resource as much as possible, so as to facilitate improving the prediction ability of the resource recommendation model for prediction based on the completely blurred resource feature (equivalent to a noise) for the subsequent resource recommendation model.
[0126] In some embodiments, the process in which the server determines the offset distance based on the noise vector and the number of noise adding steps of Gaussian noise includes: the server determines the noise adding parameter based on the noise adding step length and the preset noise adding function. The noise adding parameter is used to represent the intensity of each noise addition. The preset noise adding function is used to represent the correlation between the number of times noise is added and the intensity of each noise addition. The server uses the product of the length of the noise vector of the Gaussian noise and the number of noise adding steps as the offset distance. The scheme provided by the embodiment of the present disclosure, since the preset noise adding function reflects the correlation between the number of times noise is added and the intensity of each noise addition, makes it possible to accurately determine the noise adding parameter corresponding to the noise adding step length according to the preset noise adding function, thereby more accurately determining the total intensity of the noise to be added to the resource characteristics of the sample resource.
[0127] The present disclosure embodiment does not limit the preset noise adding function. The preset noise adding function may be α t , used to indicate that the number of noise additions (noise addition steps) is t and the intensity of each noise addition is α t ; Correspondingly, the noise parameter is Then, the server uses the product of the length of the noise vector of the Gaussian noise and the number of noise addition steps as the offset distance of the resource feature of the sample resource.
[0128] One point that needs to be explained is that the embodiment of the present disclosure does not limit the execution order of step 301 and step 302. That is, the server may first execute step 301 and then execute step 302, that is, the server first determines the multiple resource types that the sample object likes, and then performs noise processing on the resource characteristics of the sample resources. Alternatively, the server may first execute step 302 and then execute step 301, that is, the server first performs noise processing on the resource characteristics of the sample resources, and then determines the multiple resource types that the sample object likes. Alternatively, the server may also execute step 301 and step 302 at the same time, that is, the server determines the multiple resource types that the sample object likes and performs noise processing on the resource characteristics of the sample resources.
[0129] In step 303, the server performs denoising processing on the second resource feature based on multiple resource preference information of the sample object to obtain a third resource feature of the sample resource.
[0130] In the disclosed embodiment, the initial resource recommendation model includes a diffusion aggregation module. The server can use the diffusion enhancement module in the initial resource recommendation model to perform multiple denoising processes on the second resource feature based on the denoising step number, taking multiple resource preference information as conditions, to obtain a third resource feature. The denoising step number is used to indicate the number of times the Gaussian noise is removed from the second resource feature. In the solution provided by the disclosed embodiment, since multiple resource preference information reflects multiple resource types preferred by the sample object, the resource recommendation model can predict the characteristics of the resources liked by the sample object from multiple aspects of the sample object's preferences, so that the third resource feature predicted by the resource recommendation model can fit the multiple resource types preferred by the sample object. Since the third resource feature fits any resource type, it is the characteristic of the resource liked by the sample object. Therefore, it is convenient for the resource recommendation model to predict the resources that fit the various resource types liked by the sample object based on multiple resource preference information, which is conducive to the resource recommendation model to recommend more diverse, rich and object-friendly resources.
[0131] The diffusion enhancement module can be constructed based on a multi-layer perceptron. The server inputs multiple resource preference information of the sample object, the noisy resource features (the second resource features) and the number of denoising steps into the diffusion enhancement model in the initial resource recommendation model, and outputs the denoised resource features (the third resource features).
[0132] The above-mentioned denoising steps may be equal to the number of denoising steps, or may be more or less than the number of denoising steps, and the embodiments of the present disclosure are not limited to this. Optionally, in any iterative training of the model, the number of denoising steps is not less than the number of denoising steps. This method enables the model to restore the original characteristics of the sample resources as much as possible, which is conducive to the model's ability to predict the resources that the sample objects actually prefer, thereby improving the accuracy of the resource recommendation model. For example, in each iterative training of the model, the number of denoising steps is T (the maximum value of the number of denoising steps).
[0133] In step 304, the server determines a first loss according to the first resource feature and the third resource feature, where the first loss is used to represent the difference between the resource generated by the initial resource recommendation model and the real resource.
[0134] In the embodiment of the present disclosure, the server calculates the gap between the first resource feature and the third resource feature through the initial resource recommendation model, and uses the gap as the first loss. The gap between the first resource feature and the third resource feature can be calculated by a mean square error function (MSE), which is not limited in the embodiment of the present disclosure.
[0135] In step 305, the server trains the initial resource recommendation model based on the first loss to obtain a target resource recommendation model for recommending resources.
[0136] In the disclosed embodiment, the denoised resource feature (third resource feature) should be consistent with the original resource feature (first resource feature). The server calculates the first loss between the first resource feature and the third resource feature through the initial resource recommendation model, and then trains the initial resource recommendation model with the goal of minimizing the first loss, so that the resources predicted by the initial resource recommendation model are more and more in line with the resource preferences of the sample object. When the first loss is lower than the preset value or the first loss is in the preset range, the server stops training and obtains the target resource recommendation model.
[0137] In some embodiments, in addition to training the resource recommendation model through the above-mentioned first loss, the server can also score the third resource feature predicted by the resource recommendation model through positive and negative samples to determine the prediction effect of the resource recommendation model, so as to train according to the prediction effect. Accordingly, the server scores the third resource feature of the sample resource based on the first resource feature of the sample resource to obtain a first score. The first score is used to indicate that the resource generated by the initial resource recommendation model meets the sample object's preference. The server scores the third resource feature of the sample resource based on multiple negative resources of the sample object to obtain a second score. Negative resources are resources that the sample object has not interacted with or resources that the sample object has triggered negative interaction behaviors. Negative interaction behaviors are behaviors that provide negative feedback to resources. For example, negative resources are resources that the sample object has fed back "not interested", or resources that have made negative comments, or resources that have been reported by the sample object, etc., which are not limited in the embodiments of the present disclosure. The second score is used to indicate that the resource generated by the resource recommendation model does not meet the sample object's preference. Then, the server determines the second loss based on the first score and the second score. The second loss is used to indicate that the resource generated by the initial resource recommendation model meets the sample object's preference. The server trains the initial resource recommendation model based on the first loss and the second loss to obtain a target resource recommendation model.
[0138] In the solution provided by the embodiments of the present disclosure, sample resources are resources with which the sample object has triggered positive interaction behaviors, which can be regarded as resources that the sample object likes, that is, positive samples; negative resources are resources with which the sample object has not interacted or resources with which the sample object has triggered negative interaction behaviors, which can be regarded as multiple negative resources that are resources that the sample object does not like, that is, negative samples; through positive and negative samples, the resource features predicted by the resource recommendation model are scored, so that it is possible to accurately determine whether the resources generated by the resource recommendation model meet the preferences of the sample object, that is, the second loss accurately reflects the situation that the resources generated by the resource recommendation model meet the preferences of the sample object, and the resource recommendation model is trained through the first loss and the second loss, which ensures that the resources predicted by the resource recommendation model are more and more in line with the real preferences of the sample object, thereby improving the accuracy of the resource recommendation model.
[0139] The server can obtain the first score by calculating the inner product of the first resource feature and the third resource feature. The solution provided by the embodiment of the present disclosure obtains the first score by calculating the inner product of the first resource feature and the third resource feature, so that the first score can accurately reflect the similarity between the first resource feature and the third resource feature, that is, the first score can accurately reflect the degree to which the resources generated by the resource recommendation model meet the preferences of the sample object.
[0140] For any negative resource, the server can obtain a third score by calculating the inner product of the resource feature of the negative resource and the third resource feature. Then, the server sums the third scores of multiple negative resources to obtain a second score. The solution provided by the embodiment of the present disclosure obtains the second score by calculating the inner product of the resource features of multiple negative resources and the third resource feature, so that the second score can accurately reflect the similarity between the resource features of the negative resource and the third resource feature, that is, the second score can accurately reflect the degree to which the resources generated by the resource recommendation model do not meet the preferences of the sample object.
[0141] During the model training process, the server trains the initial resource recommendation model with the goal of minimizing the first loss and the second loss. In the solution provided by the embodiment of the present disclosure, since the first loss reflects the gap between the resources generated by the resource recommendation model and the real resources, and the second loss reflects the situation that the resources generated by the resource recommendation model meet the preferences of the sample objects, the resource recommendation model is trained by minimizing the first loss and the second loss, which ensures that the resources predicted by the resource recommendation model are increasingly in line with the real preferences of the sample objects, thereby improving the accuracy of the resource recommendation model.
[0142] Among them, the second loss is Sample Softmax Loss. Accordingly, the process of determining the second loss based on the first score and the second score by the server includes: the server sums the first score and the second score to obtain a total score. The server calculates the ratio between the first score and the total score. The ratio is used to represent the probability that the resources generated by the initial resource recommendation model meet the preferences of the sample object. The server uses the negative logarithm of the ratio as the second loss. The solution provided by the embodiment of the present disclosure, by dividing the first score by the sum of the first score and the second score, enables the ratio to accurately reflect the probability that the resources generated by the resource recommendation model meet the preferences of the sample object, and by using the negative logarithm of the ratio as the second loss, the probability that the resources generated by the resource recommendation model meet the preferences of the sample object can be gradually improved by minimizing the second loss during the model training process, that is, the probability that the resources predicted by the resource recommendation model meet the preferences of the object is greater, thereby improving the accuracy of the resource recommendation model.
[0143] In order to more clearly describe the training method of the resource recommendation model provided by the embodiment of the present disclosure, the training method of the resource recommendation model is further described below with reference to the accompanying drawings. Figure 4 is a schematic diagram of a resource recommendation model according to an exemplary embodiment. Figure 4, the server processes the historical behavior sequence of the sample object by the ComiRec method through the guidance extraction module in the resource recommendation model to obtain multiple resource preference information of the sample object. The server uses the diffusion enhancement module in the resource recommendation model to add noise to the first resource feature of the sample resource by the spherical geodesic walk method to obtain the second resource feature. The server can use the diffusion enhancement module in the resource recommendation model to perform multiple denoising processes on the second resource feature based on the number of noise addition steps, with multiple resource preference information as conditions, to obtain the third resource feature. Then, the server uses the mean squared error function (MSE) to calculate the gap between the first resource feature and the third resource feature, the first loss. The server uses positive and negative samples to score the third resource feature predicted by the resource recommendation model, and calculates the second loss by the calculation method of Sample Softmax Loss. Then, the server trains the resource recommendation model with the goal of minimizing the first loss and the second loss. When the first loss and the second loss reach a preset interval or are lower than a preset value, the server stops training. The server can also score the multiple resource preference information extracted by the guidance extraction module by using positive and negative samples to obtain Sample Softmax Loss (third loss), and then train the guidance extraction module by using Sample Softmax Loss to make the resource preference information extracted by the guidance extraction module more and more accurate. Figure 4 The three losses shown in Figure 2 are used to train the resource recommendation model.
[0144] For the trained resource recommendation model, the present invention tests the trained resource recommendation model on public datasets such as Yoochoose, KuaiRec and ML-10M. The evaluation indicators are HR@K and NDCG@K. In the recall task, the resource recommendation model of this solution is consistently better than the common recall models (such as SASRec, GRU4Rec, MIND, ComiRec, DreamRec, DiffuRec) in terms of the two indicators HR@K and NDCG@K. For example, in terms of the evaluation indicator HR@50, the resource recommendation model of this solution is improved by 18.29%, 22.14% and 39.13% on Yoochoose, KuaiRec and ML-10M respectively compared with the suboptimal recall model. In terms of the evaluation indicator NDCG@50, the resource recommendation model of this solution is improved by 20.75%, 9.81% and 32.90% respectively.
[0145] In addition, in the recall scenario, the resource recommendation model of this solution has brought an increase of more than 0.110% in the average time per person for resource recall, and the number of categories of recalled resources has also increased by 0.139%, indicating that the resource recommendation model of this solution can improve the accuracy and diversity of resource recall at the same time. Both offline public dataset experiments and online real experiments have verified the effectiveness of this solution.
[0146] The disclosed embodiment provides a method for training a resource recommendation model. In the training process of the resource recommendation model, noise is first added to a first resource feature of a sample resource to obtain a second resource feature so as to blur the original feature of the sample resource. Then, based on a plurality of resource preference information of the sample object, the second resource feature is denoised to predict the original feature of the sample resource. Since the plurality of resource preference information reflects the plurality of resource types preferred by the sample object, the resource recommendation model can predict the features of the resource preferred by the sample object from the plurality of aspects of the sample object's preferences, so that the third resource feature predicted by the resource recommendation model can fit the plurality of resource types preferred by the sample object. Since the third resource feature fits any resource type, it is the feature of the resource preferred by the sample object. Therefore, the resource recommendation model can predict the resources of each resource type that fits the sample object's preference according to the plurality of resource preference information, so that the resource recommendation model can recommend more diverse, rich and object-preferred resources. Furthermore, the model is trained by using the resource features predicted by the model and the real resource features of the sample resource, so that the resources predicted by the resource recommendation model are more and more in line with the real preferences of the sample object, thereby improving the accuracy of the resource recommendation model.
[0147] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.
[0148] Figure 5 FIG. 1 is a flow chart of a resource recommendation method according to an exemplary embodiment. Figure 5 , the method comprising:
[0149] 501. The server inputs Gaussian noise into the target resource recommendation model, and denoises the Gaussian noise based on multiple resource preference information of the object to obtain resource features. The resource recommendation model is trained based on any of the above-mentioned resource recommendation model training methods. The multiple resource preference information is used to represent multiple resource types corresponding to the object, and the resource features are used to represent the characteristics of the resources preferred by the object.
[0150] In the embodiment of the present disclosure, the server uses the diffusion enhancement module in the target resource recommendation model, takes multiple resource preference information as conditions (references), and based on the number of denoising steps, performs multiple denoising processes on the Gaussian noise to obtain resource characteristics. The number of denoising steps is used to indicate the degree of denoising of the Gaussian noise. The number of denoising processes is equal to the number of denoising steps. The principle of the denoising process in step 501 is similar to the principle of the denoising process in step 303, and will not be repeated here. In the scheme provided by the embodiment of the present disclosure, since multiple resource preference information reflects multiple resource types preferred by the object, the resource recommendation model can predict the characteristics of the resources liked by the object from multiple aspects of the object's preferences, so that the resource recommendation model can predict the resources that fit the various resource types liked by the object based on multiple resource preference information, which is beneficial for the resource recommendation model to recommend more diverse, rich and object-preferred resources.
[0151] Among them, the server can directly input multiple resource preference information of the object into the target resource recommendation model, so that the target resource recommendation model can denoise the Gaussian noise based on the multiple resource preference information. Alternatively, the server can also input the historical behavior sequence of the object into the target resource recommendation model, and process the historical behavior sequence through the target resource recommendation model to obtain multiple resource preference information of the object, thereby denoising the Gaussian noise based on the multiple resource preference information. The embodiment of the present disclosure does not limit the method for determining the resource preference information. The resource preference information can be determined by the target resource recommendation model itself, or it can be obtained from the outside.
[0152] The resource feature determined by the target resource recommendation model is a feature vector, which may also include multiple dimensions, each dimension being used to represent a resource type preferred by the object.
[0153] 502. The server recommends resources to the object based on resource characteristics.
[0154] In an embodiment of the present disclosure, the server determines the similarity between the resource feature and the resource features of multiple resources based on the resource feature and the resource features of multiple resources. Then, based on the similarity between the resource feature and the resource features of multiple resources, the server recommends resources to the object. Among them, the server can recommend resources whose similarity reaches a preset value to the object; or, the server can also sort multiple resources in order of similarity from high to low, and then recommend a preset number of resources with top rankings to the object, etc., which is not limited by the embodiment of the present disclosure. The solution provided by the embodiment of the present disclosure, because the resource feature can accurately reflect the characteristics of multiple types of resources preferred by the object, recommends resources to the object based on the similarity between the resource feature and the resource features of multiple resources, which is conducive to the resource recommendation model to recommend more diverse, rich and in line with the object's preferences. Resources.
[0155] Among them, for any resource among multiple resources, the server can calculate the inner product of the resource characteristics of the resource and the resource characteristics generated by the resource recommendation model, use the inner product as the similarity between the resource and the resource recommended by the resource recommendation model, and recommend the resource to the object based on the similarity.
[0156] The disclosed embodiment provides a resource recommendation method. Since multiple resource preference information reflects multiple resource types that an object likes, a resource recommendation model can predict the characteristics of resources that the object likes based on multiple aspects of the object's preferences, so that the resource characteristics predicted by the resource recommendation model can fit the multiple resource types that the object likes. Since resource characteristics that fit any resource type are characteristics of resources that the object likes, the resource recommendation model can predict resources of each resource type that fit the object's preferences based on multiple resource preference information, which helps the resource recommendation model recommend more diverse, rich resources that meet the object's preferences.
[0157] Figure 6 is a block diagram of a training device for a resource recommendation model according to an exemplary embodiment. Figure 6 , the device comprises:
[0158] The first processing unit 601 is configured to add noise to a first resource feature of a sample resource through an initial resource recommendation model to obtain a second resource feature of the sample resource, where the sample resource is a resource that the sample object has interacted with, and the first resource feature is used to represent the content of the sample resource;
[0159] The second processing unit 602 is configured to perform denoising processing on the second resource feature based on multiple resource preference information of the sample object to obtain a third resource feature of the sample resource, where the multiple resource preference information is used to represent multiple resource types corresponding to the sample object;
[0160] A first determining unit 603 is configured to determine a first loss according to the first resource feature and the third resource feature, where the first loss is used to represent the difference between the resource generated by the initial resource recommendation model and the real resource;
[0161] The training unit 604 is configured to perform training on the initial resource recommendation model based on the first loss to obtain a target resource recommendation model for recommending resources.
[0162] In some embodiments, the apparatus further comprises:
[0163] The second determination unit is configured to determine a historical behavior sequence of the sample object based on the interaction time point of the sample object with respect to the sample resource, wherein the historical behavior sequence includes resources that interacted with the sample object before the interaction with the sample resource and the behavior of the sample object with respect to the interacted resources; and determine multiple resource preference information of the sample object based on the historical behavior sequence.
[0164] In some embodiments, the second determination unit is configured to obtain resources with positive interaction behavior from the historical behavior sequence of the sample object, where the positive interaction behavior is a behavior that provides positive feedback to the resources; and determine multiple resource preference information of the sample object based on the resources with positive interaction behavior.
[0165] In some embodiments, the first processing unit 601 includes:
[0166] A first processing subunit is configured to map the initial resource characteristics of the sample resource onto a unit sphere to obtain a first resource characteristic;
[0167] The second processing sub-unit is configured to add noise to the first resource feature based on Gaussian noise and a noise adding step number to obtain a second resource feature, where the noise adding step number is used to indicate the number of times the Gaussian noise is added.
[0168] In some embodiments, the second processing sub-unit is configured to perform random sampling in the slice space of the first resource feature to obtain a noise vector of Gaussian noise; determine an offset distance based on the noise vector of the Gaussian noise and the number of noise adding steps, and the offset distance is used to represent the total intensity of the noise to be added to the first resource feature; add the offset distance to the noise component in the first resource feature in the direction indicated by the noise vector of the Gaussian noise to obtain a second resource feature, and the noise component is a component in the first resource feature that is in the direction indicated by the noise vector.
[0169] In some embodiments, the second processing sub-unit is configured to determine the noise adding parameters based on the noise adding step length and the preset noise adding function, where the noise adding parameters are used to represent the intensity of the noise added each time, and the preset noise adding function is used to represent the correlation between the number of times the noise is added and the intensity of the noise added each time; and the product of the length of the noise vector of the Gaussian noise and the number of noise adding steps is used as the offset distance.
[0170] In some embodiments, the second processing unit 602 is configured to execute the diffusion enhancement module in the initial resource recommendation model, and based on the denoising step number, perform multiple denoising processes on the second resource feature to obtain a third resource feature, with multiple resource preference information as conditions. The denoising step number is used to indicate the number of times Gaussian noise is removed from the second resource feature.
[0171] In some embodiments, the apparatus further comprises:
[0172] A third processing unit is configured to score the third resource feature of the sample resource based on the first resource feature of the sample resource to obtain a first score, where the first score is used to indicate whether the resource generated by the initial resource recommendation model meets the preference of the sample object;
[0173] a fourth processing unit configured to execute scoring of a third resource feature of the sample resource based on a plurality of negative resources of the sample object to obtain a second score, wherein the negative resource is a resource that the sample object has not interacted with or a resource that the sample object has triggered a negative interaction behavior, wherein the negative interaction behavior is a behavior of providing negative feedback to the resource, and the negative resource is a resource that the sample object does not like, and the second score is used to indicate that the resource generated by the initial resource recommendation model does not meet the preference of the sample object;
[0174] A third determining unit is configured to determine a second loss based on the first score and the second score, where the second loss is used to indicate that the resources generated by the initial resource recommendation model meet the preferences of the sample object;
[0175] The training unit 604 is configured to perform training on the initial resource recommendation model based on the first loss and the second loss to obtain a target resource recommendation model.
[0176] In some embodiments, the third processing unit is configured to perform an inner product calculation on the first resource feature and the third resource feature to obtain a first score.
[0177] In some embodiments, the third determination unit is configured to perform the summation of the first score and the second score to obtain a total score; calculate the ratio between the first score and the total score, the ratio being used to represent the probability that the resources generated by the initial resource recommendation model meet the preferences of the sample object; and use the negative logarithm of the ratio as the second loss.
[0178] The disclosed embodiment provides a training device for a resource recommendation model. In the training process of the resource recommendation model, noise is first added to the first resource feature of the sample resource to obtain a second resource feature so as to blur the original characteristics of the sample resource. Then, based on the multiple resource preference information of the sample object, the second resource feature is denoised to predict the original characteristics of the sample resource. Since the multiple resource preference information reflects the multiple resource types liked by the sample object, the resource recommendation model can predict the characteristics of the resources liked by the sample object from the multiple preferences of the sample object, so that the third resource feature predicted by the resource recommendation model can fit the multiple resource types liked by the sample object. Since the third resource feature fits any resource type, it is the characteristic of the resource liked by the sample object. Therefore, it is convenient for the resource recommendation model to predict resources that fit the various resource types liked by the sample object according to the multiple resource preference information, which is conducive to the resource recommendation model to recommend more diverse, rich and object-like resources. Moreover, the model is trained by using the resource features predicted by the model and the real resource features of the sample resources, which further ensures that the resources predicted by the resource recommendation model are more and more in line with the real preferences of the sample object, thereby improving the accuracy of the resource recommendation model.
[0179] It should be noted that the training device for the resource recommendation model provided in the above embodiment only uses the division of the above functional units as an example when training the resource recommendation model. In actual applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the electronic device is divided into different functional units to complete all or part of the functions described above. In addition, the training device for the resource recommendation model provided in the above embodiment and the training method embodiment of the resource recommendation model belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0180] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0181] Figure 7 is a block diagram of a resource recommendation device according to an exemplary embodiment. Figure 7 , the device comprises:
[0182] The processing unit 701 is configured to execute inputting Gaussian noise into the target resource recommendation model, and performing denoising processing on the Gaussian noise based on multiple resource preference information of the object to obtain resource features, wherein the target resource recommendation model is trained by a training device of any of the resource recommendation models described above, wherein the multiple resource preference information is used to represent multiple resource types corresponding to the object, and the resource features are used to represent characteristics of resources preferred by the object;
[0183] The recommendation unit 702 is configured to recommend resources to the object based on resource features.
[0184] In some embodiments, the processing unit 701 is configured to execute the diffusion enhancement module in the target resource recommendation model, take multiple resource preference information as conditions, and based on the number of denoising steps, perform multiple denoising processes on the Gaussian noise to obtain resource characteristics. The denoising steps are used to indicate the denoising degree of the Gaussian noise, and the number of denoising processes is equal to the number of denoising steps.
[0185] In some embodiments, the recommendation unit 702 is configured to determine the similarity between the resource feature and the resource features of multiple resources based on the resource feature and the resource features of multiple resources; and recommend the resource to the object based on the similarity between the resource feature and the resource features of multiple resources.
[0186] The disclosed embodiment provides a resource recommendation device. Since multiple resource preference information reflects multiple resource types that an object likes, a resource recommendation model can predict the characteristics of resources that the object likes based on multiple aspects of the object's preferences, so that the resource characteristics predicted by the resource recommendation model can fit the multiple resource types that the object likes. Since resource characteristics that fit any resource type are characteristics of resources that the object likes, the resource recommendation model can predict resources of each resource type that fit the object's preferences based on multiple resource preference information, which is beneficial for the resource recommendation model to recommend more diverse, richer resources that meet the object's preferences.
[0187] It should be noted that the resource recommendation device provided in the above embodiment only uses the division of the above functional units as an example when recommending resources to users (objects). In actual applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the electronic device is divided into different functional units to complete all or part of the functions described above. In addition, the resource recommendation device provided in the above embodiment and the resource recommendation method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0188] When the terminal is provided as a terminal, Figure 8800 is a block diagram of a terminal 800 provided according to an embodiment of the present application. The terminal 800 may be a portable mobile terminal, such as a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer or a desktop computer. The terminal 800 may also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0189] Typically, the terminal 800 includes a processor 801 and a memory 802 .
[0190] The processor 801 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 801 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0191] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include a high-speed random access memory and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 802 is used to store at least one computer program, which is used to be executed by the processor 801 to implement the training method or resource recommendation method of the resource recommendation model provided in the method embodiment of the present application.
[0192] In some embodiments, the terminal 800 may further optionally include: a peripheral device interface 803 and at least one peripheral device. The processor 801, the memory 802 and the peripheral device interface 803 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 803 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 804, a display screen 805, a camera assembly 806, an audio circuit 807 and a power supply 808.
[0193] The peripheral device interface 803 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 801 and the memory 802. In some embodiments, the processor 801, the memory 802, and the peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 801, the memory 802, and the peripheral device interface 803 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0194] The radio frequency circuit 804 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 804 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 804 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. In some embodiments, the radio frequency circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 804 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 804 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0195] The display screen 805 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 805 is a touch display screen, the display screen 805 also has the ability to collect touch signals on the surface or above the surface of the display screen 805. The touch signal can be input to the processor 801 as a control signal for processing. At this time, the display screen 805 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 805 can be one, set on the front panel of the terminal 800; in other embodiments, the display screen 805 can be at least two, respectively set on different surfaces of the terminal 800 or in a folding design; in other embodiments, the display screen 805 can be a flexible display screen, set on the curved surface or folding surface of the terminal 800. Even, the display screen 805 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 805 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).
[0196] The camera assembly 806 is used to capture images or videos. In some embodiments, the camera assembly 806 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 806 may also include a flash. The flash may be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0197] The audio circuit 807 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 801 for processing, or input them into the radio frequency circuit 804 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 800. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 801 or the radio frequency circuit 804 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 807 may also include a headphone jack.
[0198] The power supply 808 is used to power various components in the terminal 800. The power supply 808 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 808 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery charged through a wired line, and a wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0199] In some embodiments, the terminal 800 further includes one or more sensors 809 , including but not limited to: an acceleration sensor 810 , a gyroscope sensor 811 , a pressure sensor 812 , an optical sensor 813 , and a proximity sensor 814 .
[0200] The acceleration sensor 810 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 800. For example, the acceleration sensor 810 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 801 can control the display screen 805 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 810. The acceleration sensor 810 can also be used to collect game or user motion data.
[0201] The gyro sensor 811 can detect the body direction and rotation angle of the terminal 800, and the gyro sensor 811 can cooperate with the acceleration sensor 810 to collect the user's 3D actions on the terminal 800. The processor 801 can implement the following functions based on the data collected by the gyro sensor 811: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0202] The pressure sensor 812 can be set on the side frame of the terminal 800 and / or the lower layer of the display screen 805. When the pressure sensor 812 is set on the side frame of the terminal 800, it can detect the user's holding signal of the terminal 800, and the processor 801 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 812. When the pressure sensor 812 is set on the lower layer of the display screen 805, the processor 801 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 805. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0203] The optical sensor 813 is used to collect the ambient light intensity. In one embodiment, the processor 801 can control the display brightness of the display screen 805 according to the ambient light intensity collected by the optical sensor 813. Specifically, when the ambient light intensity is high, the display brightness of the display screen 805 is increased; when the ambient light intensity is low, the display brightness of the display screen 805 is reduced. In another embodiment, the processor 801 can also dynamically adjust the shooting parameters of the camera component 806 according to the ambient light intensity collected by the optical sensor 813.
[0204] The proximity sensor 814, also called a distance sensor, is usually disposed on the front panel of the terminal 800. The proximity sensor 814 is used to collect the distance between the user and the front of the terminal 800. In one embodiment, when the proximity sensor 814 detects that the distance between the user and the front of the terminal 800 is gradually decreasing, the processor 801 controls the display screen 805 to switch from the screen-on state to the screen-off state; when the proximity sensor 814 detects that the distance between the user and the front of the terminal 800 is gradually increasing, the processor 801 controls the display screen 805 to switch from the screen-off state to the screen-on state.
[0205] Those skilled in the art will understand that Figure 8 The structure shown in the figure does not constitute a limitation on the terminal 800, and the terminal 800 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0206] When the electronic device is provided as a server, Fig. 9It is a block diagram of a server 900 according to an exemplary embodiment. The server 900 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 901 and one or more memories 902, wherein the memory 902 stores at least one program code, and the at least one program code is loaded and executed by the processor 901 to implement the training method or resource recommendation method of the resource recommendation model provided by the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 900 may also include other components for implementing device functions, which will not be repeated here.
[0207] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 802 or a memory 902 including instructions, and the instructions can be executed by the processor 801 of the terminal 800 or the processor 901 of the server 900 to complete the training method of the resource recommendation model or the resource recommendation method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0208] A computer program product includes a computer program / instruction, which, when executed by a processor, implements the training method of the resource recommendation model or the resource recommendation method.
[0209] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0210] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for training a resource recommendation model, characterized in that: The method comprises: By using the initial resource recommendation model, adding noise to a first resource feature of a sample resource to obtain a second resource feature of the sample resource, wherein the sample resource is a resource with which the sample object has interacted, and the first resource feature is used to represent the content of the sample resource; Based on multiple resource preference information of the sample object, denoising the second resource feature to obtain a third resource feature of the sample resource, wherein the multiple resource preference information is used to represent multiple resource types corresponding to the sample object; Determine a first loss according to the first resource feature and the third resource feature, where the first loss is used to represent the difference between the resource generated by the initial resource recommendation model and the real resource; Based on the first loss, the initial resource recommendation model is trained to obtain a target resource recommendation model for recommending resources.
2. The method for training a resource recommendation model according to claim 1, characterized in that: The method further comprises: Determine, based on the interaction time point of the sample object with respect to the sample resource, a historical behavior sequence of the sample object, wherein the historical behavior sequence includes resources that interacted with the sample object before the interaction with the sample resource and behaviors of the sample object with respect to the interacted resources; Based on the historical behavior sequence, multiple resource preference information of the sample object is determined.
3. The method for training a resource recommendation model according to claim 2, characterized in that: The determining of the plurality of resource preference information of the sample object based on the historical behavior sequence includes: Acquire resources with positive interaction behaviors from the historical behavior sequence of the sample object, where the positive interaction behaviors are behaviors that provide positive feedback to the resources; Based on the resources with positive interaction behaviors, multiple resource preference information of the sample objects are determined.
4. The method for training a resource recommendation model according to claim 1, characterized in that: The adding noise to the first resource feature of the sample resource to obtain the second resource feature of the sample resource includes: Mapping the initial resource characteristics of the sample resource onto a unit sphere to obtain the first resource characteristics; Based on Gaussian noise and the number of noise adding steps, noise is added to the first resource feature to obtain the second resource feature, where the number of noise adding steps is used to indicate the number of times Gaussian noise is added.
5. The method for training a resource recommendation model according to claim 4, characterized in that: The adding noise to the first resource feature based on Gaussian noise and the number of noise adding steps to obtain the second resource feature includes: In the slice space of the first resource feature, random sampling is performed to obtain a noise vector of Gaussian noise; Determine an offset distance based on the noise vector of the Gaussian noise and the number of noise adding steps, where the offset distance is used to represent the total intensity of the noise to be added to the first resource feature; According to the direction indicated by the noise vector of the Gaussian noise, the offset distance is added to the noise-added component in the first resource feature to obtain the second resource feature, where the noise-added component is the component in the first resource feature in the direction indicated by the noise vector.
6. The method for training a resource recommendation model according to claim 5, characterized in that: The step of determining the offset distance based on the noise vector of the Gaussian noise and the number of noise adding steps includes: Based on the noise adding step length and the preset noise adding function, determining a noise adding parameter, wherein the noise adding parameter is used to represent the intensity of each noise added, and the preset noise adding function is used to represent the correlation between the number of times the noise is added and the intensity of each noise added; The product of the length of the noise vector of the Gaussian noise and the number of noise adding steps is used as the offset distance.
7. The method for training a resource recommendation model according to claim 1, characterized in that: The step of performing denoising on the second resource feature based on the plurality of resource preference information of the sample object to obtain the third resource feature of the sample resource includes: Through the diffusion enhancement module in the initial resource recommendation model, the second resource feature is subjected to multiple denoising processes based on the denoising steps and the multiple resource preference information, so as to obtain the third resource feature. The denoising steps are used to represent the number of times the Gaussian noise is removed from the second resource feature.
8. The method for training a resource recommendation model according to claim 1, characterized in that: The method further comprises: Based on the first resource feature of the sample resource, scoring the third resource feature of the sample resource to obtain a first score, where the first score is used to indicate the degree to which the resource generated by the initial resource recommendation model meets the preference of the sample object; Based on multiple negative resources of the sample object, scoring the third resource feature of the sample resource to obtain a second score, wherein the negative resource is a resource that the sample object has not interacted with or a resource that the sample object has triggered a negative interaction behavior, wherein the negative interaction behavior is a behavior of providing negative feedback to a resource, and the second score is used to indicate the degree to which the resource generated by the initial resource recommendation model does not meet the preference of the sample object; Determine a second loss based on the first score and the second score, where the second loss is used to indicate that the resources generated by the initial resource recommendation model meet the preferences of the sample object; The step of training the initial resource recommendation model based on the first loss to obtain a target resource recommendation model for recommending resources includes: The initial resource recommendation model is trained based on the first loss and the second loss to obtain the target resource recommendation model.
9. The method for training a resource recommendation model according to claim 8, characterized in that: Scoring the third resource feature of the sample resource based on the first resource feature of the sample resource to obtain a first score includes: An inner product is calculated for the first resource feature and the third resource feature to obtain the first score.
10. The method for training a resource recommendation model according to claim 8, characterized in that: The determining a second loss based on the first score and the second score comprises: summing the first score and the second score to obtain a total score; Calculating a ratio between the first score and the total score, the ratio being used to represent a probability that the resources generated by the initial resource recommendation model meet the preferences of the sample object; The negative logarithm of the ratio is taken as the second loss.
11. A resource recommendation method, characterized in that: The method comprises: Inputting Gaussian noise into a target resource recommendation model, and performing denoising processing on the Gaussian noise based on multiple resource preference information of an object to obtain resource features, wherein the target resource recommendation model is trained based on the training method of a resource recommendation model according to any one of claims 1 to 10, wherein the multiple resource preference information is used to represent multiple resource types corresponding to the object, and the resource features are used to represent the characteristics of the resources preferred by the object; Based on the resource characteristics, recommend resources to the object.
12. A training device for a resource recommendation model, characterized in that: The device comprises: A first processing unit is configured to add noise to a first resource feature of a sample resource through an initial resource recommendation model to obtain a second resource feature of the sample resource, wherein the sample resource is a resource that a sample object has interacted with, and the first resource feature is used to represent content of the sample resource; A second processing unit is configured to perform denoising processing on the second resource feature based on multiple resource preference information of the sample object to obtain a third resource feature of the sample resource, wherein the multiple resource preference information is used to represent multiple resource types corresponding to the sample object; A first determining unit is configured to determine a first loss according to the first resource feature and the third resource feature, where the first loss is used to represent a difference between a resource generated by the initial resource recommendation model and a real resource; The training unit is configured to perform training on the initial resource recommendation model based on the first loss to obtain a target resource recommendation model for recommending resources.
13. A resource recommendation device, characterized in that: The device comprises: A processing unit configured to execute inputting Gaussian noise into a target resource recommendation model, and denoising the Gaussian noise based on multiple resource preference information of an object to obtain resource features, wherein the target resource recommendation model is trained based on a training device for a resource recommendation model according to any one of claims 1 to 10, wherein the multiple resource preference information is used to represent multiple resource types corresponding to the object, and the resource features are used to represent characteristics of resources preferred by the object; The recommendation unit is configured to recommend resources to the object based on the resource features.
14. An electronic device, characterized in that: The electronic device comprises: one or more processors; a memory for storing program code executable by the processor; The processor is configured to execute the program code to implement the training method of the resource recommendation model as described in any one of claims 1 to 10; or, the processor is configured to execute the program code to implement the resource recommendation method as described in claim 11.
15. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the training method of the resource recommendation model as described in any one of claims 1 to 10; or, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the resource recommendation method as described in claim 11.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, it implements the training method of the resource recommendation model described in any one of claims 1 to 10; or, when the computer program is executed by a processor, it implements the resource recommendation method described in claim 11.
Citation Information
Patent Citations
Model optimization method and device based on diffusion model, equipment, medium and product
CN117408777A
Fair recommendation method and system based on conditional diffusion model
CN117745371A
Social network activity recommendation system and method based on multi-channel denoising
CN117909598A
Method and apparatus for recommending cold start object, computer device, and storage medium
US20240037133A1
