Product recommendation model training method, product recommendation method, device, and storage medium
By performing data augmentation and representation distance calculation on user behavior sequences, a product recommendation model is trained, which solves the problem of sparse user behavior data and achieves effective user interest characterization and improved product recommendation accuracy under sparse data.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-24
- Publication Date
- 2026-03-27
AI Technical Summary
The sparsity of user behavior data means that when merchants recommend products to users based on this sparse user behavior data, they cannot improve the product conversion rate.
The product recommendation model is used to augment the user's historical behavior sequence with data, calculate the representation distance between different users and the same user, determine the loss value of the loss function, and train the model based on this until the model converges.
Enhancing historical behavior sequences can better characterize the behavioral features of the same user and distinguish the behavioral features of different users, thereby effectively learning user interests and preferences under sparse user behavior data and improving the accuracy of product recommendations and conversion rates.
Smart Images

Figure CN116932908B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the technical field of machine learning, and particularly relates to a product recommendation model training method, a product recommendation method, an apparatus and a storage medium. BACKGROUND
[0002] With the rapid development of big data, various merchants begin to recommend products needed by users to users according to user behavior data such as browsing, clicking and purchasing of users, but these methods depend on a large amount of user behavior data. In actual scenarios, user behavior data often has a sparsity problem, and when a merchant recommends products to users based on the sparse user behavior data, the product conversion rate cannot be improved. SUMMARY
[0003] The present specification provides a product recommendation model training method, a product recommendation method, an apparatus and a storage medium, which can solve the technical problem that user behavior data has a sparsity problem, resulting in that when a merchant recommends products to users based on the sparse user behavior data, the product conversion rate cannot be improved. The technical solution is as follows:
[0004] In a first aspect, an embodiment of the present specification provides a product recommendation model training method, which comprises:
[0005] Obtaining at least one user historical behavior sequence, performing data enhancement on the historical behavior sequence of each user based on a product recommendation model to obtain at least two enhanced historical behavior sequences corresponding to each user historical behavior sequence;
[0006] Determining a first representation distance value between different users and a second representation distance value between the same users corresponding to the enhanced historical behavior sequence of each user based on the product recommendation model, and determining a loss value of a loss function of the product recommendation model based on the first representation distance value and the second representation distance value;
[0007] Training the product recommendation model based on the loss value of the loss function until the product recommendation model converges.
[0008] In a second aspect, an embodiment of the present specification provides a product recommendation method, which comprises:
[0009] Obtaining a target user historical behavior sequence of a target user, and inputting the target user historical behavior sequence into a product recommendation model;
[0010] Determining a product recommendation result corresponding to the target user historical behavior sequence according to output data of the product recommendation model; wherein the product recommendation model is a product recommendation model trained by the product recommendation model training method in any of the above embodiments.
[0011] In a third aspect, an embodiment of the present specification provides a product recommendation model training apparatus, the apparatus comprising:
[0012] a data enhancement module adapted to obtain at least one user historical behavior sequence, and perform data enhancement on the historical behavior sequence of each user based on a product recommendation model to obtain at least two enhanced historical behavior sequences corresponding to each user's historical behavior sequence;
[0013] a loss function determination module adapted to determine first representation distance values between different users and second representation distance values between the same users corresponding to the enhanced historical behavior sequences of each user based on the product recommendation model, and determine a loss value of a loss function of the product recommendation model based on the first representation distance values and the second representation distance values;
[0014] a convergence module adapted to train the product recommendation model based on the loss value of the loss function until the product recommendation model converges.
[0015] In a fourth aspect, an embodiment of the present specification provides a product recommendation apparatus, the apparatus comprising:
[0016] an obtaining module adapted to obtain a target user historical behavior sequence of a target user, and input the target user historical behavior sequence into a product recommendation model;
[0017] a recommendation module adapted to determine a product recommendation result corresponding to the target user historical behavior sequence according to output data of the product recommendation model; wherein the product recommendation model is a product recommendation model trained by the product recommendation model training method in any of the above embodiments.
[0018] In a fifth aspect, an embodiment of the present specification provides a computer program product containing instructions, which, when executed on a computer or a processor, cause the computer or the processor to perform the steps of the above method.
[0019] In a sixth aspect, an embodiment of the present specification provides a computer storage medium storing a plurality of instructions, which are adapted to be loaded by a processor and perform the steps of the above method.
[0020] In a seventh aspect, an embodiment of the present specification provides a terminal comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being adapted to be loaded by the processor and perform the steps of the above method.
[0021] The technical solutions provided by some embodiments of the specification have at least the following beneficial effects: determining a first feature distance value corresponding to an enhanced historical behavior sequence between different users and a second feature distance value corresponding to the enhanced historical behavior sequence between the same user based on a product recommendation model, and determining a loss value of a loss function of the product recommendation model according to the first feature distance value and the second feature distance value. In this way, training the product recommendation model based on the loss value of the loss function can make the first feature distance value between different users of the historical behavior sequence obtained after data enhancement be pulled away, and the second feature distance value between the same users be pulled close, so that the enhanced historical behavior sequence obtained after data enhancement can better depict the user behavior characteristics of the same user and can distinguish the user behavior characteristics between different users, and then the product recommendation model can effectively learn and depict the interest preferences of the user when the user behavior data is sparse, thereby recommending appropriate products for the user. BRIEF DESCRIPTION OF DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the specification or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the specification, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0023] Figure 1 An exemplary system architecture diagram of a product recommendation model training method provided by an embodiment of the specification;
[0024] Figure 2 A flowchart of a product recommendation model training method provided by an embodiment of the specification;
[0025] Figure 3 A flowchart of another product recommendation model training method provided by an embodiment of the specification
[0026] Figure 4 A flowchart of a method for determining a first feature distance value and a second feature distance value provided by an embodiment of the specification;
[0027] Figure 5 A structure diagram of a product recommendation model provided by an embodiment of the specification;
[0028] Figure 6 A local architecture diagram of a product recommendation model provided by an embodiment of the specification;
[0029] Figure 7 A flowchart of a method for determining a loss value of a loss function of a product recommendation model provided by an embodiment of the specification;
[0030] Figure 8 Another flowchart for determining a loss value of a loss function of a product recommendation model provided by an embodiment of the present specification;
[0031] Figure 9 A flowchart of data enhancement provided by an embodiment of the present specification;
[0032] Figure 10 A schematic diagram of an item mask provided by an embodiment of the present specification;
[0033] Figure 11 A schematic diagram of item reorder provided by an embodiment of the present specification
[0034] Figure 12 A flowchart of a product recommendation method provided by an embodiment of the present specification;
[0035] Figure 13 A block diagram of a product recommendation model training device provided by an embodiment of the present specification;
[0036] Figure 14 A block diagram of a product recommendation device provided by an embodiment of the present specification;
[0037] Figure 15 A structural schematic diagram of a terminal provided by an embodiment of the present specification. DETAILED DESCRIPTION
[0038] In order to make the features and advantages of the embodiments of the present specification more obvious and easy to understand, the technical solutions in the embodiments of the present specification will be described clearly and completely in conjunction with the accompanying drawings of the embodiments of the present specification. Obviously, the described embodiments are only some of the embodiments of the present specification, not all the embodiments. Based on the embodiments in the present specification, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the embodiments of the present specification.
[0039] The following description refers to the accompanying drawings. Unless otherwise indicated, same numbers in different drawings indicate the same or similar elements. The implementations described in the following example embodiments are not meant to represent all implementations consistent with the embodiments of the present specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of the present specification as detailed in the appended claims.
[0040] With the rapid rise of big data, big data has been applied to the business field, and analyzing user behavior characteristics based on big data to improve the seller's revenue has become a common technical means at present. However, when the user behavior data has a sparsity problem, it is difficult to learn more user behavior characteristics based on these data with sparsity problems. For example, in the insurance recommendation scenario, among the daily exposed users, only about 25% of the users have click behavior within the past 7 days, and the average click sequence length is only 8.8 click items, so that the user behavior data is insufficient, and it is difficult to effectively learn and characterize the user's interest preferences through the user's interaction behavior on the insurance platform, thereby recommending appropriate insurance products for the user.
[0041] Therefore, an embodiment of the present specification provides a product recommendation model training method, which first acquires at least one user historical behavior sequence of a user in a predetermined time period in the past, performs data augmentation on the historical behavior sequence of each user based on a product recommendation model, and obtains at least two enhanced historical behavior sequences corresponding to each user's historical behavior sequence after data augmentation. Then, based on the product recommendation model, the first representation distance value corresponding to the enhanced historical behavior sequence between different users and the second representation distance value corresponding to the enhanced historical behavior sequence between the same user are determined, and the loss value of the loss function of the product recommendation model is determined according to the first representation distance value and the second representation distance value.
[0042] In this way, training the product recommendation model based on the loss value of the loss function can make the first representation distance value between different users obtained after data augmentation far away, and the second representation distance value between the same user close, so that the enhanced historical behavior sequence obtained after data augmentation can better characterize the user behavior characteristics of the same user and can distinguish the user behavior characteristics between different users, and then the product recommendation model can effectively learn and characterize the user's interest preferences when the user behavior data has a sparsity problem, thereby recommending appropriate products for the user.
[0043] Please refer to Figure 1 , Figure 1 An exemplary system architecture diagram of a product recommendation model training method provided by an embodiment of the present specification is shown.
[0044] As shown in Figure 1 , the system architecture can include a terminal 101, a network 102 and a server 103. The network 102 is used to provide a communication link medium between the terminal 101 and the server 103. The network 102 can include various types of wired communication links or wireless communication links, such as: wired communication links include optical fiber, twisted pair or coaxial cable, wireless communication links include Bluetooth communication link, Wireless-Fidelity (Wi-Fi) communication link or microwave communication link, etc.
[0045] The terminal 101 can interact with the server 103 through the network 102 to receive a message from the server 103 or send a message to the server 103, or the terminal 101 can interact with the server 103 through the network 102 to receive a message or data sent by other users to the server 103. The terminal 101 can be hardware or software. When the terminal 101 is hardware, it can be various electronic devices, including but not limited to smart watches, smart phones, tablet computers, laptop computers, desktop computers, and the like. When the terminal 101 is software, it can be installed in the above-mentioned electronic devices, which can be implemented as multiple software or software modules (for example, to provide distributed services) or a single software or software module, which is not specifically limited here.
[0046] In the embodiments of the present specification, first, the terminal 101 can obtain at least one user historical behavior sequence, perform data augmentation on the historical behavior sequence of each user based on the product recommendation model to obtain at least two enhanced historical behavior sequences corresponding to the historical behavior sequence of each user; then, the terminal 101 determines the first representation distance value between different users and the second representation distance value between the same users corresponding to the enhanced historical behavior sequence of each user based on the product recommendation model, and determines the loss value of the loss function of the product recommendation model based on the first representation distance value and the second representation distance value; finally, the terminal 101 trains the product recommendation model based on the loss value of the loss function until the product recommendation model converges.
[0047] The server 103 can be an integrated server that provides various services. It should be noted that the server 103 can be hardware or software. When the server 103 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server. When the server 103 is software, it can be implemented as multiple software or software modules (for example, to provide distributed services), or as a single software or software module, which is not specifically limited here.
[0048] Alternatively, the system architecture can also not include the server 103, in other words, the server 103 can be an optional device in the embodiments of the present specification, that is, the method provided by the embodiments of the present specification can be applied to a system structure including only the terminal 101, and the embodiments of the present specification do not limit this.
[0049] It should be understood that Figure 1 The number of terminals, networks and servers in the above-mentioned system architecture is only illustrative, and can be any number of terminals, networks and servers according to the needs of implementation.
[0050] Please refer to Figure 2 , Figure 2A flowchart of a product recommendation model training method provided by an embodiment of the present specification. The execution subject of the embodiment of the present specification can be a terminal executing the product recommendation model training method, can also be a processor in the terminal executing the product recommendation model training method, and can also be a product recommendation model training service in the terminal executing the product recommendation model training method. For the convenience of description, the specific execution process of the product recommendation model training method is introduced below by taking the execution subject as the processor in the terminal.
[0051] As shown in Figure 2 The product recommendation model training method can at least include:
[0052] S202: Obtain at least one user historical behavior sequence, and respectively perform data enhancement on the historical behavior sequence of each user based on the product recommendation model to obtain at least two enhanced historical behavior sequences corresponding to the historical behavior sequence of each user.
[0053] Firstly, record the user behavior events of each user in the historical time period, such as browsing, clicking, and purchasing products, arrange these user behavior events in chronological order, and convert them into data sequences, so as to obtain the user historical behavior sequence of each user.
[0054] Secondly, obtain one or more user historical behavior sequences. Here, the obtained user historical behavior sequences can be as many as possible. It should be noted that the more samples of the user historical behavior sequence, the more user behavior features the product recommendation model can learn.
[0055] Since the user historical behavior sequence has the problem of data sparsity, the historical behavior sequence of each user can be respectively enhanced based on the product recommendation model to increase the number of samples learned by the product recommendation model. After data enhancement, each user's historical behavior sequence obtains two or more enhanced historical behavior sequences. In this way, after data enhancement, each user's historical behavior sequence can obtain an original user historical behavior sequence and two enhanced historical behavior sequences. For example, the user historical behavior sequence can be N, and the number of enhanced historical behavior sequences obtained is 2N.
[0056] It should be noted that one user historical behavior sequence corresponds to at least two enhanced historical behavior sequences, which is used to represent the representation distance between the same users in the enhanced historical behavior sequence and the representation distance between different users. Moreover, the representation distance between the same users in the enhanced historical behavior sequence is generally represented by at least two enhanced historical behavior sequences corresponding to one user historical behavior sequence.
[0057] S204: determine the first representation distance value between different users and the second representation distance value between the same users corresponding to the enhanced historical behavior sequence of each user based on the product recommendation model, and determine the loss value of the loss function of the product recommendation model based on the first representation distance value and the second representation distance value.
[0058] The first representation distance value between different users is determined by the enhanced historical behavior sequence between different users, and the second representation distance value between the same user corresponding to at least two enhanced historical behavior sequences of the same user is determined by at least two enhanced historical behavior sequences of the same user. Here, the reliability of the enhanced historical behavior sequence is represented by the first representation distance value and the second representation distance value.
[0059] When the first representation distance value is larger, it means that the representation of the enhanced historical behavior sequence corresponding to different users has a distinguishing degree, which matches the actual data; when the second representation distance value is smaller, it means that the representation of the at least two enhanced historical behavior sequences corresponding to the same user is closer, which also matches the actual data.
[0060] Then, the loss value of the loss function of the product recommendation model is determined based on the first representation distance value and the second representation distance value, and the loss value of the loss function is used to represent the first representation distance value and the second representation distance value at the same time. The smaller the loss value of the loss function, the larger the first representation distance value, and the smaller the second representation distance value, and the enhanced historical behavior sequence is closer to the real data at this time. Thus, the product recommendation model can fully and effectively learn the behavior sequence of the user based on the existing user historical behavior sequence and the enhanced historical behavior sequence. It should be noted that the loss function of the product recommendation model is determined based on the parameters corresponding to the first representation distance value and the parameters corresponding to the second representation distance value.
[0061] In one possible implementation, the historical behavior sequence of each user corresponds to two enhanced historical behavior sequences, and if the number of historical behavior sequences is N, one enhanced historical behavior sequence corresponds to one second representation distance value of the same user, and one enhanced historical behavior sequence corresponds to 2N-2 second representation distance values of different users.
[0062] In another possible implementation, the historical behavior sequence of each user corresponds to three enhanced historical behavior sequences, and if the number of historical behavior sequences is N, one enhanced historical behavior sequence corresponds to two second representation distance values of the same user, and one enhanced historical behavior sequence corresponds to 3N-3 second representation distance values of different users. In addition, when the historical behavior sequence of each user corresponds to n enhanced historical behavior sequences, if the number of historical behavior sequences is N, one enhanced historical behavior sequence corresponds to n-1 second representation distance values of the same user, and one enhanced historical behavior sequence corresponds to n(N-1) second representation distance values of different users.
[0063] S206: training the product recommendation model based on the loss value of the loss function until the product recommendation model converges.
[0064] Optionally, when the loss value of the loss function does not match the preset loss value, updating the product recommendation model based on the loss value, and again performing the step of performing data augmentation on the historical behavior sequence of each user based on the product recommendation model, updating the loss value of the loss function until the loss value matches the preset loss value, and then the product recommendation model converges.
[0065] Whether to update the product recommendation model is determined by the loss value of the loss function. Here, the update of the product recommendation model can be achieved by adjusting the parameters in the product recommendation model.
[0066] When the loss value of the loss function does not match the preset loss value, it indicates that the loss value of the loss function has not converged to the preset loss value. At this time, the loss value of the loss function can be further reduced. The parameters in the product recommendation model are adjusted by the loss value of the loss function until the loss value matches the preset loss value, i.e., the loss value converges to the preset loss value, and then the product recommendation model converges. At this time, the product recommendation model is trained.
[0067] Optionally, when the parameters in the product recommendation model are adjusted by the loss value of the loss function, at least the target parameters corresponding to the data augmentation in the product recommendation model can be updated based on the loss value.
[0068] By adjusting the target parameters corresponding to the data augmentation in the product recommendation model, the way of data augmentation on the historical behavior sequence of the user is adjusted, so as to adjust the first representation distance value and the second representation distance value corresponding to the at least two enhanced historical behavior sequences corresponding to the historical behavior sequence of each user, and further make the enhanced historical behavior sequence closer to the real user's behavior interest preference.
[0069] The embodiment of the specification provides a product recommendation model training method. First, data enhancement is performed on at least one user historical behavior sequence to obtain at least two enhanced historical behavior sequences that can represent first representation distance values between different users and second representation distance values between the same users. Then, the loss value of a loss function of a product recommendation model is determined by using the first representation distance values and the second representation distance values, and the product recommendation model is trained based on the loss value of the loss function that can represent the first representation distance values and the second representation distance values, so as to continuously adjust the product recommendation model and further adjust the enhanced historical behavior sequence, so that the enhanced historical behavior sequence is closer to the behavior interest preference of a real user, until the product recommendation model converges. The product recommendation model obtained can solve the technical problem that when user behavior data is sparse, a product recommendation model cannot improve product transaction rate when a merchant recommends a product to a user based on the sparse user behavior data.
[0070] Please refer to Figure 3 , Figure 3 A flowchart of another product recommendation model training method provided by the embodiment of the specification is shown.
[0071] As shown in Figure 3 , the step S204 includes:
[0072] S302: determining each positive sample pair based on the at least two enhanced historical behavior sequences corresponding to the historical behavior sequence of the same user.
[0073] The historical behavior sequence of the same user corresponds to two or more enhanced historical behavior sequences, and each two enhanced historical behavior sequences form a positive sample pair. For example, when the historical behavior sequence of the same user corresponds to two enhanced historical behavior sequences, the same user corresponds to one positive sample pair; when the historical behavior sequence of the same user corresponds to three enhanced historical behavior sequences, the same user corresponds to three positive sample pairs; and when the historical behavior sequence of the same user corresponds to n enhanced historical behavior sequences, the same user corresponds to n positive sample pairs.
[0074] Here, the positive sample is used to depict the closeness of the behavior features between the two enhanced historical behavior sequences corresponding to the historical behavior sequence of the same user.
[0075] S304: determining each negative sample pair based on the enhanced historical behavior sequences corresponding to the historical behavior sequence of different users.
[0076] The negative sample pairs are formed between each of the two enhanced historical behavior sequences of each two users. For example, when the historical behavior sequence of the same user corresponds to two enhanced historical behavior sequences, the number of historical behavior sequences is N, and the number of negative sample pairs corresponding to each enhanced historical behavior sequence is 2N-2; when the historical behavior sequence of the same user corresponds to three enhanced historical behavior sequences, the number of historical behavior sequences is N, and the number of negative sample pairs corresponding to each enhanced historical behavior sequence is 3N-3; when the historical behavior sequence of the same user corresponds to n enhanced historical behavior sequences, the number of negative sample pairs corresponding to each enhanced historical behavior sequence is nN-n.
[0077] Here, the negative sample is used to depict the closeness of the behavior features between the two enhanced historical behavior sequences corresponding to the historical behavior sequences of different users.
[0078] S306: determining, based on the product recommendation model, a first representation distance value corresponding to each negative sample pair and a second representation distance value corresponding to each positive sample pair.
[0079] The second representation distance value corresponding to each positive sample pair is determined through each positive sample, and the first representation distance value corresponding to each negative sample pair is determined through each negative sample. The second representation distance value is used to represent the closeness of the behavior features between the enhanced historical behavior sequences corresponding to the same user, and the first representation distance value is used to represent the closeness of the behavior features between the enhanced historical behavior sequences corresponding to different users.
[0080] Please refer to Figure 4 , Figure 4 for a flowchart of a method for determining a first representation distance value and a second representation distance value provided by an embodiment of the present specification.
[0081] As shown in Figure 4 , the step S306 of determining, based on the product recommendation model, the first representation distance value corresponding to each negative sample pair and the second representation distance value corresponding to each positive sample pair, comprises:
[0082] S402: extracting the behavior features of each of the two enhanced historical behavior sequences corresponding to each negative sample pair, determining two first metric vectors corresponding to each negative sample pair, and determining the first representation distance value between different users based on the cosine distance of the two first metric vectors corresponding to each negative sample pair.
[0083] By extracting the behavioral features corresponding to the two augmented historical behavior sequences in each negative sample pair, two first metric vectors corresponding to each of these two augmented historical behavior sequences are established. Then, the cosine distance between these two first metric vectors is calculated using a cosine function to obtain the first representation distance values for different users. Here, the cosine distance between the two first metric vectors is the cosine value of the two first metric vectors in the vector space, and this cosine value can be used as a measure of the magnitude of the difference between the two first metric vectors corresponding to each negative sample pair.
[0084] S404: Extract the behavioral features of the two enhanced historical behavior sequences corresponding to each positive sample pair, determine the two second metric vectors corresponding to each positive sample pair, and determine the second representation distance value of the same user based on the cosine distance between the two second metric vectors corresponding to each positive sample pair.
[0085] By extracting the behavioral features corresponding to the two augmented historical behavior sequences in each positive sample pair, two second metric vectors corresponding to each of these two augmented historical behavior sequences are established. Then, the cosine distance between these two second metric vectors is calculated using a cosine function to obtain the second representation distance value for each user. Here, the cosine distance between two second metric vectors is the cosine value of the two second metric vectors in the vector space, which can be used as a measure of the magnitude of the difference between the two second metric vectors corresponding to each positive sample pair. It should be noted that a vector corresponding to an augmented historical behavior sequence can be both a first metric vector and a second metric vector, but the two second metric vectors corresponding to each positive sample pair will not simultaneously be each other's first metric vectors, and the two first metric vectors corresponding to each negative sample pair will not simultaneously be each other's second metric vectors.
[0086] In one embodiment provided in this specification, determining the loss value of the loss function of the product recommendation model based on a first representation distance value and a second representation distance value includes:
[0087] The second representation distance value based on each positive sample pair Determine each numerator term And based on the first representation distance value H0 = S(z) for each negative sample pair corresponding to each positive sample pair. i ,z j Determine the denominator term
[0088] The first loss term L is determined based on the ratio of each numerator to the denominator. i = -log(A i / A0), based on each first loss term, determine the loss value of the loss function of the product recommendation model;
[0089] Where i and j represent the indices of two augmentation history behavior sequences that are negative sample pairs; i = 0, 1, 2, ..., K; K+1 is the total number of augmentation history behavior sequences; Z i and Z i + Z represents the two second metric vectors corresponding to a pair of positive samples; S(x, y) represents the cosine distance function; Z i and Z j This represents the two first metric vectors corresponding to a negative sample pair; the temperature coefficient τ is a set hyperparameter.
[0090] Here, the first representation distance value H0 = S(z) i ,z j The second characteristic distance value S(x, y) represents the cosine distance function, Z i and Z i + Z represents the two second metric vectors corresponding to the augmented historical behavior sequence with index i in the positive sample pair. i and Z j This represents the two first metric vectors corresponding to the augmented historical behavior sequence with index i in the negative sample pair, where one of the first metric vectors is Z. i The other is Z j The temperature coefficient τ is a set hyperparameter used to control the model's ability to distinguish negative samples.
[0091] As i changes, the first loss term L i Things are also changing, L i Complete can be represented as When L i When the numerator is smaller, a larger numerator is better, meaning the numerator encourages higher similarity between positive sample pairs; conversely, a smaller denominator is better, meaning the denominator encourages lower similarity between negative sample pairs.
[0092] Please see Figure 5 and Figure 6 , Figure 5 This is a schematic diagram of the structure of a product recommendation model provided in an embodiment of this specification. Figure 6 This is a partial architecture diagram of a product recommendation model provided in an embodiment of this specification.
[0093] like Figure 5 As shown in the embodiments provided in this specification, the product recommendation model includes at least: an exposure click-through rate prediction sub-model and a click conversion rate prediction sub-model;
[0094] Among them, the exposure click-through rate prediction sub-model is used to predict the product's exposure click-through rate (pCTR), and the click conversion rate prediction sub-model is used to predict the product's click conversion rate (pCVR).
[0095] The product of click-through rate (pCTR) and click-through conversion rate (pCVR) can be used to obtain the click-through conversion rate (pCTRVR) predicted by the product recommendation model. The loss value of the loss function of the product recommendation model can be used to adjust the click-through rate prediction sub-model and the click-through conversion rate prediction sub-model so that they can effectively learn the user's interests and preferences.
[0096] Figure 6 The structure of the output pCVR can correspond to Figure 5 The click-through rate prediction sub-model in the middle, Figure 6 The structure of the output pCTR can correspond to Figure 6 The exposure click-through rate prediction sub-model in the [model name]. It should be noted that... Figure 6 This is a partial architecture diagram of the product recommendation model. Figure 6 The following will illustrate important parts of the embodiments in this specification, such as how to obtain the first loss term L. i How to make predictions based on users' historical behavior sequences using product recommendation models? Furthermore, Figure 6 The structures Expert A, Expert B, Expert Shared, Gate A, and Gate B can be multiple.
[0097] Figure 7 The encoder structure uses a single-layer, dual-head Transformer to encode the sequence, and positional encoding is used to represent the different items in the sequence to learn their positional information. Building upon this, a commonly used Target Attention structure is introduced to learn the different impacts of different items in historical behavior sequences on the current recommended product. Finally, a single-layer MLP (Multilayer Perceptron) is used as the projector to map user representations into the same vector space. Figure 7 The input section includes the enhanced user history behavior sequence S i Enhanced user history behavior sequence S j The original user history behavior sequence S, user characteristics, and product characteristics, etc., are processed by the Encoder structure. The output includes the user representation e. i User representation e j User representation e.
[0098] Please see Figure 7 , Figure 8A flowchart for determining a loss value of a loss function of a product recommendation model is provided for an embodiment of the present specification.
[0099] As shown in Figure 8 , determining a loss value of a loss function of a product recommendation model based on each first loss term comprises:
[0100] S702: Determine an exposure click rate loss function of the exposure click rate estimation sub-model based on the exposure click rate estimation sub-model, each user historical behavior sequence, and each enhanced historical behavior sequence.
[0101] The exposure click rate of each user historical behavior sequence and each enhanced historical behavior sequence is predicted by using the exposure click rate estimation sub-model, and the exposure click rate loss function is obtained based on the obtained prediction result and the true exposure click rate result corresponding to each user historical behavior sequence and each enhanced historical behavior sequence.
[0102] S704: Determine an exposure conversion rate loss function of the product recommendation model based on the exposure click rate estimation sub-model and the click conversion rate estimation sub-model.
[0103] The exposure conversion rate predicted by the product recommendation model is determined based on the exposure click rate estimation sub-model and the click conversion rate estimation sub-model, and then the exposure conversion rate loss function is obtained based on the true exposure conversion rate corresponding to each user historical behavior sequence and each enhanced historical behavior sequence and the exposure conversion rate predicted by the product recommendation model.
[0104] S706: Determine a loss value of a loss function of a product recommendation model based on an exposure click rate loss function, an exposure conversion rate loss function, and each first loss term.
[0105] The exposure click rate loss function, the exposure conversion rate loss function, and each first loss term are used to establish the loss function of the product recommendation model to obtain the corresponding loss value. Here, the loss function has multiple target tasks, including but not limited to improving the accuracy of the exposure click rate and the exposure conversion rate predicted by the product recommendation model, and making the behavior features corresponding to the enhanced historical behavior sequence more close to the behavior features of the real user.
[0106] Please refer to Figure 8 , Figure 9 Another flowchart for determining a loss value of a loss function of a product recommendation model is provided for an embodiment of the present specification.
[0107] As shown in Figure 9 , determining a loss value of a loss function of a product recommendation model based on an exposure click rate loss function, an exposure conversion rate loss function, and each first loss term in step S706 comprises:
[0108] S802: respectively determine the exposure click rate loss function, the exposure conversion rate loss function and the first loss term, and add the corresponding first important weight coefficient, the second weight coefficient and the third weight coefficient; wherein the sum of the first important weight coefficient, the second weight coefficient and the third weight coefficient is 1.
[0109] The exposure click rate loss function can correspond to L ctr The exposure conversion rate loss function can correspond to L ctcvr The first loss term can correspond to L i The sum of the first loss terms can correspond to L cl The first important weight coefficient can correspond to a, the second weight coefficient can correspond to b, and the third weight coefficient can correspond to g, a+b+g=1. The first important weight coefficient, the second weight coefficient and the third weight coefficient are used to quantify the importance of the exposure click rate loss function, the exposure conversion rate loss function and the sum of the first loss terms, which can be artificially preset or obtained by calculation.
[0110] S804: determine the loss value of the loss function of the product recommendation model by multiplying the first important weight coefficient by the exposure click rate loss function, adding the second weight coefficient multiplied by the exposure conversion rate loss function, and adding the third weight coefficient multiplied by the sum of the first loss terms.
[0111] The loss function Ltotal=a·L ctr +b·L ctcvr +g·L cl . It is not difficult to see from the formula that there are three target tasks in the loss function, such as improving the accuracy of the exposure click rate and the exposure conversion rate predicted by the product recommendation model, and making the enhanced historical behavior sequence corresponding to the behavior feature more close to the real user's behavior feature.
[0112] Please refer to Figure 9 , Figure 10 for a flowchart of data enhancement provided by an embodiment of the present specification.
[0113] As Figure 6 shown, in step S202, the historical behavior sequence of each user is respectively data enhanced based on the product recommendation model to obtain at least two enhanced historical behavior sequences corresponding to the historical behavior sequence of each user, including:
[0114] S902: based on the product recommendation model, respectively mask the historical behavior sequence of each user to make at least one subsequence in the historical behavior sequence of each user invisible, and obtain each first enhanced historical behavior sequence.
[0115] By respectively masking at least one subsequence of the historical behavior sequence of each user, the historical behavior sequence can be avoided to be dominated by local information.
[0116] Here, the item mask can be used for masking, assuming that the length of the historical behavior sequence is n, and a proportion of γ of the items are randomly masked, then the length L of the masked sequence is n·γ, and the sequence length L can be selected as the smaller integer in the result of n·γ, that is, rounding down.
[0117] Referring to Figure 10 and Figure 10 , Figure 11 An item mask diagram provided by an embodiment of the present specification. Figure 6 In the embodiment, n = 7, γ = 0.3, and L = 2; the item mask randomly selects a proportion of γ of the items for masking, which can avoid the behavior sequence being dominated by local information.
[0118] S904: The order of the historical behavior sequence of each user is rearranged based on the product recommendation model, to obtain each second enhanced historical behavior sequence.
[0119] The order of the historical behavior sequence is generally arranged based on time sequence, and the order of the historical behavior sequence of each user is rearranged to disrupt the order of the historical behavior sequence of each user.
[0120] Here, the item reorder can be used to start from the item at position r in the sequence, the length of the historical behavior sequence is n, and a proportion of β of the subsequence is randomly shuffled and rearranged, and the length L of the randomly shuffled sequence is n·β, wherein the initial position r is a random number selected between 1 and n. The reorder is a random shuffling operation on the behavior sequence from the time sequence. The sequence length L can be selected as the smaller integer in the result of n·β, that is, rounding down.
[0121] Referring to Figure 11 and Figure 11 , Figure 12 An item reorder diagram provided by an embodiment of the present specification. Figure 12 In the embodiment, n = 7, γ = 0.7, L = 4, and r = 3.
[0122] S906: Based on the first enhanced historical behavior sequence and the second enhanced historical behavior sequence, at least two enhanced historical behavior sequences corresponding to the historical behavior sequence of each user are obtained.
[0123] Here, the historical behavior sequence of each user can also be enhanced by other data enhancement methods, such as randomly inserting several connected subsequences.
[0124] Referring to Figure 12 , Figure 13A flowchart of a product recommendation method provided in an embodiment of the present specification is shown.
[0125] As shown in Figure 13 , the product recommendation method comprises:
[0126] S1202: Obtain a target user historical behavior sequence of a target user, and input the target user historical behavior sequence into a product recommendation model.
[0127] Optionally, in an actual application scenario, in order to timely and accurately predict the behavior of the target user, the target user historical behavior sequence of the user in a predetermined historical time period can be selected. For example, it can be the target user historical behavior sequence of the user in the past seven days, and of course, it can also be the target user historical behavior sequence in other time periods.
[0128] Optionally, in an actual application scenario, the number of target users can be multiple, and the target user historical behavior sequences of different users are input into the product recommendation model so that the product recommendation model can learn the behavior characteristics of different users, and then predict the behaviors of different users.
[0129] S1204: Determine a product recommendation result corresponding to the target user historical behavior sequence according to output data of the product recommendation model.
[0130] Optionally, according to the exposure conversion rate output by the product recommendation model for prediction, the exposure conversion rates of the products corresponding to each predicted user behavior matter are sorted from high to low, and the product corresponding to the user behavior matter with the highest exposure conversion rate can be used as the product recommendation result of the product recommendation model.
[0131] Optionally, the products corresponding to the user behavior matters with respective exposure conversion rates can be recommended in turn according to the descending order of the exposure conversion rates of the products corresponding to each predicted user behavior matter.
[0132] In an embodiment of the present specification, a product recommendation method is provided, and the product recommendation model in any of the foregoing embodiments is deployed in an actual application scenario. The target user historical behavior sequence of a target user is obtained, and the target user historical behavior sequence is input into the product recommendation model. According to the output data of the product recommendation model, a product recommendation result corresponding to the target user historical behavior sequence is determined. Since the product recommendation model is trained by the loss function, the problem of sparsity of the original historical behavior sequence is overcome, and a more accurate product recommendation result can be output, thereby improving the transaction rate of the product.
[0133] Please refer to Figure 13 , Figure 14 A structural block diagram of a product recommendation model training device provided in an embodiment of the present specification is shown.
[0134] AsFigure 14 As shown, the product recommendation model training apparatus 1300 comprises:
[0135] The data enhancement module 1310 is adapted to obtain at least one user historical behavior sequence, and perform data enhancement on the historical behavior sequence of each user based on the product recommendation model to obtain at least two enhanced historical behavior sequences corresponding to each user historical behavior sequence;
[0136] The loss function determination module 1320 is adapted to determine the first representation distance value between different users and the second representation distance value between the same users corresponding to the enhanced historical behavior sequences of each user based on the product recommendation model, and determine the loss value of the loss function of the product recommendation model based on the first representation distance value and the second representation distance value;
[0137] The convergence module 1330 is adapted to train the product recommendation model based on the loss value of the loss function until the product recommendation model converges.
[0138] Optionally, the loss function determination module 1320 is adapted to determine each positive sample pair based on the at least two enhanced historical behavior sequences corresponding to the historical behavior sequence of the same user.
[0139] determine each negative sample pair based on the enhanced historical behavior sequences corresponding to the historical behavior sequence of different users.
[0140] determine the first representation distance value corresponding to each negative sample pair and the second representation distance value corresponding to each positive sample pair based on the product recommendation model.
[0141] Optionally, the loss function determination module 1320 is adapted to extract the behavior features of the two enhanced historical behavior sequences corresponding to each negative sample pair, determine two first metric vectors corresponding to each negative sample pair, and determine the first representation distance value between different users based on the cosine distance of the two first metric vectors corresponding to each negative sample pair.
[0142] extract the behavior features of the two enhanced historical behavior sequences corresponding to each positive sample pair, determine two second metric vectors corresponding to each positive sample pair, and determine the second representation distance value of the same user based on the cosine distance of the two second metric vectors corresponding to each positive sample pair.
[0143] Optionally, the loss function determination module 1320 is adapted to determine each positive sample pair based on the second representation distance value determine each numerator term and determine the denominator term based on the first representation distance value H0=S(z i ,z j ) of each negative sample pair corresponding to each positive sample pair.
[0144] The first loss term L is determined based on the ratio of each molecular term to the denominator term i = -log(A i The loss value of the loss function of the product recommendation model is determined based on each first loss term;
[0145] Wherein, i and j represent the numbers corresponding to the two enhanced historical behavior sequences of the negative sample pair; i = 0, 1, 2, …, K; K+1 is the total number of enhanced historical behavior sequences; Z i and Z i + represent the two second metric vectors corresponding to the positive sample pair; S(x, y) represents a cosine distance function; Z i and Z j represent the two first metric vectors corresponding to the negative sample pair; the temperature coefficient τ is a set hyperparameter.
[0146] Optionally, the product recommendation model at least includes: an exposure click rate estimation sub-model and a click conversion rate estimation sub-model;
[0147] Wherein, the exposure click rate estimation sub-model is used to predict the exposure click rate of the product, and the click conversion rate estimation sub-model is used to predict the click conversion rate of the product.
[0148] Optionally, the loss function determination module 1320 is adapted to determine an exposure click rate loss function of the exposure click rate estimation sub-model based on the exposure click rate estimation sub-model, each user historical behavior sequence and each enhanced historical behavior sequence;
[0149] determine an exposure conversion rate loss function of the product recommendation model based on the exposure click rate estimation sub-model and the click conversion rate estimation sub-model;
[0150] determine a loss function of the product recommendation model based on the exposure click rate loss function, the exposure conversion rate loss function and each first loss term.
[0151] Optionally, the loss function determination module 1320 is adapted to determine a first important weight coefficient, a second weight coefficient and a third weight coefficient corresponding to the exposure click rate loss function, the exposure conversion rate loss function and each first loss term respectively; wherein the sum of the first important weight coefficient, the second weight coefficient and the third weight coefficient is 1;
[0152] determine the loss value of the loss function of the product recommendation model by multiplying the first important weight coefficient by the exposure click rate loss function, adding the second weight coefficient multiplied by the exposure conversion rate loss function, and adding the third weight coefficient multiplied by the sum of each first loss term.
[0153] Optionally, the data enhancement module 1310 is adapted to perform a masking process on the historical behavior sequence of each user based on the product recommendation model to make at least one sub-sequence in the historical behavior sequence of each user invisible, to obtain each first enhanced historical behavior sequence.
[0154] rearrange the order of the historical behavior sequence of each user based on the product recommendation model to obtain each second enhanced historical behavior sequence;
[0155] obtain at least two enhanced historical behavior sequences corresponding to the historical behavior sequence of each user based on the first enhanced historical behavior sequence and the second enhanced historical behavior sequence.
[0156] Optionally, the convergence module 1330 is adapted to update the product recommendation model based on the loss value when the loss value of the loss function does not match the preset loss value, and perform again the step of performing data enhancement on the historical behavior sequence of each user based on the product recommendation model, update the loss value of the loss function, until the loss value matches the preset loss value, and then the product recommendation model converges.
[0157] Optionally, the convergence module 1330 is adapted to update at least the target parameters corresponding to the data enhancement in the product recommendation model based on the loss value.
[0158] In the embodiments of the present specification, a product recommendation model training device is provided, wherein a data enhancement module is adapted to obtain at least one user historical behavior sequence, perform data enhancement on the historical behavior sequence of each user based on a product recommendation model, and obtain at least two enhanced historical behavior sequences corresponding to the historical behavior sequence of each user; a loss function determination module is adapted to determine a first representation distance value between different users and a second representation distance value between the same users corresponding to the enhanced historical behavior sequence of each user based on the product recommendation model, and determine a loss value of a loss function of the product recommendation model based on the first representation distance value and the second representation distance value; and a convergence module is adapted to train the product recommendation model based on the loss function until the product recommendation model converges. The loss value of the loss function of the product recommendation model is determined based on the first representation distance value and the second representation distance value, and the product recommendation model is trained using the loss value of the loss function, so that the enhanced historical behavior sequence is more close to the real user behavior sequence, thereby solving the problem that it is difficult to effectively train the product recommendation model when the historical behavior sequence is sparse, and enabling the product recommendation model to effectively learn and depict the behavior characteristics of the user.
[0159] Please refer to Figure 14 , Figure 15 A structural block diagram of a product recommendation device provided by the embodiments of the present specification is shown in FIG. 14. Figure 15 As shown in FIG. 14, the product recommendation device 1400 includes:
[0160] The acquisition module 1410 is adapted to acquire a target user historical behavior sequence of a target user, and input the target user historical behavior sequence into the product recommendation model.
[0161] The recommendation module 1420 is adapted to determine a product recommendation result corresponding to the target user historical behavior sequence according to output data of the product recommendation model.
[0162] In the embodiments of the present specification, a product recommendation device is provided, wherein the acquisition module is adapted to acquire a target user historical behavior sequence of a target user, and input the target user historical behavior sequence into the product recommendation model; and the recommendation module is adapted to determine a product recommendation result corresponding to the target user historical behavior sequence according to output data of the product recommendation model. Since the product recommendation model is trained by the loss function, the problem of sparsity of the original historical behavior sequence is overcome, and a more accurate product recommendation result can be output, thereby improving the transaction rate of the product.
[0163] The embodiments of the present specification provide a computer program product containing instructions, which, when the computer program product is run on a computer or a processor, causes the computer or the processor to execute the steps of the method of any one of the above embodiments.
[0164] The embodiments of the present specification also provide a computer storage medium, which can store a plurality of instructions, and the instructions are adapted to be loaded and executed by a processor to perform the steps of the method of any one of the above embodiments.
[0165] Please refer to Figure 15 , Figure 15 A structural schematic diagram of a terminal is provided for the embodiments of the present specification. As shown in the figure, the terminal 1500 can include at least one terminal processor 1501, at least one network interface 1504, a user interface 1503, a memory 1505, and at least one communication bus 1502. Figure 15
[0166] The communication bus 1502 is used to realize the connection communication between the components.
[0167] The user interface 1503 can include a display screen (Display), a camera (Camera), and can optionally include a standard wired interface and a wireless interface.
[0168] The network interface 1504 can optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0169] The terminal processor 1501 can include one or more processing cores. The terminal processor 1501 connects various parts within the terminal 1500 through various interfaces and lines, and performs various functions of the terminal 1500 and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 1505, and calling data stored in the memory 1505. Alternatively, the terminal processor 1501 can be implemented in at least one of a hardware form of a digital signal processing (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The terminal processor 1501 can be integrated with a combination of one or more of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU is mainly responsible for processing the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; and the modem is responsible for processing wireless communication. It can be understood that the above-mentioned modem can also not be integrated into the terminal processor 1501, but can be implemented by a separate chip.
[0170] The memory 1505 can include a random access memory (RAM) and can also include a read-only memory (ROM). Optionally, the memory 1505 includes a non-transitory computer-readable storage medium. The memory 1505 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1505 can include a program storage area and a data storage area, wherein the program storage area can store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area can store data involved in the above-mentioned various method embodiments, etc. The memory 1505 can also be at least one storage device located away from the aforementioned terminal processor 1501. As shown, the memory 1505 as a computer storage medium can include an operating system, a network communication module, a user interface module, and a product recommendation model training and product recommendation program. Figure 15 As shown, the memory 1505 as a computer storage medium can include an operating system, a network communication module, a user interface module, and a product recommendation model training and product recommendation program.
[0171] In In the terminal 1500 shown, the user interface 1503 is mainly used to provide an interface for the user to input, and obtain data input by the user; and the terminal processor 1501 can be used to call the product recommendation model training stored in the storage 1505, and specifically perform the following operations:
[0172] Obtain at least one user historical behavior sequence, and perform data enhancement on the historical behavior sequence of each user based on the product recommendation model to obtain at least two enhanced historical behavior sequences corresponding to each user's historical behavior sequence;
[0173] Determine the first representation distance value between different users and the second representation distance value between the same users corresponding to the enhanced historical behavior sequence of each user based on the product recommendation model, and determine the loss value of the loss function of the product recommendation model based on the first representation distance value and the second representation distance value;
[0174] Train the product recommendation model based on the loss value of the loss function until the product recommendation model converges.
[0175] In some embodiments, when the terminal processor 1501 performs the operation of determining the first representation distance value between different users and the second representation distance value between the same users corresponding to the enhanced historical behavior sequence of each user based on the product recommendation model, the following steps are specifically performed:
[0176] Determine each positive sample pair based on the at least two enhanced historical behavior sequences corresponding to the historical behavior sequence of the same user;
[0177] Determine each negative sample pair based on the enhanced historical behavior sequence corresponding to the historical behavior sequence of different users;
[0178] Determine the first representation distance value corresponding to each negative sample pair and the second representation distance value corresponding to each positive sample pair based on the product recommendation model.
[0179] In some embodiments, when the terminal processor 1501 performs the operation of determining the first representation distance value corresponding to each negative sample pair and the second representation distance value corresponding to each positive sample pair based on the product recommendation model, the following steps are specifically performed:
[0180] Extract the behavior features of the two enhanced historical behavior sequences corresponding to each negative sample pair respectively, determine two first metric vectors corresponding to each negative sample pair, and determine the first representation distance value between different users based on the cosine distance of the two first metric vectors corresponding to each negative sample pair;
[0181] Extract the behavior features of the two enhanced historical behavior sequences corresponding to each positive sample pair respectively, determine two second metric vectors corresponding to each positive sample pair, and determine the second representation distance value of the same user based on the cosine distance of the two second metric vectors corresponding to each positive sample pair.
[0182] In some embodiments, when the terminal processor 1501 executes the loss function for determining the product recommendation model based on the first representation distance value and the second representation distance value, it specifically performs the following steps:
[0183] The second representation distance value based on each positive sample pair Determine each numerator term And based on the first representation distance value H0 = S(z) for each negative sample pair corresponding to each positive sample pair. i ,z j Determine the denominator term
[0184] The first loss term L is determined based on the ratio of each numerator to the denominator. i = -log(A i / A0), based on each first loss term, determine the loss value of the loss function of the product recommendation model;
[0185] Where i and j represent the indices of two augmentation history behavior sequences that are negative sample pairs; i = 0, 1, 2, ..., K; K+1 is the total number of augmentation history behavior sequences; Z i and Z i + Z represents the two second metric vectors corresponding to a pair of positive samples; S(x, y) represents the cosine distance function; Z i and Z j This represents the two first metric vectors corresponding to a negative sample pair; the temperature coefficient τ is a set hyperparameter.
[0186] In some embodiments, the product recommendation model executed by the terminal processor 1501 includes at least: an exposure click-through rate prediction sub-model and a click conversion rate prediction sub-model;
[0187] Among them, the exposure click-through rate prediction sub-model is used to predict the product's exposure click-through rate, and the click conversion rate prediction sub-model is used to predict the product's click conversion rate.
[0188] In some embodiments, when the terminal processor 1501 executes the loss value of the loss function for determining the product recommendation model based on each first loss term, it specifically performs the following steps:
[0189] The exposure click-through rate (CTR) loss function of the exposure CTR prediction sub-model is determined based on the exposure CTR prediction sub-model, the historical behavior sequences of each user, and the enhanced historical behavior sequences of each user.
[0190] The exposure conversion rate loss function of the product recommendation model is determined based on the exposure click-through rate prediction sub-model and the click conversion rate prediction sub-model.
[0191] The terminal processor 1501 determines the loss value of the loss function of the product recommendation model based on the exposure click rate loss function, the exposure conversion rate loss function, and each first loss term.
[0192] In some embodiments, when the terminal processor 1501 determines the loss value of the loss function of the product recommendation model based on the exposure click rate loss function, the exposure conversion rate loss function, and each first loss term, the terminal processor 1501 specifically performs the following steps:
[0193] The exposure click rate loss function, the exposure conversion rate loss function, and each first loss term are respectively determined to add corresponding first important weight coefficients, second weight coefficients, and third weight coefficients; wherein the sum of the first important weight coefficients, the second weight coefficients, and the third weight coefficients is 1;
[0194] The loss value of the loss function of the product recommendation model is obtained by multiplying the first important weight coefficient by the exposure click rate loss function, adding the second weight coefficient multiplied by the exposure conversion rate loss function, and adding the third weight coefficient multiplied by the sum of each first loss term.
[0195] In some embodiments, when the terminal processor 1501 performs data augmentation on the historical behavior sequence of each user based on the product recommendation model to obtain at least two augmented historical behavior sequences corresponding to the historical behavior sequence of each user, the terminal processor 1501 specifically performs the following steps:
[0196] Based on the product recommendation model, the historical behavior sequence of each user is processed to make at least one subsequence in the historical behavior sequence of each user invisible to obtain each first augmented historical behavior sequence;
[0197] Based on the product recommendation model, the order of the historical behavior sequence of each user is rearranged to obtain each second augmented historical behavior sequence;
[0198] Based on the first augmented historical behavior sequence and the second augmented historical behavior sequence, at least two augmented historical behavior sequences corresponding to the historical behavior sequence of each user are obtained.
[0199] In some embodiments, when the terminal processor 1501 trains the product recommendation model based on the loss value of the loss function until the product recommendation model converges, the terminal processor 1501 specifically performs the following steps:
[0200] When the loss value of the loss function does not match the preset loss value, the product recommendation model is updated based on the loss value, and the step of performing data augmentation on the historical behavior sequence of each user based on the product recommendation model is performed again to update the loss value of the loss function until the loss value matches the preset loss value, and the product recommendation model converges.
[0201] In some embodiments, the terminal processor 1501, when updating the product recommendation model based on the loss value, specifically performs the following steps:
[0202] updating at least the target parameters in the product recommendation model corresponding to the data augmentation based on the loss value.
[0203] In In the terminal 1500 shown, the user interface 1503 is mainly used to provide an interface for user input, and obtain data input by the user; and the terminal processor 1501 can also be used to call the product recommendation program stored in the storage 1505, and specifically perform the following operations:
[0204] obtaining a target user historical behavior sequence of a target user, and inputting the target user historical behavior sequence into the product recommendation model;
[0205] determining a product recommendation result corresponding to the target user historical behavior sequence according to the output data of the product recommendation model.
[0206] In several embodiments provided in the present specification, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the above-described apparatus embodiments are merely schematic, and the division of the modules is merely a logical function division, and there can be another division manner in actual implementation, for example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed modules can be indirect coupling or communication connection through some interfaces, devices or modules, and can be electrical, mechanical or other forms.
[0207] The modules illustrated as separate components can or can not be physically separate, and the components illustrated as modules can or can not be physical modules, i.e., can be located in one place, or can be distributed to a plurality of network modules. According to actual needs, some or all of the modules can be selected to achieve the purpose of the present embodiment scheme.
[0208] In the above embodiments, all or part can be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part can be implemented in the form of a computer program product. The above computer program product includes one or more computer instructions. When loaded and executed on a computer, the above computer program instructions generate, in whole or in part, the processes or functions described above according to the embodiments of the present specification. The above computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above computer instructions can be stored in a computer-readable storage medium or transmitted by the above computer-readable storage medium. The above computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The above computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that includes one or more available media sets. The above available medium can be a magnetic medium (for example, floppy disk, hard disk, magnetic tape), an optical medium (for example, digital versatile disc (DVD)), or a semiconductor medium (for example, solid state disk (SSD)) and the like.
[0209] It should be noted that for the foregoing method embodiments, in order to facilitate description, they are all described as a combination of a series of actions, but those skilled in the art should know that the embodiments of the present specification are not limited by the order of the described actions, because according to the embodiments of the present specification, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of the present specification.
[0210] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0211] The above is the description of the product recommendation model training method, product recommendation method, device and storage medium provided by the embodiments of the present specification. For those skilled in the art, according to the idea of the embodiments of the present specification, there will be changes in specific implementation and application range. In summary, the content of the present specification should not be understood as a limitation of the embodiments of the present specification.
Claims
1. A method for training a product recommendation model, the method comprising: Obtain at least one user's historical behavior sequence, and perform data augmentation on each user's historical behavior sequence based on the product recommendation model to obtain at least two augmented historical behavior sequences corresponding to each user's historical behavior sequence. Based on the product recommendation model, determine the first representation distance value between different users and the second representation distance value between the same users corresponding to the enhanced historical behavior sequence of each user, and determine the loss value of the loss function of the product recommendation model based on the first representation distance value and the second representation distance value; The product recommendation model is trained based on the loss value of the loss function until the product recommendation model converges. The step of determining the first representation distance value between different users and the second representation distance value between the same users corresponding to the enhanced historical behavior sequence of each user based on the product recommendation model includes: Each positive sample pair is determined based on at least two enhanced historical behavior sequences corresponding to the historical behavior sequences of the same user. Each negative sample pair is determined based on the enhanced historical behavior sequence corresponding to the historical behavior sequence of different users; Based on the product recommendation model, determine the first representation distance value corresponding to each negative sample pair and the second representation distance value corresponding to each positive sample pair; The step of determining the first representation distance value corresponding to each negative sample pair and the second representation distance value corresponding to each positive sample pair based on the product recommendation model includes: Extract the behavioral features of the two enhanced historical behavior sequences corresponding to each negative sample pair, determine the two first metric vectors corresponding to each negative sample pair, and determine the first representation distance values between different users based on the cosine distance between the two first metric vectors corresponding to each negative sample pair. Extract the behavioral features of the two enhanced historical behavior sequences corresponding to each positive sample pair, determine the two second metric vectors corresponding to each positive sample pair, and determine the second representation distance values of the same user based on the cosine distance between the two second metric vectors corresponding to each positive sample pair. The step of determining the loss value of the loss function of the product recommendation model based on the first representation distance value and the second representation distance value includes: The second representational distance H2 based on each positive sample pair Determine each numerator term And based on the first representation distance value H0 of each negative sample pair corresponding to each positive sample pair. Determine the denominator term ; Each first loss term L is determined based on the ratio of each numerator term to the denominator term. i =-log(A i / A0), based on each first loss term, determine the loss value of the loss function of the product recommendation model; Where i and j represent the indices of two augmentation history behavior sequences that are negative sample pairs; i = 0, 1, 2, ..., K; K+1 is the total number of augmentation history behavior sequences; Z i and Z i + Z represents the two second metric vectors corresponding to a pair of positive samples; S(x, y) represents the cosine distance function; Z i and Z j Represents the two first metric vectors corresponding to a negative sample pair; temperature coefficient These are the hyperparameters that are set.
2. The product recommendation model training method according to claim 1, wherein the product recommendation model comprises at least: Exposure click-through rate prediction sub-model and click-to-conversion rate prediction sub-model; The exposure click-through rate prediction sub-model is used to predict the product's exposure click-through rate, and the click conversion rate prediction sub-model is used to predict the product's click conversion rate.
3. The product recommendation model training method according to claim 2, wherein determining the loss value of the loss function of the product recommendation model based on each first loss term includes: The exposure click-through rate (CTR) loss function of the exposure CTR prediction sub-model is determined based on the exposure CTR prediction sub-model, the historical behavior sequences of each user, and the enhanced historical behavior sequences of each user. The exposure-to-click-rate prediction sub-model and the click-to-conversion-rate prediction sub-model determine the exposure-to-conversion-rate loss function of the product recommendation model; The loss value of the loss function of the product recommendation model is determined based on the exposure click-through rate loss function, the exposure conversion rate loss function, and each first loss term.
4. The product recommendation model training method according to claim 3, wherein determining the loss value of the loss function of the product recommendation model based on the exposure click-through rate loss function, the exposure conversion rate loss function, and each first loss term includes: The exposure click-through rate loss function, the exposure conversion rate loss function, and the first important weight coefficient, second weight coefficient, and third weight coefficient corresponding to the sum of each first loss term are determined respectively; wherein, the sum of the first important weight coefficient, the second weight coefficient, and the third weight coefficient is 1; The loss value of the product recommendation model's loss function is determined by multiplying the first important weight coefficient by the exposure click-through rate loss function, the second weight coefficient by the exposure conversion rate loss function, and the third weight coefficient by the sum of each first loss term.
5. The product recommendation model training method according to any one of claims 1 to 4, wherein the step of performing data augmentation on the historical behavior sequences of each user based on the product recommendation model to obtain at least two augmented historical behavior sequences corresponding to each user's historical behavior sequence includes: Based on the product recommendation model, the historical behavior sequence of each user is masked so that at least one subsequence in the historical behavior sequence of each user is not visible, thus obtaining each first enhanced historical behavior sequence. Based on the product recommendation model, the order of each user's historical behavior sequence is rearranged to obtain each second enhanced historical behavior sequence; Based on the first enhanced historical behavior sequence and the second enhanced historical behavior sequence, at least two enhanced historical behavior sequences are obtained for each user's historical behavior sequence.
6. The product recommendation model training method according to any one of claims 1 to 4, wherein training the product recommendation model based on the loss value of the loss function until the product recommendation model converges includes: When the loss value of the loss function does not match the preset loss value, the product recommendation model is updated based on the loss value. The step of performing data augmentation on the historical behavior sequence of each user based on the product recommendation model is executed again to update the loss value of the loss function until the loss value matches the preset loss value, at which point the product recommendation model converges.
7. The product recommendation model training method according to claim 6, wherein updating the product recommendation model based on the loss value includes: Based on the loss value, at least the target parameters in the product recommendation model corresponding to the data augmentation are updated.
8. A product recommendation method, the method comprising: Obtain the target user's historical behavior sequence and input the target user's historical behavior sequence into the product recommendation model; Based on the output data of the product recommendation model, the product recommendation result corresponding to the target user's historical behavior sequence is determined; wherein, the product recommendation model is the product recommendation model according to any one of claims 1 to 7.
9. A product recommendation model training device, the device comprising: The data augmentation module is suitable for acquiring at least one user's historical behavior sequence, performing data augmentation on each user's historical behavior sequence based on the product recommendation model, and obtaining at least two augmented historical behavior sequences corresponding to each user's historical behavior sequence. The loss function determination module is adapted to determine, based on the product recommendation model, a first representation distance value between different users corresponding to the enhanced historical behavior sequence of each user and a second representation distance value between the same users, and to determine the loss value of the loss function of the product recommendation model based on the first representation distance value and the second representation distance value; A convergence module is adapted to train the product recommendation model based on the loss value of the loss function until the product recommendation model converges. Among them, the loss function determination module is adapted to determine each positive sample pair based on at least two enhanced historical behavior sequences corresponding to the historical behavior sequences of the same user; Each negative sample pair is determined based on the enhanced historical behavior sequence corresponding to the historical behavior sequence of different users; Based on the product recommendation model, determine the first representation distance value corresponding to each negative sample pair and the second representation distance value corresponding to each positive sample pair; The loss function determination module is suitable for extracting the behavioral features of the two enhanced historical behavior sequences corresponding to each negative sample pair, determining the two first metric vectors corresponding to each negative sample pair, and determining the first representation distance values between different users based on the cosine distance between the two first metric vectors corresponding to each negative sample pair. Extract the behavioral features of the two enhanced historical behavior sequences corresponding to each positive sample pair, determine the two second metric vectors corresponding to each positive sample pair, and determine the second representation distance values of the same user based on the cosine distance between the two second metric vectors corresponding to each positive sample pair. The loss function determination module is adapted to use the second representation distance value H2= for each positive sample pair. Determine the numerator A i = And based on the first representation distance value H0 of each negative sample pair corresponding to each positive sample pair. Determine the denominator term ; The first loss term L is determined based on the ratio of each numerator to the denominator. i =-log(A i / A0), based on each first loss term, determine the loss value of the loss function of the product recommendation model; Where i and j represent the indices of two augmentation history behavior sequences that are negative sample pairs; i = 0, 1, 2, ..., K; K+1 is the total number of augmentation history behavior sequences; Z i and Z i + Z represents the two second metric vectors corresponding to a pair of positive samples; S(x, y) represents the cosine distance function; Z i and Z j Represents the two first metric vectors corresponding to a negative sample pair; temperature coefficient These are the hyperparameters that are set.
10. A product recommendation device, the device comprising: The acquisition module is adapted to acquire the target user's historical behavior sequence and input the target user's historical behavior sequence into the product recommendation model. The recommendation module is adapted to determine the product recommendation result corresponding to the target user's historical behavior sequence based on the output data of the product recommendation model; wherein the product recommendation model is the product recommendation model according to any one of claims 1 to 7.
11. A computer storage medium storing a plurality of instructions adapted for loading by a processor and performing the method steps of any one of claims 1 to 7 or 8.
12. A computer program product storing at least one instruction, said at least one instruction being loaded by a processor and executing the method steps as claimed in any one of claims 1 to 7 or 8.
13. A terminal, comprising: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the method steps as claimed in any one of claims 1 to 7 or 8.
Citation Information
Patent Citations
Bidirectional Transformers-based recommendation model training method, training device and recommendation method
CN115221960A
Training method and device of sequence recommendation model
CN115564532A
Target recommendation method and device
CN115631012A