Training method and device for behavior prediction system

By introducing the encoder and decoder of the Transformer mechanism into the user behavior prediction system, interest vectors are generated and predicted, which solves the problem of low user behavior prediction accuracy in the existing technology and achieves more efficient user behavior prediction results.

CN114692972BActive Publication Date: 2024-09-24ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210335212.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-31
Publication Date
2024-09-24
Estimated Expiration
2042-03-31

AI Technical Summary

Technical Problem

The accuracy of user behavior prediction in the existing technology is limited, and there is a lack of effective improvement methods.

Method used

The encoder and decoder based on the Transformer mechanism is used to obtain the user's historical behavioral object sequence and target object characteristics, generate interest vectors and make predictions, and use the prediction results and labels to train the behavior prediction system to improve prediction accuracy.

Benefits of technology

It achieves more accurate and high-performance user behavior prediction, improving the accuracy of the prediction system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114692972B
    Figure CN114692972B
Patent Text Reader

Abstract

An embodiment of the present specification provides a training method for a behavior prediction system, comprising: obtaining a first training sample, which includes a target object, multiple historical objects in which a first user has performed a specific behavior, and a behavior label indicating whether the first user has performed the specific behavior on the target object; inputting the first training sample into the behavior prediction system, the behavior prediction system including a prediction layer, and an encoder and a decoder based on a Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the multiple historical objects; the decoder determines an interest vector of the first user for the target object based on the key output matrix and the value output matrix; the prediction layer obtains a behavior prediction result based on the interest vector; and the behavior prediction system is trained using the behavior prediction result and the behavior label.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of machine learning technology, and more particularly, to a training method and device for a behavior prediction system. Background Art

[0002] Nowadays, people are increasingly using a variety of services provided by service platforms. Accordingly, in order to improve the user's service experience, the service platform can use machine learning models to predict the user's related behaviors when using the service, and then customize service plans for the user based on the prediction results. For example, the platform can determine the category and order of video streams pushed to a user by predicting the probability of a user clicking on various types of videos. For another example, a shopping website can determine whether to recommend a product to a user by predicting the user's preference for the product.

[0003] Obviously, we hope that the prediction results of user behavior are as accurate as possible. However, the current method of predicting user behavior is relatively simple, and the accuracy of the prediction results is also very limited. Therefore, it is necessary to propose a solution that can effectively improve the accuracy of user behavior prediction results. Summary of the invention

[0004] One or more embodiments of this specification describe a training method and device for a behavior prediction system, which can better learn user interests and thus improve the accuracy of prediction results for user behavior.

[0005] According to a first aspect, a training method for a behavior prediction system is provided. The method comprises: obtaining a first training sample, which includes a target object, multiple historical objects in which a first user has performed a specific behavior, and a behavior label indicating whether the first user has performed the specific behavior on the target object; inputting the first training sample into the behavior prediction system, which includes a prediction layer, and an encoder and a decoder based on a Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the multiple historical objects; the decoder determines an interest vector of the first user for the target object based on the key output matrix and the value output matrix; the prediction layer obtains a behavior prediction result based on the interest vector; and the behavior prediction system is trained using the behavior prediction result and the behavior label.

[0006] In one embodiment, the target object and the multiple historical objects are commodities or users.

[0007] In one embodiment, the encoder includes multiple encoding layers; wherein the encoder determines the key output matrix and the value output matrix for the multiple historical objects, including: each encoding layer processes the object representation matrix for the multiple historical objects output by the previous encoding layer based on the key transformation matrix and the value transformation matrix in the current layer, and obtains the key result matrix and the value result matrix corresponding to the encoding layer; based on the multiple key result matrices and the multiple value result matrices corresponding to the multiple encoding layers, determines the key output matrix and the value output matrix.

[0008] In one embodiment, the decoder determines the interest vector for the first user for the target object based on the key output matrix and the value output matrix, including: the decoder uses its query transformation matrix to process the embedding vector of the target object to obtain a query output vector, and determines the interest vector based on the product of the query output vector, the key output matrix and the value output matrix.

[0009] According to a second aspect, a training method for a behavior prediction system is provided, comprising: obtaining a first training sample, comprising a target object, a plurality of historical objects in which a first user has performed a specific behavior, and a behavior label indicating whether the first user has performed the specific behavior on the target object; inputting the first training sample into the behavior prediction system, the behavior prediction system comprising a prediction layer, and an encoder and a decoder based on a Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the plurality of historical objects; the decoder determines a query output vector for the target object; the prediction layer determines a behavior prediction result based on the key output matrix, the value output matrix and the query output vector; and training the behavior prediction system using the behavior prediction result and the behavior label.

