Behavior prediction method and device, electronic equipment and readable storage medium

By combining the behavior prediction model with the time sequence and annotation probability of object samples to calculate the loss value, the problems of information loss in the Sum pooling layer and difficulty in RNN training are solved, achieving higher prediction accuracy and lower training difficulty.

CN111539512BActive Publication Date: 2025-10-17BEIJING SANKUAI ONLINE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010246661.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-31
Publication Date
2025-10-17
Estimated Expiration
2040-03-31

AI Technical Summary

Technical Problem

In the existing technology, the Sum pooling layer preprocessing leads to large information loss, low accuracy in characterizing user change features, difficulty in RNN training and large model size, which affects the accuracy of behavior prediction and the difficulty of training.

Method used

The behavior prediction model is trained through multiple behavior sequence samples to generate vectors of object samples. The loss value is calculated based on the time sequence and labeling probability of the object samples, avoiding the use of RNN and simplifying the model structure.

Benefits of technology

It improves the accuracy of the behavior prediction model, reduces the training difficulty and model size, and simplifies the prediction process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111539512B_ABST
    Figure CN111539512B_ABST
Patent Text Reader

Abstract

The present disclosure provides a behavior prediction method and device, electronic equipment and readable storage medium. The method comprises: obtaining a historical behavior sequence of a user and a target object, the historical behavior sequence comprising at least one historical object; inputting the historical object and the target object into a behavior prediction model to obtain a probability of the user implementing a preset behavior on the target object at a future time; wherein the behavior prediction model is obtained by pre-training a plurality of behavior sequence samples, the behavior sequence samples comprising: a labeled object and a corresponding labeled probability, at least two object samples with a time sequence, the object samples comprising a first object sub-sample as a positive sample and a second object sub-sample as a negative sample. The present disclosure helps to improve the prediction accuracy of the model, reduce the training difficulty and reduce the model size.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of deep learning, in particular to a behavior prediction method and device, an electronic device and a readable storage medium. BACKGROUND

[0002] Deep learning is widely used in predicting user behavior, and specifically, a user's possible click object at a future time can be predicted according to a user's historical behavior sequence. The model used for prediction usually includes an Embedding layer and an MLP layer (Multi-Layer Perceptron). In prediction, the Embedding layer first generates an Embedding vector corresponding to each historical click object in the historical behavior sequence, and then the MLP layer predicts the object that can be clicked at the future time according to the Embedding vector corresponding to each historical click object.

[0003] In the prior art, before the Embedding vector output by the Embedding layer is input into the MLP layer, it needs to be preprocessed to mine the change features of the user from the historical behavior sequence. Common preprocessing methods include using a Sum pooling layer, an Average_pooling layer, a Max_pooling layer, and an RNN (Recurrent Neural Network) layer for preprocessing.

[0004] The inventors have found that, after studying the above-mentioned scheme, the Sum pooling layer has a large information loss in preprocessing, and the representation accuracy of the change features of the user is low, resulting in low prediction accuracy. When the user behavior sequence is large, the RNN has the problems of training difficulty and large model size. SUMMARY

[0005] The present disclosure provides a behavior prediction method and device, an electronic device and a readable storage medium, which are used to improve the prediction accuracy of the model and avoid using the RNN to reduce the training difficulty and reduce the model size.

[0006] According to a first aspect of the present disclosure, a behavior prediction method is provided, the method comprising:

[0007] obtaining a historical behavior sequence of a user and a target object, the historical behavior sequence comprising at least one historical object;

[0008] inputting the historical object and the target object into a behavior prediction model to obtain a probability of the user performing a preset behavior on the target object at a future time;

[0009] The behavior prediction model is pre-trained by a plurality of behavior sequence samples, the behavior sequence samples include: annotated objects and corresponding annotation probabilities, at least two object samples with time sequence, the object samples include first object sub-samples as positive samples and second object sub-samples as negative samples, a second vector is generated for the first object sub-sample, a third vector is generated for the second object sub-sample, a first vector of the object sample is generated by weighting the second vector and the third vector, a loss value in training includes a loss value determined according to a first vector of a first time, a second vector of a second time and a third vector of the second time, the first time is earlier than the second time.

[0010] According to a second aspect of the present disclosure, a behavior prediction device is provided, the device comprising:

[0011] An object information acquisition module is configured to acquire a historical behavior sequence of a user and a target object, the historical behavior sequence including at least one historical object.

[0012] A behavior prediction module is configured to input the historical object and the target object into a behavior prediction model to obtain a probability of the user implementing a preset behavior on the target object at a future time.

[0013] The behavior prediction model is pre-trained by a plurality of behavior sequence samples, the behavior sequence samples include: annotated objects and corresponding annotation probabilities, at least two object samples with time sequence, the object samples include first object sub-samples as positive samples and second object sub-samples as negative samples, a second vector is generated for the first object sub-sample, a third vector is generated for the second object sub-sample, a first vector of the object sample is generated by weighting the second vector and the third vector, a loss value in training includes a loss value determined according to a first vector of a first time, a second vector of a second time and a third vector of the second time, the first time is earlier than the second time.

[0014] According to a third aspect of the present disclosure, an electronic device is provided, comprising:

[0015] A processor, a memory, and a computer program stored on the memory and executable on the processor, the processor implements the aforementioned behavior prediction method when executing the program.

[0016] According to a fourth aspect of the present disclosure, a readable storage medium is provided, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the aforementioned behavior prediction method.

[0017] The present disclosure provides a behavior prediction method, device, electronic equipment and readable storage medium. The method comprises: obtaining a historical behavior sequence of a user and a target object, the historical behavior sequence comprising at least one historical object; inputting the historical object and the target object into a behavior prediction model to obtain a probability of the user implementing a preset behavior on the target object at a future time; wherein the behavior prediction model is obtained by pre-training a plurality of behavior sequence samples, the behavior sequence samples comprising: a labeled object and a corresponding labeled probability, at least two objects samples with a time sequence, the object samples comprising a first object sub-sample as a positive sample and a second object sub-sample as a negative sample, when training the behavior prediction model, generating a second vector for the first object sub-sample, generating a third vector for the second object sub-sample, and generating a first vector of the object sample by weighting the second vector and the third vector, the loss value during training comprising a loss value determined according to a first vector at a first time, a second vector at a second time and a third vector at the second time, the first time being earlier than the second time. The method combines the loss between object samples at different times when calculating the loss value, which helps to improve the prediction accuracy of the model, and only needs to predict a simple vector and perform simple weighting on the vector, avoids using an RNN model, helps to reduce the training difficulty and reduce the model size. BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the present disclosure, the drawings needed in the description of the present disclosure will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and other drawings can also be obtained by those skilled in the art without creative labor.

