Model training method, device, equipment and storage medium

By using the encoder model to learn the difference between positive and negative data samples in the sample set and adjusting parameters under low resource conditions, the problem of sparse representation and low discrimination of risk control model samples is solved, and a uniform representation of data samples and a risk control model are achieved. The distinction is improved.

CN114548273BActive Publication Date: 2024-09-13CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210162019.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-22
Publication Date
2024-09-13
Estimated Expiration
2042-02-22

AI Technical Summary

Technical Problem

Under low resource conditions, the sample representation of the risk control model is sparse and has large dimensions, and the degree of discrimination is low, making it difficult to effectively distinguish the differences between different data samples.

Method used

By obtaining a sample set, selecting positive data samples and negative data samples, using the encoder model to learn vector differences, and adjusting parameters until the target conditions are met, an encoder model that can uniformly represent data samples is obtained.

Benefits of technology

It achieves uniform representation and differentiation of data samples, improving the differentiation and prediction accuracy of the risk control model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114548273B
    Figure CN114548273B
Patent Text Reader

Abstract

The present application relates to the field of server artificial intelligence technology. The present application provides a model training method, device, equipment and storage medium. The model training method includes: obtaining a sample set, selecting a positive data sample to be calculated from the sample set, inputting the original vector corresponding to the positive data sample to be calculated into the encoder model, and obtaining a first vector pair; using n-1 data samples as n-1 negative data samples, inputting the original vector corresponding to the negative data sample into the encoder model, and obtaining a second vector pair; determining a loss value based on the difference between the vectors in the first vector pair and the difference between the vector in the first vector pair and the vector in each second vector pair; if the loss value does not meet the target condition, adjusting the parameters of the encoder model according to the loss value until the loss value meets the target condition, and obtaining a trained encoder model. Implementation of the present application allows the encoder model to learn the distinction between data samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a model training method, apparatus, device and storage medium. Background Art

[0002] Risk control models have a wide range of application scenarios in insurance underwriting and claims, credit risk control, etc. Using risk control models in online scenarios will encounter low-resource problems with little labeled data. In the case of low resources, there are only a small number of samples of each annotation type. When representing samples, the existing technology determines multiple vectors based on the values ​​of each data in the sample. The dimension of each vector is the same as the type of data value in the corresponding sample. For example, if the sample includes age and the value is 20 years old, the age is classified from 1 to 50 years old into 50 categories, and the dimension of the matrix corresponding to age is 50. For the vector corresponding to the age in the sample, only the dimension corresponding to 20 years old is 1, and the other dimensions are all 0. It can be seen that it is a very sparse matrix. The vectors used by the existing technology to represent samples are very sparse, and the dimensions are usually large, and the degree of distinction is very low. Summary of the invention

[0003] Based on this, it is necessary to provide a model training method, device, equipment and storage medium to address the above-mentioned technical problems. The encoder model trained by this application can achieve uniform representation of data samples, distinguish the differences between different data samples, and learn the distinction between data samples.

[0004] In a first aspect, the present application provides a model training method, the method comprising:

[0005] Acquire a sample set, where the sample set includes n data samples, where n is an integer greater than or equal to 2;

[0006] Selecting a data sample from the sample set as a positive data sample to be calculated, inputting an original vector corresponding to the positive data sample to be calculated into an encoder model, obtaining a first vector pair corresponding to the positive data sample to be calculated, and setting a positive data sample identifier for the selected data sample;

[0007] Taking n-1 data samples in the sample set except the positive data sample to be calculated as n-1 negative data samples, inputting the original vector corresponding to each negative data sample into the encoder model, and obtaining second vector pairs corresponding to each negative data sample;

[0008] determining a loss value based on differences between vectors in the first vector pair and differences between vectors in the first vector pair and vectors in each of the second vector pairs;

[0009] If the loss value does not meet the target condition, the parameters of the encoder model are adjusted according to the loss value, and a data sample without the positive data sample identifier is selected from the sample set as the positive data sample to be calculated, and the original vector corresponding to the positive data sample to be calculated is input into the encoder model with adjusted parameters until the loss value meets the target condition to obtain a trained encoder model.

[0010] In combination with the first aspect, in some embodiments, the first vector pair includes a first output vector and a second output vector, the first output vector has the same representation as the original vector corresponding to the positive data sample to be calculated, and the second output vector has a different representation from the original vector corresponding to the positive data sample to be calculated;

[0011] The second vector pair includes a third output vector and a fourth output vector, the third output vector is the same as the original vector representation corresponding to the negative data sample, and the fourth output vector is different from the original vector representation corresponding to the negative data sample;