[0010] In one embodiment, the decoder determines the query output vector for the target object, comprising: the decoder processes the embedding vector of the target object using its query transformation matrix to obtain the query output vector.

[0011] In one embodiment, the decoder determines a query output vector for the target object, including: the decoder uses a first query transformation matrix to process the embedding vector of the target object to obtain a first query output vector, and determines a representation vector for the target object based on the product of the query output vector, a key output matrix and a value output matrix, and then uses a second query transformation matrix to process the representation vector, and the second query output vector is used as the query output vector.

[0012] In one embodiment, the prediction layer determines the behavior prediction result based on the key output matrix, the value output matrix and the query output vector, including: the prediction layer calculates the product result based on the query output vector, the key output matrix and the value output matrix, performs linear transformation and / or nonlinear transformation on the product result to obtain a transformation result, and determines the behavior prediction result based on the transformation result.

[0013] According to a third aspect, a training device for a behavior prediction system is provided, comprising: a sample acquisition unit, configured to acquire a first training sample, comprising a target object, a plurality of historical objects in which a first user has performed a specific behavior, and a behavior label indicating whether the first user has performed the specific behavior on the target object; a prediction unit, configured to input the first training sample into the behavior prediction system, the behavior prediction system comprising a prediction layer, and an encoder and a decoder based on a Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the plurality of historical objects; the decoder determines an interest vector of the first user for the target object based on the key output matrix and the value output matrix; the prediction layer obtains a behavior prediction result based on the interest vector; and a training unit, configured to train the behavior prediction system using the behavior prediction result and the behavior label.

[0014] According to a fourth aspect, a training device for a behavior prediction system is provided, comprising: a sample acquisition unit, configured to acquire a first training sample, comprising a target object, a plurality of historical objects in which a first user has performed a specific behavior, and a behavior label indicating whether the first user has performed the specific behavior on the target object; a prediction unit, configured to input the first training sample into the behavior prediction system, the behavior prediction system comprising a prediction layer, and an encoder and a decoder based on a Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the plurality of historical objects; the decoder determines a query output vector for the target object; the prediction layer determines a behavior prediction result based on the key output matrix, the value output matrix and the query output vector; and a training unit, configured to train the behavior prediction system using the behavior prediction result and the behavior label.

[0015] According to a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method of the first aspect or the second aspect.

[0016] According to a sixth aspect, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method of the first aspect or the second aspect is implemented.

[0017] The method and device provided in the embodiments of this specification are adopted, an encoder and decoder based on the TF mechanism are introduced, and a historical object sequence reflecting the user's interest is used as the input of the encoder to obtain a key output vector and a value output vector, and then the key output vector and the value output vector, as well as the characteristics of the target object are used as the input of the decoder to obtain an interest vector representing the user's interest in the target object, thereby using the prediction layer to determine the user's behavior prediction result for the target object based on the interest vector, and then update the model parameters in the behavior prediction system based on this behavior prediction result and the behavior label. In this way, a behavior prediction system with accurate prediction and excellent performance can be trained. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0019] Figure 1 A schematic diagram of a training architecture of a behavior prediction system according to one embodiment is shown;

[0020] Figure 2 A schematic diagram showing a flow chart of a training method for a behavior prediction system according to an embodiment is shown;

[0021] Figure 3 A schematic diagram showing the structure of any i-th encoding layer in the Transformer mechanism;

[0022] Figure 4 A schematic diagram showing the structure of any j-th decoding layer in the Transformer mechanism;

[0023] Figure 5 A schematic diagram showing a training architecture of a behavior prediction system according to another embodiment is shown;

[0024] Figure 6 A flow chart showing a training method for a behavior prediction system according to another embodiment is shown;

[0025] Figure 7 A schematic diagram showing the structure of a training device of a behavior prediction system according to an embodiment is shown;

[0026] Figure 8 A schematic diagram of the structure of a training device for a behavior prediction system according to another embodiment is shown. DETAILED DESCRIPTION

[0027] The solution provided in this specification is described below in conjunction with the accompanying drawings.

