Behavior prediction model processing method, behavior prediction method, device and equipment
By splitting model processing and feature compression tasks in the server system, the difficulty in obtaining prediction results caused by limited resources of mobile devices is solved, and a more efficient and lightweight behavior prediction process is achieved, which improves the user experience.
Patent Information
- Application Number
- CN202210365027.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-08
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2042-04-08
AI Technical Summary
In the prior art, the failure of the instant communication link between the mobile device and the server system causes the mobile device to fail to obtain the predicted results in a timely manner, affecting the user experience, and the mobile device resources are limited, making it difficult to perform a complete model training and decision-making process. .
In the server system, the model processing and feature compression are carried out, tasks with high computing power and storage resources are split, and tasks are executed by the attention model and the prediction model respectively, and the training prediction model and the benchmark memory vector after the feature compression are sent. To mobile devices, reduce the computing and storage burden of mobile devices.
It effectively avoids the poor user experience caused by communication link failure, and makes the prediction process of mobile devices lighter, adapts to the operating environment with limited resources, and improves the speed and accuracy of the acquisition of prediction results.
Smart Images

Figure CN114677763B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a behavior prediction model processing method, a behavior prediction method, a device and an apparatus. Background Art
[0002] The rapid development of computer technology has made it possible to use the historical behavior big data of mobile device users to predict mobile user behavior. For example, for target users, we can predict the click behavior of website page display content, predict product purchase behavior, predict service behavior, etc.
[0003] A neural network model is usually used for prediction. Specifically: the prediction model is trained in the server system in advance to obtain a trained prediction model. When a mobile device has a prediction demand, a prediction request is sent to the corresponding server system. The server system obtains the prediction result through the above-mentioned trained prediction model and returns it to the mobile device.
[0004] The above method has high requirements for the instant communication link between the mobile device and the server system. When the communication link fails and the mobile device cannot obtain the prediction results in time, the user experience will be greatly reduced. Summary of the invention
[0005] In view of this, embodiments of the present application provide a behavior prediction model processing method, a behavior prediction method, an apparatus and a device to at least partially solve the above-mentioned problems.
[0006] According to a first aspect of an embodiment of the present application, a behavior prediction model processing method is provided, which is applied to a server system and a mobile device, including:
[0007] Obtaining a behavior feature vector and a sample label corresponding to a training sample; the behavior feature vector represents behavior information of a user of the mobile terminal device;
[0008] Through the initial attention model, the behavior feature vector is feature compressed based on the attention mechanism to obtain an initial memory vector;
[0009] Inputting the initial memory vector into an initial prediction model to obtain an initial prediction result;
[0010] Based on the initial prediction result and the sample label, the initial attention model and the initial prediction model are trained to obtain a trained attention model and a prediction model; and the behavior feature vector is input into the trained attention model to obtain a reference memory vector;
[0011] The benchmark memory vector and the trained prediction model are sent to the mobile terminal device.
[0012] According to a second aspect of an embodiment of the present application, a behavior prediction method is provided, which is applied to a mobile device and a server system, including:
[0013] Acquire a benchmark memory vector and a trained prediction model from the server system; the benchmark memory vector is obtained by performing feature compression on a historical behavior feature vector of a user of the mobile device based on an attention mechanism;
[0014] Acquire the user's real-time behavior feature vector; and fuse each element contained in the real-time behavior feature vector to obtain a fused real-time behavior feature vector;
[0015] The fused instant behavior feature vector and the reference memory vector are weightedly fused, and the weighted fusion result is input into the prediction model to obtain a prediction result.
[0016] According to a third aspect of an embodiment of the present application, a model training device is provided, which is applied to a server system and a mobile device, including:
[0017] A sample information acquisition module, used to acquire a behavior feature vector and a sample label corresponding to a training sample; the behavior feature vector represents the behavior information of the user of the mobile terminal device;
[0018] A feature compression module, used to perform feature compression on the behavior feature vector based on an attention mechanism through an initial attention model to obtain an initial memory vector;
[0019] A prediction module, used for inputting the initial memory vector into an initial prediction model to obtain an initial prediction result;
[0020] A model training module, used to train the initial attention model and the initial prediction model based on the initial prediction result and the sample label to obtain a trained attention model and a prediction model; and input the behavior feature vector into the trained attention model to obtain a reference memory vector;
[0021] A sending module is used to send the benchmark memory vector and the trained prediction model to the mobile terminal device.
[0022] According to a fourth aspect of an embodiment of the present application, a behavior prediction device is provided, which is applied to a mobile device and a server system, including:
[0023] A first acquisition module is used to acquire a benchmark memory vector and a trained prediction model from the server system; the benchmark memory vector is obtained by performing feature compression on a historical behavior feature vector of a user of the mobile device based on an attention mechanism;
[0024] A second acquisition module is used to acquire the user's real-time behavior feature vector; and to fuse each element contained in the real-time behavior feature vector to obtain a fused real-time behavior feature vector;
[0025] The result obtaining module is used to perform weighted fusion on the fused instant behavior feature vector and the reference memory vector, and input the weighted fusion result into the prediction model to obtain the prediction result.
[0026] According to the fifth aspect of the embodiments of the present application, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the behavior prediction model processing method of the first aspect or operations corresponding to the behavior prediction method described in the second aspect.
[0027] According to the sixth aspect of the embodiments of the present application, a computer storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the behavior prediction model processing method described in the first aspect or the behavior prediction method described in the second aspect is implemented.
[0028] The behavior prediction model processing method and behavior prediction method provided in the embodiments of the present application split the model processing process and the prediction process, perform model processing in a server system with sufficient computing power and storage resources, and perform prediction on a mobile device with limited resources. Therefore, it can effectively avoid the problem in the existing solution that the mobile device cannot obtain the prediction results in time and the user experience is poor due to the failure of the instant communication link between the mobile device and the server system.
[0029] Moreover, in the embodiment of the present application, in the model processing process of the server system, the feature compression task and prediction process that require high computing power and storage resources are also split, and are executed by the attention model and the prediction model respectively, and finally only the prediction model and the benchmark memory vector after feature compression are sent to the mobile device. In this way, on the one hand, the mobile device does not need to store the behavioral feature vectors with a large amount of data for training, nor does it need to perform feature compression operations, but only needs to obtain the benchmark memory vectors with a small amount of data after feature compression; on the other hand, compared with the models involved in the model processing process (attention model and prediction model), the models involved in the prediction process of the mobile device (prediction model) are also more lightweight and more suitable for deployment to mobile devices with limited resources. In summary, the solution of the embodiment of the present application can better adapt to the operating environment on the mobile terminal. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0031] Figure 1 A schematic diagram of an example scenario in an embodiment of the present application;
[0032] Figure 2 A flowchart of a behavior prediction model processing method according to Embodiment 1 of the present application;
[0033] Figure 3 A flowchart of a behavior prediction model processing method according to Embodiment 2 of the present application;
[0034] Figure 4 is a flowchart of a behavior prediction method according to Embodiment 3 of the present application;
[0035] Figure 5 is a structural block diagram of a behavior prediction model processing device according to Embodiment 4 of the present application;
[0036] Figure 6 is a structural block diagram of a behavior prediction device according to Embodiment 5 of the present application;
[0037] Figure 7 This is a schematic diagram of the structure of an electronic device according to Embodiment 6 of the present application. DETAILED DESCRIPTION
[0038] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.
[0039] Background Overview:
[0040] With the continuous development of artificial intelligence technology, neural networks have been widely used. When making predictions on mobile devices, neural network models are also usually used. At present, the prediction process is usually a centralized structure, that is, the training and decision-making of the prediction model are all done on the server side. When a prediction is needed, the mobile device sends a prediction request to the server device, and then the server device makes a prediction through the trained prediction model, obtains the prediction result and returns it to the mobile device.
[0041] However, the above prediction method has high requirements for the instant communication link between the server device and the mobile device. If there is a fault in the communication link and the request sent by the mobile device cannot be responded to in time by the server device, it will directly affect the user experience.
[0042] However, if the complete model training process and decision-making process in the above prediction method are directly deployed on the mobile device, since the complete model training process requires a large amount of sample information and complex calculations, and compared with the server-side device, the mobile device has very limited computing power and storage resources. Therefore, the training and decision-making process may eventually fail to run.
[0043] General overview of this application:
[0044] See also Figure 1 , Figure 1 This is a schematic diagram of an example of a scenario in the embodiment of the present application. In the embodiment of the present application, first, see Figure 1In the left part, the model processing process and the behavior prediction (decision-making) process are separated. The model processing operation is performed in the server system (a distributed server cluster consisting of server 1, server 2, ..., server N) with sufficient computing power and storage resources, and the trained prediction model is sent to the mobile device; the prediction is performed based on the received prediction model in the mobile device with limited resources, and the behavior prediction operation is performed to obtain the prediction result. Therefore, the problem of the mobile terminal being unable to obtain the prediction result in time and the poor user experience caused by the failure of the instant communication link between the mobile device and the server system in the existing solution can be effectively avoided.
[0045] Secondly, in the embodiment of the present application, in the model processing process on the server system, the feature compression task and the prediction process, which require high computing power and storage resources, are also split, see Figure 1 The right part is executed by the attention model and the prediction model respectively, and finally only the trained prediction model and the benchmark memory vector obtained after feature compression of the historical behavior feature vector of the user of the mobile device are sent to the mobile device, so that the mobile device can obtain the prediction result based on the benchmark memory vector and the immediate behavior feature vector through the prediction model. In this way, on the one hand, the mobile device does not need to store the historical behavior feature vector with a large amount of data for training, nor does it need to perform feature compression operations, but only needs to obtain the benchmark memory vector with a small amount of data after feature compression; on the other hand, since there is no need to perform feature compression operations, compared with the attention model and prediction model required by the model processing process, the prediction process of the mobile device only needs to use the prediction model to obtain the prediction result. Therefore, the model involved in the prediction process is also more lightweight and more suitable for deployment on mobile devices with limited resources. In summary, the solution of the embodiment of the present application can better adapt to the operating environment on the mobile device.
[0046] Detailed implementation process of the embodiment of this application
[0047] The specific implementation of the embodiment of the present application is further explained below in conjunction with the accompanying drawings of the embodiment of the present application. Example
[0048] Reference Figure 2 , Figure 2 The following is a flow chart of the steps of a behavior prediction model processing method according to the first embodiment of the present application. Specifically, the behavior prediction model processing method provided in this embodiment is applied to a server system and a mobile device, and the method includes the following steps:
[0049] Step 202: Obtain the behavior feature vector and sample label corresponding to the training sample.
[0050] The behavior feature vector represents the behavior information of the user of the mobile device.
[0051] In the embodiments of the present application, there is no limitation on the specific user behavior content. For example, when predicting the click behavior of the content displayed on the website page, the user's behavior information can be the click behavior information of different display objects; when predicting the purchase behavior of goods, the user's behavior information can be the purchase behavior information of different goods; when predicting the service behavior, the user's behavior information can be the selection behavior information of different services, and so on.
[0052] The behavior feature vector can be obtained by vectorizing the behavior information after acquiring the user's behavior information. Specifically, it can be implemented through an embedding layer, that is, the behavior information is input into the embedding layer, and the corresponding behavior feature vector is output through the embedding layer.
[0053] Take the user's behavior information as the click behavior information on different display objects as an example: In this case, the behavior feature vector involves the user's click behavior information on different display objects. Therefore, the behavior feature vector belongs to a sequence feature containing multiple sequence items. For example: There are 100 different display objects: , ,……, ,in, Indicates the attribute information of the displayed object, such as number, price, color, etc. The user clicked , ,……, , the user's click behavior information on each display object can be expressed as: ,Will The input embedding layer performs feature vectorization to obtain the corresponding behavior feature vector: ,in, for A vector of a preset dimension (such as 32, 64, 128, etc.) that corresponds one-to-one. is a natural number greater than 0 and less than or equal to 100; Greater than 0 and less than or equal to Correspondingly, the sample label represents whether the user clicks on a display object. For example, if the user clicks on display object a, then for sample a, the sample label can be 1. Otherwise, if the user does not click on the display object a, the sample label can be set to 0.
[0054] Step 204: Using the initial attention model, feature compression is performed on the behavior feature vector based on the attention mechanism to obtain an initial memory vector.
[0055] The data volume of the behavior feature vector is usually large. In this step, after obtaining the behavior feature vector, it is compressed to obtain an initial memory vector with a smaller data volume. Feature compression based on the attention mechanism aims to enable the compressed initial memory vector to inherit the important information in the behavior feature vector (user preferences or favorite behavior information).
[0056] Specifically, feature compression can be performed through the following iterative formula to obtain the initial memory vector:
[0057]
[0058] in, is the initial memory vector; , is the parameter matrix to be trained; for or dimension; T represents the transpose of the matrix; softmax() is the normalized exponential function.
[0059] Furthermore, in order to make the initial memory vector inherit as much important information as possible from the behavior feature vector, the initial memory vector can also be divided into several attention segments, the value of each attention segment is calculated separately, and then the attention segments are concatenated into the final initial memory vector. Specifically, the following formula can be used:
[0060]
[0061]
[0062] Wherein, is the number of attention segments, and the value of can be set based on experience or actual conditions, and is not limited here; They are all different attention spans; Greater than 0 and less than or equal to The natural number of for Dimension value of ; , is the parameter matrix to be trained; for The fragments.
[0063] Step 206: input the initial memory vector into the initial prediction model to obtain an initial prediction result.
[0064] In the present application example, the specific structure of the initial prediction model is not limited and can be set as needed. Further, in order to reduce the computational complexity, a neural network model with a relatively simple structure can be used, such as a multi-sensor network model, etc.
[0065] In addition, since the prediction result may also be related to other feature information, such as environmental characteristics (weather, temperature, etc.), attribute characteristics such as user occupation, etc., therefore, in step 202, while obtaining the behavior feature vector, the feature vector corresponding to the above other feature information can also be obtained. Correspondingly, in this step, the above initial memory vector and the feature vector corresponding to the above other feature information can be input into the initial prediction model to obtain the prediction result.
[0066] Step 208, based on the initial prediction results and sample labels, the initial attention model and the initial prediction model are trained to obtain the trained attention model and prediction model; and the behavior feature vector is input into the trained attention model to obtain the benchmark memory vector.
[0067] Specifically, a loss value can be obtained based on the initial prediction results and sample labels, and then, based on the loss value, the parameter values in the initial attention model and the initial prediction model can be adjusted to obtain the trained attention model and prediction model.
[0068] In addition, in this step, after obtaining the trained attention model, the behavior feature vector corresponding to the training sample obtained in step 202 is input into the above attention model, and the benchmark memory vector is output based on the attention mechanism.
[0069] Step 210, sending the reference memory vector and the trained prediction model to the mobile device.
[0070] In the embodiment of the present application, the prediction model can be a general model for predicting user behavior. That is to say, the specific prediction content of the prediction model is not limited in the embodiment of the present application. For example, it can be a model for predicting click behavior, a model for predicting purchase behavior, a model for predicting service selection, and so on.
[0071] In the embodiment of the present application, the model training process and the prediction process are split, the model training is performed in a server device with sufficient computing power and storage resources, and the prediction is performed in a mobile device with limited resources. Therefore, it is possible to effectively avoid the problem in the existing solution that the mobile device cannot obtain the prediction results in time and the user experience is poor due to the failure of the instant communication link between the mobile device and the server system.
[0072] Moreover, in the embodiment of the present application, in the model processing process of the server system, the feature compression task and prediction process that require high computing power and storage resources are also split, and are executed by the attention model and the prediction model respectively, and finally only the prediction model and the benchmark memory vector after feature compression are sent to the mobile device. In this way, on the one hand, the mobile device does not need to store the behavioral feature vectors with a large amount of data for training, nor does it need to perform feature compression operations, but only needs to obtain the benchmark memory vectors with a small amount of data after feature compression; on the other hand, compared with the models involved in the model processing process (attention model and prediction model), the models involved in the prediction process of the mobile device (prediction model) are also more lightweight and more suitable for deployment to mobile devices with limited resources. In summary, the solution of the embodiment of the present application can better adapt to the operating environment on the mobile device. Example
[0073] Reference Figure 3 , Figure 3 The following is a flow chart of the steps of a behavior prediction model processing method according to the second embodiment of the present application. Specifically, the behavior prediction model processing method provided in this embodiment is applied to the server system and the mobile terminal, and the method includes the following steps:
[0074] Step 302: Obtain the behavior feature vector and sample label corresponding to the training sample.
[0075] The behavior feature vector represents the behavior information of the user of the mobile device.
[0076] Step 304: obtaining a plurality of masking sequence vectors based on the behavior feature vector; wherein each masking sequence vector is obtained by performing a random masking process on each element included in the behavior feature vector.
[0077] Also take the behavior feature vector in step 202 For example: Both The elements contained in , each element is a vector of a preset dimension. In the embodiment of the present application, The elements contained in are randomly masked to obtain a masked sequence vector, wherein the masked elements no longer participate in subsequent calculations.
[0078] Specifically: Perform a random masking on each element in to obtain a masking sequence vector. Repeat the masking process multiple times to obtain multiple masking sequence vectors. Those skilled in the art will understand that, due to random masking, the number of elements and specific element values contained in the masking sequence vector generated by each masking process may not be the same. For each masking process, each element may be masked according to a preset masking probability. For example, each element is masked with a masking probability of 30%. The masking sequence vector obtained by the first masking process may be: , the masking sequence vector obtained by the second masking process may be: , etc. In the embodiment of the present application, no limitation is made to the specific covering strategy.
[0079] Step 306, using the initial attention model, feature compression is performed on each mask sequence vector to obtain multiple initial memory vectors.
[0080] Furthermore, multiple initial memory vectors can be obtained in the following way:
[0081] Determine whether there is a historical benchmark memory vector. If so, concatenate the behavior feature vector and the historical benchmark memory vector to obtain a concatenated behavior feature vector; wherein the historical benchmark memory vector is a benchmark memory vector obtained in the previous model processing process;
[0082] Through the initial attention model, the concatenated behavior feature vector is compressed based on the attention mechanism to obtain the initial memory vector.
[0083] Specifically, since the model processing process may be performed periodically corresponding to the periodic update of the behavior feature vector, in the current model processing process, there may already be a benchmark memory vector obtained in the previous processing (here referred to as the historical benchmark memory vector), which is obtained by feature compression of the historical behavior feature vector, and has inherited the important information in the historical behavior feature vector. Therefore, in the current model processing process, the above historical benchmark memory vector and the newly acquired behavior feature vector can be spliced, and the spliced behavior feature vector can be used as the latest behavior feature vector for feature compression, so that the prediction accuracy of the model finally trained can be further improved.
[0084] Specifically in this step, after determining that there is a historical benchmark memory vector, for each masked sequence vector, the masked sequence vector and the historical benchmark memory vector are concatenated, and the concatenated results are feature compressed through the attention model to obtain multiple initial memory vectors.
[0085] Step 308: Input each initial memory vector into the initial prediction model to obtain a plurality of initial prediction results.
[0086] Step 310, based on the multiple initial prediction results and sample labels, obtain a first loss value and a second loss value respectively.
[0087] Among them, the smaller the sum of the differences between the sample label and each initial prediction result is, the smaller the first loss value is; the smaller the sum of the differences between the initial prediction results is, the smaller the second loss value is.
[0088] In the embodiment of the present application, there is no limitation on the specific calculation method of the first loss value and the second loss value, which can be set according to actual conditions.
[0089] For example, the first loss value can be obtained as follows:
[0090]
[0091] For another example, since it is expected that multiple initial prediction results are as consistent as possible, the second loss value can be obtained as follows:
[0092]
[0093]
[0094] in, is the first loss value; is the second loss value; is the total number of initial prediction results; Indicates Initial prediction results; is the sample label value.
[0095] Step 312: numerically fuse the first loss value and the second loss value to obtain a fused loss value.
[0096] In the embodiment of the present application, there is no limitation on the specific numerical fusion method, which can be set according to actual needs. For example:
[0097] The numerical fusion can be performed by the following formula:
[0098]
[0099] in, are the preset hyperparameters; is the fusion loss value.
[0100] Step 314: train the initial attention model and the initial prediction model according to the fusion loss value to obtain a trained attention model and a prediction model.
[0101] There may be erroneous operations in the process of users performing user behaviors. For example, taking click behavior as an example, in the process of clicking on each display object, there may be click behaviors that are inconsistent with the user's own intentions, such as: accidentally clicking on display content that the user is not interested in, or, although interested in a certain type of display object, the interest level is average, and it is only because the number of such display objects pushed by the system is large, so the number of clicks is large, etc. The above erroneous operations will cause the behavior feature vector obtained in step 302 to contain noise, deviation or redundant information, and then the prediction accuracy of the trained model will be reduced when model processing is performed based on the behavior feature vector containing noise information.
[0102] In an embodiment of the present application, a random masking method is introduced to perform random masking on the behavior feature vector for multiple times to obtain multiple masked sequence vectors, and then predictions are performed based on each masked sequence vector to obtain multiple initial prediction results. The model training is then completed based on the multiple initial prediction results. This can effectively remove the noise, deviation or redundant information contained in the behavior feature vector, thereby avoiding the above-mentioned problem of reduced model prediction accuracy caused by the noise information contained in the behavior feature vector, that is, the embodiment of the present application can effectively improve the accuracy of model prediction.
[0103] Step 316, input the behavior feature vector into the trained attention model to obtain a baseline memory vector.
[0104] Furthermore, in some of the embodiments, the behavior feature vector obtained in step 302 can be divided into: a historical behavior feature vector and an instant behavior feature vector, wherein the historical behavior feature vector represents the behavior information of the user in a first preset historical time period from the current moment; and the instant behavior feature vector represents the behavior information of the user in a second preset historical time period from the current moment; wherein the duration of the first preset historical time period is greater than the duration of the second preset historical time period, and the first preset historical time period may include the second preset historical time period, or may not include the second preset historical time period.
[0105] For example: the first preset historical time period can be one day, and the historical behavior feature vector can represent the user's behavior information within one day from the current moment, or the historical behavior feature vector can represent the user's behavior information within one day before the current moment; the second preset historical time period can be 5 minutes, and the instant behavior feature vector can represent the user's behavior information within 5 minutes before the current moment, and so on.
[0106] Correspondingly, the initial memory vector can be obtained in the following way, and finally the initial prediction result can be obtained:
[0107] Through the initial attention model, the historical behavior feature vector is compressed based on the attention mechanism to obtain the initial memory vector; the elements contained in the instant behavior feature vector are fused to obtain the fused instant behavior feature vector; the fused instant behavior feature vector and the initial memory vector are weighted fused to obtain the fused feature vector; the fused feature vector is input into the initial prediction model to obtain the initial prediction result.
[0108] Specifically, in order to facilitate calculation, the average value of each element contained in the instant behavior feature vector can be calculated to obtain the fused instant behavior feature vector, and then the fused instant behavior feature vector and the initial memory vector are weighted fused to obtain the fused feature vector. When performing weighted fusion, the sum of the weight coefficient of the fused instant behavior feature vector and the weight coefficient of the initial memory vector is 1. The above weight coefficient can be pre-set as a hyperparameter, or obtained through a preset neural network model. Specifically: a neural network model for obtaining the above weight coefficient can be set, and the feature vector that may affect the value of the above weight coefficient (such as: user behavior characteristics, environmental characteristics, etc.) can be used as the input of the neural network model, and the above neural network model is trained simultaneously with the attention model and the prediction model to obtain a trained neural network model.
[0109] Step 318, sending the benchmark memory vector and the trained prediction model to the mobile device.
[0110] In the embodiment of the present application, the model processing process and the prediction process are split, the model processing is performed in the server system with sufficient computing power and storage resources, and the prediction is performed on the mobile device with limited resources. Therefore, it can effectively avoid the problem in the existing solution that the mobile device cannot obtain the prediction results in time and the user experience is poor due to the failure of the instant communication link between the mobile device and the server system.
[0111] Moreover, in the embodiment of the present application, in the model processing process of the server system, the feature compression task and prediction process that require high computing power and storage resources are also split, and are executed by the attention model and the prediction model respectively, and finally only the prediction model and the benchmark memory vector after feature compression are sent to the mobile device. In this way, on the one hand, the mobile device does not need to store the behavioral feature vectors with a large amount of data for training, nor does it need to perform feature compression operations, but only needs to obtain the benchmark memory vectors with a small amount of data after feature compression; on the other hand, compared with the models involved in the model processing process (attention model and prediction model), the models involved in the prediction process of the mobile device (prediction model) are also more lightweight and more suitable for deployment to mobile devices with limited resources. In summary, the solution of the embodiment of the present application can better adapt to the operating environment on the mobile device.
[0112] In addition, in the embodiment of the present application, by introducing a random masking method, the behavior feature vector is randomly masked multiple times to obtain multiple masked sequence vectors, and then predictions are made based on each masked sequence vector to obtain multiple initial prediction results, and then the model training is completed based on the multiple initial prediction results. This can effectively remove the noise, deviation or redundant information contained in the behavior feature vector, thereby avoiding the above-mentioned problem of reduced model prediction accuracy caused by the noise information contained in the behavior feature vector, that is: the embodiment of the present application can effectively improve the accuracy of model prediction. Example
[0113] Reference Figure 4 , Figure 4 The following is a flow chart of the steps of a behavior prediction method according to the third embodiment of the present application. Specifically, the behavior prediction method provided in this embodiment is applied to a mobile terminal device and a server system, and the method includes the following steps:
[0114] Step 402, obtaining a reference memory vector and a trained prediction model from a server system.
[0115] Among them, the benchmark memory vector is obtained by feature compression of the user's historical behavior feature vector based on the attention mechanism.
[0116] Step 404, obtaining the user's instant behavior feature vector; and fusing the elements contained in the instant behavior feature vector to obtain a fused instant behavior feature vector.
[0117] Optionally, in some of the embodiments, for the convenience of calculation, an average operation may be performed on each element included in the instant behavior feature vector, so as to obtain a fused instant behavior feature vector.
[0118] Step 406, weighted fusion is performed on the fused instant behavior feature vector and the reference memory vector, and the weighted fusion result is input into the prediction model to obtain a prediction result.
[0119] When performing weighted fusion, the sum of the weight coefficient of the fused instant behavior feature vector and the weight coefficient of the initial memory vector is 1. The above weight coefficient can be pre-set or obtained from the server system. Specifically, on the server system side, the above weight coefficient can be a pre-set hyperparameter or obtained through a preset neural network model. Specifically: a neural network model for obtaining the above weight coefficient can be set, and the feature vector that may affect the value of the above weight coefficient (such as: user behavior characteristics, environmental characteristics, etc.) can be used as the input of the neural network model. The above neural network model is trained simultaneously with the attention model and the prediction model to obtain a trained neural network model, and the weight coefficient output by the trained neural network model is sent to the mobile device.
[0120] In the embodiment of the present application, the model processing process and the prediction process are split, the model processing is performed in the server system with sufficient computing power and storage resources, and the prediction is performed on the mobile device with limited resources. Therefore, it can effectively avoid the problem in the existing solution that the mobile device cannot obtain the prediction results in time and the user experience is poor due to the failure of the instant communication link between the mobile device and the server system.
[0121] Moreover, in the embodiment of the present application, in the model processing process of the server system, the feature compression task and prediction process that require high computing power and storage resources are also split, and are executed by the attention model and the prediction model respectively, and finally only the prediction model and the benchmark memory vector after feature compression are sent to the mobile device. In this way, on the one hand, the mobile device does not need to store the behavioral feature vectors with a large amount of data for training, nor does it need to perform feature compression operations, but only needs to obtain the benchmark memory vectors with a small amount of data after feature compression; on the other hand, compared with the models involved in the model processing process (attention model and prediction model), the models involved in the prediction process of the mobile device (prediction model) are also more lightweight and more suitable for deployment to mobile devices with limited resources. In summary, the solution of the embodiment of the present application can better adapt to the operating environment on the mobile terminal. Example
[0122] See also Figure 5 , Figure 5 1 is a structural block diagram of a behavior prediction model processing device according to Embodiment 4 of the present application. The behavior prediction model processing device provided in the embodiment of the present application includes:
[0123] The sample information acquisition module 502 is used to obtain the behavior feature vector and sample label corresponding to the training sample; the behavior feature vector represents the behavior information of the user of the mobile terminal device;
[0124] A feature compression module 504 is used to perform feature compression on the behavior feature vector based on the attention mechanism through the initial attention model to obtain an initial memory vector;
[0125] Prediction module 506, used to input the initial memory vector into the initial prediction model to obtain an initial prediction result;
[0126] A model training module 508 is used to train the initial attention model and the initial prediction model based on the initial prediction results and the sample labels to obtain the trained attention model and the prediction model; and input the behavior feature vector into the trained attention model to obtain a reference memory vector;
[0127] The sending module 510 is used to send the reference memory vector and the trained prediction model to the mobile terminal device.
[0128] Optionally, in some embodiments, the feature compression module 504 is specifically configured to:
[0129] Based on the behavior feature vector, a plurality of masking sequence vectors are obtained; wherein each masking sequence vector is obtained by performing a random masking process on each element contained in the behavior feature vector;
[0130] Through the initial attention model, feature compression is performed on each mask sequence vector to obtain multiple initial memory vectors;
[0131] The prediction module 506 is specifically used to: input each initial memory vector into the initial prediction model respectively to obtain multiple initial prediction results.
[0132] Optionally, in some of the embodiments, when the model training module 508 performs the step of training the initial attention model and the initial prediction model based on the initial prediction results and the sample labels to obtain the trained attention model and the prediction model, it is specifically used to:
[0133] Based on the multiple initial prediction results and sample labels, a first loss value and a second loss value are obtained respectively, wherein the smaller the sum of the differences between the sample label and each initial prediction result is, the smaller the first loss value is; the smaller the sum of the differences between each initial prediction result is, the smaller the second loss value is;
[0134] Numerically fuse the first loss value and the second loss value to obtain a fused loss value;
[0135] According to the fusion loss value, the initial attention model and the initial prediction model are trained to obtain the trained attention model and prediction model.
[0136] Optionally, in some of the embodiments, the behavior feature vector includes: a historical behavior feature vector and an instant behavior feature vector;
[0137] The feature compression module 504 is specifically used to: compress the historical behavior feature vector based on the attention mechanism through the initial attention model to obtain the initial memory vector;
[0138] The prediction module 506 is specifically used for:
[0139] Each element contained in the instant behavior feature vector is fused to obtain a fused instant behavior feature vector; the fused instant behavior feature vector and the initial memory vector are weighted fused to obtain a fused feature vector; the fused feature vector is input into the initial prediction model to obtain an initial prediction result.
[0140] Optionally, in some embodiments, the feature compression module 504 is specifically configured to:
[0141] Determine whether there is a historical benchmark memory vector. If so, concatenate the behavior feature vector and the historical benchmark memory vector to obtain a concatenated behavior feature vector; wherein the historical benchmark memory vector is a benchmark memory vector obtained in the previous model processing process;
[0142] Through the initial attention model, the concatenated behavior feature vector is compressed based on the attention mechanism to obtain the initial memory vector.
[0143] The model training device of the embodiment of the present application is used to implement the corresponding behavior prediction model processing method in the aforementioned method embodiment 1 or embodiment 2, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here. In addition, the functional implementation of each module in the behavior prediction model processing device of the embodiment of the present application can refer to the description of the corresponding part in the aforementioned method embodiment 1 or embodiment 2, which will not be repeated here. Example
[0144] Reference Figure 6 , Figure 6 The behavior prediction device provided in the embodiment of the present application is located in a client device and includes:
[0145] The first acquisition module 602 is used to acquire a reference memory vector and a trained prediction model from the server system; the reference memory vector is obtained by compressing the historical behavior feature vector of the user of the mobile device based on the attention mechanism;
[0146] The second acquisition module 604 is used to acquire the user's instant behavior feature vector; and fuse each element contained in the instant behavior feature vector to obtain a fused instant behavior feature vector;
[0147] The result obtaining module 606 is used to perform weighted fusion on the fused instant behavior feature vector and the reference memory vector, and input the weighted fusion result into the prediction model to obtain the prediction result.
[0148] The behavior prediction device of the embodiment of the present application is used to implement the corresponding behavior prediction method in the aforementioned method embodiment 3, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here. In addition, the functional implementation of each module in the behavior prediction device of the embodiment of the present application can refer to the description of the corresponding part in the aforementioned method embodiment 3, which will not be repeated here. Example
[0149] Reference Figure 7 , shows a schematic diagram of the structure of an electronic device according to Embodiment 6 of the present application. The specific embodiments of the present application do not limit the specific implementation of the electronic device.
[0150] like Figure 7 As shown, the electronic device may include: a processor (processor) 702 , a communication interface (Communications Interface) 704 , a memory (memory) 706 , and a communication bus 708 .
[0151] in:
[0152] The processor 702 , the communication interface 704 , and the memory 706 communicate with each other via a communication bus 708 .
[0153] The communication interface 704 is used to communicate with other electronic devices or servers.
[0154] The processor 702 is used to execute the program 710, and specifically can execute the relevant steps in the above-mentioned behavior prediction model processing method or behavior prediction method embodiment.
[0155] Specifically, the program 710 may include program codes, which include computer operation instructions.
[0156] The processor 702 may be a CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0157] The memory 706 is used to store the program 710. The memory 706 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0158] Program 710 can be specifically used to enable processor 702 to perform the following operations: obtain the behavior feature vector and sample label corresponding to the training sample; the behavior feature vector represents the behavior information of the user of the mobile device; through the initial attention model, the behavior feature vector is feature compressed based on the attention mechanism to obtain the initial memory vector; the initial memory vector is input into the initial prediction model to obtain the initial prediction result; based on the initial prediction result and the sample label, the initial attention model and the initial prediction model are trained to obtain the trained attention model and prediction model; and the behavior feature vector is input into the trained attention model to obtain the baseline memory vector; the baseline memory vector and the trained prediction model are sent to the mobile device.
[0159] or,
[0160] Program 710 can be specifically used to enable processor 702 to perform the following operations: obtain a baseline memory vector and a trained prediction model from a server system; the baseline memory vector is obtained by performing feature compression on a historical behavior feature vector of a user of a mobile device based on an attention mechanism; obtain the user's instant behavior feature vector; and fuse each element contained in the instant behavior feature vector to obtain a fused instant behavior feature vector; perform weighted fusion on the fused instant behavior feature vector and the baseline memory vector, and input the weighted fusion result into the prediction model to obtain a prediction result.
[0161] The specific implementation of each step in program 710 can refer to the corresponding description of the corresponding steps and units in the above-mentioned behavior prediction model processing method or behavior prediction method embodiment, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above-mentioned method embodiment, which will not be repeated here.
[0162] Through the electronic device of this embodiment, the model processing process and the prediction process are split, the model processing is performed in the server system with sufficient computing power and storage resources, and the prediction is performed on the mobile device with limited resources. Therefore, it can effectively avoid the problem in the existing solution that the mobile device cannot obtain the prediction results in time and the user experience is poor due to the failure of the instant communication link between the mobile device and the server system.
[0163] Moreover, in the embodiment of the present application, in the model processing process of the server system, the feature compression task and prediction process that require high computing power and storage resources are also split, and are executed by the attention model and the prediction model respectively, and finally only the prediction model and the benchmark memory vector after feature compression are sent to the mobile device. In this way, on the one hand, the mobile device does not need to store the behavioral feature vectors with a large amount of data for training, nor does it need to perform feature compression operations, but only needs to obtain the benchmark memory vectors with a small amount of data after feature compression; on the other hand, compared with the models involved in the model processing process (attention model and prediction model), the models involved in the prediction process of the mobile device (prediction model) are also more lightweight and more suitable for deployment to mobile devices with limited resources. In summary, the solution of the embodiment of the present application can better adapt to the operating environment on the mobile device.
[0164] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to execute operations corresponding to any behavior prediction model processing method or behavior prediction method in the above-mentioned multiple method embodiments.
[0165] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0166] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the behavior prediction model processing method or behavior prediction method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the behavior prediction model processing method or behavior prediction method shown herein, the execution of the code converts the general-purpose computer into a dedicated computer for executing the behavior prediction model processing method or behavior prediction method shown herein.
[0167] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0168] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.
Claims
1. A behavior prediction model processing method, applied to a server system and a mobile device, comprising: Obtain the behavior feature vector and sample label corresponding to the training sample; The behavior feature vector represents the behavior information of the user of the mobile terminal device; Through the initial attention model, the behavior feature vector is feature compressed based on the attention mechanism to obtain an initial memory vector; Inputting the initial memory vector into an initial prediction model to obtain an initial prediction result; Based on the initial prediction result and the sample label, the initial attention model and the initial prediction model are trained to obtain a trained attention model and a prediction model; and the behavior feature vector is input into the trained attention model to obtain a reference memory vector; The benchmark memory vector and the trained prediction model are sent to the mobile terminal device.
2. The method according to claim 1, wherein: The initial attention model is used to compress the behavior feature vector based on the attention mechanism to obtain the initial memory vector, including: Based on the behavior feature vector, a plurality of masking sequence vectors are obtained; wherein each masking sequence vector is obtained by performing a random masking process on each element contained in the behavior feature vector; Through the initial attention model, feature compression is performed on each mask sequence vector to obtain multiple initial memory vectors; The step of inputting the initial memory vector into an initial prediction model to obtain an initial prediction result includes: Each initial memory vector is input into the initial prediction model respectively to obtain a plurality of initial prediction results.
3. The method according to claim 2, wherein: The step of training the initial attention model and the initial prediction model based on the initial prediction result and the sample label to obtain a trained attention model and a prediction model includes: Based on the multiple initial prediction results and the sample labels, a first loss value and a second loss value are obtained respectively, wherein the smaller the sum of the differences between the sample label and each initial prediction result is, the smaller the first loss value is; the smaller the sum of the differences between each initial prediction result is, the smaller the second loss value is; Numerically fusing the first loss value and the second loss value to obtain a fused loss value; The initial attention model and the initial prediction model are trained according to the fusion loss value to obtain a trained attention model and a prediction model.
4. The method according to claim 1, wherein: The behavior feature vector includes: a historical behavior feature vector and an immediate behavior feature vector; the initial attention model is used to perform feature compression on the behavior feature vector based on the attention mechanism to obtain an initial memory vector, including: Through the initial attention model, the historical behavior feature vector is feature compressed based on the attention mechanism to obtain an initial memory vector; The step of inputting the initial memory vector into an initial prediction model to obtain an initial prediction result includes: Performing fusion processing on each element contained in the instant behavior feature vector to obtain a fused instant behavior feature vector; Performing weighted fusion on the fused instant behavior feature vector and the initial memory vector to obtain a fused feature vector; The fused feature vector is input into the initial prediction model to obtain an initial prediction result.
5. The method according to claim 1, wherein: The initial attention model is used to compress the behavior feature vector based on the attention mechanism to obtain the initial memory vector, including: Determine whether there is a historical benchmark memory vector, and if so, concatenate the behavior feature vector and the historical benchmark memory vector to obtain a concatenated behavior feature vector; wherein the historical benchmark memory vector is a benchmark memory vector obtained in the previous model processing process; The initial attention model is used to perform feature compression on the concatenated behavior feature vector based on the attention mechanism to obtain an initial memory vector.
6. A behavior prediction method, applied to a mobile device and a server system, comprising: Obtaining a benchmark memory vector and a trained prediction model from the server system; The benchmark memory vector is obtained by compressing the historical behavior feature vector of the user of the mobile terminal device based on the attention mechanism; Acquire the user's real-time behavior feature vector; and fuse each element contained in the real-time behavior feature vector to obtain a fused real-time behavior feature vector; The fused instant behavior feature vector and the reference memory vector are weightedly fused, and the weighted fusion result is input into the prediction model to obtain a prediction result.
7. The method according to claim 6, wherein: The fusing the elements contained in the instant behavior feature vector to obtain the fused instant behavior feature vector includes: An average operation is performed on each element contained in the instant behavior feature vector to obtain a fused instant behavior feature vector.
8. A behavior prediction model processing device, applied to a server system and a mobile device, comprising: A sample information acquisition module is used to obtain the behavior feature vector and sample label corresponding to the training sample; The behavior feature vector represents the behavior information of the user of the mobile terminal device; A feature compression module, used to perform feature compression on the behavior feature vector based on an attention mechanism through an initial attention model to obtain an initial memory vector; A prediction module, used for inputting the initial memory vector into an initial prediction model to obtain an initial prediction result; A model training module, used for training the initial attention model and the initial prediction model based on the initial prediction result and the sample label to obtain a trained attention model and a prediction model; and inputting the behavior feature vector into the trained attention model to obtain a reference memory vector; A sending module is used to send the benchmark memory vector and the trained prediction model to the mobile terminal device.
9. A behavior prediction device, applied to a mobile device and a server system, comprising: A first acquisition module, used to acquire a reference memory vector and a trained prediction model from the server system; The benchmark memory vector is obtained by compressing the historical behavior feature vector of the user of the mobile terminal device based on the attention mechanism; The second acquisition module is used to acquire the instant behavior feature vector of the user; and to fuse each element contained in the instant behavior feature vector to obtain a fused instant behavior feature vector; The result obtaining module is used to perform weighted fusion on the fused instant behavior feature vector and the reference memory vector, and input the weighted fusion result into the prediction model to obtain the prediction result.
10. An electronic device, comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the behavior prediction model processing method as described in any one of claims 1-5, or to perform operations corresponding to the behavior prediction method as described in claim 6 or 7.
11. A computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the behavior prediction model processing method as described in any one of claims 1 to 5, or implements the behavior prediction method as described in claim 6 or 7.
12. A computer program product, comprising computer instructions, wherein the computer instructions instruct a computing device to perform operations corresponding to the behavior prediction model processing method as described in any one of claims 1-5, or to perform operations corresponding to the behavior prediction method as described in claim 6 or 7.
Citation Information
Patent Citations
Failure predication system and failure predication method for background operation and maintenance system of bank
CN104156562A
Privacy protection model training method and device, data processing method and server
CN111490995A