[0012] The determining of the loss value according to the difference between the vectors in the first vector pair and the difference between the vector in the first vector pair and the vectors in each of the second vector pairs comprises:

[0013] calculating a first cosine distance between the first output vector and the second output vector in the first vector pair;

[0014] Calculate the second cosine distances between the first output vector in the first vector pair and the fourth output vectors in n-1 second vector pairs respectively;

[0015] A loss value is determined according to the first cosine distance and n-1 second cosine distances.

[0016] In combination with the first aspect, in some embodiments, after obtaining the sample set, the method further includes:

[0017] Obtaining target attribute information of each data sample in the n data samples;

[0018] According to the target attribute information of each data sample, the original vector corresponding to each data sample is determined respectively.

[0019] In conjunction with the first aspect, in some embodiments, the target attribute information of the data sample includes attribute information corresponding to each attribute of at least one attribute of the data sample;

[0020] Determining the original vectors corresponding to the data samples according to the target attribute information of the data samples includes:

[0021] Respectively obtain the target category to which the attribute information corresponding to each attribute in the target attribute information belongs;

[0022] Using an information conversion algorithm corresponding to the target category, converting the attribute information corresponding to the attribute into a representation vector corresponding to the attribute;

[0023] The representation vectors corresponding to the respective attributes of the at least one attribute are concatenated to obtain the original vector corresponding to the data sample.

[0024] In combination with the first aspect, in some embodiments, the using an information conversion algorithm corresponding to the target category to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute includes:

[0025] If the target category is a discrete numerical type, a dictionary encoding algorithm is used to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute;

[0026] If the target category is a continuous numerical type, a numerical algorithm is used to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute;

[0027] If the target category is a text type or an image type, a Bert encoding algorithm is used to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute.

[0028] In combination with the first aspect, in some embodiments, after obtaining the trained encoder model, the method further includes:

[0029] Obtain training samples for training the risk control model to be trained;

[0030] Obtaining a target original vector corresponding to the training sample;

[0031] Inputting the target original vector into the trained encoder model to obtain a target output vector;

[0032] The target output vector is input into the risk control model to be trained to train the risk control model to be trained.

[0033] In combination with the first aspect, in some embodiments, inputting the target output vector into the risk control model to be trained to train the risk control model to be trained includes:

[0034] Inputting the target output vector into the risk control model to be trained to obtain the predicted risk level corresponding to the training sample;

[0035] According to the difference between the predicted risk level and the actual risk level corresponding to the training sample, the parameters of the risk control model to be trained are adjusted.

[0036] In a second aspect, the present application provides a model training device, the device comprising:

[0037] A first acquisition unit, configured to acquire a sample set, wherein the sample set includes n data samples, where n is an integer greater than or equal to 2;

[0038] A second acquisition unit is used to select a data sample from the sample set as a positive data sample to be calculated, input the original vector corresponding to the positive data sample to be calculated into the encoder model, obtain a first vector pair corresponding to the positive data sample to be calculated, and set a positive data sample identifier for the selected data sample;

[0039] a third acquisition unit, configured to use n-1 data samples in the sample set except the positive data sample to be calculated as n-1 negative data samples, input the original vector corresponding to each negative data sample into the encoder model, and obtain second vector pairs corresponding to each negative data sample;

[0040] a first determining unit, configured to determine a loss value according to a difference between vectors in the first vector pair and a difference between a vector in the first vector pair and a vector in each of the second vector pairs;

[0041] A parameter adjustment unit is used to adjust the parameters of the encoder model according to the loss value if the loss value does not meet the target condition, and select a data sample without the positive data sample identifier from the sample set as the positive data sample to be calculated, and input the original vector corresponding to the positive data sample to be calculated into the encoder model after parameter adjustment until the loss value meets the target condition to obtain a trained encoder model.

[0042] In conjunction with the second aspect, in some embodiments, the first vector pair includes a first output vector and a second output vector, the first output vector has the same representation as the original vector corresponding to the positive data sample to be calculated, and the second output vector has a different representation from the original vector corresponding to the positive data sample to be calculated;

[0043] The second vector pair includes a third output vector and a fourth output vector, the third output vector is the same as the original vector representation corresponding to the negative data sample, and the fourth output vector is different from the original vector representation corresponding to the negative data sample;

[0044] The first determining unit is specifically configured to: calculate a first cosine distance between the first output vector and the second output vector in the first vector pair;

[0045] Calculate the second cosine distances between the first output vector in the first vector pair and the fourth output vectors in n-1 second vector pairs respectively;