[0028] As mentioned above, a solution is needed to effectively improve the accuracy of user behavior prediction results. Therefore, the embodiment of this specification discloses a training method for a behavior prediction system, which introduces Transformer (or TF for short) in the construction of the behavior prediction system, uses the encoder and decoder of TF as a paradigm, and nests different sequences of different subjects, so as to better learn user interests and improve the prediction accuracy of user behavior.

[0029] Figure 1 A schematic diagram of a training architecture of a behavior prediction system according to an embodiment is shown. Figure 1 As shown, the behavior prediction system 100 includes an encoder 110 and a decoder 120 based on the TF mechanism, and a prediction layer 130 is also set. Based on this, the historical object sequence reflecting the user's interest in the training sample is used as the input of the encoder 110, and then the output of the encoder 110 and the target object are used as the decoder 120 to obtain the learned user's interest vector for the target object, and then the prediction layer 130 is used to process the interest vector to obtain a prediction result indicating the probability of the user performing a specific behavior on the target object. In this way, accurate behavior prediction results can be obtained.

[0030] The implementation steps of the above solution are described below in conjunction with specific embodiments. Figure 2 A flow chart of a training method for a behavior prediction system according to an embodiment is shown. The execution subject of the method can be any device, server or equipment cluster with computing and processing capabilities. Figure 2 As shown, the method comprises the following steps:

[0031] Step S210, obtaining a first training sample, which includes a target object, multiple historical objects in which the first user has performed specific behaviors, and a behavior label indicating whether the first user has performed a specific behavior on the target object; Step S220, inputting the first training sample into the behavior prediction system, which behavior prediction system includes a prediction layer, and an encoder and a decoder based on the Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the multiple historical objects; the decoder determines the interest vector of the first user for the target object based on the key output matrix and the value output matrix; the prediction layer obtains a behavior prediction result based on the interest vector; Step S230, training the behavior prediction system using the behavior prediction result and the behavior label.

[0032] The above steps are described as follows:

[0033] First, in step S210, a first training sample is obtained, which includes a target object, a plurality of historical objects in which a first user has performed a specific behavior, and a behavior label indicating whether the first user has performed a specific behavior on the target object.

[0034] It should be understood that any training sample in the training sample set is referred to as the first training sample in this article. In one embodiment, for a certain user, multiple historical objects that have performed specific behaviors before a certain historical moment are obtained to form an object sequence, and a target object pushed to the user after the certain historical moment is obtained, and a behavior label is determined based on the collected behavior data of whether the user performs a specific behavior on the target object, and then, a corresponding training sample is constructed based on the object features of the multiple historical objects and the target object, as well as the behavior label.

[0035] The above-mentioned multiple historical objects and target objects usually belong to the same type of business objects, such as commodities or users; the carrier of the business object can be text, pictures, videos or audios, etc. The above-mentioned specific behaviors are adapted to the business objects. For example, assuming that the business object is an advertisement, the corresponding specific behavior can be whether to click. For another example, assuming that the business object is a video, the corresponding specific behavior can be whether the playback time reaches a preset percentage of the total time. For another example, assuming that the business object is an APP, the corresponding specific behavior can be whether to register.

[0036] In one embodiment, the object features of each object involved in the training sample may include an object ID. Further, in one example, the business object involved in the training sample is a video advertisement. Accordingly, the features of the historical video object may include a video introduction and user behavior features, and the features of the target video object may include a video introduction. Exemplarily, the video introduction may include the video ID, video category information (such as travel, cars, etc.), video duration, video author, etc.; user behavior features may include user ID, viewing duration, video comments, whether to like, whether to forward, etc. In one embodiment, the above-mentioned behavior label may be 1 (indicating that a specific behavior is performed) or 0 (indicating that a specific behavior is not performed).

[0037] On the other hand, in one embodiment, in the process of constructing a training sample, multiple feature items of the collected object features can be first screened, and then the feature items retained after screening can be included in the training sample. In a specific embodiment, batch normalization (BN) can be used to determine the importance of each feature item, so as to retain the feature items whose importance reaches a predetermined standard. In another specific embodiment, the automatic feature cross-screening (Automatic Feature Interaction Selection, AutoFIS) algorithm can be used for feature screening. Specifically, a trainable parameter is set for each feature item, and the feature importance is judged by the size of the parameter after training. The parameter is optimized by a special sparse optimizer to obtain a sparse solution. Thus, the feature items can be screened according to the importance parameter. In another specific embodiment, the feature importance can be determined by shuffling. Specifically, a model is trained through the collected training data, and the index value auc_0 of the benchmark evaluation index is obtained on the validation set. When calculating the feature importance of a certain feature a, the validation set is evaluated through the trained model. During the evaluation process, the values ​​of feature a are shuffled and rearranged in each batch of training data to obtain the index value auc_a, and then the importance of feature a is determined according to the gap between auc_0 and auc_a. Further, if the importance meets the preset standard, the feature a is retained, and otherwise it is discarded. In this way, key features can be screened out and training samples can be constructed, thereby avoiding the amount of calculation and negative impact on training caused by redundant features, so that the constructed training samples have higher availability.

