Method and device for processing user behavior sequence
By using a neural network model with two sub-models with the same network structure and parameters, and using a contrastive learning method to process user behavior sequences, it solves the problems of low efficiency and lack of labels in the existing technology, achieves efficient generation of feature vectors, and improves user experience. The ability to analyze behavioral sequences.
Patent Information
- Application Number
- CN202111283645.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-01
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-11-01
AI Technical Summary
When processing user behavior sequences, the existing technology requires manual feature engineering and label supervised learning, resulting in low efficiency and reliance on manual experience. In many business scenarios, it is difficult to effectively process due to the lack of labels.
Use a neural network model with two sub-models with the same network structure and network parameters, train through contrastive learning methods, generate feature vectors that do not depend on business labels, use data enhancement to generate positive sample pairs and negative sample pairs, and update the neural network model to minimize Minimize the distance between pairs of positive samples and maximize the distance between pairs of negative samples.
It achieves efficient processing of user behavior sequences, generates representative feature vectors, reduces dependence on manual annotation, improves the generalization and training efficiency of the model, and can accurately understand user habits and preferences.
Smart Images

Figure CN114090401B
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of machine learning, and more particularly, to a method and apparatus for processing user behavior sequences. Background Art
[0002] In many scenarios, user behavior sequences need to be analyzed and processed. User behavior sequences are a series of events such as clicks, visits, and purchases generated by users in daily operations. They can be represented as a time series of event sets. They contain the characteristics of users' fine-grained habits and preferences, and are one of the important feature sources of user-level machine learning models. However, the behavior sequence data itself is a variable time series with a huge representation space. To extract fixed-dimensional, representative, and usable feature vectors for classification and regression, it needs to be processed. Generally speaking, the process of processing user behavior sequences into feature vectors often uses artificial feature engineering or label-based supervised learning in specific scenarios. It is understandable that artificial feature engineering consumes a lot of manpower and time, and the effect is heavily dependent on manual business experience and efficiency. The supervised learning method requires obtaining well-labeled labels in specific business scenarios. For example, if you want to analyze whether a user account is stolen based on the user behavior sequence, you need a large number of sample behavior sequences and labels indicating whether the users corresponding to these sample behavior sequences are actually stolen accounts. In many business scenarios, labels are often lacking due to the difficulty in obtaining them, making it difficult to conduct supervised learning.
[0003] Therefore, it is hoped that there will be an improved solution to more effectively process the user behavior sequence to obtain a feature vector suitable for subsequent analysis. Summary of the invention
[0004] One or more embodiments of the present specification describe a method and apparatus for processing user behavior sequences, wherein a neural network model including two identical sub-models is used to process user behavior sequences into feature vectors. The neural network model is trained based on a contrastive learning method and is independent of business labels, thereby enabling efficient processing of user behavior sequences.
[0005] In a first aspect, a method for processing a user behavior sequence is provided, comprising:
[0006] Obtain the user behavior sequences of N sample users;
[0007] Performing data enhancement on each user behavior sequence respectively to obtain a training sample set; the training sample set includes a plurality of positive sample pairs and a plurality of negative sample pairs; each of the positive sample pairs includes at least two subsequences obtained by splitting the same user behavior sequence according to different services; each of the negative sample pairs includes at least two subsequences from different user behavior sequences among a plurality of subsequences obtained by splitting at least two user behavior sequences according to different services;
[0008] Inputting each positive sample pair and each negative sample pair into a neural network model, wherein the neural network model includes two sub-models with the same network structure and network parameters, and is used to process two sub-sequences in the input sample pair to obtain respective corresponding behavior vectors;
[0009] For any positive sample pair or negative sample pair, the corresponding distance is calculated according to the behavior vectors corresponding to the two subsequences;
[0010] With the goal of minimizing the distance between the two subsequences in each positive sample pair and maximizing the distance between the two subsequences in each negative sample pair, the neural network model is updated to process the user behavior sequence to be analyzed.
[0011] In a second aspect, a device for processing a user behavior sequence is provided, comprising:
[0012] An acquisition unit, used to acquire user behavior sequences of N sample users;
[0013] An enhancement unit is used to perform data enhancement on each user behavior sequence to obtain a training sample set; the training sample set includes a plurality of positive sample pairs and a plurality of negative sample pairs; each positive sample pair includes at least two subsequences obtained by splitting the same user behavior sequence according to different services; each negative sample pair includes at least two subsequences from different user behavior sequences among a plurality of subsequences obtained by splitting at least two user behavior sequences according to different services;
[0014] An input unit, used for inputting each positive sample pair and each negative sample pair into a neural network model, wherein the neural network model includes two sub-models with the same network structure and network parameters, and is used for processing two sub-sequences in the input sample pair to obtain respective corresponding behavior vectors;
[0015] A calculation unit, for calculating the corresponding distance for any positive sample pair or negative sample pair according to the behavior vectors corresponding to the two subsequences therein;
[0016] An updating unit is used to update the neural network model with the goal of minimizing the distance between the two subsequences in each positive sample pair and maximizing the distance between the two subsequences in each negative sample pair, so as to process the user behavior sequence to be analyzed.
[0017] According to a third aspect, a computer 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.
[0018] According to a fourth aspect, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method of the first aspect is implemented.
[0019] The method and device for processing user behavior sequences provided in one or more embodiments of this specification, in order to effectively process user behavior sequences into feature vectors, designs a neural network model including two sub-models with the same network structure and network parameters, and trains the neural network model based on the contrastive learning method. The contrastive learning method does not depend on the task business scenario, so the trained neural network model has good generalization. In addition, the contrastive learning method does not require manual labeling, which can greatly improve the training efficiency of the neural network model. The trained neural network model can be used to convert the user behavior sequence to be processed into a representative feature vector. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0021] Figure 1 A schematic diagram of an implementation scenario of an embodiment disclosed in this specification;
[0022] Figure 2 A schematic diagram showing the structure of a neural network model in one embodiment is shown;
[0023] Figure 3 A flowchart of a method for training a neural network model according to one embodiment is shown;
[0024] Figure 4a A schematic diagram showing data enhancement according to one embodiment;
[0025] Figure 4b A schematic diagram showing data enhancement according to another embodiment;
[0026] Figure 4c A schematic diagram showing data enhancement according to yet another embodiment;
[0027] Figure 5 A flowchart of a neural network model fine-tuning method provided in one embodiment of this specification;
[0028] Figure 6 A schematic diagram of a device for processing a user behavior sequence according to an embodiment is shown. DETAILED DESCRIPTION
[0029] The solution provided in this specification is described below in conjunction with the accompanying drawings.
[0030] In most cases, service platforms usually provide users with a variety of services in different scenarios (such as life payment, catering, social networking, financial management, charity, etc.). In the process of users using these services, the service platform can collect user behavior sequences. These behavior sequences usually contain characteristics such as users' fine-grained habits and preferences. Therefore, understanding the user habits and preferences behind user behavior will help to better serve users. In other words, a deeper understanding of user behavior will help user behavior better feed back to the users themselves.
[0031] Currently, language models based on contextual content understanding are used to process user behavior. The core idea is to compare user behavior sequences with text sequence content and use neural network models to perform high-dimensional abstraction of user behavior. The process is simple and well-founded. However, as the complexity of existing businesses increases, the coupled structure of behavior sequences in multiple scenarios cannot fully characterize the users behind the behaviors.
[0032] To this end, the inventor of the present application proposes that a plurality of positive sample pairs and a plurality of negative sample pairs can be first constructed, and then a neural network model for processing user behavior sequences can be trained based on a contrastive learning method.
[0033] Through the solution provided in this specification, even for a user behavior sequence mixed with noise, the user's habitual preferences behind the behavior can be accurately understood. The solution is generally described below.
[0034] Figure 1 This is a schematic diagram of an implementation scenario of an embodiment disclosed in this specification. Figure 1 As shown, in the embodiment of this specification, a neural network model is constructed to convert user behavior sequences <X 1 , X 2 , …, X N>Converted into a feature vector S. The neural network model includes two sub-models with the same network structure and network parameters, which are used to process the two sub-sequences extracted from the user behavior sequence to obtain the corresponding behavior vectors. It should be understood that the above feature vector S can be obtained by integrating the two behavior vectors. The specific structure and processing process of the neural network model here will be described in detail later.
[0035] It should be noted that the above neural network model needs to be trained to obtain the ideal feature vector S. The training process is described below.
[0036] Specifically, user behavior sequences of multiple sample users may be collected and data enhancement may be performed on them to obtain a training sample set. The training sample set here includes multiple positive sample pairs and multiple negative sample pairs, wherein the positive sample pair includes at least two subsequences obtained by splitting the same user behavior sequence according to different services. The negative sample pair includes at least two subsequences from different user behavior sequences among several subsequences obtained by splitting at least two user behavior sequences according to different services;
[0037] Then, the neural network model is trained based on the training sample set. Specifically, for any positive sample pair or negative sample pair, the two subsequences therein are respectively input into the two sub-models of the neural network model, and the corresponding behavior vectors are respectively output through the two sub-models. According to the two behavior vectors, the distance between the two sub-sequences in the positive sample pair or negative sample pair is calculated. Finally, with the goal of minimizing the distance between the two sub-sequences in each positive sample pair and maximizing the distance between the two sub-sequences in each negative sample pair, the neural network model is updated to achieve its parameter adjustment and training.
[0038] In the above process, the neural network model is trained based on the contrastive learning method to obtain the feature vector of the user behavior sequence. This process does not require the intervention of artificial feature engineering. In addition, it can be seen that the contrastive learning method does not depend on the task business scenario, so the trained neural network model has good generalization. In addition, the contrastive learning method does not require manual labeling, which can greatly improve the training efficiency of the neural network model. The trained neural network model can be used to convert the user behavior sequence to be processed into a representative feature vector.
[0039] The above is a general description of this solution, which will be described in detail below.
[0040] First, the composition and processing of the neural network model are described.
[0041] Figure 2 A schematic diagram of the structure of a neural network model in one embodiment is shown. Figure 2As shown, the neural network model for processing user behavior sequences includes two sub-models with the same network structure and network parameters, which are used to process two sub-sequences received respectively (i.e., sub-sequences extracted from user behavior sequences). Each sub-model here can include an embedding layer and an attention layer, wherein in the embedding layer of any first sub-model, multiple embedding vectors are obtained according to the behavioral characteristics and position encoding of each behavior in the received sub-sequence. In the attention layer of the first sub-model, different weights are applied to the multiple embedding vectors to obtain corresponding behavior vectors. Finally, by integrating the behavior vectors V1 and V2 output by the two sub-models, the final output feature vector S can be obtained.
[0042] Combination of the above Figure 2 Describes the user behavior sequence <X 1 , X 2 , …, X N >The process of converting to feature vector S. In the process of obtaining the above feature vector, a large number of parameters are involved in the neural network model, such as the embedding matrix of the embedding layer, the linear transformation matrix of the attention layer, etc. These parameters need to be determined through training.
[0043] The following describes Figure 2 The process of training a neural network model.
[0044] Figure 3 FIG. 1 is a flow chart of a method for training a neural network model according to an embodiment. It is understood that the method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities. Figure 3 As shown, the training process includes at least the following steps.
[0045] Step 302: Obtain the user behavior sequences of N sample users.
[0046] Each user behavior sequence includes m user behaviors that are arranged in time order and are executed in sequence by the corresponding sample users, wherein the time intervals between the m user behaviors are less than a predetermined time interval (eg, 15 minutes).
[0047] It should be noted that in practical applications, the number of user behavior sequences corresponding to each sample user is usually one or more. In this specification, for simplicity, a corresponding user behavior sequence will be obtained for each sample user. That is, in the following description of this specification, there is a one-to-one correspondence between sample users and user behavior sequences.
[0048] Step 304: perform data enhancement on each user behavior sequence to obtain a training sample set.
[0049] The training sample set here includes multiple positive sample pairs and multiple negative sample pairs.
[0050] In one example, each positive sample pair includes at least two subsequences obtained by splitting the same user behavior sequence according to different services. Each negative sample pair includes at least two subsequences from different user behavior sequences among a plurality of subsequences obtained by splitting at least two user behavior sequences according to different services.
[0051] Figure 4a FIG. 2 is a schematic diagram showing data enhancement according to an embodiment. Figure 4a As shown, the user behavior sequence includes 8 user behaviors that are arranged in chronological order and performed by the user in sequence, where each user behavior is shown by a box. Now assume that the 1st and 5-8th user behaviors correspond to the first business (e.g., purchasing funds), and the 2nd to 4th user behaviors correspond to the second business (e.g., Huabei repayment). Then when the user behavior sequence is split according to different businesses, two subsequences can be obtained, one of which is composed of the 1st and 5-8th user behaviors, and the other is composed of the 2nd to 4th user behaviors.
[0052] It should be understood that when the user behavior sequence also includes user behavior corresponding to a third service, it can be split to obtain another subsequence.
[0053] It should be noted that in the same user behavior sequence, user behaviors of multiple businesses are usually coupled. These user behaviors are independent of each other but intertwined. Therefore, through the above data enhancement method, user behaviors in the same user behavior sequence can be decoupled, and then the user's interest preferences in different scenarios can be captured. That is, through this behavior sequence data enhancement method, the trained model can learn business relevance.
[0054] In the following example, Figure 4a After the data enhancement shown, or after splitting each user behavior sequence according to different services, a positive sample pair can be formed based on two subsequences from the same user behavior sequence (ie, the same user), and a negative sample pair can be formed based on two subsequences from different user behavior sequences (ie, different users).
[0055] In another example, the positive sample pair may also include two subsequences obtained by equally dividing the same user behavior sequence. Each negative sample pair also includes two subsequences from different user behavior sequences among several subsequences obtained by equally dividing at least two user behavior sequences.
[0056] Figure 4b FIG. 2 shows a schematic diagram of performing data enhancement according to another embodiment. Figure 4b As shown, the user behavior sequence includes 8 user behaviors that are arranged in chronological order and performed by the user in sequence, wherein each user behavior is shown by a box. In one example, after the user behavior sequence is divided equally, that is, after the user behavior sequence is divided according to the position shown by the dotted line, a subsequence can be formed based on the first 4 user behaviors, and another subsequence can be formed based on the last 4 user behaviors.
[0057] It should be understood that Figure 4b This is just an exemplary description. In actual applications, the user behavior sequence can also be split by randomly determining the split position. For example, the first three user behaviors are taken as a subsequence, and the last five user behaviors are taken as another subsequence. Alternatively, only a part of the user behaviors in the user behavior sequence can be obtained. For example, the 2nd to 3rd user behaviors are taken as a subsequence, and the 4th to 7th user behaviors are taken as another subsequence, and so on. This specification does not limit this.
[0058] The inventor believes that the behaviors of each user in the same behavior sequence have potential consistency. The reason is that although the same user performs different operations at different times, the essence behind it is his similar capital liquidity, income expectations and personality preferences. These attributes cannot be changed in the short term, and some will even accompany the user for life. Based on this, the inventor designed the above data enhancement method.
[0059] It should be understood that when two subsequences come from the same user behavior sequence (i.e., the same user), they can exist as a positive sample pair because they are similar. Conversely, two subsequences from different user behavior sequences (i.e., different users) are used as negative sample pairs. Through this method of forming behavior sequences, the trained model can learn the monetary liquidity, income expectations, and personality preferences behind each user.
[0060] In another example, the positive sample pair may also include two subsequences obtained by randomly masking the same user behavior sequence twice. Each negative sample pair also includes two subsequences from different user behavior sequences among several subsequences obtained by randomly masking at least two user behavior sequences several times.
[0061] Figure 4c A schematic diagram showing data enhancement according to yet another embodiment. Figure 4cIn the example, the user behavior sequence includes 8 user behaviors that are arranged in time order and performed by the user in sequence, wherein each user behavior is represented by a box. In one example, assume that random masking is performed twice on the user behavior sequence, wherein the user behaviors at positions 2, 4, 5, and 7 are masked for the first time to obtain a subsequence, and the user behaviors at positions 1, 3, 5, and 6 are masked for the second time to obtain another subsequence.
[0062] It should be understood that when random masking is performed on the user behavior sequence once more, another subsequence can be obtained.
[0063] In the following example, Figure 4c After the data augmentation shown, or after performing at least two random masking operations on each user behavior sequence, a positive sample pair can be formed based on two subsequences from the same user behavior sequence (i.e., the same user), and a negative sample pair can be formed based on two subsequences from different user behavior sequences (i.e., different users).
[0064] It should be noted that users often generate some meaningless or abnormal clicks. Therefore, it is necessary to find a solution that can solve these noises without stability factors. According to research, the masking method can improve the robustness of the model. Therefore, this solution will enhance the user behavior sequence based on the masking method.
[0065] In summary, the method of obtaining a training sample set by performing data enhancement on a user behavior sequence in the embodiments of this specification can facilitate the understanding and insight into the behaviors of different users in different scenarios. Furthermore, based on the training sample set obtained through data enhancement, the trained model can perform tasks such as search or recommendation more accurately, which can greatly improve the user experience.
[0066] Step 306: Input each positive sample pair and each negative sample pair into the neural network model.
[0067] The neural network model includes two sub-models with the same network structure and network parameters, which are used to process two sub-sequences in the input sample pair to obtain the corresponding behavior vectors.
[0068] In one example, the two sub-models mentioned above can both be BERT models.
[0069] In another example, the above two sub-models can both be Transformer encoders.
[0070] Taking the Transformer encoder as an example, it may include an embedding layer and an attention layer. The above processing of the two subsequences in the input sample pair may specifically include: for the first sequence in the input sample pair, in the embedding layer of the corresponding first sub-model, multiple embedding vectors are obtained according to the behavioral characteristics and position encoding of each behavior in the first sequence. In the attention layer of the corresponding first sub-model, different weights are applied to the multiple embedding vectors to obtain the corresponding behavior vector.
[0071] Step 308: For any positive sample pair or negative sample pair, the corresponding distance is calculated according to the behavior vectors corresponding to the two subsequences therein.
[0072] The distance here may include but is not limited to any of the following: cosine similarity, Euclidean distance, Manhattan distance, Pearson correlation coefficient, etc.
[0073] Step 310, with the goal of minimizing the distance between two subsequences in each positive sample pair and maximizing the distance between two subsequences in each negative sample pair, updates the neural network model for processing the user behavior sequence to be analyzed.
[0074] Specifically, the prediction loss may be determined based on the distance between two subsequences in each positive sample pair, the distance between two subsequences in each negative sample pair, and the contrast loss function, and then the neural network model is updated based on the prediction loss.
[0075] In an example, the above contrast loss function can be as follows:
[0076] (Formula 1)
[0077] Among them, i is the i-th sample pair, and are the two subsequences in the i-th sample pair, W is the model parameter, is the distance between the two subsequences in the i-th sample pair, L D () and L S () are all functions about distance, and Y is an identifier. Specifically, if the i-th sample pair is a positive sample pair, then Y=0, otherwise Y=1.
[0078] In a specific example, , In this example, the contrast loss function L specifically means: for a positive sample pair, the distance between the two subsequences is minimized; for a negative sample pair, if the distance between the two subsequences is less than the maximum threshold distance m, the distance is increased, otherwise no optimization is performed.
[0079] At this point, a neural network model for processing user behavior sequences has been trained. The processing of user behavior sequences based on the neural network model can be the same as described above, and this specification will not repeat it here.
[0080] In summary, the solution provided in the embodiments of this specification, in order to effectively process user behavior sequences into feature vectors, designs a neural network model that includes two sub-models with the same network structure and network parameters, and trains the neural network model based on the contrastive learning method. The contrastive learning method does not depend on the task business scenario, so the trained neural network model has good generalization. In addition, the contrastive learning method does not require manual labeling, which can greatly improve the training efficiency of the neural network model. The trained neural network model can be used to convert the user behavior sequence to be processed into a representative feature vector.
[0081] It should be noted that the user subject is hidden behind the user behavior. Directly imitating the method of processing text in the natural language model to process the user behavior sequence ignores the existence of the user behind it. Therefore, this solution is based on the contrastive learning method to distinguish the user behavior sequence from the user granularity.
[0082] In addition, after fine-tuning the neural network model trained by the embodiments of this specification in combination with a specific prediction task, downstream task prediction can be performed quickly and effectively. The fine-tuning process is described below.
[0083] Figure 5 This is a flowchart of a neural network model fine-tuning method provided in one embodiment of this specification. It can be understood that the method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities. Figure 5 As shown, the fine-tuning method includes at least the following steps.
[0084] Step 502: Obtain the target behavior sequence of the target user.
[0085] The target behavior sequence here may include m user behaviors that are arranged in chronological order and are sequentially performed by the corresponding sample users, wherein the time intervals between the m user behaviors are less than a predetermined time interval (eg, 15 minutes).
[0086] Step 504, split the target behavior sequence to obtain two sub-target sequences.
[0087] In one example, the target behavior sequence may be split according to different businesses to obtain two sub-target sequences.
[0088] In another example, the target behavior sequence may be divided equally to obtain two sub-target sequences.
[0089] In yet another example, two sub-target sequences can be obtained by randomly masking the target behavior sequence twice.
[0090] Step 506, input the two sub-goal sequences into the updated neural network model to obtain the corresponding two target behavior vectors.
[0091] That is, the two sub-target sequences are respectively input into the two sub-models of the updated neural network model, and two target behavior vectors are obtained through the outputs of the two sub-models.
[0092] Step 508: The two target behavior vectors are integrated and input into the business prediction model, and the updated neural network model is fine-tuned according to the output of the business prediction model and the label value of the target user.
[0093] The above-mentioned integrating the two target behavior vectors may include: concatenating the two target behavior vectors.
[0094] Of course, in practical applications, the integration of the two target behavior vectors can also be achieved by summing, averaging, or weighted averaging the two target behavior vectors.
[0095] In addition, the above-mentioned business prediction model can be used to perform face recognition on the target user, or to recommend services or goods to the target user. It should be understood that when the business prediction model is used to perform face recognition on the target user, the label value of the target user can be used to indicate whether the target user is a legitimate user. When the business prediction model is used to recommend services or goods to the target user, the label value of the target user can be used to indicate the identification of the corresponding service or goods.
[0096] In summary, after fine-tuning the neural network model in combination with a specific prediction task (i.e., face recognition, service or product recommendation), the feature vector of the target user in a specific business scenario can be obtained based on the neural network model, and then the corresponding business prediction can be made based on it. In other words, the neural network model trained by the embodiments of this specification can be flexibly applied to different business scenarios, thereby saving model training costs.
[0097] It should be noted that the acquisition, use and analysis of user information (such as user behavior, etc.) involved in this plan have been explicitly authorized by the user.
[0098] Corresponding to the above method for processing user behavior sequences, an embodiment of the present specification also provides a device for processing user behavior sequences, such as Figure 6 As shown, the device may include:
[0099] The acquisition unit 602 is used to acquire the user behavior sequences of N sample users.
[0100] The enhancement unit 604 is used to perform data enhancement on each user behavior sequence to obtain a training sample set. The training sample set includes multiple positive sample pairs and multiple negative sample pairs, wherein each positive sample pair includes at least two subsequences obtained by splitting the same user behavior sequence according to different services. Each negative sample pair includes at least two subsequences from different user behavior sequences among a plurality of subsequences obtained by splitting at least two user behavior sequences according to different services.
[0101] Optionally, each positive sample pair may include two subsequences obtained by equally dividing the same user behavior sequence. Each negative sample pair may include two subsequences from different user behavior sequences among a plurality of subsequences obtained by equally dividing at least two user behavior sequences.
[0102] Optionally, each positive sample pair may further include two subsequences obtained by randomly masking the same user behavior sequence twice. Each negative sample pair may further include two subsequences from different user behavior sequences among several subsequences obtained by randomly masking at least two user behavior sequences respectively.
[0103] The input unit 606 is used to input each positive sample pair and each negative sample pair into the neural network model, which includes two sub-models with the same network structure and network parameters, and is used to process two sub-sequences in the input sample pair to obtain respective corresponding behavior vectors.
[0104] In one example, both sub-models are Transformer encoders, which include an embedding layer and an attention layer.
[0105] The input unit 606 is specifically used for:
[0106] For the first sequence in the input sample pair, in the embedding layer of the corresponding first sub-model, multiple embedding vectors are obtained according to the behavioral features and position encoding of each behavior in the first sequence. In the attention layer of the corresponding first sub-model, different weights are added to the multiple embedding vectors to obtain the corresponding behavior vector.
[0107] The calculation unit 608 is used to calculate the corresponding distance for any positive sample pair or negative sample pair according to the behavior vectors corresponding to the two subsequences therein.
[0108] The updating unit 610 is used to update the neural network model with the goal of minimizing the distance between two subsequences in each positive sample pair and maximizing the distance between two subsequences in each negative sample pair, so as to process the user behavior sequence to be analyzed.
[0109] Optionally, the device may further include: a splitting unit 612 and a fine-tuning unit 614 .
[0110] The acquisition unit 602 is further used to acquire the target behavior sequence of the target user.
[0111] The splitting unit 612 is used to split the target behavior sequence to obtain two sub-target sequences.
[0112] The input unit 606 is also used to input the two sub-target sequences into the updated neural network model to obtain the corresponding two target behavior vectors.
[0113] The fine-tuning unit 614 is used to integrate the two target behavior vectors and input them into the business prediction model, and fine-tune the updated neural network model according to the output of the business prediction model and the label value of the target user.
[0114] The business prediction model may be used to perform face recognition on a target user, or the business prediction model may be used to recommend services or products to the target user.
[0115] The functions of the functional modules of the device in the above-mentioned embodiment of this specification can be implemented through the steps of the above-mentioned method embodiment. Therefore, the specific working process of the device provided by one embodiment of this specification will not be repeated here.
[0116] An apparatus for processing a user behavior sequence provided by an embodiment of the present specification can accurately understand the user's habitual preferences behind the behavior, and further can more accurately perform vector expression on the user behavior sequence.
[0117] 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 3 or Figure 5 The method described.
[0118] According to another embodiment of the present invention, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the Figure 3 or Figure 5 The method described.
[0119] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0120] The steps of the method or algorithm described in conjunction with the disclosure of this specification can be implemented in hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, register, hard disk, mobile hard disk, CD-ROM or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a server. Of course, the processor and the storage medium can also be present in the server as discrete components.
[0121] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the present invention may be implemented in hardware, software, firmware, or any combination thereof. When implemented using software, the functions may be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium may be any available medium that a general or special-purpose computer can access.
[0122] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0123] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of this specification. It should be understood that the above description is only the specific implementation method of this specification and is not intended to limit the protection scope of this specification. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of this specification should be included in the protection scope of this specification.
Claims
1. A method for processing a user behavior sequence, comprising: Obtain the user behavior sequences of N sample users; Perform data enhancement on each user behavior sequence to obtain a training sample set; The training sample set includes a plurality of positive sample pairs and a plurality of negative sample pairs; each of the positive sample pairs includes at least two subsequences obtained by splitting the same user behavior sequence according to different services; each negative sample pair includes at least two subsequences from different user behavior sequences among a plurality of subsequences obtained by splitting at least two user behavior sequences according to different services; the different user behavior sequences are behavior sequences of different users; Inputting each positive sample pair and each negative sample pair into a neural network model, wherein the neural network model includes two sub-models with the same network structure and network parameters, and is used to process two sub-sequences in the input sample pair to obtain respective corresponding behavior vectors; For any positive sample pair or negative sample pair, the corresponding distance is calculated according to the behavior vectors corresponding to the two subsequences; With the goal of minimizing the distance between the two subsequences in each positive sample pair and maximizing the distance between the two subsequences in each negative sample pair, the neural network model is updated to process the user behavior sequence to be analyzed.
2. The method according to claim 1, wherein: Each positive sample pair also includes two subsequences obtained by equally dividing the same user behavior sequence; each negative sample pair also includes two subsequences from different user behavior sequences among a number of subsequences obtained by equally dividing at least two user behavior sequences.
3. The method according to claim 1, wherein: Each positive sample pair also includes two subsequences obtained by randomly masking the same user behavior sequence twice; each negative sample pair also includes two subsequences from different user behavior sequences among several subsequences obtained by randomly masking at least two user behavior sequences respectively.
4. The method according to claim 1, further comprising: Obtain the target behavior sequence of the target user; Splitting the target behavior sequence to obtain two sub-target sequences; Inputting the two sub-goal sequences into the updated neural network model to obtain two corresponding target behavior vectors; The two target behavior vectors are integrated and input into the business prediction model, and the updated neural network model is fine-tuned according to the output of the business prediction model and the label value of the target user.
5. The method according to claim 4, wherein: The business prediction model is used to perform face recognition on the target user, or the business prediction model is used to recommend services or products to the target user.
6. The method according to claim 1, wherein: Both sub-models are Transformer encoders, and the Transformer encoder includes an embedding layer and an attention layer; The processing of two subsequences in an input sample pair comprises: For the first sequence in the input sample pair, in the embedding layer of the corresponding first sub-model, multiple embedding vectors are obtained according to the behavioral characteristics and position encoding of each behavior in the first sequence; in the attention layer of the corresponding first sub-model, different weights are added to the multiple embedding vectors to obtain the corresponding behavior vector.
7. A device for processing a user behavior sequence, comprising: An acquisition unit, used to acquire user behavior sequences of N sample users; An enhancement unit, used to perform data enhancement on each user behavior sequence to obtain a training sample set; the training sample set includes a plurality of positive sample pairs and a plurality of negative sample pairs; Each positive sample pair includes at least two subsequences obtained by splitting the same user behavior sequence according to different services; each negative sample pair includes at least two subsequences from different user behavior sequences among a plurality of subsequences obtained by splitting at least two user behavior sequences according to different services; the different user behavior sequences are behavior sequences of different users; An input unit, used for inputting each positive sample pair and each negative sample pair into a neural network model, wherein the neural network model includes two sub-models with the same network structure and network parameters, and is used for processing two sub-sequences in the input sample pair to obtain respective corresponding behavior vectors; A calculation unit, for calculating the corresponding distance for any positive sample pair or negative sample pair according to the behavior vectors corresponding to the two subsequences therein; An updating unit is used to update the neural network model with the goal of minimizing the distance between the two subsequences in each positive sample pair and maximizing the distance between the two subsequences in each negative sample pair, so as to process the user behavior sequence to be analyzed.
8. The device according to claim 7, wherein: Each positive sample pair also includes two subsequences obtained by equally dividing the same user behavior sequence; each negative sample pair also includes two subsequences from different user behavior sequences among a number of subsequences obtained by equally dividing at least two user behavior sequences.
9. The device according to claim 7, wherein: Each positive sample pair also includes two subsequences obtained by randomly masking the same user behavior sequence twice; each negative sample pair also includes two subsequences from different user behavior sequences among several subsequences obtained by randomly masking at least two user behavior sequences respectively.
10. The apparatus according to claim 7, further comprising: Split units and fine-tune units; The acquisition unit is further used to acquire a target behavior sequence of a target user; The splitting unit is used to split the target behavior sequence to obtain two sub-target sequences; The input unit is further used to input the two sub-goal sequences into the updated neural network model to obtain two corresponding target behavior vectors; The fine-tuning unit is used to integrate the two target behavior vectors and input them into the business prediction model, and fine-tune the updated neural network model according to the output of the business prediction model and the label value of the target user.
11. The device according to claim 10, wherein: The business prediction model is used to perform face recognition on the target user, or the business prediction model is used to recommend services or products to the target user.
12. The device according to claim 7, wherein: Both sub-models are Transformer encoders, and the Transformer encoder includes an embedding layer and an attention layer; The input unit is specifically used for: For the first sequence in the input sample pair, in the embedding layer of the corresponding first sub-model, multiple embedding vectors are obtained according to the behavioral characteristics and position encoding of each behavior in the first sequence; in the attention layer of the corresponding first sub-model, different weights are added to the multiple embedding vectors to obtain the corresponding behavior vector.
13. 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 6.
14. A computing device comprising a memory and a processor, wherein: The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Neural network model training method and device and computer readable storage medium
CN112183729A
Target classification method, target classification device and computer readable storage medium
CN112560880A
Data processing method and device
CN112925973A
A user interest mining model training method and device and a user interest mining method and device
CN113408706A
Detecting Network Address Translation Devices In A Network Based On Network Traffic Logs
US20160315952A1