[0046] A loss value is determined according to the first cosine distance and n-1 second cosine distances.

[0047] In conjunction with the second aspect, in some embodiments, the apparatus further includes:

[0048] A fourth acquisition unit, used to acquire target attribute information of each data sample in the n data samples;

[0049] The second determining unit is used to determine the original vector corresponding to each data sample according to the target attribute information of each data sample.

[0050] In conjunction with the second aspect, in some embodiments, the target attribute information of the data sample includes attribute information corresponding to each attribute of at least one attribute of the data sample;

[0051] The second determining unit is specifically used to: respectively obtain the target category to which the attribute information corresponding to each attribute in the target attribute information belongs;

[0052] Using an information conversion algorithm corresponding to the target category, converting the attribute information corresponding to the attribute into a representation vector corresponding to the attribute;

[0053] The representation vectors corresponding to the respective attributes of the at least one attribute are concatenated to obtain the original vector corresponding to the data sample.

[0054] In conjunction with the second aspect, in some embodiments, the second determining unit is specifically configured to: if the target category is a discrete numerical type, convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute using a dictionary encoding algorithm;

[0055] If the target category is a continuous numerical type, a numerical algorithm is used to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute;

[0056] If the target category is a text type or an image type, a Bert encoding algorithm is used to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute.

[0057] In conjunction with the second aspect, in some embodiments, the apparatus further includes:

[0058] A fifth acquisition unit, used to acquire training samples for training the risk control model to be trained;

[0059] A sixth acquisition unit, used to acquire a target original vector corresponding to the training sample;

[0060] a seventh acquisition unit, configured to input the target original vector into the trained encoder model to obtain a target output vector;

[0061] The risk control model training unit is used to input the target output vector into the risk control model to be trained so as to train the risk control model to be trained.

[0062] In conjunction with the second aspect, in some embodiments, the risk control model training unit is specifically used to:

[0063] Inputting the target output vector into the risk control model to be trained to obtain the predicted risk level corresponding to the training sample;

[0064] According to the difference between the predicted risk level and the actual risk level corresponding to the training sample, the parameters of the risk control model to be trained are adjusted.

[0065] In a third aspect, the present application provides a model training device, comprising a processor, a memory, and a communication interface, wherein the processor, the memory, and the communication interface are interconnected, wherein the communication interface is used to receive and send data, the memory is used to store program code, and the processor is used to call the program code to execute the method described in the first aspect and any possible implementation method of the first aspect.

[0066] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored therein; when the computer program runs on one or more processors, the processor executes the method described in the first aspect and any possible implementation of the first aspect.

[0067] In an embodiment of the present application, when training the encoder model, one data sample in the sample set is used as the positive data sample to be calculated, and all other samples are used as negative data samples. The positive data sample to be calculated is input into the encoder model to obtain a first vector pair, and each negative data sample is input into the encoder model to obtain at least one second vector pair. The parameters of the encoder model are adjusted by the difference between the two vectors in the first vector pair and the difference between the vector in the first vector pair and the vector in the second vector pair, so that the encoder model learns the commonalities between similar vectors and the distinction between different data samples. The encoder model of the present application performs fusion learning on each dimension in the original vector, so as to achieve uniform representation of the data samples. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments are briefly introduced below.

[0069] Figure 1 A flowchart of a model training method provided in an embodiment of the present application;

[0070] Figure 2 A flowchart of another model training method provided in an embodiment of the present application;

[0071] Figure 3 A schematic diagram of an encoder model provided in an embodiment of the present application;

[0072] Figure 4 A schematic diagram of a model training device provided in an embodiment of the present application;

[0073] Figure 5 A schematic diagram of another model training device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0074] The present invention is further described in detail below in conjunction with the accompanying drawings.

[0075] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0076] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0077] The embodiment of the present application provides a model training method. In order to more clearly describe the scheme of the present application, some drawings involved in the present application are further introduced below.

[0078] See also Figure 1 , Figure 1 A flow chart of a model training method provided in an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:

[0079] Step 110, obtaining a sample set, wherein the sample set includes n data samples, where n is an integer greater than or equal to 2;

[0080] In an embodiment of the present application, a data sample in a sample set may be a batch of data samples, and the sample set includes n data samples, where n may be an integer greater than or equal to 2. The data sample may be a user or a product, for example, the sample set may include user identifiers of n users. Further, target attribute information of each data sample in the n data samples is obtained respectively, and the original vector corresponding to each data sample is determined respectively according to the target attribute information of each data sample, that is, the target attribute information of each data sample is converted into a corresponding original vector.