[0038] As described above, the first training sample obtained is introduced. Then, in step S220, the first training sample is input into the behavior prediction system. Figure 1 The behavior prediction system 100 includes components: an encoder 110, a decoder 120, and a prediction layer 130. The following describes the process of the behavior prediction system using these three components to process the first training sample.

[0039] The encoder 110 includes one or more coding layers. Figure 3 The schematic diagram of the structure of any i-th coding layer in the Transformer mechanism is shown. Figure 3 As shown, the i-th encoding layer includes a sequentially connected attention layer, residual module 1, feedforward layer and residual module 2, wherein the attention layer obtains the representation matrix Z of the input current encoding layer for the above multiple historical objects (i) It should be noted that if the current coding layer is the first coding layer, then the representation matrix Z (1)It is formed by stacking multiple object embedding vectors corresponding to multiple historical objects, where each object embedding vector is obtained by embedding according to the object features of the corresponding historical object; otherwise, the representation matrix Z (i) is the representation matrix output by the previous coding layer (i.e., the i-1th coding layer).

[0040] The above attention layer first uses the query transformation matrix W q , key transformation matrix W k Sum value transformation matrix W v , input the representation matrix Z of the current coding layer (i) Project them into query space, key space and value space respectively to get the query result matrix Q i , key result matrix K i Sum result matrix V i Then, based on the attention mechanism, the query result matrix Q i The sum key result matrix K i Determine the attention and use the attention pair value to output the matrix V i The transformation is performed and the transformation result is used as the output of the attention layer. The residual module 1 performs a transformation on the output and the matrix Z (i) The output of residual module 1 is processed by the feedforward layer, and then the output is processed by residual module 2 to obtain the output matrix Z of the current coding layer. (i+1) .

[0041] In this way, by using multiple historical objects in the training sample as inputs of the encoder 110, the key result matrix K determined in any i-th encoding layer can be obtained. i Sum result matrix V i . Further, in one embodiment, any set of key and value result matrices can be selected from a number (referring to one or more) of key result matrices and a number of value result matrices generated by all coding layers of the encoder, and used as the key output matrix K and the value output matrix V input to the decoder 120. In another embodiment, the key and value result matrix generated by the last coding layer can be directly selected. In another embodiment, the mean matrices of a number of key output matrices and a number of value output matrices can be determined respectively as the key output matrix K and the value output matrix V.

[0042] Then, the decoder 120 determines the interest vector of the first user for the target object based on the key output matrix K and the value output matrix V determined based on the multiple historical objects obtained from the encoder 110. The decoder 120 includes one or more decoding layers, and it should be understood that the structures of the decoding layer and the encoding layer have a certain degree of similarity. Figure 4The schematic diagram of the structure of any j-th decoding layer in the Transformer mechanism is shown. Figure 4 As shown, the j-th decoding layer includes a sequentially connected attention layer, a residual module 3, a feedforward layer and a residual module 4, wherein the attention layer obtains the representation vector z of the first user's interest in the target product input into the current decoding layer. (j) It should be noted that if the current decoding layer is the first decoding layer, then the representation vector z (1) is the embedding vector corresponding to the target object; otherwise, the representation vector z (j) is the representation vector output by the previous decoding layer (i.e., the j-1th decoding layer).

[0043] In the first decoding layer, the attention layer uses the query transformation matrix W q The characterization vector z (1) A linear transformation is performed to obtain the query result vector q1, and based on the attention mechanism, the query result vector q1 and the key output matrix K received from the encoder are used to determine the attention, and then the attention is used to transform the value output matrix V received from the encoder, and the transformation result is used as the output of the attention layer. The residual module 3 combines the output and the representation vector z (1) The output of residual module 3 is processed by the feedforward layer, and then the output is processed by residual module 4 to obtain the output vector z of the current coding layer. (2) .

