Behavior prediction method, model training method and equipment
By combining structured and unstructured data for multiple predictions, it solves the low accuracy problem caused by traditional behavior prediction algorithms relying on a single data source, achieving higher prediction accuracy and data utilization.
Patent Information
- Application Number
- CN202410147953.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2024-09-20
AI Technical Summary
Traditional behavior prediction algorithms rely on a single structured data, resulting in low prediction accuracy and inability to fully utilize multiple data sources.
Combining structured data and a variety of unstructured data for behavior prediction, improve prediction accuracy through preliminary prediction of unstructured data and re-prediction of structured data, and update behavior prediction model parameters through model training.
Through multiple predictions and model parameter updates, the accuracy and comprehensiveness of behavioral predictions are significantly improved, multiple data sources are fully utilized, and the reliability of prediction results is enhanced.
Smart Images

Figure CN118674086A
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a behavior prediction method, a model training method and a device. Background Art
[0002] Machine models are widely used in various fields. For example, machine models can be used to predict user behavior to determine whether the user will exhibit a certain behavior.
[0003] Machine models can be combined with structured data for behavior prediction. Structured data is data with a predefined data model, which can be conveniently represented using a two-dimensional logical table in a database. The structured data can include any information content of the user, such as the user's basic information, historical behavior information, and regional information. Summary of the invention
[0004] The present application provides a behavior prediction method, a model training method and a device.
[0005] In a first aspect, the present application provides a behavior prediction method, comprising:
[0006] Acquire user characteristic data, wherein the user characteristic data includes structured data and N types of unstructured data, where N is a positive integer;
[0007] Generate a first vector corresponding to the structured data, and generate second vectors corresponding to the N types of unstructured data respectively;
[0008] Performing behavior prediction according to the N second vectors to obtain a first prediction result;
[0009] The first vector and the first prediction result are input into a behavior prediction model to perform behavior prediction to obtain a second prediction result, wherein the first prediction result and the second prediction result are used to indicate whether the user exhibits a target behavior.
[0010] It can be seen that in the embodiment of the present application, behavior prediction is achieved based on structured data and multiple unstructured data, making full use of multiple data sources to improve the prediction accuracy of the target behavior. In addition, the target behavior is first predicted based on multiple unstructured data to obtain a first prediction result, and then the first prediction result and structured data are combined to perform a second prediction to obtain a second prediction result, achieving two predictions, further improving the prediction accuracy of the target behavior.
[0011] In a second aspect, the present application provides a model training method, comprising:
[0012] Acquire characteristic data of sample users, wherein the characteristic data of the sample users includes sample structured data and N types of sample unstructured data, where N is a positive integer;
[0013] Generate a first sample vector corresponding to the sample structured data, and generate second sample vectors corresponding to the N types of sample unstructured data respectively;
[0014] Performing behavior prediction according to the N second sample vectors to obtain a first sample prediction result;
[0015] Inputting the first sample vector and the first sample prediction result into a behavior prediction model to perform behavior prediction, and obtaining a second sample prediction result, wherein the first sample prediction result and the second sample prediction result are used to indicate whether the sample user has a target behavior;
[0016] The parameters of the behavior prediction model are updated according to the second sample prediction result.
[0017] It can be seen that in the embodiments of the present application, multiple data sources are fully utilized during model training to improve the accuracy of the behavior prediction model.
[0018] In a third aspect, the present application provides a behavior prediction device, comprising:
[0019] A feature data acquisition module, used to acquire user feature data, wherein the user feature data includes structured data and N types of unstructured data, where N is a positive integer;
[0020] A vector generation module, used to generate a first vector corresponding to the structured data, and to generate second vectors corresponding to the N types of unstructured data respectively;
[0021] A first prediction module, configured to perform behavior prediction according to the N second vectors to obtain a first prediction result;
[0022] The second prediction module is used to input the first vector and the first prediction result into the behavior prediction model to perform behavior prediction and obtain a second prediction result, wherein the first prediction result and the second prediction result are used to indicate whether the user exhibits a target behavior.
[0023] In a fourth aspect, an embodiment of the present application provides a model training device, including:
[0024] A sample feature data acquisition module is used to acquire feature data of sample users, wherein the feature data of sample users includes sample structured data and N types of sample unstructured data, where N is a positive integer;
[0025] A sample vector generating module, used to generate a first sample vector corresponding to the sample structured data, and to generate second sample vectors corresponding to the N types of sample unstructured data respectively;
[0026] A first sample prediction module, used for performing behavior prediction according to the N second sample vectors to obtain a first sample prediction result;
[0027] A second sample prediction module, used for inputting the first sample vector and the first sample prediction result into a behavior prediction model to perform behavior prediction, and obtaining a second sample prediction result, wherein the first sample prediction result and the second sample prediction result are used to indicate whether the sample user has a target behavior;
[0028] A model updating module is used to update the parameters of the behavior prediction model according to the second sample prediction result.
[0029] In a fifth aspect, the present application provides an electronic device, comprising a memory and at least one processor;
[0030] Wherein, the memory stores computer-executable instructions;
[0031] At least one processor executes the computer-executable instructions stored in the memory, so that the electronic device implements the method of the first aspect or the second aspect mentioned above.
[0032] In a sixth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect or the second aspect.
[0033] In a seventh aspect, the present application provides a computer program product for implementing the method of the first aspect or the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0035] Figure 1 It is a schematic diagram of input and output of a behavior prediction model provided in an embodiment of the present application;
[0036] Figure 2 is a flowchart of a behavior prediction method provided by an embodiment of the present application;
[0037] Figure 3 It is a structural schematic diagram of a user relationship diagram provided in an embodiment of the present application;
[0038] Figure 4This is a schematic diagram of data flow in the behavior prediction process provided by the embodiment of the present application;
[0039] Figure 5 It is a flowchart of the steps of a model training method provided in an embodiment of the present application;
[0040] Figure 6 is a structural block diagram of a behavior prediction device provided in an embodiment of the present application;
[0041] Figure 7 It is a structural block diagram of a model training device provided in an embodiment of the present application;
[0042] Figure 8 It is a structural block diagram of an electronic device provided in an embodiment of the present application.
[0043] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0044] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0045] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0046] It should be noted that the behavior prediction method, model training method and equipment of the present application can be used in the field of artificial intelligence technology, and can also be used in any field outside the field of artificial intelligence technology. The application field of the behavior prediction method, model training method and equipment of the present application is not limited.
[0047] The behavior prediction method and model training method of the embodiments of the present application can be used in any technical scenario. For example, in the financial technology scenario, model training can be used to train a behavior prediction model, so that the trained behavior prediction model can be used to predict whether the user will have a target behavior, and user evaluation and financial decision-making can be performed based on the prediction results. The target behavior here can be any behavior, for example, a behavior that does not meet the preset rules. Of course, the embodiments of the present application do not limit the target behavior.
[0048] In traditional behavior prediction algorithms, some user-related structured data is usually used for prediction. Since the data source used for prediction is relatively single and not comprehensive enough, the prediction accuracy is low.
[0049] In order to solve the above technical problems, the embodiment of the present application combines a variety of unstructured data for behavior prediction and model training based on structured data. In this way, the data source can be enriched, the breadth and comprehensiveness of the data used for prediction can be improved, and the prediction accuracy can be improved.
[0050] In the embodiment of the present application, the first behavior prediction is performed by using unstructured data to obtain the first prediction result, and then the second behavior prediction is performed by combining the first prediction result and the structured data to obtain the second prediction result. In this way, the prediction accuracy can be further improved by using two predictions based on the combination of multiple data sources.
[0051] Corresponding to the above prediction process, a model training method is also proposed to train a behavior prediction model, and the behavior prediction model is used to perform the above second behavior prediction.
[0052] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0053] Figure 1 Schematic diagram of the input and output of a behavior prediction model provided in an embodiment of the present application. Figure 1 As shown, the behavior prediction model is used to perform a second behavior prediction based on the input first vector and the first prediction result, and output a second prediction result. The first prediction result and the second prediction result are both used to indicate whether the user has the target behavior. Figure 1 It can be seen that the two inputs of the behavior prediction model are obtained after a series of processing of user feature data.
[0054] Specifically, first, the structured data and unstructured data in the user feature data are vectorized respectively to obtain a first vector and a second vector. The first vector is used as an input of the behavior prediction model, and the second vector needs to perform a first behavior prediction to obtain a first prediction result, and is used as another input of the behavior prediction model. The first prediction result is a preliminary prediction result obtained based on the second vector, and the second prediction result is a final prediction result obtained by combining the first prediction result and the structured data.
[0055] Above Figure 1 The processing process of the input of the behavior prediction model shown is the same in the behavior prediction method and the model training method.
[0056] Figure 2 is a flowchart of a behavior prediction method provided in an embodiment of the present application. Figure 2 As shown, the behavior prediction method of the present application may include:
[0057] S201: Acquire user characteristic data, where the user characteristic data includes structured data and N types of unstructured data, where N is a positive integer.
[0058] Among them, the above-mentioned structured data is data with a predefined data model, which can be conveniently represented by a two-dimensional logical table of a database. Structured data is usually expressed as tabular data, that is, structured data can be understood as data stored in a table. Structured data may include sub-data of one or more dimensions. The dimensions included in the structured data corresponding to different application scenarios are different. For example, in a loan scenario, structured data may include but is not limited to: basic personal information, historical overdue information, credit limit information, credit information, behavioral information, regional overdue information, consumption information, marketing information, collection information, etc.
[0059] Unstructured data is data that does not have a predefined data model, and can also be understood as data that is not stored in a table. For example, unstructured data can be text data, voice data, image data, user information, application information, etc. Among them, user information is information used to describe the user, including but not limited to: user identification, contact information, etc. Application information is information used to describe the application, including but not limited to: application number, application name, application type, etc. running on the terminal.
[0060] S202: Generate a first vector corresponding to the structured data, and generate second vectors corresponding to N types of unstructured data respectively.
[0061] The first vector is a vector of structured data, and the second vector is a vector of unstructured data. Each type of unstructured data corresponds to a second vector, so N second vectors are obtained. The vectorization process of structured data and unstructured data is different.
[0062] The first vector can directly obtain the corresponding vector through encoding. Structured data can include sub-data of multiple dimensions, and the first vector can be generated based on the sub-data of the target dimension in the structured vector. The target dimension can be predetermined during the model training process, and the target dimension can be understood as the dimension in the structured data that has a greater impact on the prediction. For example, when structured data may include sub-data of the following dimensions: personal basic information, historical overdue information, credit information, behavioral information, regional overdue information, consumption information, marketing information, and collection information, the target dimension can be some of the above dimensions, for example, personal basic information, historical overdue information, credit information, and collection information.
[0063] It can be understood that the target dimension is the dimension that affects the prediction result determined during the model training process, so as to avoid inputting invalid information into the behavior prediction model as much as possible, reduce the number of inputs of the behavior prediction model, simplify the behavior prediction model, avoid feature disaster problems, help improve prediction efficiency, and avoid overfitting. The process of determining the target dimension specifically refers to the relevant description of step S302 in the model training process.
[0064] For N types of unstructured data, N second vector models need to be determined, and the N second vector models correspond to the N types of unstructured data one by one; the corresponding unstructured data are processed by the N second vector models respectively to generate second vectors corresponding to the N types of unstructured data. In this way, the second vector of each unstructured vector can be accurately generated by using the corresponding second vector model, which can improve the accuracy of the second vector.
[0065] For any positive integer i less than or equal to N, the i-th second vector model is used to receive the i-th type of unstructured data and generate a second vector of the i-th type of unstructured data. The i-th second vector model is related to the type of the i-th type of unstructured data, and different types of unstructured data correspond to different second vector models.
[0066] When the N types of unstructured data include: text data, voice data, image data, user information and application information, the second vector may include at least one of the following: a second vector corresponding to the text data, a second vector corresponding to the voice data, a second vector corresponding to the image data, a second vector corresponding to the user information, and a second vector corresponding to the application information.
[0067] If the unstructured data is text data or voice data, the second vector model corresponding to the unstructured data is a text processing model, which is any model that converts input text into a vector. The text processing model is used to receive the above text data and generate a vector of the text data as the second vector of the text data, or to receive the text data converted from the above voice data and generate a vector of the converted text data as the second vector of the voice data.
[0068] Among them, voice data may include collection, telemarketing, customer service conversations, etc., and text data may include but are not limited to: intelligent robot conversation texts, collection texts, and customer service texts, etc. Voice data can be converted into text data through an automatic speech recognition system, such as Whisper. Whisper is an open source automatic speech recognition system trained with multi-language multi-task supervised data, which can convert voice data in multiple languages into text data.
[0069] A commonly used text processing model may be a BERT (Bidirectional Encoder Representations from Transformers) model.
[0070] If the unstructured data is image data, the second vector model corresponding to the unstructured data is an image processing model, which is any model that converts image data into vectors. The image processing model is used to receive the above image data and generate a vector of the image data as the second vector of the image data.
[0071] An image processing model is any machine model that can convert image data into a vector. For example, a commonly used image processing model may be Resnet (Deep Residual Network).
[0072] If the unstructured data is user information or application information, the second vector model corresponding to the unstructured data is an embedding model, which is a model based on encoding to generate vectors. It is used to receive target community characteristics or application information corresponding to the target user determined according to the user information, and generate a vector of the user information as the second vector corresponding to the user information, or to receive application information and generate a vector of the application information as the second vector of the application information.
[0073] For the above application information, the embedding model can discretize and encode the application information to obtain a corresponding second vector. The application information can include an application number, an application name, an application type, and the like.
[0074] The above user information may include user identification and contact information. The user identification may include the user identification corresponding to the target user (referred to as the target user identification) and the user identification of the active user (referred to as the active user identification). Thus, users with the same contact information may be identified as communities one by one, so that the target community is the community where the target user is located. The target community characteristics are the characteristics of the target community, including but not limited to: the number of target users in the target community, the proportion of target users, the target community identification, the overdue characteristics of the target community, the lost contact characteristics, etc.
[0075] The disclosed embodiment can generate second vectors corresponding to different types of unstructured data through different second vector models, thereby realizing the first behavior prediction by combining a plurality of different types of unstructured data, and can improve the prediction accuracy as much as possible.
[0076] In some embodiments, the unstructured data includes user information of at least one user, and the at least one user includes a target user and users other than the target user. Therefore, the second vector of the user information can be generated by the following process: first, a user relationship graph is constructed according to the user information; then, a target community of the target user is determined according to the user relationship graph, and community features of the target community are determined; finally, the community features are input into the embedding model to obtain the second vector corresponding to the user information.
[0077] Among them, the nodes in the user relationship graph are active user identifiers or target user identifiers, and the edges in the user relationship graph are used to indicate that the user identifiers corresponding to the connected nodes use the same contact information. Then, the target community where the target user identifier is located is determined through the label propagation algorithm, so that the characteristics of the target community are used as the target community characteristics.
[0078] Among them, the active user information includes the user information that is active in the recent period of time, and the target user list includes the user information of the target user. The above-mentioned target users may include blacklist users, for example, users who have committed breach of contract. The active status information includes the active user ID and its contact information, and the target user list includes the target user ID and its contact information. The contact information here can be a mobile phone number. Therefore, the nodes in the user relationship graph are active user IDs or target user IDs, and the edges in the user relationship graph are used to indicate that the two user IDs corresponding to the connected nodes use the same contact information. The construction of the user relationship graph can call the Neo4j algorithm.
[0079] Figure 3 Schematic diagram of a user relationship diagram provided in an embodiment of the present application. Figure 3As shown, the user relationship graph includes 6 users, corresponding to user IDs U1 to U6, wherein user ID U1 and user ID U4 are connected by an edge, user IDs U2 and U3 are connected by an edge, and user IDs U5 and U6 are connected by an edge. Therefore, representative user IDs U1 and U4 use the same contact method, user IDs U2 and U3 use the same contact method, and user IDs U5 and U6 use the same contact method. Unconnected user IDs use different contact methods.
[0080] After obtaining the above user relationship graph, users can be clustered by LPA (Label Propagate Algorithm). Figure 3 It can be seen that users can be clustered through the edges of the user relationship graph, and interconnected users can form a community, that is, user IDs in the same community use the same contact information. Figure 3 User identifiers U1 and U4 form a community, user identifiers U2 and U3 form a community, and user identifiers U5 and U6 form a community.
[0081] The user relationship graph is constructed by the target user ID and the active user ID, so that the community may include the target user ID. In the embodiment of the present application, the community where the target user ID is located can be used as the target community, and the community characteristics can be used as the target community characteristics to generate the second vector. In this way, behavior prediction can be performed based on the target community characteristics, which can improve the prediction accuracy of the target behavior.
[0082] The target community features may include but are not limited to: target community ID, target user number, percentage, and overdue and disconnected features in the target community. Numerical features in the target community features can be directly used as the second vector, while character features, such as community ID, overdue and disconnected features, need to be mapped into vectors through the embedding model as the second vector.
[0083] S203: Perform behavior prediction according to the N second vectors to obtain a first prediction result.
[0084] In some embodiments, N second vectors may be fused to perform prediction to obtain a first prediction result. However, this may result in overfitting due to the large number of features included in the second vector. In order to avoid overfitting as much as possible, the N second vectors may be processed separately to obtain N third vectors, where the dimension of the third vector is lower than that of the second vector; then, behavior prediction is performed based on the N third vectors to obtain a first prediction result. The processing here can be understood as dimensionality reduction processing, in which some dimensions of the second vector are deleted, so as to perform behavior prediction based on the retained dimensions after deletion to obtain a first prediction result.
[0085] The dimensions deleted here are the same as those deleted in the last iteration of the model training process. During the model training process, the dimensions deleted corresponding to the feature data of different sample users in the same iteration are the same, while the dimensions deleted corresponding to different iterations can be different.
[0086] When performing behavior prediction based on N third vectors, the N third vectors can be fused to obtain a fused vector, and behavior prediction can be performed based on the fused vector to obtain a first prediction result. Specifically, the N third vectors can be first input into the self-attention layer (Self Attention) for fusion to obtain a fused vector, and then the fused vector can be input into the prediction layer for behavior prediction to obtain the first prediction result. The self-attention layer is used to fuse the third vectors with different attention levels, and the prediction layer is used to perform binary classification behavior prediction based on the fused vector output by the self-attention layer to obtain a first prediction result.
[0087] Among them, the processing process of the self-attention layer mainly includes: first, for the i-th third vector among the above N third vectors, the i-th third vectors of multiple users can be combined into a matrix, called the i-th third vector matrix V3i, and the i-th third vector matrix V3i is converted into three weighted matrices Qi, Ki and Vi respectively through three weight matrices W1, W2 and W3; then, the self-attention weight matrix Ai is calculated through the weighted matrices Qi and Ki, and finally, the corresponding weighted matrix Vi is weighted summed by the respective attention weights Ai to obtain the fusion result. The fusion result is a matrix, called the fusion matrix V, and each row of the fusion matrix V corresponds to the fusion vector of a user.
[0088] Among them, Qi is the product of the i-th third vector matrix V3i and the weight matrix W1, Ki is the product of the i-th third vector matrix V3i and the weight matrix W2, and Vi is the product of the i-th third vector matrix V3i and the weight matrix W3.
[0089] The self-attention weight matrix Ai of the i-th third vector can be calculated by the following formula:
[0090]
[0091] Among them, K T is the transposed matrix of the weight matrix Ki. K is the dimension of the weighted matrix Ki, which can be the number of rows or columns, or the product of the number of rows and columns. Softmax is a commonly used activation function in machine learning, which is used to normalize each row of the matrix.
[0092] The above fusion matrix V can be calculated by the following formula:
[0093]
[0094] Wherein, N is the number of third vectors for each user, which is the same as the number of types of unstructured data N. For example, when the N types of unstructured data include: voice data, text data, image data, application information, and user information, the corresponding third vectors are: the third vector of voice data, the third vector of text data, the third vector of image data, the third vector of application information, and the third vector of user information. At this time, I=5.
[0095] It can be seen that the self-attention layer can fuse multiple third vectors into a fusion vector and input it into the prediction layer. The prediction layer can be a Softmax layer, which is used to normalize the input fusion vector to obtain a first prediction result. Specifically, the fusion vectors of multiple users can be input into the prediction layer in batches, that is, the aforementioned fusion matrix V is input into the prediction layer to obtain a prediction result matrix, and each row of the prediction result matrix corresponds to the first prediction result of a user. For example, the prediction result matrix can be a matrix of 100 rows and 2 columns, so that each row is used to represent the first prediction result of a user, and the first and second columns of each row are used to represent the probability that the user has the target behavior and the probability that the user does not have the target behavior, respectively.
[0096] S204: Input the first vector and the first prediction result into a behavior prediction model to perform behavior prediction and obtain a second prediction result. The first prediction result and the second prediction result are used to indicate whether the user exhibits the target behavior.
[0097] The behavior prediction model may be any machine model with a prediction function, for example, the commonly used machine model XGBOOST model may be used.
[0098] It is understood here that in the behavior prediction method, the behavior prediction model used in S204 is a behavior prediction model trained by a model training method.
[0099] Specifically, the first prediction result and the first vector may be input into a behavior prediction model, and the behavior prediction model may perform a series of operations according to the first prediction result and the first vector to obtain a second prediction result.
[0100] The embodiment of the present application can perform a first behavior prediction through unstructured data to obtain a first prediction result, and perform a second prediction in combination with the first prediction result and structured data, which can effectively improve the prediction accuracy.
[0101] In summary, the embodiments of the present application can perform behavior prediction through structured data and unstructured data. During the behavior prediction process, the data circulates multiple times to finally obtain the second prediction result. Figure 4 It is a schematic diagram of data flow in the behavior prediction process provided in an embodiment of the present application.
[0102] Reference Figure 4 As shown, on the one hand, the structured data in the user feature data is vectorized to obtain a first vector, and the first vector is used as an input of the behavior prediction model (XGBOOST).
[0103] On the other hand, the unstructured data in the user feature data is first vectorized to obtain a second vector, and then some dimensions in each second vector are deleted (Dropout) to obtain multiple third vectors, and then the multiple third vectors are fused through the self-attention layer (Self Attention) to obtain a fused vector. Finally, the fused vector is passed through the prediction layer (Softmax) for behavior prediction to obtain a first prediction result, and the first prediction result is used as another input of the behavior prediction model.
[0104] Among them, the vectorization process is different for different types of unstructured data.
[0105] The voice data may be input into a Whisper model to convert the voice data into text data, and then the converted text data may be input into a text processing model to generate a second vector of the voice data.
[0106] For text data, it can be directly input into a text processing model to generate a second vector of the text data.
[0107] The image data may be input into an image processing model to generate a second vector corresponding to the image data.
[0108] The application information may be input into an embedding model to generate a second vector corresponding to the application information.
[0109] For user information, the corresponding user relationship graph can be constructed through the user information, and then the user relationship graph can be input into the label propagation algorithm (LPA) to generate the target community feature, which is the feature of the community where the target user is located. Finally, the target community feature is input into the embedding model to generate the second vector of user information.
[0110] After deleting some dimensions from the second vector of the voice data, a third vector of the voice data is obtained. After deleting some dimensions from the second vector of the text data, a third vector of the text data is obtained. After deleting some dimensions from the second vector of the image data, a third vector of the image data is obtained. After deleting some dimensions from the second vector of the application information, a third vector of the application information is obtained. After deleting some dimensions from the second vector of the user information, a third vector of the application information is obtained. In this way, five second vectors can be obtained, which can be input into the self-attention layer for fusion to obtain a fusion vector.
[0111] It should be noted that the target community features input into the embedding model are character data, and the numerical data in the target community features can be directly input into the behavior prediction model.
[0112] After the behavior prediction model receives the first vector, the first prediction result, and the numerical data in the target community feature, a second prediction may be performed to obtain a second prediction result.
[0113] It should be noted that the above Figure 4 The process shown is applicable to the behavior prediction method, and the processing flow of the model training method is the same as Figure 4 The difference is that the model training method includes multiple rounds of iterations, each of which includes the above Figure 4 In addition to the process shown, the loss value is also calculated based on the second sample prediction result output by the behavior prediction model, so as to update the parameters of the behavior prediction model through the next round of iteration until the loss value meets the preset convergence condition, and the current behavior prediction model is used as the trained behavior prediction model.
[0114] It is understandable that structured data may include but is not limited to: user history overdue information, user basic information, credit information, marketing information, approval feedback information, regional information, etc., and unstructured data may include but is not limited to: application information, user information, image data, text data, voice data, etc., so that Figure 4 The process shown realizes prediction by integrating multiple data, which can form user portraits more accurately and improve prediction accuracy as much as possible.
[0115] Corresponding to the above behavior prediction method, Figure 5 is a flowchart of the steps of a model training method provided in an embodiment of the present application. Figure 5 As shown, the above model training method includes:
[0116] S301: Acquire characteristic data of sample users, where the characteristic data of sample users includes sample structured data and N types of sample unstructured data, where N is a positive integer.
[0117] Step S301 in the model training method is implemented in the same manner as step S201 in the aforementioned behavior prediction method. The characteristic data of the sample user corresponds to the user characteristic data in the aforementioned step S201, the sample structured data corresponds to the structured data in the aforementioned S201, and the sample unstructured data corresponds to the aforementioned unstructured data. The sample user and the user in the aforementioned S201 may be the same user or different users, and the characteristic data of the sample user may also be the same as or different from the aforementioned user characteristic data.
[0118] S302: Generate a first sample vector corresponding to the sample structured data, and generate second sample vectors corresponding to N types of sample unstructured data respectively.
[0119] Step S302 in the model training method is implemented in the same manner as S202 in the aforementioned behavior prediction method. The first sample vector is the vectorized representation result corresponding to the sample structured data, and the first sample vector corresponds to the first vector in the aforementioned step S202. The second sample vector is the vectorized representation result corresponding to the sample unstructured data, and corresponds to the second vector in the aforementioned S202.
[0120] As can be seen from the description of the aforementioned step S202, the structured data may include sub-data of multiple dimensions, and the first vector of the structured data may be generated based on sub-data of at least one target dimension among these dimensions. Therefore, correspondingly, in the model training method, the target dimension needs to be determined in advance.
[0121] Specifically, first, the importance of each dimension is predicted respectively by multiple prediction algorithms to obtain multiple importance parameters corresponding to each dimension; then, the target dimension is determined according to the multiple importance parameters of each dimension; finally, the first sample vector is generated according to the sub-data of the target dimension.
[0122] Among them, the importance prediction principles of multiple prediction algorithms are different, so that the accuracy of the importance parameter of each dimension can be improved to avoid losing sub-data of important dimensions as much as possible.
[0123] For each dimension of sub-data, it can be predicted by a variety of prediction algorithms to obtain multiple importance parameters. There are two strategies for screening target dimensions by using multiple importance parameters.
[0124] In the first target dimension screening strategy, the target dimensions are screened according to multiple importance parameters. For example, for each importance parameter obtained by the prediction algorithm, the target dimension is screened by the importance parameter, so that the target dimensions screened by the importance parameters of all prediction algorithms are merged into the final screened target dimension.
[0125] In the second screening strategy for the target dimension, the importance parameters obtained by multiple prediction algorithms are merged into the importance parameters of the sub-data of the dimension, and then the target dimension is screened. The importance parameters obtained by multiple prediction algorithms can be summed, weighted summed, averaged, multiplied, etc., as the importance parameters of the sub-data of the dimension. Furthermore, one or more dimensions with the highest importance parameters can be used as target dimensions, including but not limited to: the dimension at the front position after arranging multiple dimensions in descending order according to the importance parameters is used as the target dimension, or the dimension with an importance parameter greater than or equal to a preset threshold is used as the target dimension.
[0126] After obtaining the target dimension, a first vector can be generated according to the sub-data of the target dimension in the structured data in the behavior prediction method, and a first sample vector can be generated according to the sub-data of the target dimension in the sample structured data in the model training method.
[0127] In order to improve the prediction accuracy of the importance parameter as much as possible, it is necessary to adopt a prediction algorithm with completely different prediction principles. Optionally, a linear prediction algorithm and a nonlinear prediction algorithm can be used. The linear prediction algorithm is used to use the linear correlation between the sub-data of each dimension and the target behavior as the importance parameter of the sub-data of the dimension, and the nonlinear prediction algorithm is used to predict the importance parameter of each dimension through a machine model.
[0128] Among them, the linear prediction algorithm can be implemented by a function for calculating the correlation between variables. For example, the Pearson correlation function can be used to calculate the Pearson correlation coefficient between the sub-data and the target behavior of each dimension as the importance parameter of the sub-data of the dimension. Specifically, for each dimension, the sub-data of each sample user on the dimension can be used as the value of the first variable, and the label of whether the target behavior exists for each sample user can be used as the value of the second variable. For example, label 1 represents that the sample user has the target behavior, and label 0 represents that the sample user does not have the target behavior. In this way, the value of the first variable and the value of the second variable can be input into the Pearson correlation function, and the Pearson correlation coefficient between the first variable and the second variable can be calculated as the importance parameter of the sub-data of the dimension.
[0129] The value of the Pearson correlation coefficient can be in the interval [-1, 1], where 1 represents a complete positive correlation, -1 represents a complete negative correlation, and 0 represents no correlation.
[0130] In the above nonlinear prediction algorithm, the XGBOOST model can be used as a nonlinear prediction model to obtain its importance parameter according to the sub-data prediction of each dimension.
[0131] Similar to the unstructured data in the behavior prediction method, the sample unstructured data also includes at least one of the following: text data, voice data, image data, application information, and user information. For different types of sample unstructured data, different second vector models are required to generate second sample vectors. Specifically, first, N second vector models are determined, and the N second vector models correspond one-to-one to the N types of sample unstructured data; then, the corresponding sample unstructured data are processed by the N second vector models respectively to generate second sample vectors corresponding to the N types of sample unstructured data. The second vector model corresponding to each of the above-mentioned sample unstructured data is determined according to the type of the sample unstructured data.
[0132] Specifically, the process of generating the second sample vector includes the following steps.
[0133] If the sample unstructured data is text data or voice data, the second vector model corresponding to the sample unstructured data is a text processing model.
[0134] If the sample unstructured data is image data, the second vector model corresponding to the sample unstructured data is an image processing model.
[0135] If the sample unstructured data is user information or application information, the second vector model corresponding to the sample unstructured data is an embedding model.
[0136] The second vector model mentioned above can refer to the second vector model in the aforementioned behavior prediction method, which will not be described in detail here.
[0137] S303: Perform behavior prediction according to the N second sample vectors to obtain a first sample prediction result.
[0138] Similar to the prediction process based on the second vector in the aforementioned behavior prediction method, in the model training method, the process of performing behavior prediction based on the second sample vector to obtain the first sample prediction result is specifically as follows: N second sample vectors are processed separately to obtain N third sample vectors, and the dimension of the third sample vector is lower than the dimension of the second sample vector; then, behavior prediction is performed based on the N third sample vectors to obtain the first sample prediction result.
[0139] After obtaining the first sample prediction result, the N third sample vectors are fused to obtain a sample fusion vector; behavior prediction is performed according to the sample fusion vector to obtain the first sample prediction result.
[0140] It should be noted that the above prediction process based on the second sample vector can refer to the detailed description of S203 above, which will not be repeated here.
[0141] S304: Input the first sample vector and the first sample prediction result into the behavior prediction model to perform behavior prediction, and obtain a second sample prediction result. The first sample prediction result and the second sample prediction result are used to indicate whether the sample user exhibits the target behavior.
[0142] It can be understood that step S304 in the model training method is implemented in the same manner as step S204 in the aforementioned behavior prediction method, and will not be described in detail here.
[0143] S305: Update the parameters of the behavior prediction model according to the second sample prediction result.
[0144] It can be understood that, compared with the aforementioned behavior prediction method, the model training method needs to update the parameters of the behavior prediction model through step S305 after obtaining the second sample prediction result.
[0145] Specifically, based on the second sample prediction result and in combination with the sample importance parameter preset for the characteristic data of the sample user, a loss value is determined to adjust and optimize the behavior prediction model according to the loss value.
[0146] Among them, the sample importance parameter is positively correlated with the loss value. Based on the prediction result of the second sample, when the sample importance parameter is larger, the loss value is larger, which means that the sample has a greater impact on the model adjustment. Conversely, when the sample importance parameter is smaller, the loss value is smaller, which means that the sample has a smaller impact on the model adjustment.
[0147] The traditional loss function is the cross entropy loss function, which calculates the loss value based on the prediction result of the second sample. The cross entropy loss function is as follows:
[0148]
[0149] Where L is the loss value. M is the number of samples, and each sample includes the feature data of a sample user and the label Yj of the sample user. Pj is the second sample prediction result corresponding to the jth sample user, and Yj is used to indicate whether the jth sample user has the target behavior.
[0150] However, in the risk control scenario, since there are relatively few abnormal users or overdue users, the traditional cross entropy loss function may be biased, resulting in the model being unable to accurately capture these important but fewer samples. In order to solve this problem, the embodiment of the present application is based on the following loss function:
[0151]
[0152] Among them, FL is the loss value calculated by the Focal Loss loss function, and αj, Rj, and Sj are the adjustable coefficients of the jth sample user.
[0153] αj is a dynamic adjustment coefficient used to represent the weight of the category corresponding to the jth sample. It can be set according to the distribution of the number of samples in this category in the total number of samples. For example, αj can be the ratio between the total number of samples and the number of samples in this category.
[0154] Rj is an adaptive exponential parameter used to represent the relative frequency of the category corresponding to the i-th sample, and can also be set according to the distribution of samples of this category in the total number of samples. For example, Rj can be the proportion of the number of samples of this category in the total number of samples.
[0155] Sj is the sample importance parameter of the jth sample.
[0156] Above It can be recorded as γj, which is understood as the attention coefficient, which is used to adjust the attention weight of each sample. β is a hyperparameter that controls the steepness of the attention curve and can be flexibly set according to the actual scenario.
[0157] The loss function given by the above formula (4) in the embodiment of the present application is an improvement based on the Focal Loss function. Of course, in practical applications, the cross entropy loss function can also be improved by the above γj to obtain the loss function used in the embodiment of the present application.
[0158] In some implementations, the sample importance parameter is associated with the business scenario corresponding to the characteristic data of the sample user to adjust the sample importance in different business scenarios.
[0159] In summary, the embodiment of the present application can adjust the loss function through αj, Rj and Sj to balance the influence of samples of different categories on the training process through αj and Rj, and to increase the influence of important samples through Sj. When calculating the loss value, more attention is paid to samples that are difficult to classify but important, which can improve the prediction accuracy of the behavior prediction model in scenarios with a small number of samples.
[0160] Figure 6 is a structural block diagram of a behavior prediction device provided in an embodiment of the present application, referring to Figure 6 As shown, the above-mentioned behavior prediction device 400 includes:
[0161] The feature data acquisition module 401 is used to acquire user feature data, where the user feature data includes structured data and N types of unstructured data, where N is a positive integer.
[0162] The vector generating module 402 is used to generate a first vector corresponding to the structured data, and to generate second vectors corresponding to the N types of unstructured data respectively.
[0163] The first prediction module 403 is used to perform behavior prediction according to the N second vectors to obtain a first prediction result.
[0164] The second prediction module 404 is used to input the first vector and the first prediction result into the behavior prediction model to perform behavior prediction and obtain a second prediction result, wherein the first prediction result and the second prediction result are used to indicate whether the user has a target behavior.
[0165] Optionally, the first prediction module 403 is further configured to:
[0166] The N second vectors are processed respectively to obtain N third vectors, where the dimension of the third vector is lower than the dimension of the second vector; and behavior prediction is performed according to the N third vectors to obtain the first prediction result.
[0167] Optionally, the first prediction module 403 is further used for:
[0168] The N third vectors are fused to obtain a fused vector; and behavior prediction is performed according to the fused vector to obtain the first prediction result. Optionally, the vector generation module 402 is further used to:
[0169] Determine N second vector models, where the N second vector models correspond one-to-one to the N types of unstructured data; and process the corresponding unstructured data respectively through the N second vector models to generate second vectors corresponding to the N types of unstructured data respectively.
[0170] Optionally, if the unstructured data is text data or voice data, the second vector model corresponding to the unstructured data is a text processing model; if the unstructured data is image data, the second vector model corresponding to the unstructured data is an image processing model; if the unstructured data is user information or application information, the second vector model corresponding to the unstructured data is an embedding model.
[0171] Optionally, the unstructured data is user information; the vector generation module 402 is further used to:
[0172] A user relationship graph is constructed according to the user information; a target community in which a target user is located is determined according to the user relationship graph, and community features of the target community are determined; and the community features are input into the embedding model to obtain a second vector corresponding to the user information.
[0173] The above-mentioned device embodiment corresponds to the above-mentioned behavior prediction method embodiment. For specific descriptions, reference can be made to the descriptions in the above-mentioned method embodiment, and the embodiments of the present application will not be repeated here.
[0174] Figure 7 This is a structural block diagram of a model training device provided in an embodiment of the present application, referring to Figure 7 As shown, the above-mentioned model training device 500 includes:
[0175] The sample characteristic data acquisition module 501 is used to acquire characteristic data of sample users, where the characteristic data of sample users includes sample structured data and N types of sample unstructured data, where N is a positive integer.
[0176] The sample vector generating module 502 is used to generate a first sample vector corresponding to the sample structured data, and to generate second sample vectors corresponding to the N types of sample unstructured data respectively.
[0177] The first sample prediction module 503 is used to perform behavior prediction according to the N second sample vectors to obtain a first sample prediction result.
[0178] The second sample prediction module 504 is used to input the first sample vector and the first sample prediction result into the behavior prediction model to perform behavior prediction and obtain a second sample prediction result. The first sample prediction result and the second sample prediction result are used to indicate whether the sample user exhibits the target behavior.
[0179] The model updating module 505 is used to update the parameters of the behavior prediction model according to the second sample prediction result.
[0180] Optionally, the structured data includes sub-data of at least one dimension, and the sample vector generating module 502 is further used for:
[0181] The importance of the dimensions is predicted respectively by multiple prediction algorithms to obtain multiple importance parameters of the dimensions; the target dimension is determined according to the multiple importance parameters of the dimensions; and a first sample vector is generated according to the sub-data of the target dimension.
[0182] Optionally, the multiple prediction algorithms include a linear prediction algorithm and a nonlinear prediction algorithm, the linear prediction algorithm is used to take the linear correlation between the sub-data of the dimension and the target behavior as the importance parameter, and the nonlinear prediction algorithm is used to predict the importance parameter through a machine model.
[0183] Optionally, the first sample prediction module 503 is further used for:
[0184] The N second sample vectors are processed respectively to obtain N third sample vectors, where the dimension of the third sample vector is lower than the dimension of the second sample vector; behavior prediction is performed based on the N third sample vectors to obtain the first sample prediction result.
[0185] Optionally, the first sample prediction module 503 is further used for:
[0186] Fusing the N third sample vectors to obtain a sample fusion vector;
[0187] Behavior prediction is performed according to the sample fusion vector to obtain the first sample prediction result.
[0188] Optionally, the model updating module 505 is further used for:
[0189] Based on the second sample prediction result and in combination with the sample importance parameter preset for the characteristic data of the sample user, a loss value is determined, and the sample importance parameter is positively correlated with the loss value.
[0190] The parameters of the behavior prediction model are updated according to the loss value.
[0191] Optionally, the sample importance parameter is associated with a business scenario corresponding to the characteristic data of the sample user.
[0192] Optionally, the sample vector generating module 502 is further used for:
[0193] Determine N second vector models, where the N second vector models correspond one-to-one to the N types of sample unstructured data; and process the corresponding sample unstructured data respectively through the N second vector models to generate second sample vectors corresponding to the N types of sample unstructured data respectively.
[0194] Optionally, if the sample unstructured data is text data or voice data, the second vector model corresponding to the sample unstructured data is a text processing model.
[0195] If the sample unstructured data is image data, the second vector model corresponding to the sample unstructured data is an image processing model.
[0196] If the sample unstructured data is user information or application information, the second vector model corresponding to the sample unstructured data is an embedding model.
[0197] The above-mentioned device embodiment corresponds to the aforementioned model training method embodiment. For specific descriptions, reference can be made to the descriptions in the aforementioned method embodiment, and the embodiments of the present application will not be repeated here.
[0198] Figure 8 6 is a block diagram of an electronic device provided in an embodiment of the present application. The electronic device 600 includes a memory 602 and at least one processor 601 .
[0199] The memory 602 stores computer-executable instructions.
[0200] At least one processor 601 executes computer-executable instructions stored in the memory 602, so that the electronic device 600 implements the aforementioned model training method or behavior prediction method.
[0201] In addition, the electronic device 600 may further include a receiver 603 and a transmitter 604. The receiver 603 is used to receive information from other devices or equipment and forward it to the processor 601. The transmitter 604 is used to send the information to other devices or equipment.
[0202] In an exemplary embodiment, a non-temporary computer-readable storage medium is also provided, in which computer-readable storage medium is stored computer-executable instructions, which are used to implement the above-mentioned model training method or behavior prediction method when executed by a processor.
[0203] In an exemplary embodiment, a computer program product is also provided for implementing the aforementioned model training method or behavior prediction method.
[0204] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0205] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A behavior prediction method, characterized in that: include: Acquire user characteristic data, wherein the user characteristic data includes structured data and N types of unstructured data, where N is a positive integer; Generate a first vector corresponding to the structured data, and generate second vectors corresponding to the N types of unstructured data respectively; Performing behavior prediction according to the N second vectors to obtain a first prediction result; The first vector and the first prediction result are input into a behavior prediction model to perform behavior prediction to obtain a second prediction result, wherein the first prediction result and the second prediction result are used to indicate whether the user exhibits a target behavior.
2. The method according to claim 1, characterized in that The performing behavior prediction according to the N second vectors to obtain a first prediction result includes: Processing the N second vectors respectively to obtain N third vectors, where the dimension of the third vector is lower than the dimension of the second vector; Behavior prediction is performed based on the N third vectors to obtain the first prediction result.
3. The method according to claim 2, characterized in that The performing behavior prediction according to the N third vectors to obtain the first prediction result includes: Fusing the N third vectors to obtain a fused vector; Behavior prediction is performed according to the fusion vector to obtain the first prediction result.
4. The method according to any one of claims 1 to 3, characterized in that: The generating second vectors respectively corresponding to the N types of unstructured data includes: Determine N second vector models, where the N second vector models correspond one-to-one to the N types of unstructured data; The corresponding unstructured data are processed respectively by using N second vector models to generate second vectors corresponding to the N types of unstructured data respectively.
5. The method according to claim 4, characterized in that If the unstructured data is text data or voice data, the second vector model corresponding to the unstructured data is a text processing model; If the unstructured data is image data, the second vector model corresponding to the unstructured data is an image processing model; If the unstructured data is user information or application information, the second vector model corresponding to the unstructured data is an embedding model.
6. The method according to claim 5, characterized in that The unstructured data is user information; Processing the user information by using the embedding model to generate a second vector corresponding to the user information includes: Constructing a user relationship graph according to the user information; Determine a target community where the target user belongs according to the user relationship graph, and determine community characteristics of the target community; The community feature is input into the embedding model to obtain a second vector corresponding to the user information.
7. A model training method, characterized in that: The method comprises: Acquire characteristic data of sample users, wherein the characteristic data of the sample users includes sample structured data and N types of sample unstructured data, where N is a positive integer; Generate a first sample vector corresponding to the sample structured data, and generate second sample vectors corresponding to the N types of sample unstructured data respectively; Performing behavior prediction according to the N second sample vectors to obtain a first sample prediction result; Inputting the first sample vector and the first sample prediction result into a behavior prediction model to perform behavior prediction, and obtaining a second sample prediction result, wherein the first sample prediction result and the second sample prediction result are used to indicate whether the sample user has a target behavior; The parameters of the behavior prediction model are updated according to the second sample prediction result.
8. A behavior prediction device, characterized in that: include: A feature data acquisition module, used to acquire user feature data, wherein the user feature data includes structured data and N types of unstructured data, where N is a positive integer; A vector generation module, used to generate a first vector corresponding to the structured data, and to generate second vectors corresponding to the N types of unstructured data respectively; A first prediction module, configured to perform behavior prediction according to the N second vectors to obtain a first prediction result; The second prediction module is used to input the first vector and the first prediction result into the behavior prediction model to perform behavior prediction and obtain a second prediction result, wherein the first prediction result and the second prediction result are used to indicate whether the user exhibits a target behavior.
9. A model training device, characterized in that: include: A sample feature data acquisition module is used to acquire feature data of sample users, wherein the feature data of sample users includes sample structured data and N types of sample unstructured data, where N is a positive integer; A sample vector generating module, used to generate a first sample vector corresponding to the sample structured data, and to generate second sample vectors corresponding to the N types of sample unstructured data respectively; A first sample prediction module, used for performing behavior prediction according to the N second sample vectors to obtain a first sample prediction result; A second sample prediction module, used for inputting the first sample vector and the first sample prediction result into a behavior prediction model to perform behavior prediction, and obtaining a second sample prediction result, wherein the first sample prediction result and the second sample prediction result are used to indicate whether the sample user has a target behavior; A model updating module is used to update the parameters of the behavior prediction model according to the second sample prediction result.
10. An electronic device comprising a memory and at least one processor; in, The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the electronic device implements the behavior prediction method described in any one of claims 1 to 6, or the model training method described in claim 7.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the behavior prediction method as described in any one of claims 1 to 6, or the model training method as described in claim 7.
12. A computer program product, characterized in that Used to implement the behavior prediction method as described in any one of claims 1 to 6, or the model training method as described in claim 7.