[0081] Exemplarily, the target attribute information of the data sample may include attribute information corresponding to each attribute of at least one attribute of the data sample. For example, the at least one attribute may be various attributes of the user, such as one or more of age, gender, native place, occupation, and income, etc. For another example, the attribute information corresponding to the at least one attribute may include: age: 30, gender: male, native place: Hubei, occupation: IT, income: 8k, etc. It can be understood that the categories of the attribute information of each attribute may include but are not limited to text, numbers, images, etc.

[0082] When converting the target attribute information into the corresponding original vector, the target category to which the attribute information corresponding to each attribute in the target attribute information belongs can be determined respectively, and the information conversion algorithm corresponding to the target category is used to convert the attribute information corresponding to the attribute into the representation vector corresponding to the attribute, and further concatenate the representation vectors corresponding to each attribute, so as to obtain the original vector corresponding to the data sample. For example, if the target attribute information of the data sample includes the attribute information corresponding to attribute 1 and the attribute information corresponding to attribute 2, the attribute information corresponding to attribute 1 is converted into the corresponding representation vector 1, and the attribute information corresponding to attribute 2 is converted into the corresponding representation vector 2, and further concatenate the representation vector 1 and the representation vector 2, so as to obtain the original vector corresponding to the data sample.

[0083] Optionally, when using the information conversion algorithm corresponding to the target category to which the attribute information belongs to convert the attribute information corresponding to the attribute into the representation vector corresponding to the attribute, if the target category is a discrete numerical type, a dictionary can be used for encoding, such as one-hot encoding, to obtain the corresponding representation vector. If it is a continuous numerical type, the digitized data can be used for representation to obtain the corresponding representation vector, which is a one-dimensional vector. If it is a text or image type, Bert encoding can be used to encode the text or image to obtain the corresponding representation vector.

[0084] Finally, the representation vectors corresponding to each attribute are concatenated together to obtain the original vector of the data sample.

[0085] Step 120, selecting a data sample from the sample set as a positive data sample to be calculated, inputting the original vector corresponding to the positive data sample to be calculated into the encoder model, obtaining a first vector pair corresponding to the positive data sample to be calculated, and setting a positive data sample identifier for the selected data sample;

[0086] In an embodiment of the present application, a data sample is selected from a sample set as a positive data sample to be calculated, and the original vector corresponding to the positive data sample to be calculated is input into the encoder model to obtain a first vector pair corresponding to the positive data sample to be calculated, wherein the first vector pair includes two vectors, wherein one vector is the same as the input original vector and can be called a first output vector, and the other vector is different from the input original vector, but the vector is another representation of the original vector, that is, the semantics are the same as the original vector, and the other vector can be called a second output vector. The encoder model uses different dropout templates to input the original vector and output a vector pair with the above-mentioned features. The dropout template refers to stopping a certain neuron with a certain probability when the model is forward propagated. Different dropout templates have different corresponding neurons that stop working, so that the first output vector and the second output vector in the vector pair can be output.

[0087] like Figure 3 As shown, it is a schematic diagram of an encoder model provided by the present application. The original vector is input to the encoder model, and the encoder model uses different dropout templates to encode the original vector, thereby outputting two different vectors in the vector pair. It can be understood that when the original vectors of different data samples are input into the encoder model, the dropout templates used can also be different.

[0088] Furthermore, after selecting a data sample from the sample set as the positive data sample to be calculated, it is also necessary to set a positive data sample identifier for the selected data sample.

[0089] It should be noted that if it is the first time to select the positive data samples to be calculated from the sample set, they can be randomly selected. If it is not the first time to select the positive data samples to be calculated from the sample set, data samples without data sample identifiers can be selected from the sample set as the positive data samples to be calculated.

[0090] Step 130, taking n-1 data samples in the sample set except the positive data sample to be calculated as n-1 negative data samples, inputting the original vector corresponding to each negative data sample into the encoder model, and obtaining second vector pairs corresponding to each negative data sample;

[0091] In an embodiment of the present application, after determining the positive data sample to be calculated, n-1 data samples other than the positive data sample to be calculated can be further obtained from the sample set as n-1 negative data samples, and the original vectors corresponding to each negative data sample are input into the encoder model, thereby obtaining second vector pairs corresponding to each negative data sample, respectively. The second vector pair may include a third output vector and a fourth output vector, the third output vector is represented the same as the original vector corresponding to the negative data sample, and the fourth output vector is represented differently from the original vector corresponding to the negative data sample, but has the same semantics as the original vector corresponding to the negative data sample. It can be understood that when the original vector corresponding to the negative data sample is input into the encoder model, the encoder model also uses different dropout templates to encode the original vector, thereby obtaining a second vector pair including two different output vectors.