[0044] In the jth (≥2) decoding layer, the attention layer first uses the query transformation matrix W q , key transformation matrix W k Sum value transformation matrix W v , the representation vector z of the input current decoding layer (j) Perform linear transformations respectively to obtain the query result vector q j , key result vector k j The sum result vector v j Then, based on the attention mechanism, the query result vector q j and key result vector k j Determine the attention, and then use the attention to value the result vector v j The transformation is performed and the transformation result is used as the output of the attention layer. The residual module 3 performs a transformation on the output and the vector z (j) The output of residual module 3 is processed by the feedforward layer, and then the output is processed by residual module 4 to obtain the output vector z of the current decoding layer. (j+1) .

[0045] From the above, the output vector z of all decoding layers in the decoder can be obtained. Further, in one embodiment, the output vector of the last decoding layer can be directly determined as the above interest vector. In another embodiment, the average vector of multiple output vectors of multiple decoding layers can be determined as the above interest vector.

[0046] Afterwards, the prediction layer 130 may determine the behavior prediction result of the first user for the target object based on the interest vector output by the decoder. In one embodiment, the prediction layer 130 includes several fully connected layers and sigmoid layers, and the interest vector is linearly transformed and reduced to 1 dimension through several fully connected layers. Then, the sigmoid layer is used to map the 1-dimensional value to a probability interval of 0 to 1, and the mapped probability value is determined as the behavior prediction result.

[0047] As described above, by introducing the first training sample input into the behavior prediction system implemented by TF, a more accurate behavior prediction result can be obtained. Next, in step S230, the behavior prediction result and the behavior label are used to train the behavior prediction system.

[0048] Specifically, the training loss can be determined based on the behavior prediction results and the behavior labels, and then the gradient can be calculated based on the training loss, so as to update the model parameters of each component in the behavior prediction system according to the back propagation method. Exemplarily, the training loss can be determined by using a cross entropy loss function or a hinge loss function.

[0049] By repeatedly executing the above steps S210 to S230, multiple iterations of the behavior prediction system can be updated. In addition, after the iteration reaches a preset convergence standard, for example, a predetermined number of iterations is reached or the evaluation index of the model after the iteration reaches a predetermined threshold, the iteration is terminated, and the behavior prediction system obtained after the last iteration is used as the behavior prediction system that is actually used.

[0050] In summary, the training method of the behavior prediction system disclosed in the embodiment of this specification is adopted, an encoder and decoder based on the TF mechanism are introduced, and the historical object sequence reflecting the user's interest is used as the input of the encoder to obtain a key output vector and a value output vector, and then the key output vector and the value output vector, as well as the characteristics of the target object are used as the input of the decoder to obtain an interest vector that represents the user's interest in the target object, so as to use the prediction layer to determine the user's behavior prediction result for the target object according to the interest vector, and then update the model parameters in the behavior prediction system according to the behavior prediction result and the behavior label. In this way, a behavior prediction system with accurate prediction and excellent performance can be trained.

[0051] The present specification also discloses another method for training a behavior prediction system. The behavior prediction system includes: Figure 5The encoder 510 and decoder 520 based on the TF mechanism, and the prediction layer 530 are shown in FIG. Figure 6 A flow chart of a training method for a behavior prediction system according to another embodiment is shown. The execution subject of the method can be any device, server or equipment cluster with computing and processing capabilities. Figure 6 As shown, the method comprises the following steps:

[0052] Step S610, obtaining a first training sample, which includes a target object, multiple historical objects in which a first user has performed a specific behavior, and a behavior label indicating whether the first user has performed a specific behavior on the target object; Step S620, inputting the first training sample into the behavior prediction system, which includes a prediction layer, and an encoder and a decoder based on a Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the multiple historical objects; the decoder determines a query output vector for the target object; the prediction layer determines a behavior prediction result based on the key output matrix, the value output matrix and the query output vector; Step S630, training the behavior prediction system using the behavior prediction result and the behavior label.

[0053] The above steps are described as follows:

[0054] First, in step S610, a first training sample is obtained. It should be noted that the description of step S610 can refer to the introduction of step S210, and will not be repeated here.

[0055] Step S620: Input the first training sample into the behavior prediction system. Figure 5 The behavior prediction system 500 includes an encoder 510, a decoder 520 and a prediction layer 530. Next, the process of processing the first training sample using the three components in the behavior prediction system 500 is introduced in sequence.