[0019] Figure 1 A step flowchart of a behavior prediction method in an embodiment of the present disclosure is shown;

[0020] Figure 2 A structural schematic diagram of an MLP layer of the present disclosure is shown;

[0021] Figure 3 A structural schematic diagram of a behavior prediction model of the present disclosure is shown;

[0022] Figure 4 A step flowchart of determining a first loss value of the present disclosure is shown;

[0023] Figure 5 A step flowchart of inputting a fifth vector of the present disclosure is shown;

[0024] Figure 6 A step flowchart of inputting a sixth vector of the present disclosure is shown;

[0025] Figure 7A 、 7B respectively show schematic diagrams of two time intervals of a history object of the present disclosure;

[0026] Figure 8 show a structural schematic diagram of a Transformer layer of the present disclosure;

[0027] Figure 9 show a structural schematic diagram of another Transformer layer of the present disclosure;

[0028] Figure 10 show a structural schematic diagram of an Attention layer of the present disclosure;

[0029] Figure 11 show a structural schematic diagram of another Attention layer of the present disclosure;

[0030] Figure 12 show a flow chart of a step of determining a loss value of the present disclosure;

[0031] Figure 13 show a structural diagram of a behavior prediction device of the present disclosure;

[0032] Figure 14 show a module block diagram of determining a first loss value of the present disclosure;

[0033] Figure 15 show a module block diagram of inputting a fifth quantity of the present disclosure;

[0034] Figure 16 show a module block diagram of inputting a sixth quantity of the present disclosure;

[0035] Figure 17 show a module block diagram of determining a loss value of the present disclosure;

[0036] Figure 18 show a structural diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0037] The technical solutions in the present disclosure will be described clearly and completely below in combination with the drawings in the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present disclosure.

[0038] Embodiment One

[0039] Reference Figure 1FIG. 1 shows a step flowchart of a behavior prediction method in an embodiment of the present disclosure, specifically as follows:

[0040] In step 101, a historical behavior sequence of a user and a target object are obtained, the historical behavior sequence comprising at least one historical object.

[0041] The historical behavior sequence can be composed of historical objects on which the user has performed a preset behavior in a historical time period. The preset behavior can be a click behavior or an order behavior, etc. For example, if the historical objects on which the user has clicked in the historical time period include PG1, PG2, PG3 and PG4, the historical behavior sequence can be {PG1, PG2, PG3, PG4}.

[0042] The target object can be any object, so that the user's performance of a preset behavior on the target object at a future time can be predicted according to the historical object. It should be noted that the historical object and the target object are the same type of object, which can be a webpage, a merchant, etc.

[0043] The present disclosure can be applied to the prediction of a click behavior, an order behavior, etc.

[0044] In step 102, the historical object and the target object are input into a behavior prediction model to obtain a probability of the user performing a preset behavior on the target object at a future time.

[0045] The behavior prediction model is obtained by pre-training a plurality of behavior sequence samples. The behavior sequence samples include labeled objects and corresponding labeled probabilities, at least two object samples with a time sequence, the object samples including first object sub-samples as positive samples and second object sub-samples as negative samples. When training the behavior prediction model, a second vector is generated for the first object sub-sample, a third vector is generated for the second object sub-sample, a first vector of the object sample is generated by weighting the second vector and the third vector, and a loss value during training includes a loss value determined according to a first vector at a first time, a second vector at a second time and a third vector at the second time, the first time being earlier than the second time.

[0046] The behavior prediction model is used to predict a probability of the user performing a preset behavior on the target object at a future time. The preset behavior is any behavior representing the user's interest preference for the target object, including but not limited to a click behavior, an order behavior, a collection behavior, and an add-to-cart behavior. For example, when the preset behavior is a click behavior, the behavior prediction model is used to predict a probability of the user performing the click behavior on the target object at a future time. For a single user, the probability of the user performing the click behavior on the target object at a future time is a probability of the user clicking the target object at a future time. For a large number of users, the probability of the user performing the click behavior on the target object at a future time represents a proportion of the number of users who click the target object at a future time among the large number of users, that is, a click-through rate (CTR).

[0047] The labeled object in step 102 is used for supervised training. The labeled probability of the labeled object is a real probability of the user performing the preset behavior. When the labeled object is an object on which the user has actually performed the preset behavior, the labeled probability is 1. When the labeled object is an object on which the user has not performed the preset behavior, the labeled probability can be 0.

[0048] The object sample is an object used for prediction at a reference time in a training process. Further, the object sample includes a first object sub-sample as a positive sample and a second object sub-sample as a negative sample. For example, in an application scenario of network sales, the object sample is a merchant. If the preset behavior is a click behavior, the first object sub-sample is a merchant clicked by the user, and the second object sub-sample is a merchant not clicked by the user. If the preset behavior is an order behavior, the first object sub-sample is a merchant ordered by the user, and the second object sub-sample is a merchant not ordered by the user. It can be understood that each object sample in the behavior sequence sample includes the first object sub-sample and the second object sub-sample. Each historical object in the historical behavior sequence also includes a first historical sub-object performing the preset behavior and a second historical sub-object not performing the preset behavior.

[0049] In an embodiment of the present application, the behavior prediction model can be trained based on object samples. The behavior prediction model can generate a second vector for a first object sub-sample in each object sample, and generate a third vector for a second object sub-sample in each object sample. For the same object sample, the second vector of the first object sub-sample and the third vector of the second object sub-sample are weighted to obtain a first vector of the object sample. A loss value is calculated based on the three vectors. Specifically, for two object samples with a time sequence: an object sample at a first time and an object sample at a second time, a first sub-loss value is calculated based on the second vector of the first object sub-sample in the object sample at the second time and the first vector of the object sample at the first time, and a second sub-loss value is calculated based on the third vector of the second object sub-sample in the object sample at the second time and the first vector of the object sample at the first time. The first sub-loss value and the second sub-loss value are weighted to obtain a final loss value. In this way, the loss value not only considers the loss in the time sequence, but also considers the loss value caused by weighting, which helps to improve the accuracy of the loss value.

