Training method and device for behavior prediction system
By organizing historical behavior data into a sparse matrix and utilizing attention networks and prediction networks, the problems of insufficient accuracy and waste of computing resources in user behavior prediction in existing technologies are solved, and more efficient user behavior prediction is achieved.
Patent Information
- Application Number
- CN202211174369.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-26
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2042-09-26
AI Technical Summary
Existing user behavior prediction methods are relatively simple and cannot meet the growing needs of practical applications. In addition, sequence models have problems of information loss and waste of computing resources when processing long sequences.
The historical behavior data is organized into a sparse matrix form, and the sparse matrix is processed using the attention network and prediction network, and the prediction accuracy is improved through the correlation and attention weight.
While reducing storage space and computational complexity, the accuracy of user behavior prediction is significantly improved.
Smart Images

Figure CN115438787B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of this specification relate to the field of machine learning technology, and more particularly, to a training method and apparatus for a behavior prediction system. Background Art
[0002] With the development of technology and social progress, more and more service platforms have emerged, providing users with a wide range of services to meet their diverse needs in life and work. To achieve personalized services for each individual, many service platforms use machine learning to predict user behavior and then customize service plans based on the predicted results. For example, video platforms can predict the probability of a user clicking on various videos to determine the categories and order of video streams pushed to users. Another example is shopping platforms that can predict a user's preference for a particular product to determine whether to recommend the product to the user.
[0003] Obviously, we want to predict user behavior as accurately as possible. However, current methods for predicting user behavior are relatively simple and fail to meet the growing demand for practical applications. Therefore, we need to propose a solution that can effectively improve the accuracy of user behavior prediction results, thereby better serving users and effectively improving the user experience. Summary of the Invention
[0004] One or more embodiments of this specification describe a training method and apparatus for a behavior prediction system, which can better learn user interests and thereby effectively improve the accuracy of prediction results for user behavior.
[0005] According to a first aspect, a method for training a behavior prediction system is provided, comprising: obtaining a first training sample, comprising several historical objects in which a first user performs a predetermined behavior, and statistical behavioral features for each of the historical objects, and also comprising a target object, and a behavior label indicating whether the first user performs the predetermined behavior on the target object after the several historical objects. The first training sample is input into a behavior prediction system comprising an attention network and a prediction network; wherein the attention network is used to determine a first correlation between the various historical objects and the target object, and a second correlation between the various historical objects and their corresponding statistical behavioral features, and based on the first correlation and the second correlation, the attention weight corresponding to the various historical objects is determined; the prediction network is used to process the target object, the various historical objects, and their corresponding attention weights to obtain a behavior prediction result. The behavior prediction system is trained based on the behavior prediction result and the behavior label.
[0006] In one embodiment, the first training sample includes a historical behavior matrix, wherein a first dimension of the historical behavior matrix corresponds to an object identifier, and a second dimension corresponds to a statistical behavior feature.
[0007] In one embodiment, obtaining the first training sample includes: obtaining multiple behavior records of the first user performing the predetermined behavior multiple times; and performing statistical processing on the multiple behavior records to obtain the multiple historical objects involved therein and the statistical behavior features.
[0008] In one embodiment, the behavior prediction system also includes an embedding layer, and the method also includes: using the embedding layer to process the identification of each object in the first training sample to obtain a corresponding embedding vector; wherein, determining the first degree of association between the each historical object and the target object includes: calculating the first similarity between the embedding vector of each historical object and the embedding vector of the target object as the first degree of association.
[0009] In one embodiment, the behavior prediction system further includes an object coding layer and a feature coding layer, and the method further includes: using the object coding layer to process the embedding vectors of each historical object to obtain a corresponding object coding vector; using the feature coding layer to process the statistical behavior features to obtain a corresponding feature coding vector; wherein, determining the second correlation between each historical object and its corresponding statistical behavior feature includes: calculating a second similarity between the object coding vector and the feature coding vector as the second correlation.
[0010] In a specific embodiment, the statistical behavior feature includes multiple statistical features corresponding to multiple statistical items, and the feature coding layer includes multiple feature coding layers corresponding to the multiple statistical items; wherein, using the feature coding layer to process the statistical behavior feature to obtain a corresponding feature coding vector includes: using the multiple feature coding layers to process the multiple statistical features to obtain multiple feature coding vectors; wherein, calculating the second similarity between the object coding vector and the feature coding vector as the second association degree includes: respectively calculating multiple second similarities between the object coding vector and the multiple feature coding vectors as multiple second association degrees.
[0011] In a specific embodiment, the statistical behavior feature includes at least one of the following: number of behaviors, behavior time period, and object category.
[0012] In one embodiment, the statistical behavior features include behavior periods, and the prediction network includes a period interest representation layer, a period interest interaction layer and a prediction layer; wherein, the prediction network is used to process the target object, the various historical objects and their corresponding attention weights to obtain a behavior prediction result, including: using the period interest representation layer, for historical objects with the same behavior period, using their corresponding attention weights to perform weighted summation on their corresponding embedding vectors to obtain the period interest representation vector under the behavior period; using the period interest interaction layer, processing the period interest representation vectors under each behavior period to obtain a first comprehensive interest representation vector; using the prediction layer, processing the first comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result.
[0013] In a specific embodiment, obtaining the behavior time period includes: for each historical object, obtaining several behavior moments in which the first user performs the predetermined behavior on the object several times within a predetermined time period; determining the duration sub-interval to which the last behavior moment among the several behavior moments belongs in the predetermined time period, and taking the interval number of the duration sub-interval as the corresponding behavior time period, and classifying it into the statistical behavior feature.
[0014] In a specific embodiment, the time period interest interaction layer is implemented as a timing network, wherein the time period interest interaction layer is used to process the time period interest representation vectors under each behavior time period to obtain a first comprehensive interest representation vector, including: using the time period interest representation vectors under each behavior time period as inputs of the timing network in sequence to obtain the first comprehensive interest representation vector.
[0015] In a specific embodiment, the prediction layer is used to process the first comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result, including: using the prediction layer to fuse the first comprehensive interest representation vector and the embedding vector of the target object to obtain a fusion vector, and performing linear transformation and / or nonlinear transformation on the fusion vector to obtain the behavior prediction result.
[0016] In a more specific embodiment, the fusion process includes concatenation, summation, or bitwise multiplication.
[0017] In one embodiment, the statistical behavior features include object categories, and the prediction network includes a category interest representation layer, a category interest interaction layer and a prediction layer; wherein, the prediction network is used to process the target object, the historical objects and their corresponding attention weights to obtain a behavior prediction result, including: using the category interest representation layer, for historical objects with the same object category, using their corresponding attention weights to perform weighted summation on their corresponding embedding vectors to obtain a category interest representation vector under the object category; using the category interest interaction layer, processing the category interest representation vectors under each object category to obtain a second comprehensive interest representation vector; using the prediction layer, processing the second comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result.
[0018] In a specific embodiment, the prediction layer is used to process the second comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result, including: using the prediction layer to fuse the second comprehensive interest representation vector and the embedding vector of the target object to obtain a fusion vector, and performing linear transformation and / or nonlinear transformation on the fusion vector to obtain the behavior prediction result.
[0019] According to a second aspect, a training device for a behavior prediction system is provided, comprising: an acquisition unit configured to acquire a first training sample, comprising several historical objects in which a first user performs a predetermined behavior, and statistical behavioral features for each of the historical objects, and also comprising a target object, and a behavior label indicating whether the first user performs the predetermined behavior on the target object after the several historical objects; a processing unit configured to process the first training sample using a behavior prediction system including an attention network and a prediction network; the processing unit comprising the following subunits: a weight determination subunit configured to determine a first degree of association between the various historical objects and the target object using the attention network, and to determine a second degree of association between the various historical objects and their corresponding statistical behavioral features, and to determine an attention weight corresponding to the various historical objects based on the first and second degrees of association; a prediction subunit configured to process the target object, the various historical objects and their corresponding attention weights using the prediction network to obtain a behavior prediction result; and a training unit configured to train the behavior prediction system based on the behavior prediction result and the behavior label.
[0020] According to a third 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.
[0021] According to a fourth aspect, a computing device is provided, comprising 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 is implemented.
[0022] By using the method and device provided in the embodiments of this specification, the collected historical behavior data is not arranged into a behavior sequence in chronological order, but is organized into a sparse matrix form, thereby significantly reducing storage space and computational complexity while fully retaining effective information. Furthermore, the newly designed behavior prediction system is used to process the behavior data in sparse matrix form, thereby effectively improving the accuracy of user behavior prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] 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 paying any creative work.
[0024] Figure 1 A schematic diagram showing a comparison of behavioral data collection between active users and inactive users according to one embodiment is shown;
[0025] Figure 2 Show examples of behavior sequences;
[0026] Figure 3 shows behavioral data in sparse matrix form according to one embodiment;
[0027] Figure 4 A schematic diagram of a training architecture of a behavior prediction system according to one embodiment is shown;
[0028] Figure 5 A flowchart of a training method for a behavior prediction system according to one embodiment is shown;
[0029] Figure 6 A schematic structural diagram of a training device for a behavior prediction system according to one embodiment is shown. DETAILED DESCRIPTION
[0030] The following describes the solutions provided in this specification in conjunction with the accompanying drawings. It should be noted that, without requiring any creative effort, any embodiments obtained by reasonably combining the following embodiments fall within the scope of the embodiments described in this specification.
[0031] As mentioned above, current methods for predicting user behavior are relatively simple. In recent years, much work in the industry has focused on mining historical user behavior data through sequence methods. Although these models have achieved good results, analysis has revealed that two major problems still exist:
[0032] 1) From a modeling perspective, sequence models are limited in the length of data they can process. Sequence processing layers such as recurrent neural networks (RNNs) and long-short term memory (LSTMs) inherently struggle with long sequences. As a result, very long sequences are truncated, resulting in information loss. Furthermore, the model must process behavior sequences within a given maximum length (e.g., 200). However, the richness of sample information varies widely in practice, making it difficult to process very sparse samples (e.g., new or inactive users, who have less historical behavior data), resulting in a waste of storage and computational resources.
[0033] 2) Using a fixed-length sequence to represent behavioral data is irrational in terms of time span. In fact, the behavioral sequence patterns of active users are very different from those of inactive users. Figure 1 For inactive users, in order to obtain a fixed-length (10 behaviors in the figure) behavior sequence, most of the intercepted behavior data is from one year ago. For active users, the intercepted behavior data is from one week, and the behavior data from one week ago is discarded.
[0034] Based on the above observations and analysis, the inventors propose a solution to collect historical behavior data, which is not arranged in chronological order into behavior sequences (see Figure 2 ), but is organized into a sparse matrix form, for example, see Figure 3 , where o and u represent objects and users respectively, and the elements in the matrix are the cumulative times, thereby significantly reducing storage space and computational complexity while fully retaining effective information. Furthermore, a model structure for processing behavioral data in sparse matrix form is proposed, which effectively improves the accuracy of user behavior prediction results.
[0035] Figure 4 FIG. 1 shows a schematic diagram of a training architecture of a behavior prediction system according to an embodiment. Figure 4 As shown, first, obtain the training sample of organizing the historical behavior data into a historical behavior matrix, the row and column dimensions of the historical behavior matrix correspond to the identifier of the business object (denoted as Id i ) and the statistical behavior characteristics of historical objects (such as cumulative times, etc., recorded as f j ), Figure 4Where m and n are both positive integers, and are usually integers greater than 1; then, the training sample is input into the behavior prediction system 400, and the attention network 410 is used to determine the relationship between each historical object and the target object (denoted as Id t ), denoted as Or simply written as And the second correlation between each historical behavior object and each statistical feature is recorded as Or simply written as Based on the first correlation and the second correlation, the attention weight corresponding to each historical behavior object is determined, which is recorded as Or simply written as Thus, the target object ID is processed using the prediction network 420 t , each historical object ID i and its corresponding attention weight Get behavior prediction results Then, use the behavior to predict the results and the corresponding behavior label y to determine the training loss to update the model parameters in the behavior prediction system.
[0036] The following describes in detail the implementation steps of the above solution in conjunction with more embodiments.
[0037] Figure 5 The following is a flow chart showing a training method for a behavior prediction system according to an embodiment. The execution subject of the method can be any device, platform, server or equipment cluster with computing and processing capabilities. Figure 5 As shown, the method includes the following steps:
[0038] First, in step S510, a first training sample is obtained, which includes several historical objects in which the first user performs a predetermined behavior, and statistical behavioral features for each of the historical objects, and also includes a target object and a behavior label indicating whether the first user performs the predetermined behavior on the target object after the several historical objects.
[0039] It should be understood that the first training sample can refer to any training sample in the training sample set. In one embodiment, for a certain user, multiple behavioral records of the user performing predetermined behaviors before a certain historical moment are obtained, and the target object pushed to the user after the certain historical moment is obtained; further, the multiple behavioral records are statistically analyzed to obtain several (several in the text refers to one or more) historical objects involved therein, as well as the statistical behavioral features corresponding to each historical object. In addition, the behavioral label is determined based on the collected behavioral data of whether the user performs the predetermined behavior with respect to the target object, thereby constructing the corresponding training sample.
[0040] In a specific embodiment, multiple behavioral records of a user performing predetermined behaviors within a predetermined period of time (e.g., within one month, one year, etc.) before the aforementioned historical moment can be obtained. In this way, the temporal alignment of historical behaviors of different users can be achieved, thereby improving the availability of samples and the accuracy of subsequent predictions.
[0041] In a specific embodiment, the behavior label may be a binary label, for example, a label value of 1 indicates that a predetermined behavior is performed, and a label value of 0 indicates that a predetermined behavior is not performed.
[0042] On the other hand, in one embodiment, the aforementioned historical objects and target objects generally belong to the same type of business object, and the aforementioned predetermined behavior is adapted to the business object. For example, if the business object is an advertisement, the predetermined behavior may be a click operation; if the business object is a user, the predetermined behavior may be a follow operation or an unfollow operation; if the business object is a product, the predetermined behavior may be operations such as searching, browsing, adding to favorites, adding to a shopping cart, creating an order, and purchasing; if the business object is a video, the predetermined behavior may be a playback time that reaches a preset percentage of the total time; if the business object is an app, the predetermined behavior may be registration; if the business object is content information, the predetermined behavior may be a like, forward, etc.; if the business object is a public account, the predetermined behavior may be a subscription, follow, unsubscribe, etc.
[0043] In one embodiment, the statistical behavior features determined for each historical object may include one or more of the following: the cumulative number of times a predetermined behavior was performed, the behavior time period, the object category of the historical object, etc. In a specific embodiment, the number of behavior records corresponding to each historical object is determined as the corresponding cumulative number.
[0044] In a specific embodiment, the first training sample is constructed based on multiple behavior records collected within the above-mentioned predetermined time period, each behavior record includes the historical moment of performing the predetermined behavior, and the predetermined time period is pre-divided into multiple time periods (or time sub-intervals), for example, the predetermined time period is 1 year, and the multiple time periods are 12 months or 4 quarters; thus, for each historical object, the last historical moment of the last predetermined behavior for the historical object can be determined based on the above-mentioned multiple behavior records, and the time period to which this last historical moment belongs in the above-mentioned multiple time periods can be determined as the corresponding behavior time period. For example, the serial number of the time period can be used as the corresponding behavior time period.
[0045] In one specific embodiment, the historical object is a commodity, and the corresponding object category is a commodity category, such as electronic products, maternity and baby products, household products, daily consumables, etc. In another specific embodiment, the historical object is content information, and the corresponding object category may include technology, entertainment, sports, and society, etc.
[0046] In this way, by performing feature statistics and slight aggregation on the original behavior data, the redundancy in the original behavior data can be eliminated and the available behavior information can be effectively retained, thereby saving storage space and computing power, and effectively improving the accuracy of subsequent prediction results.
[0047] Furthermore, in one embodiment, the aforementioned several historical objects and statistical behavior features included in the first training sample are organized into a matrix form, wherein the row dimension in the matrix corresponds to the object identifier and the column dimension corresponds to the statistical behavior feature, or vice versa. For example, see Figure 1 The historical behavior matrix shown in , where the element in the i-th row and j-th column represents the i-th statistical behavior feature for the j-th historical object.
[0048] In another embodiment, the aforementioned historical objects and statistical behavior features included in the first training sample are organized into a key-vector format, which can be considered as an extension of the key-value format and is expressed as:
[0049] {b,v b :b∈B u} (1)
[0050] In formula (1), B u represents the historical object identification set (or index set) of the first user (or user u), v b represents a statistical feature vector formed by multiple statistical behavior features of the historical object b. For example, v b =[t b ,c b ,κ b ], where t b 、c b and κ b They represent the above behavior time period, cumulative number of times and object category respectively.
[0051] Based on this, for a batch of training samples used in a single training iteration, the key-vector form can be represented as a sparse matrix, where the non-zero elements x u,b Represents a triple (u,v,x u,b Similarly, we can use a three-dimensional tensor (U, B, X) to represent key-vector behavioral data, where U and B represent row and column index vectors, respectively, and X represents the matrix consisting of all statistical eigenvectors. This approach eliminates duplication and does not require padding, effectively saving computational and storage space.
[0052] After obtaining the first training sample, step S520 is executed to process the first training sample using the behavior prediction system, which specifically includes:
[0053] In step S521, the attention network in the behavior prediction system is used to determine the first correlation between each historical object and the target object, and to determine the second correlation between each historical object and its corresponding statistical behavior feature, and based on the first correlation and the second correlation, the attention weight corresponding to each historical object is determined.
[0054] It is understood that the behavior prediction system also includes an embedding layer for business objects, which is used to determine the object embedding vector, which is then used to calculate the first and second degrees of association. In one embodiment, before performing this step, the embedding layer can be used to process the identifiers of each of the multiple objects involved in the first training sample to obtain a corresponding embedding vector, where the multiple objects include several historical objects and the target object.
[0055] In another embodiment, the embedding layer is designed to include a first embedding layer and a second embedding layer. Based on this, before executing this step, the first embedding layer can be used to process the object identifiers of each historical object to obtain a corresponding embedding vector, and the second embedding layer can be used to process the object features of the target object to obtain an embedding vector for the target object. For example, the target object is a commodity, and its object features may include cost, origin, commodity category, target population, etc.
[0056] Based on the object embedding vectors obtained above, the first degree of association can be calculated. In this step, the first similarity between the embedding vectors of each historical object and the embedding vector of the target object can be calculated as the corresponding first degree of association. It is understood that the vector similarity calculation described herein can be implemented by calculating a dot product or cosine similarity, for example. In this way, the first degree of association can be calculated.
[0057] On the other hand, regarding the calculation of the second degree of association, in this step, a second similarity can be calculated based on the embedding vector of each historical object and the feature coding vector of the statistical behavior feature, as the aforementioned second degree of association. In a specific embodiment, the attention network also includes a feature coding layer, and accordingly, the feature coding layer can be used to process the statistical behavior feature to obtain a feature coding vector. It can be understood that the feature coding layer takes the statistical behavior feature as input, performs linear transformation processing using a parameter matrix, and / or performs nonlinear transformation processing using an activation function, thereby outputting a corresponding feature coding vector. In a more specific embodiment, the statistical behavior feature includes multiple statistical features corresponding to multiple statistical items, and the feature coding layer includes multiple feature coding layers corresponding to the multiple statistical items; thus, multiple feature coding layers are used to process the multiple statistical behavior features to obtain multiple feature coding vectors, and then a second similarity calculation is performed based on the embedding vector of each historical object and the multiple feature coding vectors, respectively, to obtain multiple second similarities as multiple second degrees of association.
[0058] In one specific embodiment, the feature encoding vector is designed to have the same dimension as the object embedding vector. In this case, the embedding vector and the feature encoding vector can be directly used to calculate the inter-vector similarity to obtain the corresponding second similarity. In another specific embodiment, the dimension of the embedding vector is greater than the dimension of the feature encoding vector. In this case, an object encoding layer can be introduced into the attention network. Thus, the object encoding layer is first used to reduce the dimension of the embedding vector to obtain the object encoding vector. The object encoding vector and the feature encoding vector are then used to calculate the inter-vector similarity to obtain the corresponding second similarity.
[0059] In this way, the second correlation degree can be calculated.
[0060] From this, we can obtain the first correlation between each historical object and the target object, as well as the second correlation between each historical object and each statistical behavior feature. Based on this, we can calculate the attention score for each historical object and then normalize the attention scores corresponding to several historical objects to obtain several attention weights.
[0061] For each historical object, multiple correlation calculation items are determined based on the first correlation and the second correlation involved, and then the attention score of the historical object is determined based on the multiple correlation calculation items. In one embodiment, the first correlation and the second correlation involved are included in the multiple correlation calculation items. In another embodiment, the first correlation and the second correlation involved are cross-multiplied, and the multiple product results are included in the multiple correlation calculation items; illustratively, the products between the first correlation involved and each second correlation involved are calculated respectively, and the products between a predetermined number (such as 2 or 3) of the second correlations involved are calculated.
[0062] In one embodiment, the above multiple correlation calculation items are summed and the summed result is used as the corresponding attention score. In another embodiment, the above multiple correlation calculation items can be input into the attention scoring layer set in the attention network to obtain the attention score of the historical object.
[0063] In this way, a number of attention scores corresponding to a number of historical objects can be obtained. Furthermore, in one embodiment, a softmax function can be used, or a simple ratio calculation method can be used to normalize the several attention scores to obtain a number of attention weights.
[0064] From the above, using the attention network in the behavior prediction system, we can obtain several attention weights corresponding to several historical objects in the first training sample.
[0065] Then, in step S522, the prediction network in the behavior prediction system processes the target object, each historical object, and its corresponding attention weights to obtain a behavior prediction result. It is understood that the behavior prediction result includes the predicted probability of the first user performing a predetermined behavior on the target object.
[0066] In one embodiment, a prediction network is used to process each historical object and its corresponding attention weight to obtain an interest representation vector for the first user, and a behavior prediction result is determined based on the interest representation vector and the embedding vector of the target object.
[0067] In one embodiment, for several historical objects, several embedding vectors thereof may be simply weighted summed using their several attention weights, and the obtained vector may be used as the interest representation vector of the first user.
[0068] In another embodiment, consider multi-dimensional segmentation and fusion of user interests to obtain vectors that can more richly and accurately represent user interests. Specifically, for a number of historical objects, the historical objects are first grouped according to statistical behavior characteristics. Historical objects in the same group have the same statistical behavior characteristics. It can be understood that when there are multiple statistical behavior characteristics, a certain feature can be selected from them to group a number of historical objects; then, for each group obtained by grouping, the corresponding embedding vectors are weighted summed using the attention weights of the historical objects therein to obtain the corresponding interest representation vector; then, based on the multiple interest representation vectors corresponding to the multiple groups, a fusion process is performed to obtain a comprehensive interest representation vector of the first user.
[0069] In a specific embodiment, the behavior time periods in the statistical behavior characteristics can be grouped, and accordingly, a time period interest representation layer, a time period interest interaction layer and a first prediction layer are set in the prediction network; based on this, this step may include: using the time period interest representation layer, for historical objects with the same behavior time period, using their corresponding attention weights to perform weighted summation on their corresponding embedding vectors to obtain the time period interest representation vector under the behavior time period; using the time period interest interaction layer, processing the time period interest representation vectors under each behavior time period to obtain a first comprehensive interest representation vector; using the first prediction layer, processing the first comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result.
[0070] Furthermore, in a more specific embodiment, the above-mentioned time period interest interaction layer is implemented as a time series network. Accordingly, the time period interest representation vectors under each behavior time period can be used as the input of the time series network in sequence to obtain a first comprehensive interest representation vector. For example, the time series network can be implemented using an RNN network, an LSTM network, a gated recurrent unit (GRU), etc. In another more specific embodiment, the above-mentioned time period interest interaction layer can be implemented as a multi-layer perceptron. In this way, a first comprehensive interest representation vector that integrates the user's interest information in different time periods can be obtained. For example, assuming that the user purchased apples and pears in two historical time periods in turn, then the first comprehensive interest representation vector, in addition to containing these two parts of information, also contains information that the user is interested in fruits such as apples and pears.
[0071] In a more specific embodiment, the prediction layer is used to fuse the first comprehensive interest representation vector and the embedding vector of the target object to obtain a fused vector, and the fused vector is linearly transformed and / or nonlinearly transformed to obtain a behavior prediction result. In one example, the fusion process includes concatenation, summation, or bitwise multiplication. In one example, the linear transformation and / or nonlinear transformation process can be implemented by deep neural networks (DNN).
[0072] In this way, a first comprehensive representation vector that integrates the user's interests at different time periods can be obtained, thereby effectively improving the accuracy of the prediction results.
[0073] In another specific embodiment, the objects can be grouped according to the object categories in the statistical behavior characteristics. Accordingly, a category interest representation layer, a category interest interaction layer and a second prediction layer are set in the prediction network. Based on this, this step may include: using the category interest representation layer, for historical objects with the same object category, using their corresponding attention weights to perform weighted summation on their corresponding embedding vectors to obtain the category interest representation vector under the object category; using the category interest interaction layer, processing the category interest representation vectors under each object category to obtain a second comprehensive interest representation vector; using the second prediction layer, processing the second comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result.
[0074] In a more specific embodiment, the above-mentioned category interest interaction layer can be implemented as a multi-layer perceptron, whose input is multiple category interest representation vectors under multiple object categories. The second comprehensive interest representation vector obtained thereby integrates the user's cross-preferences between different object categories.
[0075] In a more specific embodiment, the second prediction layer is used to fuse the second comprehensive interest representation vector and the target object's embedding vector to obtain a fused vector. The fused vector is then subjected to linear and / or nonlinear transformation to obtain a behavior prediction result. Exemplarily, the fusion process includes summing, concatenating, averaging, and bitwise multiplication.
[0076] According to one example, the prediction network includes the above-mentioned time period interest representation layer, time period interest interaction layer, category interest representation layer, and category interest interaction layer, as well as a prediction layer. In this case, the prediction layer can be used to fuse the first comprehensive interest representation vector, the second comprehensive interest representation vector, and the target object's embedding vector to obtain a fused vector, and the fused vector is subjected to linear and / or nonlinear transformation to obtain a behavior prediction result. Furthermore, the behavior prediction system also includes a user representation layer, whose input is the user characteristics of the first user (such as occupation, permanent residence, etc.) and whose output is a user representation vector. In this case, this user representation vector can also be used to participate in the above-mentioned fusion process to enrich the input and improve the accuracy of the behavior prediction results.
[0077] From the above, the behavior prediction system outputs a behavior prediction result. Subsequently, in step S530, the behavior prediction system is trained based on the behavior prediction result and the behavior label. Specifically, a training loss, such as a cross-entropy loss, can be calculated based on the behavior prediction result and the behavior label. Then, a training gradient is calculated based on the training loss. Based on this training gradient, backpropagation is used to update the network parameters in the behavior prediction system. It will be understood that these network parameters refer to optimizable parameters.
[0078] Based on the above, the behavior prediction system can be trained. Figure 5 The method described in [1] allows for multiple iterative updates of the behavior prediction system until convergence is achieved, such as when the fluctuation of the training loss on the validation set falls below a predetermined threshold or when a predetermined number of iterations is reached. This results in a trained behavior prediction system that can be applied to user behavior prediction in real-world scenarios.
[0079] In summary, by using the training method of the behavior prediction system disclosed in the embodiments of this specification, the collected historical behavior data is not arranged into a behavior sequence in chronological order, but is organized into the form of a sparse matrix, thereby greatly reducing the storage space and computational complexity while fully retaining effective information. Furthermore, the newly designed behavior prediction system is used to process the behavior data in the form of a sparse matrix, thereby effectively improving the accuracy of the user behavior prediction results.
[0080] Corresponding to the above-mentioned training method, the embodiments of this specification also disclose a training device. Figure 6 FIG. 1 shows a schematic diagram of the structure of a training device for a behavior prediction system according to an embodiment. Figure 6 As shown, the apparatus 600 includes:
[0081] The acquisition unit 610 is configured to acquire a first training sample, which includes several historical objects in which the first user performs a predetermined behavior, and statistical behavioral features for each of the historical objects, and also includes a target object and a behavior label indicating whether the first user performs the predetermined behavior on the target object after the several historical objects.
[0082] The processing unit 620 is configured to process the first training sample using a behavior prediction system including an attention network and a prediction network; the processing unit 620 includes the following sub-units: a weight determination sub-unit 621, configured to use the attention network to determine the first correlation between each historical object and the target object, and to determine the second correlation between each historical object and its corresponding statistical behavior feature, and based on the first correlation and the second correlation, determine the attention weight corresponding to each historical object; a prediction sub-unit 622, configured to use the prediction network to process the target object, each historical object and its corresponding attention weight to obtain a behavior prediction result.
[0083] The training unit 630 is configured to train the behavior prediction system according to the behavior prediction results and behavior labels.
[0084] In one embodiment, the first training sample includes a historical behavior matrix, wherein a first dimension of the historical behavior matrix corresponds to an object identifier, and a second dimension corresponds to a statistical behavior feature.
[0085] In one embodiment, the acquisition unit 610 is specifically configured to: acquire multiple behavior records of the first user performing the predetermined behavior multiple times; perform statistical processing on the multiple behavior records to obtain the several historical objects involved therein and the statistical behavior features.
[0086] In one embodiment, the behavior prediction system further includes an embedding layer, and the processing unit 620 further includes an embedding subunit 623, which is configured to use the embedding layer to process the identification of each object in the first training sample to obtain a corresponding embedding vector; the weight determination subunit 621 is specifically configured to: calculate the first similarity between the embedding vector of each historical object and the embedding vector of the target object as the first association degree.
[0087] In one embodiment, the behavior prediction system further includes an object coding layer and a feature coding layer, and the processing unit 620 further includes a coding subunit 624, which is configured to use the object coding layer to process the embedding vectors of each historical object to obtain a corresponding object coding vector; use the feature coding layer to process the statistical behavior features to obtain a corresponding feature coding vector; the weight determination subunit 621 is specifically configured to: calculate the second similarity between the object coding vector and the feature coding vector as the second correlation degree.
[0088] In a specific embodiment, the statistical behavior feature includes multiple statistical features corresponding to multiple statistical items, and the feature coding layer includes multiple feature coding layers corresponding to the multiple statistical items; the encoding subunit 624 is specifically configured to: use the multiple feature coding layers to process the multiple statistical features to obtain multiple feature coding vectors; the weight determination subunit 621 is specifically configured to: respectively calculate multiple second similarities between the object coding vector and the multiple feature coding vectors as multiple second correlation degrees.
[0089] In one embodiment, the statistical behavior feature includes at least one of the following: number of behaviors, behavior time period, and object category.
[0090] In one embodiment, the statistical behavior features include behavior periods, and the prediction network includes a period interest representation layer, a period interest interaction layer and a prediction layer; the prediction subunit 622 is specifically configured as follows: using the period interest representation layer, for historical objects with the same behavior period, using their corresponding attention weights to perform weighted summation on their corresponding embedding vectors to obtain the period interest representation vector under the behavior period; using the period interest interaction layer, processing the period interest representation vectors under each behavior period to obtain a first comprehensive interest representation vector; using the prediction layer, processing the first comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result.
[0091] In a specific embodiment, the acquisition unit 610 is further configured to: for each historical object, obtain several behavior moments in which the first user performs the predetermined behavior on it several times within a predetermined time period; determine the duration sub-interval to which the last behavior moment among the several behavior moments belongs in the predetermined time period, and use the interval number of the duration sub-interval as the corresponding behavior time period, and include it in the statistical behavior feature.
[0092] In a specific embodiment, the time period interest interaction layer is implemented as a temporal network, and the prediction subunit 622 is further configured to: use the time period interest representation vectors under the various behavior time periods as inputs of the temporal network in sequence to obtain the first comprehensive interest representation vector.
[0093] In a specific embodiment, the prediction sub-unit 622 is further configured to: utilize the prediction layer to fuse the first comprehensive interest representation vector and the embedding vector of the target object to obtain a fusion vector, and perform linear transformation and / or nonlinear transformation on the fusion vector to obtain the behavior prediction result.
[0094] In one example, the fusion process includes concatenation, summation, or bitwise multiplication.
[0095] In one embodiment, the statistical behavior features include object categories, and the prediction network includes a category interest representation layer, a category interest interaction layer and a prediction layer; the prediction subunit 622 is specifically configured as follows: using the category interest representation layer, for historical objects with the same object category, using their corresponding attention weights to perform weighted summation on their corresponding embedding vectors to obtain the category interest representation vector under the object category; using the category interest interaction layer, processing the category interest representation vectors under each object category to obtain a second comprehensive interest representation vector; using the prediction layer, processing the second comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result.
[0096] In a specific embodiment, the prediction sub-unit 622 is further configured to: utilize the prediction layer to fuse the second comprehensive interest representation vector and the embedding vector of the target object to obtain a fusion vector, and perform linear transformation and / or nonlinear transformation on the fusion vector to obtain the behavior prediction result.
[0097] 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 5 The method described.
[0098] According to another embodiment, 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 system realizes the combination of Figure 5 The method described.
[0099] Those skilled in the art will appreciate that, in one or more of the above examples, the functions described herein may be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions may be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0100] 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 replacements, 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, comprising: Obtaining a first training sample, which includes several historical objects in which a first user performs a predetermined behavior, as well as statistical behavior features for each of the historical objects, and also includes a target object and a behavior label indicating whether the first user performs the predetermined behavior on the target object after the several historical objects; the first training sample includes a historical behavior matrix, wherein a first dimension of the historical behavior matrix corresponds to an object identifier and a second dimension corresponds to the statistical behavior features; The first training sample is input into a behavior prediction system including an attention network and a prediction network; wherein, Determining, using the attention network, a first degree of association between each of the historical objects and a target object, and a second degree of association between each of the historical objects and its corresponding statistical behavior feature, and determining an attention weight corresponding to each of the historical objects based on the first and second degrees of association; Processing the target object, the historical objects, and their corresponding attention weights using the prediction network to obtain a behavior prediction result; The behavior prediction system is trained according to the behavior prediction results and the behavior labels.
2. The method according to claim 1, wherein Obtain the first training sample, including: Acquire multiple behavior records of the first user performing the predetermined behavior multiple times; Statistical processing is performed on the plurality of behavior records to obtain the several historical objects involved therein and the statistical behavior features.
3. The method according to claim 1, wherein The behavior prediction system further includes an embedding layer, and the method further includes: Processing the identifier of each object in the first training sample using the embedding layer to obtain a corresponding embedding vector; Determining the first degree of association between each of the historical objects and the target object includes: A first similarity between the embedding vectors of the respective historical objects and the embedding vector of the target object is calculated as the first association degree.
4. The method according to claim 1 or 3, wherein The behavior prediction system further includes an object coding layer and a feature coding layer, and the method further includes: Processing the embedding vectors of the respective historical objects using the object encoding layer to obtain corresponding object encoding vectors; Processing the statistical behavior features using the feature coding layer to obtain corresponding feature coding vectors; Determining the second correlation between each historical object and its corresponding statistical behavior feature includes: A second similarity between the object encoding vector and the feature encoding vector is calculated as the second association degree.
5. The method according to claim 4, wherein The statistical behavior feature includes multiple statistical features corresponding to multiple statistical items, and the feature coding layer includes multiple feature coding layers corresponding to the multiple statistical items; wherein the statistical behavior feature is processed by the feature coding layer to obtain a corresponding feature coding vector, including: Processing the plurality of statistical features correspondingly using the plurality of feature coding layers to obtain a plurality of feature coding vectors; Calculating the second similarity between the object encoding vector and the feature encoding vector as the second association degree includes: A plurality of second similarities between the object encoding vector and the plurality of feature encoding vectors are respectively calculated as a plurality of second association degrees.
6. The method according to any one of claims 1 to 3 and 5, wherein The statistical behavior feature includes at least one of the following: number of behaviors, behavior time period, and object category.
7. The method according to claim 1, wherein The statistical behavior features include behavior time periods, and the prediction network includes a time period interest representation layer, a time period interest interaction layer, and a prediction layer. The prediction network is used to process the target object, the historical objects, and their corresponding attention weights to obtain a behavior prediction result, including: Using the time period interest representation layer, for historical objects with the same behavior period, using their corresponding attention weights to perform weighted summation on their corresponding embedding vectors to obtain the time period interest representation vector under the behavior period; Using the time period interest interaction layer, processing the time period interest representation vectors under each behavior time period to obtain a first comprehensive interest representation vector; The prediction layer is used to process the first comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result.
8. The method according to claim 7, wherein: The acquisition of the behavior period includes: For each of the historical objects, obtaining a number of action moments at which the first user performs the predetermined action on the historical object a number of times within a predetermined time period; Determine the duration subinterval to which the last behavior moment among the plurality of behavior moments belongs in the predetermined duration, and use the interval sequence number of the duration subinterval as the corresponding behavior time period, and include it in the statistical behavior feature.
9. The method according to claim 7, wherein: The time period interest interaction layer is implemented as a temporal network, wherein the time period interest interaction layer is used to process the time period interest representation vectors under each behavior time period to obtain a first comprehensive interest representation vector, including: The time period interest representation vectors under the various behavior time periods are sequentially used as inputs of the temporal network to obtain the first comprehensive interest representation vector.
10. The method according to claim 7, wherein: Utilizing the prediction layer to process the first comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result includes: The prediction layer is used to fuse the first comprehensive interest representation vector and the embedding vector of the target object to obtain a fusion vector, and the fusion vector is linearly transformed and / or nonlinearly transformed to obtain the behavior prediction result.
11. The method according to claim 10, wherein: The fusion process includes concatenation, summation, or bitwise multiplication.
12. The method according to claim 1, wherein The statistical behavior features include object categories, and the prediction network includes a category interest representation layer, a category interest interaction layer, and a prediction layer. The prediction network is used to process the target object, the historical objects, and their corresponding attention weights to obtain a behavior prediction result, including: Using the category interest representation layer, for historical objects of the same object category, using their corresponding attention weights to perform weighted summation on their corresponding embedding vectors to obtain a category interest representation vector under the object category; Using the category interest interaction layer, processing the category interest representation vectors under each object category to obtain a second comprehensive interest representation vector; The prediction layer is used to process the second comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result.
13. The method according to claim 12, wherein: Utilizing the prediction layer to process the second comprehensive interest representation vector and the embedding vector of the target object to obtain the behavior prediction result includes: The prediction layer is used to fuse the second comprehensive interest representation vector and the embedding vector of the target object to obtain a fusion vector, and the fusion vector is linearly transformed and / or nonlinearly transformed to obtain the behavior prediction result.
14. A training device for a behavior prediction system, comprising: an acquisition unit configured to acquire a first training sample, comprising a plurality of historical objects in which a first user performs a predetermined behavior, and statistical behavior features for each of the historical objects, and a target object, and a behavior label indicating whether the first user performs the predetermined behavior on the target object after the plurality of historical objects; the first training sample comprises a historical behavior matrix, wherein a first dimension of the historical behavior matrix corresponds to an object identifier, and a second dimension corresponds to the statistical behavior features; A processing unit configured to process the first training sample using a behavior prediction system including an attention network and a prediction network; the processing unit includes the following subunits: a weight determination subunit configured to determine, using the attention network, a first degree of association between each of the historical objects and a target object, and a second degree of association between each of the historical objects and its corresponding statistical behavior feature, and determine an attention weight corresponding to each of the historical objects based on the first and second degrees of association; a prediction subunit, configured to use the prediction network to process the target object, the historical objects and their corresponding attention weights to obtain a behavior prediction result; A training unit is configured to train the behavior prediction system according to the behavior prediction results and behavior labels.
15. A computer-readable storage medium having a computer program stored thereon, wherein: 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 13.
16. A computing device comprising a memory and a processor, wherein: The memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 13 is implemented.
Citation Information
Patent Citations
Object recommendation method and device and computer storage medium
CN111046286A
Training method and device of behavior prediction system
CN114692972A