[0056] The encoder 510 includes one or more encoding layers. For the introduction of the encoder 510, reference can be made to the relevant introduction of the encoder 110. Thus, by taking the multiple historical objects in the first training sample as the input of the encoder 510, a key output matrix K and a value output matrix V can be obtained, which are used as part of the input of the decoder 520 and the prediction layer 530. It should be understood that the key and value output matrices used as the input of the decoder 520 and the key and value output matrices used as the input of the prediction layer 530 can be the same or different.

[0057] The decoder 520 determines several query result vectors in several decoding layers it contains based on the key output matrix K and the value output matrix V obtained from the encoder 510, as well as the characteristics of the target object. Further, a query output vector can be determined based on these several query result vectors and used as a partial input of the prediction layer 530. In one embodiment, the query result vector output by the last decoding layer can be used as the query output vector q. In another embodiment, the average vector of the query result vectors output by multiple decoding layers can be used as the query output vector. It should be noted that the introduction to the decoder 520 can also refer to the aforementioned description of the decoder 130.

[0058] The prediction layer 530 determines the behavior prediction result based on the key output matrix K and the value output matrix V obtained from the encoder 510, and the query output vector q obtained from the decoder 520. Specifically, in the prediction layer 530, the interest vector of the first user for the target object is calculated based on the key output matrix K, the value output matrix V and the query output vector, and then the behavior prediction result is determined based on the interest vector. In one embodiment, the product of the query output vector q and the key output matrix K can be calculated to obtain the attention vector, and then the product vector of the attention vector and the value output matrix V is determined as the interest vector. In another embodiment, the prediction layer 530 can be designed to include several prediction sublayers, wherein each prediction sublayer has the same network structure as the decoding layer, thereby, the above interest vector can be determined based on several representation vectors output by several prediction sublayers. On the other hand, in one embodiment, the prediction layer 530 can also be designed to include several fully connected layers and sigmoid layers, which are used to determine the probability of the first user performing a specific behavior on the target object based on the interest vector as the behavior prediction result.

[0059] As described above, by introducing the first training sample input into the behavior prediction system implemented by TF, a more accurate behavior prediction result can be obtained.

[0060] Step S630, using the behavior prediction results and behavior labels, train the behavior prediction system. Specifically, the training loss can be determined based on the behavior prediction results and behavior labels, and then the gradient can be calculated based on the training loss, so as to update the model parameters of each component in the behavior prediction system according to the back propagation method. Exemplarily, the determination of the training loss can adopt a cross entropy loss function or a hinge loss function.

[0061] By repeatedly executing the above steps S610 to S630, multiple iterations of the behavior prediction system can be updated. In addition, after the iteration reaches a preset convergence standard, for example, a predetermined number of iterations is reached or the evaluation index of the model after the iteration reaches a predetermined threshold, the iteration is terminated, and the behavior prediction system obtained after the last iteration is used as the behavior prediction system that is actually used.

[0062] In summary, the training method of the behavior prediction system disclosed in the embodiment of this specification is adopted, an encoder and decoder based on the TF mechanism are introduced, and a historical object sequence reflecting user interests is used as the input of the encoder to obtain a key output vector and a value output vector, and then the key output vector and the value output vector, as well as the characteristics of the target object are used as the input of the decoder to obtain a query output vector, thereby using the prediction layer to determine the behavior prediction result according to the key output vector and the value output vector output by the encoder and the query output vector output by the decoder, and then update the model parameters in the behavior prediction system according to the behavior prediction result and the behavior label. In this way, a behavior prediction system with accurate prediction and excellent performance can be trained.

[0063] Corresponding to the above-mentioned training method, the embodiments of this specification also disclose a training device. Figure 7 FIG. 1 is a schematic diagram showing the structure of a training device for a behavior prediction system according to an embodiment, and the device can be integrated into any server or device cluster with computing and processing capabilities. Figure 7 As shown, the device 700 includes the following components:

[0064] The sample acquisition unit 710 is configured to acquire a first training sample, which includes a target object, multiple historical objects in which the first user has performed a specific behavior, and a behavior label indicating whether the first user has performed the specific behavior on the target object. The prediction unit 720 is configured to input the first training sample into the behavior prediction system, which includes a prediction layer, and an encoder and a decoder based on the Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the multiple historical objects; the decoder determines the interest vector of the first user for the target object based on the key output matrix and the value output matrix; the prediction layer obtains a behavior prediction result based on the interest vector; and the training unit 730 is configured to train the behavior prediction system using the behavior prediction result and the behavior label.