[0050] After training the behavior prediction model, the behavior prediction model can be used to predict the probability of a user performing a preset behavior on a target object at a future time. There are usually multiple target objects, but only one target object can be input to the behavior prediction model at a time. For example, in a network sales scenario, the target object can be all merchants registered on a network sales platform, or merchants near the user's location. Therefore, after predicting the probability of the user performing the preset behavior on the target object at the future time, some target objects can be selected from the multiple target objects as the objects on which the user is most likely to perform the preset behavior according to the probability. The some target objects can be target objects with a probability greater than or equal to a preset probability threshold, or at least one target object with the maximum probability.

[0051] Optionally, in another embodiment of the present disclosure, the behavior prediction model comprises an Embedding layer, a Transformer layer, and an MLP layer; when training the behavior prediction model, the object sample is input into the Embedding layer, the output of the Embedding layer is input into the Transformer layer, the output of the Transformer layer is input into the MLP layer, and the loss value of the behavior prediction model during training is determined according to a first loss value and a second loss value, the first loss value is determined according to a first vector corresponding to the object sample at a first time output by the Transformer layer, a second vector corresponding to the first object sub-sample at a second time output by the Embedding layer, and a third vector corresponding to the second object sub-sample at the second time output by the Embedding layer, and the second loss value is determined according to a label probability of the labeled object and a prediction probability of the labeled object output by the MLP layer.

[0052] The input of the behavior prediction model is the input of the Embedding layer, so as to generate a vector for the input information. The input information is the historical object and the target object when applied, and is the first object sub-sample, the second object sub-sample, the labeled object, and the label probability when trained.

[0053] The Transformer layer is a conversion layer, which is used to transform the vector output by the Embedding layer to extract features.

[0054] The MLP layer is used to further convert the vector output by the Transformer layer. The multi-layer perceptron is composed of multiple activation layers from bottom to top, and the total number and type of the activation layers can be set. For example, as shown in the structure diagram of the MLP layer, the MLP is composed of three LEAKY RELU activation layers and one Sigmoid activation layer, the lowermost LEAKY RELU activation layer is the input of the MLP layer, and the output of the Sigmoid activation layer is the output of the MLP layer. Figure 2

[0055] Refer to Figure 3 ​The structure diagram of the behavior prediction model is shown. The Embedding layer is located at the bottom of the behavior prediction model and is the input layer of the model. In training, PG11 and PG12 are the first object sub-sample and the second object sub-sample with the earliest time in the behavior sequence sample, PG21 and PG22 are the first object sub-sample and the second object sub-sample with the second earliest time in the behavior sequence sample, and PGT1 and PGT2 are the first object sub-sample and the second object sub-sample with the latest time in the behavior sequence sample. The Embedding layer outputs vectors PGE11, PGE12, PGE21, PGE22, …, PGET1, and PGET2 from PG11, PG12, PG21, PG22, …, PGT1, and PGT2, respectively. Then, the Transformer outputs vectors PGT11, PGT12, PGT21, PGT22, …, PGTT1, and PGTT2 from PGE11, PGE12, PGE21, PGE22, …, PGET1, and PGET2, respectively. Finally, the vectors obtained by stacking or splicing PGT11, PGT12, PGT21, PGT22, …, PGTT1, and PGTT2 are input to the MLP layer, and the output of the MLP layer is the output of the behavior prediction model. In actual application, at least one other feature OF that affects prediction can also be input to the Embedding layer, so that the vector output by the Embedding layer is OFE. Then, the Transformer layer outputs OFT from OFE. Finally, the vectors obtained by stacking or splicing OFT and PGT11, PGT12, PGT21, PGT22, …, PGTT1, and PGTT2 are input to the MLP layer.

[0056] For the behavior prediction model of Figure 3 , the disclosure not only considers the loss between the annotation probability of the annotated object and the prediction probability of the annotated object output by the MLP layer to obtain a second loss value when calculating the loss value, but also considers the loss introduced by the Transformer to obtain a first loss value. Therefore, a more accurate loss value is obtained, which helps to improve the prediction accuracy of the behavior prediction model.

[0057] Optionally, in another embodiment of the disclosure, referring to the step flow chart for determining the first loss value shown in Figure 4 , the first loss value is determined by the following steps 103 to 105:

[0058] Step 103, determining the positive sample sub-loss value of the object sample according to the first vector corresponding to the object sample at the first time output by the Transformer layer and the second vector corresponding to the first object sub-sample at the second time output by the Embedding layer.

[0059] Specifically, for the object sample OBJ i,t , in the first time t of the i-th behavior sequence sample, the positive sample sub-loss value PLOSS i,t can be calculated according to the following formula:

[0060] PLOSS i,t = log (FUNC (Y i,t ·P i,t+1 )) (1)

[0061] Where Y i,t is the first vector corresponding to the OBJ i,t output by the Transformer layer, P i,t+1 is the second vector corresponding to the POBJ i,t+1 output by the Embedding layer, and POBJ i,t+1 is the first object sub-sample in the second time t+1 of the i-th behavior sequence sample, so that Y i,t ·P i,t+1 is the inner product of Y i,t and P i,t+1 , and FUNC is any selected activation function. In the present disclosure, FUNC can preferably be a Sigmoid activation function, so that the following formula is obtained:

[0062]

[0063] It should be noted that the first time t and the second time t+1 differ by 1, which only represents that the difference between the two time points is 1, that is, the t-th time point is taken as the first time point, and the t+1-th time point is taken as the second time point, and the time difference between the two time points is 1.

[0064] Step 104, determining the negative sample sub-loss value of the object sample according to the first vector corresponding to the object sample in the first time output by the Transformer layer and the third vector corresponding to the second object sub-sample in the second time output by the Embedding layer.

[0065] Specifically, for the object sample OBJ i,t , in the first time t of the i-th behavior sequence sample, the negative sample sub-loss value NLOSS i,t can be calculated according to the following formula:

[0066] NLOSS i,t = log (1-FUNC (Y i,t ·N i,t+1 )) (3)