[0092] Step 140, determining a loss value based on the difference between the vectors in the first vector pair and the difference between the vector in the first vector pair and the vectors in each of the second vector pairs;

[0093] In an embodiment of the present application, the encoder model is required to be able to distinguish between similar vectors and different vectors. Therefore, the present application determines the loss value based on the difference between the two vectors in the first vector pair and the difference between the vector in the first vector pair and the vectors in each second vector pair.

[0094] Exemplarily, the first cosine distance between the first output vector and the second output vector in the first vector pair is calculated, and the second cosine distances between the first output vector in the first vector pair and the fourth output vectors in the n-1 second vector pairs are calculated, thereby determining the loss value based on the first cosine distance and the n-1 second cosine distances.

[0095] The following formula is an optional way to calculate the loss value, where N is the number of negative data samples. In the embodiment of the present application, N=n-1:

[0096]

[0097] where h i is the first output vector in the first vector pair, h i + is the second output vector in the first vector pair, h j+ is the fourth output vector in the second vector pair, τ represents the temperature parameter, which is a number between [0,1], and the sim() function represents the cosine distance formula, as follows:

[0098]

[0099] Step 150, if the loss value does not meet the target condition, adjusting the parameters of the encoder model according to the loss value;

[0100] In an embodiment of the present application, after obtaining the loss value, an optimization algorithm such as Adam can be used to optimize the parameters of the encoder model until the encoder model converges to obtain a converged encoder model.

[0101] Exemplarily, it is determined whether the loss value meets the target condition. If the target condition is not met, such as the loss value is greater than a preset threshold, the parameters of the encoder model are adjusted according to the loss value to obtain the encoder model after parameter adjustment, and a data sample without a positive data sample identifier is continuously selected from the sample set as the positive data sample to be calculated, and the original vector corresponding to the positive data sample to be calculated is input into the encoder model after parameter adjustment to obtain the first vector pair corresponding to the positive data sample to be calculated, that is, after the parameters of the encoder model are adjusted, steps 120 to 140 are executed in a loop until the loss value meets the target condition, and step 160 is executed. If the loss value does not meet the target condition, step 150 is still executed, and steps 120 to 140 are executed in a loop.

[0102] Step 160: If the loss value meets the target condition, a trained encoder model is obtained.

[0103] In the embodiment of the present application, if after executing step 140, it is determined that the loss value meets the target condition, the iterative training ends, and the encoder model after the last parameter adjustment is used as the trained encoder model. Wherein, the loss value meeting the target condition may mean that the loss value is less than or equal to a preset threshold.

[0104] When the trained encoder model is subsequently used, the obtained original vector can be input into the trained encoder model, and the encoder model outputs an output vector used to represent the original vector. The output vector can represent the original vector more evenly and has better discrimination than the original vector.

[0105] In an embodiment of the present application, when training the encoder model, one data sample in the sample set is used as the positive data sample to be calculated, and all other samples are used as negative data samples. The positive data sample to be calculated is input into the encoder model to obtain a first vector pair, and each negative data sample is input into the encoder model to obtain at least one second vector pair. The parameters of the encoder model are adjusted by the difference between the two vectors in the first vector pair and the difference between the vector in the first vector pair and the vector in the second vector pair, so that the encoder model learns the commonalities between similar vectors and the distinction between different data samples. The encoder model of the present application performs fusion learning on each dimension in the original vector, so as to achieve uniform representation of the data samples.

[0106] See also Figure 2 , Figure 2 A flow chart of another model training method provided in an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:

[0107] Step 210, obtaining a sample set, wherein the sample set includes n data samples, where n is an integer greater than or equal to 2;

[0108] Step 220, selecting a data sample from the sample set as a positive data sample to be calculated, inputting the original vector corresponding to the positive data sample to be calculated into the encoder model, obtaining a first vector pair corresponding to the positive data sample to be calculated, and setting a positive data sample identifier for the selected data sample;

[0109] Step 230, taking n-1 data samples in the sample set except the positive data sample to be calculated as n-1 negative data samples, inputting the original vector corresponding to each negative data sample into the encoder model, and obtaining second vector pairs corresponding to each negative data sample;

[0110] Step 240, determining a loss value based on the difference between the vectors in the first vector pair and the difference between the vector in the first vector pair and the vectors in each of the second vector pairs;

[0111] Step 250, if the loss value does not meet the target condition, adjusting the parameters of the encoder model according to the loss value;

[0112] Step 260: If the loss value meets the target condition, a trained encoder model is obtained.