[0065] In one embodiment, the target object and the multiple historical objects are commodities or users.

[0066] In one embodiment, the encoder includes multiple encoding layers; the prediction unit 720 is configured to use the encoder to determine the key output matrix and the value output matrix for the multiple historical objects, specifically including: each encoding layer processes the object representation matrix for the multiple historical objects output by the previous encoding layer based on the key transformation matrix and the value transformation matrix in the current layer, and obtains the key result matrix and the value result matrix corresponding to the encoding layer; based on the multiple key result matrices and the multiple value result matrices corresponding to the multiple encoding layers, the key output matrix and the value output matrix are determined.

[0067] In one embodiment, the prediction unit 720 is configured to use the decoder to determine the interest vector for the first user for the target object based on the key output matrix and the value output matrix, specifically including: the decoder uses its query transformation matrix to process the embedding vector of the target object to obtain a query output vector, and determines the interest vector based on the product of the query output vector, the key output matrix and the value output matrix.

[0068] In summary, the training device of the behavior prediction system disclosed in the embodiment of this specification is used, an encoder and decoder based on the TF mechanism are introduced, and the historical object sequence reflecting the user's interest is used as the input of the encoder to obtain a key output vector and a value output vector, and then the key output vector and the value output vector, as well as the characteristics of the target object are used as the input of the decoder to obtain an interest vector that represents the user's interest in the target object, so as to use the prediction layer to determine the user's behavior prediction result for the target object according to the interest vector, and then update the model parameters in the behavior prediction system according to the behavior prediction result and the behavior label. In this way, a behavior prediction system with accurate prediction and excellent performance can be trained.

[0069] Figure 8 FIG. 8 is a schematic diagram showing the structure of a training device for a behavior prediction system according to another embodiment. The device 800 can be integrated into any server or device cluster with computing and processing capabilities. Figure 8 As shown, the device 800 includes the following components:

[0070] The sample acquisition unit 810 is configured to acquire a first training sample, which includes a target object, multiple historical objects in which the first user has performed a specific behavior, and a behavior label indicating whether the first user has performed the specific behavior on the target object. The prediction unit 820 is configured to input the first training sample into the behavior prediction system, which includes a prediction layer, and an encoder and a decoder based on the Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the multiple historical objects; the decoder determines a query output vector for the target object; the prediction layer determines a behavior prediction result based on the key output matrix, the value output matrix and the query output vector; and the training unit 830 is configured to train the behavior prediction system using the behavior prediction result and the behavior label.

[0071] In one embodiment, the prediction unit 820 is configured to determine the query output vector for the target object using the decoder, specifically comprising: the decoder processes the embedding vector of the target object using its query transformation matrix to obtain the query output vector.

[0072] In one embodiment, the prediction unit 820 is configured to use the decoder to determine a query output vector for the target object, specifically including: the decoder uses a first query transformation matrix to process the embedding vector of the target object to obtain a first query output vector, and determines a representation vector for the target object based on the product of the query output vector, a key output matrix and a value output matrix, and then uses a second query transformation matrix to process the representation vector, the second query output vector, as the query output vector.

[0073] In one embodiment, the prediction unit 820 is configured to use the prediction layer to determine the behavior prediction result based on the key output matrix, the value output matrix and the query output vector, including: the prediction layer calculates the product result based on the query output vector, the key output matrix and the value output matrix, performs linear transformation and / or nonlinear transformation on the product result to obtain a transformation result, and determines the behavior prediction result based on the transformation result.

[0074] In summary, the training device of the behavior prediction system disclosed in the embodiment of this specification is used, an encoder and decoder based on the TF mechanism are introduced, and the historical object sequence reflecting the user's interests is used as the input of the encoder to obtain the key output vector and the value output vector, and then the key output vector and the value output vector, as well as the characteristics of the target object are used as the input of the decoder to obtain the query output vector, so as to use the prediction layer to determine the behavior prediction result according to the key output vector and the value output vector output by the encoder and the query output vector output by the decoder, and then update the model parameters in the behavior prediction system according to the behavior prediction result and the behavior label. In this way, a behavior prediction system with accurate prediction and excellent performance can be trained.

[0075] According to another embodiment, there is also provided a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute a combination of Figure 2 or Figure 6 The method described.