[0067] Where Ni,t+1 NOBJ output by the Embedding layer i,t+1 The corresponding third vector, and NOBJ i,t+1 is the second object subsample at the second moment t+1 in the i-th behavior sequence sample, Y i,t ·N i,t+1 Y i,t and N i,t+1 The inner product of FUNC is the same as FUNC in formula (1), corresponding to formula (2), when FUNC is a Sigmoid function, the following formula is obtained:

[0068]

[0069] Step 105: Determine a first loss value according to the positive sample sub-loss value and the negative sample sub-loss value.

[0070] Specifically, the first loss value can be obtained according to the following formula:

[0071]

[0072] Wherein, I is the number of behavior sequence samples, and T is the number of object samples contained in each behavior sequence sample. Of course, different behavior sequence samples may contain different numbers of object samples.

[0073] In practical applications, the first loss value corresponding to each object sample can be obtained by dividing LOSS1 in formula (5) by T to avoid the influence of different sequence sample lengths on the loss value.

[0074] The present disclosure can calculate the positive sample sub-loss value and the negative sample sub-loss value separately to obtain a first loss value, wherein the negative sample sub-loss value is the loss introduced by the Transformer layer, thereby helping to improve the prediction accuracy of the model.

[0075] Optionally, in another embodiment of the present disclosure, referring to Figure 5 The method further comprises steps 106 to 108:

[0076] Step 106: Generate a position vector of the historical object according to the position information of the historical object in the historical behavior sequence.

[0077] The position information can uniquely represent the position of each historical object in each historical behavior sequence. For example, the position information can be a position number. For the historical behavior sequence {PG1, PG2, PG3, PG4, PG5}, since it includes five historical objects, the position number can be numbered from 1, and the position number of PG1 is 1, the position number of PG2 is 2, the position number of PG3 is 3, the position number of PG4 is 4, and the position number of PG5 is 5.

[0078] The position vector is a vector representation of the position information of the historical object, which can uniquely represent each position information. In an embodiment of the present disclosure, for the position information of each historical object, each item of the position vector corresponding to the position information can be calculated according to the following formula:

[0079] PE 2k = sin(pos / 10000 2k / K ) (6)

[0080] PE 2k+1 = cos(pos / 10000 2k / K ) (7)

[0081] wherein PE 2k , PE 2k+1 are even position items and odd position items of the position vector respectively, pos is the position information of the historical object, k is a number between 0 and K / 2, and K is a preset length of the position vector.

[0082] When k is 0, the first item of the position vector is PE1 = cos(pos) according to the above formula (7), and when k is 1, the second item of the position vector is PE2 = sin(pos / 10000 2 / K ) according to the above formula (6). Similarly, the K items of the position vector are determined.

[0083] In step 107, a fifth vector of the historical object is determined according to the position vector and the fourth vector of the historical object output by the Embedding layer.

[0084] Specifically, the position vector and the fourth vector can be spliced into the fifth vector. For example, if the position vector is [PE1, PE2, PE3, PE4, PE5] and the fourth vector is [VF1, VF2, VF3, VF4, VF5], the spliced fifth vector can be [PE1, PE2, PE3, PE4, PE5, VF1, VF2, VF3, VF4, VF5], or [VF1, VF2, VF3, VF4, VF5, PE1, PE2, PE3, PE4, PE5].

[0085] In addition, the position vector and the fourth vector can also be superimposed bit by bit into a fifth vector. For example, if the position vector is [PE1, PE2, PE3, PE4, PE5] and the fourth vector is [VF1, VF2, VF3, VF4, VF5], the fifth vector obtained by bit-by-bit superposition can be [PE1+VF1, PE2+VF2, PE3+VF3, PE4+VF4, PE5+VF5].

[0086] It can be seen that splicing can not consider the length of the position vector and the fourth vector, and bit-by-bit superposition requires the length of the position vector and the fourth vector to be the same.

[0087] It can be understood that since the historical object and the target object can be represented by a unique identifier, the historical object and the target object are input into the behavior prediction model, that is, the identifier of the historical object and the identifier of the target object are input into the behavior prediction model, so that the Embedding layer of the behavior prediction model outputs the fourth vector of the historical object as the vector corresponding to the identifier of the historical object, and the vector of the target object output by the Embedding layer is the vector corresponding to the identifier of the target object. The fifth vector of the historical object is the vector representation of the historical object, which integrates the two pieces of information of the identifier and the position.

[0088] In addition, the position vector can also be learned in an end-to-end manner, for example, the position vector is learned in an end-to-end manner, and the generation method of the position vector is not limited in the disclosure.

[0089] Step 108: inputting the fifth vector of the historical object into the Transformer layer.

[0090] The disclosure can generate the fifth vector in combination with the position vector, so that the Transformer layer can make more accurate predictions in combination with the position information.

[0091] It should be noted that during training, the object sample also needs to generate a position vector according to the above step 106, and generate a new vector in combination with the vector output by the Embedding layer for the object sample according to the same method of the above step 107, to input into the Transformer layer.

[0092] Alternatively, in another embodiment of the disclosure, referring to the step flow chart of inputting the sixth vector shown in Figure 6 The method further includes steps 109-111:

[0093] Step 109: generating a time vector of the historical object according to a time interval between the historical object and a previous historical object.

[0094] The time interval can be expressed in seconds, minutes, hours, or the like. For example, the historical object sequence is {PG1, PG2, PG3, PG4, PG5}, and the time interval between PG1 and PG2 is 1 hour, the time interval between PG2 and PG3 is 1 hour, the time interval between PG3 and PG4 is 1 hour, and the time interval between PG4 and PG5 is 6 days.

[0095] The time vector is a vector representation of the time interval between each historical object and the previous historical object, which can uniquely represent each time interval. In an embodiment of the present disclosure, for each time interval corresponding to each historical object, each item constituting the time vector corresponding to the time interval can be calculated according to the following formula:

[0096] TE 2j = sin(t / 10000 2j / J ) (8)

[0097] TE 2j+1 = cos(t / 10000 2j / J ) (9)

[0098] wherein TE 2j , TE 2j+1 are even position items and odd position items of the time vector respectively, t is the time interval between the historical object and the previous historical object, j is a number between 0 and J / 2, and J is a preset length of the time vector.

[0099] When j is 0, the first item of the time vector is TE1 = cos(t) based on the above formula (9), and when j = 1, the second item of the time vector is TE2 = sin(t / 10000 2 / J ) based on the above formula (8). Similarly, the J items of the time vector are determined.