[0113] For steps 210 to 260 of this embodiment of the present application, please refer to Figure 1 The detailed description of step 110 to step 160 of the embodiment will not be repeated here.

[0114] Step 270, obtaining training samples for training the risk control model to be trained;

[0115] Step 280, obtaining a target original vector corresponding to the training sample;

[0116] The trained encoder model in the embodiment of the present application can be used to encode the original vector corresponding to the training sample input to the risk control model to be trained, and the risk control model is used to predict the risk level. Specifically, optionally, a training sample for training the risk control model to be trained is obtained, and the training sample may include attribute information corresponding to at least one attribute, and according to the method described in step 110, the attribute information corresponding to each attribute in the training sample is converted into a corresponding representation vector, and the representation vectors corresponding to each attribute information are spliced ​​to obtain the target original vector.

[0117] Step 290, inputting the target original vector into the trained encoder model to obtain a target output vector;

[0118] In an embodiment of the present application, the target original vector is input into a trained encoder model for encoding processing to obtain a target output vector, which can uniformly represent the input original sample.

[0119] Step 300: input the target output vector into the risk control model to be trained to train the risk control model to be trained.

[0120] In an embodiment of the present application, the target output vector is input into the risk control model to be trained to obtain the predicted risk level corresponding to the training sample, and the loss value is determined based on the difference between the actual risk level corresponding to the training sample and the predicted risk level, and the parameters of the risk control model to be trained are further adjusted based on the loss value.

[0121] In an embodiment of the present application, when training the risk control model, the original vector of the training sample is input into the encoder model for encoding processing to obtain an output vector. Since the output vector uniformly represents the training sample and the output vector has a relatively high discrimination, the risk control model can also quickly learn the discrimination between different samples when trained according to the output vector. The trained risk control model has a relatively high accuracy in risk level identification.

[0122] See also Figure 4 , which is a schematic diagram of the structure of a model training device provided in the embodiment of the present application. Figure 4 As shown, the model training device may include:

[0123] A first acquisition unit 10 is used to acquire a sample set, where the sample set includes n data samples, where n is an integer greater than or equal to 2;

[0124] A second acquisition unit 11 is used to select a data sample from the sample set as a positive data sample to be calculated, input the original vector corresponding to the positive data sample to be calculated into the encoder model, obtain a first vector pair corresponding to the positive data sample to be calculated, and set a positive data sample identifier for the selected data sample;

[0125] A third acquisition unit 12 is used to use n-1 data samples in the sample set except the positive data sample to be calculated as n-1 negative data samples, input the original vector corresponding to each negative data sample into the encoder model, and obtain second vector pairs corresponding to each negative data sample;

[0126] A first determining unit 13, configured to determine a loss value according to a difference between vectors in the first vector pair and a difference between a vector in the first vector pair and a vector in each of the second vector pairs;

[0127] The parameter adjustment unit 14 is used to adjust the parameters of the encoder model according to the loss value if the loss value does not meet the target condition, and select a data sample without the positive data sample identifier from the sample set as the positive data sample to be calculated, and input the original vector corresponding to the positive data sample to be calculated into the encoder model after parameter adjustment until the loss value meets the target condition to obtain a trained encoder model.

[0128] In a possible design, the first vector pair includes a first output vector and a second output vector, the first output vector has the same representation as the original vector corresponding to the positive data sample to be calculated, and the second output vector has a different representation from the original vector corresponding to the positive data sample to be calculated;

[0129] The second vector pair includes a third output vector and a fourth output vector, the third output vector is the same as the original vector representation corresponding to the negative data sample, and the fourth output vector is different from the original vector representation corresponding to the negative data sample;

[0130] The first determining unit is specifically configured to: calculate a first cosine distance between the first output vector and the second output vector in the first vector pair;

[0131] Calculate the second cosine distances between the first output vector in the first vector pair and the fourth output vectors in n-1 second vector pairs respectively;

[0132] A loss value is determined according to the first cosine distance and n-1 second cosine distances.

[0133] In one possible design, the device further includes:

[0134] A fourth acquisition unit, used to acquire target attribute information of each data sample in the n data samples;

[0135] The second determining unit is used to determine the original vector corresponding to each data sample according to the target attribute information of each data sample.

[0136] In a possible design, the target attribute information of the data sample includes attribute information corresponding to each attribute of at least one attribute of the data sample;

[0137] The second determining unit is specifically used to: respectively obtain the target category to which the attribute information corresponding to each attribute in the target attribute information belongs;

[0138] Using an information conversion algorithm corresponding to the target category, converting the attribute information corresponding to the attribute into a representation vector corresponding to the attribute;