[0076] According to another embodiment of the present invention, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the Figure 2 or Figure 6 The method described.

[0077] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0078] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A training method for a behavior prediction system, include: Acquire a first training sample, which includes a target object, a plurality of historical objects in which a first user has performed a specific behavior, and a behavior label indicating whether the first user has performed the specific behavior on the target object; The first training sample is input into the behavior prediction system, which includes a prediction layer, and an encoder and a decoder based on a Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the multiple historical objects; the decoder processes the embedding vector of the target object using its query transformation matrix to obtain a query output vector, and determines an interest vector based on the product of the query output vector, the key output matrix and the value output matrix; the prediction layer obtains a behavior prediction result based on the interest vector; The behavior prediction system is trained using the behavior prediction results and behavior labels.

2. The method according to claim 1, in, The target object and the multiple historical objects are commodities or users.

3. The method according to claim 1, in, The encoder comprises a plurality of encoding layers; wherein the encoder determines a key output matrix and a value output matrix for the plurality of history objects, comprising: Each coding layer processes the object representation matrix for the multiple historical objects output by the previous coding layer based on the key transformation matrix and the value transformation matrix in the current layer, and obtains the key result matrix and the value result matrix corresponding to the coding layer; The key output matrix and the value output matrix are determined based on a plurality of key result matrices and a plurality of value result matrices corresponding to the plurality of encoding layers.

4. A training method for a behavior prediction system, include: Acquire a first training sample, which includes a target object, a plurality of historical objects in which a first user has performed a specific behavior, and a behavior label indicating whether the first user has performed the specific behavior on the target object; The first training sample is input into the behavior prediction system, which includes a prediction layer, and an encoder and a decoder based on the Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the multiple historical objects; the decoder processes the embedding vector of the target object using the first query transformation matrix to obtain a first query output vector, and determines a representation vector for the target object based on the product of the query output vector, the key output matrix and the value output matrix, and then processes the representation vector using the second query transformation matrix to obtain a second query output vector as a query output vector for the target object; the prediction layer determines a behavior prediction result based on the key output matrix, the value output matrix and the query output vector; The behavior prediction system is trained using the behavior prediction results and behavior labels.

5. The method according to claim 4, in, The prediction layer determines the behavior prediction result based on the key output matrix, the value output matrix and the query output vector, including: The prediction layer calculates a product result based on the query output vector, the key output matrix and the value output matrix, performs linear transformation and / or nonlinear transformation processing on the product result to obtain a transformation result, and determines the behavior prediction result based on the transformation result.

6. A training device for a behavior prediction system, include: a sample acquisition unit configured to acquire a first training sample, which includes a target object, a plurality of historical objects in which the first user has performed a specific behavior, and a behavior label indicating whether the first user has performed the specific behavior on the target object; A prediction unit is configured to input the first training sample into the behavior prediction system, the behavior prediction system comprising a prediction layer, and an encoder and a decoder based on a Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the multiple historical objects; the decoder processes the embedding vector of the target object using its query transformation matrix to obtain a query output vector, and determines an interest vector based on the product of the query output vector, the key output matrix and the value output matrix; the prediction layer obtains a behavior prediction result based on the interest vector; A training unit is configured to train the behavior prediction system using the behavior prediction results and behavior labels.

7. A training device for a behavior prediction system, include: a sample acquisition unit configured to acquire a first training sample, which includes a target object, a plurality of historical objects in which the first user has performed a specific behavior, and a behavior label indicating whether the first user has performed the specific behavior on the target object; A prediction unit is configured to input the first training sample into the behavior prediction system, which includes a prediction layer, and an encoder and a decoder based on a Transformer mechanism; wherein the encoder determines a key output matrix and a value output matrix for the multiple historical objects; the decoder processes the embedding vector of the target object using a first query transformation matrix to obtain a first query output vector, and determines a representation vector for the target object based on the product of the query output vector, the key output matrix and the value output matrix, and then processes the representation vector using a second query transformation matrix to obtain a second query output vector as a query output vector for the target object; the prediction layer determines a behavior prediction result based on the key output matrix, the value output matrix and the query output vector; A training unit is configured to train the behavior prediction system using the behavior prediction results and behavior labels.

8. A computer-readable storage medium having a computer program stored thereon, in, When the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 5.

9. A computing device comprising a memory and a processor, in, The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 5 is implemented.