[0100] In step 110, a sixth vector of the historical object is determined according to the time vector and the fourth vector of the historical object output by the Embedding layer.

[0101] Specifically, the time vector and the fourth vector can be spliced into the sixth vector. For example, if the time vector is [TE1, TE2, TE3, TE4, TE5] and the fourth vector is [VF1, VF2, VF3, VF4, VF5], the spliced sixth vector can be [TE1, TE2, TE3, TE4, TE5, VF1, VF2, VF3, VF4, VF5], or [VF1, VF2, VF3, VF4, VF5, TE1, TE2, TE3, TE4, TE5].

[0102] In addition, the time vector and the fourth vector can also be superimposed bit by bit into the sixth vector. For example, if the time vector is [TE1, TE2, TE3, TE4, TE5] and the fourth vector is [VF1, VF2, VF3, VF4, VF5], the sixth vector obtained by bit-by-bit superposition can be [TE1+VF1, TE2+VF2, TE3+VF3, TE4+VF4, TE5+VF5].

[0103] It can be seen that splicing can not consider the length of the time vector and the fourth vector, while bit-by-bit superposition requires the length of the time vector and the fourth vector to be the same.

[0104] It can be understood that the sixth vector of the historical object is a vector representation of the historical object, which integrates the two pieces of information of identification and time.

[0105] In addition, the time vector can also be determined in other ways, such as learning the time vector in an end-to-end manner, and the determination method of the time vector is not limited in the present disclosure.

[0106] In step 111, the sixth vector of the historical object is input into the Transformer layer.

[0107] Among them, the sixth vector contains the time vector, and the time vectors of multiple historical objects can represent whether the user preference is stable. For example, as shown in Figure 7A The time interval between the historical object PG1 and the historical object PG2, the time interval between the historical object PG2 and the historical object PG3, and the time interval between the historical object PG3 and the historical object PG4 are all 1 hour, and the time interval between the historical object PG4 and the historical object PG5 is 6 days; as shown in Figure 7B The time interval between the historical object PG1 and the historical object PG2, the time interval between the historical object PG2 and the historical object PG3, and the time interval between the historical object PG3 and the historical object PG4 are all 1 hour, and the time interval between the historical object PG4 and the historical object PG5 is 6 days; as shown in Figure 7A The stability of the user preference is poor in Figure 7B The stability of the user preference is good in

[0108] The present disclosure can generate the sixth vector in combination with the time vector, so that the Transformer layer can make more accurate predictions in combination with time information.

[0109] It should be noted that during training, the object sample also needs to generate a time vector in the same way as step 109, and generate a new vector in combination with the vector output by the Embedding layer for the object sample in the same way as step 110, to input into the Transformer layer.

[0110] In actual application, the position vector generated in step 106, the time vector generated in step 109, and the fourth vector of the historical object output by the Embedding layer can be spliced or superimposed bit by bit to obtain a seventh vector, and the seventh vector is input into the Transformer layer, so as to realize prediction combined with time information and position information, and make the prediction result more accurate. It can be understood that the seventh vector of the historical object is the vector representation of the historical object, which comprehensively considers the three information of identification, position and time.

[0111] Optionally, in another embodiment of the present disclosure, the first object sub-sample and the second object sub-sample are both input into the Embedding layer, and the vectors generated according to the outputs of the Embedding layer on the first object sub-sample and the second object sub-sample are input into the Transformer layer.

[0112] In the present disclosure, each object sample specifically includes a first object sub-sample and a second object sub-sample, so that the Embedding layer generates vectors for the first object sub-sample and the second object sub-sample respectively, and finally the vectors of the first object sub-sample and the second object sub-sample are spliced or superimposed bit by bit to obtain a new vector input into the Transformer layer. For example, if the vector of the first object sub-sample is [PGV11, PGV12, PGV13, PGV14, PGV15], and the vector of the second object sub-sample is [PGV21, PGV22, PGV23, PGV24, PGV25], the spliced new vector can be [PGV11, PGV12, PGV13, PGV14, PGV15, PGV21, PGV22, PGV23, PGV24, PGV25], or [PGV21, PGV22, PGV23, PGV24, PGV25, PGV11, PGV12, PGV13, PGV14, PGV15]; and the new vector obtained by bit superposition is [PGV11+PGV21, PGV12+PGV22, PGV13+PGV23, PGV14+PGV24, PGV15+PGV25].

[0113] Compared with the traditional algorithm that only inputs the vector of the first object sub-sample into the Transformer layer for training, the present disclosure can combine the first object sub-sample as a positive sample and the second object sub-sample as a negative sample to more accurately learn the model, so that the model can simultaneously combine the first historical sub-object of the user implementing the preset behavior and the second historical sub-object of the user not implementing the preset behavior to predict whether the user implements the preset behavior on the target object at a future time, and can improve the accuracy of prediction.

[0114] Optionally, in another embodiment of the present disclosure, the Transformer layer comprises at least one Transformer unit, the Transformer unit comprises an Attention layer, a feedforward network layer, a first stacking and normalization layer, and a second stacking and normalization layer, the input of the Attention layer is the input of the Transformer unit, the input of the Transformer unit and the output of the Attention layer are input to the first stacking and normalization layer, the output of the first stacking and normalization layer is input to the feedforward network layer, the output of the feedforward network layer is input to the second stacking and normalization layer, and the output of the second stacking and normalization layer is the output of the Transformer unit.

[0115] In the present disclosure, as shown in a structural schematic diagram of a Transformer layer, if the Transformer layer is composed of only one Transformer unit, the input of the Transformer layer is the input of the Attention layer in the Transformer unit, and the output of the second stacking and normalization layer is the output of the Transformer layer. Figure 8 In order to improve the generalization ability of the model, another structural schematic diagram of a Transformer layer as shown in Figure 9 may be used, which is composed of several Transformer units, the input of the Transformer layer is the input of the Attention layer in the first Transformer unit, and the output of the second stacking and normalization layer in the last Transformer unit is the output of the Transformer layer. In addition, an activation layer such as a Softmax activation layer, a RELU activation layer, etc. can also be arranged after the last Transformer layer. The present disclosure does not limit the selection of the activation layer.