[0139] The representation vectors corresponding to the respective attributes of the at least one attribute are concatenated to obtain the original vector corresponding to the data sample.

[0140] In a possible design, the second determining unit is specifically configured to: if the target category is a discrete numerical type, use a dictionary encoding algorithm to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute;

[0141] If the target category is a continuous numerical type, a numerical algorithm is used to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute;

[0142] If the target category is a text type or an image type, a Bert encoding algorithm is used to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute.

[0143] In one possible design, the device further includes:

[0144] A fifth acquisition unit, used to acquire training samples for training the risk control model to be trained;

[0145] A sixth acquisition unit, used to acquire a target original vector corresponding to the training sample;

[0146] a seventh acquisition unit, configured to input the target original vector into the trained encoder model to obtain a target output vector;

[0147] The risk control model training unit is used to input the target output vector into the risk control model to be trained so as to train the risk control model to be trained.

[0148] In a possible design, the risk control model training unit is specifically used to:

[0149] Inputting the target output vector into the risk control model to be trained to obtain the predicted risk level corresponding to the training sample;

[0150] According to the difference between the predicted risk level and the actual risk level corresponding to the training sample, the parameters of the risk control model to be trained are adjusted.

[0151] in, Figure 4 The detailed description of the embodiment of the device shown can refer to the aforementioned Figure 1 or Figure 2 The specific description of the illustrated method embodiment will not be repeated here.

[0152] Please refer to Figure 5 , is a schematic diagram of the structure of another model training device provided in an embodiment of the present application, such as Figure 5 As shown, the model training device 1000 may include: at least one processor 1001, such as a CPU, at least one communication interface 1003, a memory 1004, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The communication interface 1003 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface). The memory 1004 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1004 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Figure 5 As shown, the memory 1004 as a computer storage medium may include an operating system, a network communication unit, and program instructions.

[0153] exist Figure 5 In the model training device 1000 shown, the processor 1001 can be used to load the program instructions stored in the memory 1004, and specifically perform the following operations:

[0154] Acquire a sample set, where the sample set includes n data samples, where n is an integer greater than or equal to 2;

[0155] Selecting a data sample from the sample set as a positive data sample to be calculated, inputting an original vector corresponding to the positive data sample to be calculated into an encoder model, obtaining a first vector pair corresponding to the positive data sample to be calculated, and setting a positive data sample identifier for the selected data sample;

[0156] Taking n-1 data samples in the sample set except the positive data sample to be calculated as n-1 negative data samples, inputting the original vector corresponding to each negative data sample into the encoder model, and obtaining second vector pairs corresponding to each negative data sample;

[0157] determining a loss value based on differences between vectors in the first vector pair and differences between vectors in the first vector pair and vectors in each of the second vector pairs;

[0158] If the loss value does not meet the target condition, the parameters of the encoder model are adjusted according to the loss value, and a data sample without the positive data sample identifier is selected from the sample set as the positive data sample to be calculated, and the original vector corresponding to the positive data sample to be calculated is input into the encoder model with adjusted parameters until the loss value meets the target condition to obtain a trained encoder model.

[0159] It should be noted that the specific implementation process can be found in Figure 1 or Figure 2 The specific description of the illustrated method embodiment will not be repeated here.

[0160] The present application also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded and executed by a processor as described above. Figure 1 or Figure 2 The method steps of the embodiment shown in the figure can be found in the specific execution process. Figure 1 or Figure 2 The specific description of the illustrated embodiment will not be repeated here.

[0161] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0162] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

Claims

1. A model training method, characterized in that: include: Acquire a sample set, the sample set including n data samples, where n is an integer greater than or equal to 2, and the n data samples are n users; Acquire target attribute information of each data sample in the n data samples, wherein the target attribute information of the data sample includes attribute information corresponding to each attribute of at least one attribute of the user, wherein the at least one attribute includes the user's age, gender, place of origin, occupation, and income; Determine the original vector corresponding to each data sample according to the target attribute information of each data sample; Selecting a data sample from the sample set as a positive data sample to be calculated, inputting an original vector corresponding to the positive data sample to be calculated into an encoder model, obtaining a first vector pair corresponding to the positive data sample to be calculated, and setting a positive data sample identifier for the selected data sample; Taking n-1 data samples in the sample set except the positive data sample to be calculated as n-1 negative data samples, inputting the original vector corresponding to each negative data sample into the encoder model, and obtaining second vector pairs corresponding to each negative data sample; determining a loss value based on a difference between two vectors in the first vector pair and a difference between a vector in the first vector pair and a vector in each of the second vector pairs; If the loss value does not meet the target condition, the parameters of the encoder model are adjusted according to the loss value, and a data sample without the positive data sample identifier is selected from the sample set as the positive data sample to be calculated, and the original vector corresponding to the positive data sample to be calculated is input into the encoder model after parameter adjustment until the loss value meets the target condition, thereby obtaining a trained encoder model; Acquire training samples for training the risk control model to be trained, wherein the training samples include attribute information corresponding to at least one attribute of the target user, wherein the at least one attribute includes the user's age, gender, place of origin, occupation, and income; Obtaining a target original vector corresponding to the training sample; Inputting the target original vector into the trained encoder model to obtain a target output vector; The target output vector is input into the risk control model to be trained to train the risk control model to be trained, and the risk control model is used to predict the predicted risk level of the target user.