[0116] The Attention layer can adopt an SDPA (Scaled Dot-Product Attention) structural schematic diagram as shown in Figure 10 , or an MHA (Multi-Head Attention) structure as shown in Figure 11 . The present disclosure does not limit this.

[0117] For the MHA structure as shown in Figure 11 , the relationship between the output and the input can be represented by the following formula:

[0118] MH = Concat (head1,..., headh ..., head H )·WH (10)

[0119] wherein, MH is the vector output by the MHA structure, WH is the matrix composed of the parameters of the MHA structure, H represents the number of head vectors, is a hyperparameter that can be set, and Concat(head1,..., head h ..., head H ) is a vector obtained by splicing 1 to H head vectors, wherein, head h is the head vector output by each SDPA structure as shown in Figure 10 , which can be specifically represented by the following formula:

[0120]

[0121] wherein, the vector E is the vector input into the Transformer layer, which can be the output of the Embedding layer, or a vector determined according to the output of the Embedding layer and the position vector, or a vector determined according to the output of the Embedding layer and the time vector, or a vector determined according to the output of the Embedding layer, the time vector and the position vector; the matrix WQ h , the matrix WK h , and the matrix WV h are all matrices composed of parameters that need to be trained in the Attention structure, and the value d h is the distance between the vector E·WQ h and the vector E·WK h , the vector E·WQ h is the product of the vector E and the matrix WQ h , the vector E·WK h is the product of the vector E and the matrix WK h , the vector (E·WK h ) T is the transposed vector of the vector E·WK h , the value (E·WQ h )·(E·WK h ) T is the product of the vector E·WQ h and the vector (E·WK h ) T , and the vector E·WV h is the product of the vector E and the matrix WV h . Softmax is an activation function, and the value is the variable of the Softmax function, so that the value output by the above formula is multiplied by the vector (E·WV h ) to obtain the head vector headh Based on different h, we get: Figure 11 The WQ1, WK1, WV1 matrices in the head vector head1, WQ H , WK H , WV H matrix corresponds to the head vector head H .

[0122] Figure 8 Or Figure 9 The feedforward network layer in the above formula (10) can be a fully connected network layer. The feedforward network layer can be simply regarded as a function as follows:

[0123] FFN = max (0, X1·W1 + B1)·W2 + B2 (12)

[0124] Wherein, FFN is the output vector of the feedforward network layer, X1 is the input vector of the feedforward network layer, W1, B1, W2 and B2 are all parameters of the feedforward network layer.

[0125] Optionally, in another embodiment of the present disclosure, referring to the step flow chart for determining the loss value shown in FIG. 11, the loss value is determined by the following steps 112 to 113: Figure 12

[0126] Step 112, calculating the product of the preset adjustment coefficient and the first loss value to obtain an adjusted loss value.

[0127] Wherein, the adjustment coefficient can be set and adjusted according to the empirical value, which is used to adjust the first loss value to an adjusted loss value which is basically comparable to the second loss value in the order of magnitude.

[0128] Step 113, calculating the sum of the product and the second loss value to obtain the loss value.

[0129] Specifically, the loss value TLOSS can be calculated according to the following formula:

[0130] TLOSS = α·LOSS1 + LOSS2 (13)

[0131] Wherein, α is a preset adjustment coefficient, LOSS1 is the first loss value calculated by formula (5), LOSS2 is the second loss value, which can be calculated by using cross-entropy loss function, exponential loss function, square loss function, absolute value loss function, 0-1 loss function, etc. The specific selection of the loss function is related to the target of the task. For example, since the target of whether the user will implement the preset behavior on the target object at the future time is classification, the cross-entropy can be used to calculate the second loss value, which is specifically as follows:

[0132]

[0133] wherein, I is the number of behavior sequence samples, y i is the annotation probability of the annotated object in the i-th behavior sequence sample, y i is the prediction probability of the annotated object in the i-th behavior sequence sample output by the behavior prediction model.

[0134] It can be understood that, compared with setting an adjustment parameter for the first loss value and the second loss value at the same time, the operation amount of the present disclosure is smaller.

[0135] The present disclosure can adjust the first loss value to an adjusted loss value which is basically comparable to the second loss value in order of magnitude by a smaller operation amount, so that the influence of the two on training is comparable, avoiding that the first loss value is too large or the second loss value is too large, resulting in that the influence of the smaller loss value is ignored, which helps to improve the prediction accuracy of the model.

[0136] In summary, the present disclosure provides a behavior prediction method, comprising: obtaining a historical behavior sequence of a user and a target object, the historical behavior sequence comprising at least one historical object; inputting the historical object and the target object into a behavior prediction model to obtain a probability that the user implements a preset behavior on the target object at a future time; wherein the behavior prediction model is obtained by pre-training a plurality of behavior sequence samples, the behavior sequence sample comprising: an annotated object and a corresponding annotation probability, at least two object samples with a time sequence, the object sample comprising a first object sub-sample as a positive sample and a second object sub-sample as a negative sample, when training the behavior prediction model, generating a second vector for the first object sub-sample, generating a third vector for the second object sub-sample, and generating a first vector of the object sample by weighting the second vector and the third vector, the loss value during training comprising a loss value determined according to the first vector at the first time, the second vector at the second time, and the third vector at the second time, the first time being earlier than the second time. The method combines the loss between object samples at different times when calculating the loss value, which helps to improve the prediction accuracy of the model, and only needs to use a simple prediction vector and perform simple weighting on the vector, avoiding the use of an RNN model, which helps to reduce the training difficulty and reduce the model size.

[0137] Embodiment Two

[0138] With reference to Figure 13 which shows the structure diagram of the behavior prediction device in an embodiment of the present disclosure, specifically as follows:

[0139] The object information acquisition module 201 is configured to obtain a historical behavior sequence of a user and a target object, the historical behavior sequence comprising at least one historical object.

[0140] The behavior prediction module 202 is configured to input the historical object and the target object into a behavior prediction model to obtain a probability that the user implements a preset behavior on the target object at a future time.

[0141] The behavior prediction model is obtained by pre-training a plurality of behavior sequence samples. The behavior sequence samples include labeled objects and corresponding labeled probabilities, at least two objects samples with time sequence. The object samples include a first object sub-sample as a positive sample and a second object sub-sample as a negative sample. When training the behavior prediction model, a second vector is generated for the first object sub-sample, a third vector is generated for the second object sub-sample, and a first vector of the object sample is generated by weighting the second vector and the third vector. The loss value during training includes a loss value determined according to the first vector at the first time, the second vector at the second time, and the third vector at the second time. The first time is earlier than the second time.

[0142] Optionally, in another embodiment of the present disclosure, referring to the module block diagram for determining the first loss value shown in Figure 14 The first loss value is determined by the positive sample sub-loss value determination module 203, the negative sample sub-loss value module 204, and the first loss value determination module 205.

[0143] The positive sample sub-loss value determination module 203 is configured to determine a positive sample sub-loss value of the object sample according to the first vector of the object sample at the first time output by the Transformer layer and the second vector of the first object sub-sample at the second time output by the Embedding layer.

[0144] The negative sample sub-loss value module 204 is configured to determine a negative sample sub-loss value of the object sample according to the first vector of the object sample at the first time output by the Transformer layer and the third vector of the second object sub-sample at the second time output by the Embedding layer.

[0145] The first loss value determination module 205 is configured to determine a first loss value according to the positive sample sub-loss value and the negative sample sub-loss value.

[0146] Optionally, in another embodiment of the present disclosure, referring to the module block diagram for inputting the fifth vector shown in Figure 15 The device further includes the position vector determination module 206, the fifth vector determination module 207, and the fifth vector input module 208.

[0147] The position vector determination module 206 is configured to generate a position vector of the historical object according to position information of the historical object in the historical behavior sequence.

[0148] The fifth vector determining module 207 is configured to determine a fifth vector of the historical object according to the position vector and the fourth vector of the historical object output by the Embedding layer.

[0149] The fifth vector input module 208 is configured to input the fifth vector of the history object into the Transformer layer.

[0150] Optionally, in another embodiment of the present disclosure, referring to Figure 16 The module block diagram of inputting the sixth vector shown in FIG. 2 further includes a time vector determination module 209, a sixth vector determination module 210, and a sixth vector input module 211:

[0151] The time vector determining module 209 is configured to generate a time vector of the historical object according to a time interval between the historical object and a previous historical object.

[0152] The sixth vector determining module 210 is configured to determine a sixth vector of the historical object according to the time vector and the fourth vector of the historical object output by the Embedding layer.

[0153] The sixth vector input module 211 is configured to input the sixth vector of the history object into the Transformer layer.

[0154] Optionally, in another embodiment of the present disclosure, the first object subsample and the second object subsample are both input into the Embedding layer, and the vector generated according to the output of the Embedding layer for the first object subsample and the output of the second object subsample is input into the Transformer layer.

[0155] Optionally, in another embodiment of the present disclosure, the Transformer layer includes: at least one Transformer unit, the Transformer unit includes: an Attention layer, a feedforward network layer, a first superposition and normalization layer, and a second superposition and normalization layer. The input of the Attention layer is the input of the Transformer unit, the input of the Transformer unit and the output of the Attention layer are input to the first superposition and normalization layer, the output of the first superposition and normalization layer is input to the feedforward network layer, the output of the feedforward network layer is input to the second superposition and normalization layer, and the output of the second superposition and normalization layer is used as the output of the Transformer unit.

[0156] Optionally, in another embodiment of the present disclosure, referring toFigure 17 The module block diagram shown in the determination of the loss value, the loss value is adjusted by the first loss value adjustment module 212, the loss value calculation module 213:

[0157] The first loss value adjustment module 212 is configured to calculate the product of the preset adjustment coefficient and the first loss value to obtain an adjusted loss value.

[0158] The loss value calculation module 213 is configured to calculate the sum of the product and the second loss value to obtain the loss value.

[0159] In summary, the present disclosure provides a behavior prediction device, comprising: an object information acquisition module, configured to acquire a historical behavior sequence of a user and a target object, the historical behavior sequence comprising at least one historical object; a behavior prediction module, configured to input the historical object and the target object into a behavior prediction model to obtain a probability of the user implementing a preset behavior on the target object at a future time; wherein the behavior prediction model is obtained by pre-training a plurality of behavior sequence samples, the behavior sequence sample comprising: a labeled object and a corresponding labeled probability, at least two object samples with a time sequence, the object sample comprising a first object sub-sample as a positive sample and a second object sub-sample as a negative sample, when training the behavior prediction model, generating a second vector for the first object sub-sample, generating a third vector for the second object sub-sample, and generating a first vector of the object sample by weighting the second vector and the third vector, the loss value during training comprising a loss value determined according to a first vector at a first time, a second vector at a second time, and a third vector at a second time, the first time being earlier than the second time. When calculating the loss value, the device combines the loss between the object samples at different times, which helps to improve the prediction accuracy of the model, and only needs to predict a simple vector and perform simple weighting on the vector, avoiding the use of an RNN model, which helps to reduce the training difficulty and reduce the model size.

[0160] Embodiment two is a device embodiment corresponding to embodiment one, and the detailed description can be referred to in embodiment one, which will not be repeated here.

[0161] The present disclosure also provides an electronic device, which comprises a processor 301, a memory 302, and a computer program 3021 stored in the memory 302 and executable on the processor, wherein the processor 301 implements the behavior prediction method of the preceding embodiments when executing the program. Figure 18

[0162] The present disclosure also provides a readable storage medium, when the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the behavior prediction method of the preceding embodiments. ​

[0163] For the apparatus embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the relevant portions of the description of the method embodiments.

[0164] The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems can be used with programs in accordance with the teachings herein, or it can prove convenient to construct more specialized apparatus to perform the required method steps. The required structure for a variety of these systems will be apparent from the description above. In addition, the present disclosure is not intended to be limited to any particular programming language. It will be appreciated that a variety of programming languages can be used to implement the present disclosure as described herein, and any references below to specific languages are provided for disclosure of enablement of the present disclosure.

[0165] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the disclosure can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.

[0166] Similarly, it is to be understood that the disclosure can employ techniques described herein as related to example embodiments of the disclosure without necessarily being limited to such techniques. In other words, it is contemplated that the disclosure can be practiced with the tacit understanding with which the pertinent art has been taught, irrespective of the particular techniques employed by the present disclosure. Furthermore, it is to be understood that the use of certain terms to describe the disclosure is used by way of the examples, and should not necessarily limit the scope of the disclosure to the specific terms so used.