2. The method according to claim 1, characterized in that The first vector pair includes a first output vector and a second output vector, the first output vector has the same representation as the original vector corresponding to the positive data sample to be calculated, and the second output vector has a different representation from the original vector corresponding to the positive data sample to be calculated; The second vector pair includes a third output vector and a fourth output vector, the third output vector is the same as the original vector representation corresponding to the negative data sample, and the fourth output vector is different from the original vector representation corresponding to the negative data sample; The determining of the loss value according to the difference between the two vectors in the first vector pair and the difference between the vector in the first vector pair and the vectors in each of the second vector pairs comprises: calculating a first cosine distance between the first output vector and the second output vector in the first vector pair; Calculate the second cosine distances between the first output vector in the first vector pair and the fourth output vectors in n-1 second vector pairs respectively; A loss value is determined according to the first cosine distance and n-1 second cosine distances.

3. The method according to claim 2, characterized in that The target attribute information of the data sample includes attribute information corresponding to each attribute of at least one attribute of the data sample; Determining the original vectors corresponding to the data samples according to the target attribute information of the data samples includes: Respectively obtain the target category to which the attribute information corresponding to each attribute in the target attribute information belongs; Using an information conversion algorithm corresponding to the target category, converting the attribute information corresponding to the attribute into a representation vector corresponding to the attribute; The representation vectors corresponding to the respective attributes of the at least one attribute are concatenated to obtain the original vector corresponding to the data sample.

4. The method according to claim 3, characterized in that The adopting of an information conversion algorithm corresponding to the target category to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute includes: If the target category is a discrete numerical type, a dictionary encoding algorithm is used to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute; If the target category is a continuous numerical type, a numerical algorithm is used to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute; If the target category is a text type or an image type, a Bert encoding algorithm is used to convert the attribute information corresponding to the attribute into a representation vector corresponding to the attribute.

5. The method according to claim 1, characterized in that The step of inputting the target output vector into the risk control model to be trained to train the risk control model to be trained includes: Inputting the target output vector into the risk control model to be trained to obtain the predicted risk level corresponding to the training sample; According to the difference between the predicted risk level and the actual risk level corresponding to the training sample, the parameters of the risk control model to be trained are adjusted.

6. A model training device, characterized in that: The device comprises a unit for executing the method according to any one of claims 1 to 5, wherein the device comprises: A first acquisition unit, configured to acquire a sample set, wherein the sample set includes n data samples, where n is an integer greater than or equal to 2; A second acquisition unit is used to select a data sample from the sample set as a positive data sample to be calculated, input the original vector corresponding to the positive data sample to be calculated into the encoder model, obtain a first vector pair corresponding to the positive data sample to be calculated, and set a positive data sample identifier for the selected data sample; a third acquisition unit, configured to use n-1 data samples in the sample set except the positive data sample to be calculated as n-1 negative data samples, input the original vector corresponding to each negative data sample into the encoder model, and obtain second vector pairs corresponding to each negative data sample; a first determining unit, configured to determine a loss value according to a difference between vectors in the first vector pair and a difference between a vector in the first vector pair and a vector in each of the second vector pairs; A parameter adjustment unit is used to adjust the parameters of the encoder model according to the loss value if the loss value does not meet the target condition, and select a data sample without the positive data sample identifier from the sample set as the positive data sample to be calculated, and input the original vector corresponding to the positive data sample to be calculated into the encoder model after parameter adjustment until the loss value meets the target condition to obtain a trained encoder model.

7. A model training device, characterized in that: It includes a processor, a memory and a communication interface, wherein the processor, the memory and the communication interface are interconnected, wherein the communication interface is used to receive and send data, the memory is used to store program code, and the processor is used to call the program code to execute the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program; when the computer program runs on one or more processors, the method according to any one of claims 1 to 5 is executed.