[0167] Those skilled in the art will appreciate that the modules in the apparatuses in the embodiments can be adapted and placed in one or more apparatuses other than the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and further can be divided into multiple sub-modules or sub-units or sub-components. Any combination of all the features disclosed in the specification (including the accompanying claims, abstract and drawings), and any method or apparatus otherwise disclosed in the specification, can be used in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless explicitly stated otherwise, each feature disclosed in the specification (including the accompanying claims, abstract and drawings) can be replaced by alternative features that serve the same, equivalent or similar purpose.

[0168] The various component embodiments of the present disclosure can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all of the functions of some or all of the components in the behavior prediction device according to the present disclosure. The present disclosure can also be implemented as a device or apparatus program for performing part or all of the methods described herein. Such a program implementing the present disclosure can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0169] It should be noted that the above embodiments illustrate rather than limit the present disclosure, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between brackets should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present disclosure may be implemented by means of hardware comprising several different elements and by means of appropriately programmed computers. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

[0170] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0171] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure should be included in the scope of protection of the present disclosure.

[0172] The above description is merely a specific embodiment of the present disclosure, but the scope of protection of the present disclosure is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this disclosure should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure should be based on the scope of protection of the claims.

Claims

1. A behavior prediction method, characterized in that: The method comprises: Acquire a user's historical behavior sequence and a target object, wherein the historical behavior sequence includes at least one historical object; Inputting the historical object and the target object into a behavior prediction model to obtain the probability that the user will perform a preset behavior on the target object at a future moment; In which, the behavior prediction model is pre-trained through multiple behavior sequence samples, and the behavior sequence samples include: labeled objects and corresponding labeling probabilities, at least two object samples with a time sequence, and the object samples include a first object subsample as a positive sample and a second object subsample as a negative sample. When training the behavior prediction model, a second vector is generated for the first object subsample, a third vector is generated for the second object subsample, and the second vector and the third vector are weighted to generate the first vector of the object sample. The loss value during training includes the loss value determined based on the first vector at the first moment, the second vector at the second moment, and the third vector at the second moment, and the first moment is earlier than the second moment.

2. The method according to claim 1, characterized in that The behavior prediction model includes: an Embedding layer, a Transformer layer, and an MLP layer; when training the behavior prediction model, the object sample is input into the Embedding layer, the output of the Embedding layer is input into the Transformer layer, and the output of the Transformer layer is input into the MLP layer. The loss value of the behavior prediction model during training is determined based on a first loss value and a second loss value. The first loss value is determined based on a first vector corresponding to the object sample at the first moment output by the Transformer layer, a second vector corresponding to the first object subsample at the second moment output by the Embedding layer, and a third vector corresponding to the second object subsample at the second moment output by the Embedding layer. The second loss value is determined based on the labeling probability of the labeled object and the predicted probability of the labeled object output by the MLP layer.

3. The method according to claim 2, characterized in that The first loss value is determined by the following steps: Determine a positive sample sub-loss value of the object sample according to a first vector corresponding to the object sample at a first moment output by the Transformer layer and a second vector corresponding to the first object sub-sample at a second moment output by the Embedding layer; Determine a negative sample sub-loss value of the object sample according to a first vector corresponding to the object sample at a first moment output by the Transformer layer and a third vector corresponding to the second object sub-sample at a second moment output by the Embedding layer; A first loss value is determined according to the positive sample sub-loss value and the negative sample sub-loss value.

4. The method according to claim 2 or 3, characterized in that The method further comprises: generating a position vector of the historical object according to position information of the historical object in the historical behavior sequence; Determine a fifth vector of the historical object according to the position vector and a fourth vector of the historical object output by the Embedding layer; The fifth vector of the history object is input to the Transformer layer.

5. The method according to claim 2 or 3, characterized in that The method further comprises: generating a time vector of the historical object according to a time interval between the historical object and a previous historical object; Determine a sixth vector of the history object according to the time vector and the fourth vector of the history object output by the Embedding layer; The sixth vector of the history object is input to the Transformer layer.

6. The method according to claim 2, characterized in that The first object subsample and the second object subsample are both input to the Embedding layer, and a vector generated according to the output of the Embedding layer for the first object subsample and the output of the second object subsample is input to the Transformer layer.

7. The method according to claim 2, characterized in that The Transformer layer includes: at least one Transformer unit, and the Transformer unit includes: an Attention layer, a feedforward network layer, a first stacking and normalization layer, and a second stacking and normalization layer. The input of the Attention layer is the input of the Transformer unit, the input of the Transformer unit and the output of the Attention layer are input to the first stacking and normalization layer, the output of the first stacking and normalization layer is input to the feedforward network layer, the output of the feedforward network layer is input to the second stacking and normalization layer, and the output of the second stacking and normalization layer is used as the output of the Transformer unit.

8. The method according to claim 2, characterized in that The loss value is determined by the following steps: Calculating the product of a preset adjustment coefficient and the first loss value to obtain an adjusted loss value; The sum of the product and the second loss value is calculated to obtain the loss value.

9. A behavior prediction device, characterized in that: The device comprises: An object information acquisition module, configured to acquire a user's historical behavior sequence and a target object, wherein the historical behavior sequence includes at least one historical object; A behavior prediction module, configured to input the historical object and the target object into a behavior prediction model to obtain a probability that the user will perform a preset behavior on the target object at a future moment; In which, the behavior prediction model is pre-trained through multiple behavior sequence samples, and the behavior sequence samples include: labeled objects and corresponding labeling probabilities, at least two object samples with a time sequence, and the object samples include a first object subsample as a positive sample and a second object subsample as a negative sample. When training the behavior prediction model, a second vector is generated for the first object subsample, a third vector is generated for the second object subsample, and the second vector and the third vector are weighted to generate the first vector of the object sample. The loss value during training includes the loss value determined based on the first vector at the first moment, the second vector at the second moment, and the third vector at the second moment, and the first moment is earlier than the second moment.

10. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the behavior prediction method according to any one of claims 1 to 8 is implemented.

11. A readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the behavior prediction method according to any one of method claims 1 to 8.

Citation Information

Patent Citations

  • Information pushing method, device and system

    CN108205766A

  • Click rate prediction method, click rate determination method and server

    CN110020877A