Model training method and device, storage medium, processor and electronic device
By formatting the sample data and training multiple classification models, the high cost and low performance problems caused by small sample size in financial risk control are solved, and complex data modeling and performance improvement are achieved.
Patent Information
- Application Number
- CN202210737197.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-27
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2042-06-27
AI Technical Summary
In the field of financial risk control, existing technologies suffer from high training costs and poor performance due to the small size of training samples.
By acquiring first sample data with a sample size greater than a preset threshold and second sample data with a sample size less than a preset threshold, formatting is performed, and machine learning training is performed on the first classification model containing the initial encoder and the first classifier, and the second classification model containing the target encoder and the second classifier, based on the formatting results, to obtain the target classification model.
This approach reduces model training costs and improves model performance even with a small training sample size, thus solving the problems of high training costs and poor performance.
Smart Images

Figure CN115130574B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of machine learning, and in particular, to a model training method and device, a storage medium, a processor and an electronic device. BACKGROUND
[0002] In the field of financial risk control, especially in credit business, risk control is needed, so it is necessary to continuously optimize the risk control model and improve the performance and effect of the model.
[0003] In related technologies, various types of data sources are integrated and label information is spliced to combine modeling data, and a suitable machine learning algorithm is selected for model training. However, when formulating a modeling scheme, the training sample size is often small. There are mainly two schemes in the prior art for training of small sample size, which are abstract statistical variables and simple model algorithms.
[0004] The abstract statistical variable method first preliminarily divides the sample data into small categories, then abstracts and induces them into large categories, performs classification statistics, then derives variables, and finally applies a relatively simple algorithm to model based on the statistical characteristics of the derived variables. However, when processing and deriving variables for a large amount of complex data, not only does the engineer need rich data mining experience, but also needs to continuously optimize the variable derivation scheme to extract effective variables. At the same time, the abstract statistical variable method is limited by the small available sample size, and the actual modeling variables cannot be too many, so the modeling variables need to be repeatedly screened, resulting in high labor costs for the abstract statistical variable method.
[0005] When designing a modeling scheme for a small sample size, the application of complex algorithms will lead to serious overfitting of the model, and the simple model algorithm uses a simple algorithm to mine sample data, which can train a model that meets the basic business requirements, but the model performance is poor.
[0006] Therefore, when the training sample size is small, using the abstract statistical variable method or the simple model algorithm in the prior art for model training will result in high data mining costs and poor model performance.
[0007] To address the above problems, no effective solutions have been proposed so far. SUMMARY
[0008] The embodiments of the present application provide a model training method and device, a storage medium, a processor and an electronic device to at least solve the technical problems of high model training cost and poor model performance caused by small training sample size in related technologies.
[0009] According to an aspect of an embodiment of the present application, a model training method is provided, comprising:
[0010] obtaining target sample data, wherein the target sample data comprises first sample data and second sample data, the number of samples of the first sample data is greater than a preset threshold, and the number of samples of the second sample data is less than the preset threshold; performing format processing on the target sample data to obtain an intermediate processing result; and performing machine learning training on a first classification model and a second classification model based on the intermediate processing result to obtain a target classification model, wherein the first classification model comprises an initial encoder and a first classifier, the second classification model comprises a target encoder and a second classifier, the first classifier is configured to perform classification processing on the first sample data, and the second classifier is configured to perform classification processing on the second sample data.
[0011] Optionally, obtaining the target sample data comprises: obtaining first sample data corresponding to a first classification label, and obtaining second sample data corresponding to a second classification label, wherein the first classification label is used for training the first classifier, the second classification label is used for training the second classifier, and the first classification label is associated with the second classification label.
[0012] Optionally, performing format processing on the target sample data to obtain the intermediate processing result comprises: obtaining type information of the initial encoder; determining a target processing mode corresponding to the target sample data based on the type information of the initial encoder; and performing format processing on the target sample data by using the target processing mode to obtain the intermediate processing result.
[0013] Optionally, performing machine learning training on the first classification model and the second classification model based on the intermediate processing result comprises: for the first classification model, repeatedly performing the following operations: training the first classification model based on the intermediate processing result corresponding to the first sample data and recording a first loss error, wherein the first loss error is used to determine the target encoder; and for the second classification model, repeatedly performing the following operations: training the second classification model based on the intermediate processing result corresponding to the second sample data and recording a second loss error, wherein the second loss error is used to determine the target classification model.
[0014] Optionally, the model training method further comprises: obtaining test sample data and a business evaluation index; performing classification processing on the test sample data by using the target classification model to obtain a classification result; and performing a prediction score on the classification result based on the business evaluation index to obtain a score result, wherein the score result is used to determine whether the classification result is accurate.
[0015] Optionally, the model training method further comprises: the target sample data comprises a numerical field and / or a non-numerical field.
[0016] According to another aspect of an embodiment of the present application, a model training apparatus is also provided, comprising:
[0017] The acquisition module is configured to acquire target sample data, where the target sample data includes first sample data and second sample data, the number of samples of the first sample data is greater than a preset threshold, and the number of samples of the second sample data is less than the preset threshold. The processing module is configured to perform format processing on the target sample data to obtain an intermediate processing result. The training module is configured to perform machine learning training on the first classification model and the second classification model based on the intermediate processing result to obtain a target classification model, where the first classification model includes an initial encoder and a first classifier, the second classification model includes a target encoder and a second classifier, the first classifier is configured to perform classification processing on the first sample data, and the second classifier is configured to perform classification processing on the second sample data.
[0018] Optionally, the acquisition module is further configured to acquire the target sample data by acquiring first sample data corresponding to a first classification label and acquiring second sample data corresponding to a second classification label, where the first classification label is used for training the first classifier, the second classification label is used for training the second classifier, and the first classification label is associated with the second classification label.
[0019] Optionally, the processing module is further configured to perform format processing on the target sample data to obtain the intermediate processing result, including: acquiring type information of the initial encoder; determining a target processing mode corresponding to the target sample data based on the type information of the initial encoder; and performing format processing on the target sample data by using the target processing mode to obtain the intermediate processing result.
[0020] Optionally, the training module is further configured to perform machine learning training on the first classification model and the second classification model based on the intermediate processing result, including: for the first classification model, repeatedly performing the following operations: training the first classification model based on the intermediate processing result corresponding to the first sample data and recording a first loss error, where the first loss error is used to determine the target encoder; and for the second classification model, repeatedly performing the following operations: training the second classification model based on the intermediate processing result corresponding to the second sample data and recording a second loss error, where the second loss error is used to determine the target classification model.
[0021] Optionally, the acquisition module is further configured to acquire test sample data and a business evaluation index. The model training apparatus further includes: a classification module configured to perform classification processing on the test sample data by using the target classification model to obtain a classification result; and a scoring module configured to perform predictive scoring on the classification result based on the business evaluation index to obtain a scoring result, where the scoring result is used to determine whether the classification result is accurate.
[0022] Optionally, the target sample data includes a numerical field and / or a non-numerical field.
[0023] According to an embodiment of the present application, a non-transitory storage medium is provided, and the storage medium stores a computer program. The computer program is configured to perform the model training method in any of the above embodiments when executed.
[0024] According to an embodiment of the present application, a processor is provided, and the processor is configured to execute a program. The program is configured to perform the model training method in any of the above embodiments when executed.
[0025] According to an embodiment of the present application, an electronic device is provided, and the electronic device comprises a memory and a processor. The memory stores a computer program, and the processor is configured to execute the computer program to perform the model training method in any of the above embodiments.
[0026] In the embodiments of the present application, by obtaining first sample data with a sample quantity greater than a preset threshold and second sample data with a sample quantity less than the preset threshold, and performing format processing on the two sample data, the first classification model comprising an initial encoder and a first classifier and the second classification model comprising a target encoder and a second classifier are trained by machine learning based on the formatted results, to obtain a target classification model, so as to achieve the purpose of complex data modeling for small-scale sample data, thereby realizing the technical effects of reducing model training cost and improving model performance, and further solving the technical problems of high model training cost and poor model performance caused by small training sample size in the related art. BRIEF DESCRIPTION OF DRAWINGS
[0027] The accompanying drawings, which are included to provide a further understanding of the present application and are incorporated in and constitute a part of this application, illustrate embodiments of the present application and serve to explain the present application. In the drawings:
[0028] Figure 1 is a flowchart of a model training method according to an embodiment of the present application;
[0029] Figure 2 is a schematic diagram of a model training process according to an optional embodiment of the present application;
[0030] Figure 3 is a schematic diagram of a model testing process according to an optional embodiment of the present application;
[0031] Figure 4 is a schematic diagram of a model training system according to an optional embodiment of the present application;
[0032] Figure 5 is a structural block diagram of a model training device according to an embodiment of the present application. DETAILED DESCRIPTION
[0033] In the following, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative effort should belong to the scope of protection of the present application.
[0034] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device including a series of steps or units does not necessarily have to include only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product, or device.
[0035] There are mainly two schemes for training a small sample in the prior art, which are abstract statistical variables and simple model algorithms.
[0036] The abstract statistical variable method includes the following steps: first, the sample data is preliminarily and finely classified, and after being classified into small categories, numerical calculation is performed, including summation, difference, quotient, etc.; then, the sample data classified into small categories is abstractly summarized into large categories, and classification statistics of different fine levels are performed, and after the classification statistics are completed, variable derivation is performed through the intersection of various categories, wherein the most extreme derivation method is violent combination between categories, and the feature dimension of the derived variable can reach several tens or even hundreds of times of the original statistical feature dimension; finally, based on the statistical characteristics of the derived variables, a relatively simple algorithm can be applied for modeling. However, when processing and deriving variables for a large amount of complex data, not only does the engineer need to have rich data mining experience, but also the variable derivation scheme needs to be optimized constantly to mine effective variables. At the same time, the abstract statistical variable method is limited by the small available sample size, and the variables actually used for modeling cannot be too many, so the modeling variables need to be repeatedly screened, which results in high labor cost of the abstract statistical variable method.
[0037] When designing a modeling scheme for a small sample, a complex algorithm is applied to cause serious overfitting of the model, and a simple model algorithm uses a simple algorithm to mine sample data, so as to train a model that meets the basic requirements of the business, but the model performance is poor.
[0038] Therefore, in the case of a small training sample size, using the abstract statistical variable method or the simple model algorithm in the prior art for model training can cause high data mining cost and poor model effect. Therefore, the present application proposes a model training method for a small training sample size.
[0039] According to an embodiment of the present application, an embodiment of a model training method is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0040] The method embodiment can be executed in an electronic device or similar computing device containing a memory and a processor. Taking a computer terminal running as an example, the computer terminal can include one or more processors (the processor can include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a programmable logic device (FPGA), a neural network processor (NPU), a tensor processor (TPU), an artificial intelligence (AI) type processor, etc. processing device) and memory for storing data. Optionally, the above-mentioned computer terminal can also include a transmission device for communication function, an input and output device, and a display device. Those skilled in the art can understand that the above structure description is only illustrative, and does not limit the structure of the above-mentioned computer terminal. For example, the computer terminal can include more or less components than the above structure description, or have a different configuration from the above structure description.
[0041] The memory can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the information processing method in the embodiment of the present application. The processor executes various functions and data processing by running the computer program stored in the memory, that is, implements the above-mentioned information processing method. The memory can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory can further include a memory remotely arranged with respect to the processor, which can be connected to the mobile terminal through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0042] The transmission device is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0043] The display device can be, for example, a touchscreen liquid crystal display (LCD) and a touch display (also referred to as a "touchscreen" or "touch display"). This LCD allows the user to interact with the user interface of the mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), which the user can interact with by touching a touch-sensitive surface with fingers and / or gestures. Optional human-computer interaction functions include: creating web pages, drawing, word processing, creating electronic documents, playing games, video conferencing, instant messaging, sending and receiving emails, a call interface, playing digital video, playing digital music, and / or web browsing, etc. Executable instructions for performing the above human-computer interaction functions are configured / stored in one or more processor-executable computer program products or readable storage media.
[0044] This embodiment provides a model training method that runs on the aforementioned computer terminal. Figure 1 This is a flowchart of a model training method according to one embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:
[0045] Step S12: Obtain target sample data, wherein the target sample data includes first sample data and second sample data, the number of samples in the first sample data is greater than a preset threshold, and the number of samples in the second sample data is less than a preset threshold.
[0046] Step S14: Format the target sample data to obtain intermediate processing results;
[0047] Step S16: Based on the intermediate processing results, perform machine learning training on the first classification model and the second classification model to obtain the target classification model. The first classification model includes an initial encoder and a first classifier, and the second classification model includes a target encoder and a second classifier. The first classifier is used to classify the first sample data, and the second classifier is used to classify the second sample data.
[0048] The target sample data includes a numerical field and / or a non-numerical field. Specifically, the target sample data can include a numerical field, a non-numerical field, or both. For example, the numerical field can be a user's salary, work experience, and the like; and the non-numerical field can be a work unit, occupation information in credit investigation, and an application list in a mobile phone, and the like. The target sample data includes first sample data and second sample data, where the first sample data represents sample data with a quantity greater than a preset threshold, and the second sample data represents sample data with a quantity less than the preset threshold.
[0049] There are two principles for selecting the first sample data. One principle is that the classification task corresponding to the first sample data should be similar to the classification task corresponding to the second sample data, which ensures that the classification tasks corresponding to the two sample data are similar, and can solve the problem of insufficient learning of the second sample data to a certain extent. The other principle is that the magnitude of the first sample data should be large enough. For example, when the preset threshold is 200,000, the sample data with a quantity greater than 200,000 is the first sample data, and the sample data with a quantity less than 200,000 is the second sample data.
[0050] Specifically, the formatting processing of the target sample data means that the target sample data is formatted in a preset manner, which can be formatted according to the characteristics of the target sample data and the type of the encoder. The characteristics of the target sample data represent the data format of the target sample data, which can include a numerical field and / or a non-numerical field. When formatting according to the characteristics of the target sample data and the self-defined encoder structure, the target sample data needs to be processed into the format required by the encoder structure.
[0051] Specifically, the first classification model includes an initial encoder and a first classifier. The initial encoder can be selected according to the data type of the target sample data. For example, when the target sample data is a natural language type, a pre-trained model in natural language processing (NLP) can be selected, such as a commonly used Bidirectional Encoder Representation from Transformers (BERT) and its variants. When the target sample data is an enumerated type of non-numerical data, a corresponding neural network structure can be defined. The first classifier is used to classify the first sample data, for example, according to whether there is a business registration record in the first sample data, the first sample data is classified into two categories: with a business registration record and without a business registration record.
[0052] Specifically, the second classification model includes a target encoder and a second classifier, where the target encoder is a training result of the first classification model. The second classifier is configured to perform classification processing on the second sample data, for example, according to whether there is an operating activity in the second sample data, and divide the second sample data into two categories, i.e., an operating activity and no operating activity.
[0053] Based on the steps S12 to S16, the first sample data with a sample quantity greater than a preset threshold and the second sample data with a sample quantity less than the preset threshold are obtained, and the two sample data are formatted. Based on the formatted results, the first classification model including the initial encoder and the first classifier and the second classification model including the target encoder and the second classifier are trained by machine learning to obtain a target classification model, so as to achieve the purpose of complex data modeling on small-scale sample data.
[0054] Optionally, in the step S12, obtaining the target sample data further includes: obtaining first sample data corresponding to a first classification label, and obtaining second sample data corresponding to a second classification label, where the first classification label is used for training the first classifier, the second classification label is used for training the second classifier, and the first classification label is associated with the second classification label.
[0055] Specifically, the first classification label can be "label 1", and "label 1" is defined as whether there is a business registration record. According to "label 1", data with a registered business record (i.e., a positive example) and data without a registered business record (i.e., a negative example) can be selected as the first sample data. The second classification label can be "label 2", and "label 2" is defined as whether there is an operating activity. According to "label 2", data with an operating activity (i.e., a positive example) and data without an operating activity (i.e., a negative example) can be selected as the second sample data, which is artificially collected and has a small sample quantity. Since the classification task corresponding to the first classification label is similar to the classification task corresponding to the second classification label, the first classification label is associated with the second classification label.
[0056] Specifically, the first classifier is configured to classify the first sample data, for example, according to whether there is a business registration record in the first sample data, and divide the first sample data into two categories, i.e., a business registration record and no business registration record. The second classifier is configured to classify the second sample data. For example, according to whether there is an operating activity in the second sample data, the second sample data is divided into two categories, i.e., an operating activity and no operating activity.
[0057] By obtaining the first sample data and the second sample data corresponding to the associated first classification label and the second classification label, the problem that knowledge is not fully covered in learning on a small number of samples can be solved.
[0058] Optionally, in step S14, the target sample data is formatted to obtain an intermediate processing result, including:
[0059] In step S141, type information of an initial encoder is obtained.
[0060] In step S142, a target processing mode corresponding to the target sample data is determined based on the type information of the initial encoder.
[0061] In step S143, the target sample data is formatted by using the target processing mode to obtain the intermediate processing result.
[0062] Specifically, the initial encoder can include one or more of a custom encoder structure, an open source model, and a pre-trained model. For example, the type of the initial encoder is natural language processing, and the target processing mode determined according to the type information is to process the target sample data into a format in which each target sample data corresponds to a text record. By using this processing mode to format the target sample data, an intermediate processing result in which each target sample data corresponds to a text record format can be obtained. For another example, the type of the initial encoder is a custom type, and the target processing mode determined according to the type information is to index and convert the target sample data according to a custom dictionary. By using this processing mode to format the target sample data, a numerical intermediate processing result can be obtained.
[0063] Based on the above steps S141 to S143, by obtaining the type information of the initial encoder and determining the target processing mode corresponding to the target sample data based on the type information, and formatting the target sample data by using the target processing mode, the target sample data can be more fully and conveniently machine learned in the encoder.
[0064] Optionally, in step S16, the first classification model and the second classification model are trained by machine learning based on the intermediate processing result, including:
[0065] For the first classification model, the following operations are repeatedly performed:
[0066] In step S161, the first classification model is trained based on the intermediate processing result corresponding to the first sample data, and a first loss error is recorded, wherein the first loss error is used to determine a target encoder.
[0067] For the second classification model, the following operations are repeatedly performed:
[0068] Step S162, training the second classification model based on the intermediate processing result corresponding to the second sample data and recording the second loss error, wherein the second loss error is used to determine the target classification model.
[0069] Specifically, the above machine learning training of the first classification model can train the initial encoder and the first classifier based on the intermediate processing result corresponding to the first sample data for n1 rounds, and store the loss error corresponding to each round of training in the first loss error loss_n. For example, the loss error corresponding to the nth1 round of training is loss_n1, and this error is recorded. Repeat the above steps, when the error in the first loss error loss_n no longer decreases significantly, stop the n1 rounds of training, and save the encoder at this time as the target encoder.
[0070] Specifically, the above machine learning training of the second classification model can train the target encoder and the second classifier obtained by training the first classification model based on the intermediate processing result corresponding to the second sample data for m1 rounds, and store the loss error corresponding to each round of training in the second loss error loss_m. For example, the loss error corresponding to the mth1 round of training is loss_m1, and this error is recorded. When the error in the second loss error loss_m no longer decreases significantly, the target encoder and the second classifier are retained as the target classification model, and the entire training process is stopped.
[0071] Based on the above steps S161 to S162, by machine learning training of the first classification model, the target encoder is determined, and the target classification model is finally determined by machine learning training of the second classification model using the target encoder. Thus, the target classification model can be used to predict the score of the test sample data, achieving the purpose of complex data modeling for small-scale sample data, thereby realizing the technical effect of reasonable classification when the training sample size is small.
[0072] Figure 2 is a schematic diagram of the model training process according to one of the optional embodiments of the present application. The entire training process of the first classification model and the second classification model can be as shown in Figure 2 .
[0073] The training of the first classification model can include the following processes:
[0074] Firstly, the target sample data is preprocessed, including formatting and introducing labels. The preprocessing of the target sample data can be completed by index value conversion of the target sample data, for example, when the target sample data is a mobile application list [mobile application 1, mobile application 2, mobile application 3, …], the index value conversion of the mobile application list can obtain a mobile application index list [200001, 200002, 200003, …].
[0075] Secondly, the initial encoder and the first classifier in the first classification model training are selected, wherein the long short-term memory (LSTM) and the self-defined network structure with attention fusion structure are used as the initial encoder (encoder n1, encoder n2, …, encoder nx, …, encoder ny), and the first classifier can include a linear layer, an activation function layer, a forgetting layer, a fully connected layer and a classification layer.
[0076] Subsequently, the first classification model is used for machine learning training of the formatted first sample data corresponding to the "label 1", including: based on the intermediate processing result corresponding to the first sample data, the initial encoder and the first classifier are trained for n1 rounds, and the loss error corresponding to each round of training is stored in the first loss error loss_n. Repeat the above steps, when the error in the first loss error loss_n no longer decreases significantly, stop the n1 rounds of training, and save the encoder at this time as the target encoder.
[0077] Finally, the trained first classification model is used to predict the score of the first sample data.
[0078] The training of the second classification model can include the following processes:
[0079] Firstly, the target sample data is preprocessed, including formatting and introducing labels. The preprocessing of the target sample data can be completed by index value conversion of the target sample data, for example, when the target sample data is a mobile application list [mobile application 1, mobile application 2, mobile application 3, …], the index value conversion of the mobile application list can obtain a mobile application index list [200001, 200002, 200003, …].
[0080] Then, the second classification model is used to perform machine learning training on the formatted second sample data corresponding to "label 2", including: performing m1 rounds of training on the target encoder and the second classifier obtained by training the first sample data based on the intermediate processing result corresponding to the second sample data, and storing the loss error corresponding to each round of training in the second loss error loss_m. The above steps are repeated, and when the error in the second loss error loss_m no longer decreases significantly, the target encoder and the second classifier at this time are retained as the final target classification model, and the m1 rounds of training are stopped.
[0081] Finally, the trained second classification model is used to perform prediction scoring on the second sample data.
[0082] In the above model training process, by using the first classification model to perform machine learning training on the formatted first sample data and using the second classification model to perform machine learning training on the formatted second sample data, the target classification model is obtained, the purpose of complex data modeling on small-scale sample data is achieved, and the technical effects of reducing model training cost and improving model performance are achieved, thereby solving the technical problems of high model training cost and poor model performance caused by small training sample size in the related art.
[0083] Optionally, the model training method of the embodiment of the present application further comprises:
[0084] In step S181, test sample data and business evaluation indicators are obtained.
[0085] In step S182, the target classification model is used to perform classification processing on the test sample data to obtain a classification result.
[0086] In step S183, the classification result is scored based on the business evaluation indicators to obtain a scoring result, wherein the scoring result is used to determine whether the classification result is accurate.
[0087] Figure 3 FIG. 1 is a schematic diagram of a model testing process according to an optional embodiment of the present application.
[0088] By training the first classification model and the second classification model based on the first sample data and the second sample data to obtain the target encoder and the second classifier, storing the target classification model and the second classifier as the final model to obtain the target classification model, and using the target classification model to perform prediction scoring on the test sample data. The model testing process includes the following processes:
[0089] Firstly, the test sample data and the business evaluation index are acquired, and the formatting processing of the test sample data is completed by indexing and value conversion on the mobile application list [mobile application 1, mobile application 2, mobile application 3, …] to obtain the mobile application index list [200001, 200002, 200003, …]. Secondly, the formatted test sample data is classified by using the target sample model containing the target encoder and the second classifier to obtain the classification result. Finally, the classification result is predicted and scored based on the business evaluation index to obtain the scoring result, so as to determine whether the classification result is accurate.
[0090] In the above model test process, the target classification model is obtained by storing the target classification model and the second classifier as the final model, and the target classification model is used to predict and score the test sample data, so as to determine the final target classification model required, achieve the purpose of complex data modeling on small-scale sample data, and realize the technical effects of reducing model training cost and improving model performance, thereby solving the technical problems of high model training cost and poor model performance caused by small training sample size in the related art.
[0091] Figure 4 is a schematic diagram of a model training system according to an optional embodiment of the application. As shown in Figure 4 , the model training system will train the sample data for N rounds, and the training process is described by taking the first round of training as an example, and the training processes of the second round to the Nth round are similar to the first round of training.
[0092] As shown in Figure 4 , the first round of training mainly includes three parts: data preprocessing, model training, model storage and prediction scoring.
[0093] The data preprocessing part is mainly responsible for defining labels, sample preparation and formatting processing of source data. The definition of labels and sample preparation includes selecting second sample data corresponding to the second classification label, selecting a second classification label similar to the classification task corresponding to the second sample data and the first sample data corresponding to the second classification label; the formatting processing of the sample data includes formatting the sample data according to the characteristics of the sample data and the type of the encoder. The model training part is mainly responsible for model training based on the first sample data and the second sample data. The initial encoder and the first classifier are trained based on the first sample data to obtain the target encoder and the second classifier; and the target encoder and the second classifier are trained based on the second sample data to obtain the target classification model, including the target encoder and the second classifier. The model storage and prediction scoring part is mainly responsible for the storage of the target classification model and the prediction scoring of the test sample data by using the target classification model.
[0094] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software on a general hardware platform as necessary, and of course can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product in essence or in the part that contributes to the prior art, and the computer software product is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disc), and includes a plurality of instructions for causing an end device (which can be a mobile phone, a computer, a server, or a network device) to execute the method described in each embodiment of the present application.
[0095] In this embodiment, a model training device is also provided, which is used to implement the above embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware or a combination of software and hardware is also possible and contemplated.
[0096] Figure 5 is a structural block diagram of a model training device according to an embodiment of the present application, as shown in Figure 5 The model training device includes: an acquisition module 501 configured to acquire target sample data, wherein the target sample data includes first sample data and second sample data, the number of samples of the first sample data is greater than a preset threshold, and the number of samples of the second sample data is less than the preset threshold; a processing module 502 configured to perform format processing on the target sample data to obtain an intermediate processing result; and a training module 503 configured to perform machine learning training on a first classification model and a second classification model based on the intermediate processing result to obtain a target classification model, wherein the first classification model includes an initial encoder and a first classifier, the second classification model includes a target encoder and a second classifier, the first classifier is configured to perform classification processing on the first sample data, and the second classifier is configured to perform classification processing on the second sample data.
[0097] Optionally, the acquisition module 501 is further configured to acquire first sample data corresponding to a first classification label, and acquire second sample data corresponding to a second classification label, wherein the first classification label is used to train the first classifier, the second classification label is used to train the second classifier, and the first classification label is associated with the second classification label.
[0098] Optionally, the processing module 502 is further configured to: acquire type information of the initial encoder; determine a target processing mode corresponding to the target sample data based on the type information of the initial encoder; and perform format processing on the target sample data by using the target processing mode to obtain the intermediate processing result.
[0099] Optionally, the training module 503 is further configured to: for the first classification model, repeatedly perform the following operations: training the first classification model based on the intermediate processing result corresponding to the first sample data and recording a first loss error, wherein the first loss error is used to determine the target encoder; and for the second classification model, repeatedly perform the following operations: training the second classification model based on the intermediate processing result corresponding to the second sample data and recording a second loss error, wherein the second loss error is used to determine the target classification model.
[0100] Optionally, the obtaining module 501 is further configured to obtain test sample data and a business evaluation index; the model training apparatus further comprises: a classification module 504, configured to perform classification processing on the test sample data by using the target classification model to obtain a classification result; and a scoring module 505, configured to perform predictive scoring on the classification result based on the business evaluation index to obtain a scoring result, wherein the scoring result is used to determine whether the classification result is accurate.
[0101] Optionally, the target sample data comprises a numerical field and / or a non-numerical field.
[0102] It should be noted that the above various modules can be implemented by software or hardware, and for the latter, the following implementation manners can be used, but are not limited thereto: the above modules are located in the same processor; or the above various modules are located in different processors in any combination.
[0103] Embodiments of the present application also provide a storage medium having a computer program stored therein, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.
[0104] Optionally, in the present embodiment, the above storage medium can be configured to store a computer program for executing the following steps:
[0105] Step S1, obtaining target sample data, wherein the target sample data comprises first sample data and second sample data, the sample quantity of the first sample data is greater than a preset threshold, and the sample quantity of the second sample data is less than the preset threshold;
[0106] Step S2, performing format processing on the target sample data to obtain an intermediate processing result;
[0107] Step S3, performing machine learning training on a first classification model and a second classification model based on the intermediate processing result to obtain a target classification model, wherein the first classification model comprises an initial encoder and a first classifier, the second classification model comprises a target encoder and a second classifier, the first classifier is used for performing classification processing on the first sample data, and the second classifier is used for performing classification processing on the second sample data.
[0108] Optionally, in the embodiment, the storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various storage media that can store computer programs.
[0109] Optionally, in the embodiment, the processor can be configured to execute the following steps by using the computer program:
[0110] In step S1, target sample data is obtained, wherein the target sample data includes first sample data and second sample data, the sample quantity of the first sample data is greater than a preset threshold, and the sample quantity of the second sample data is less than the preset threshold.
[0111] In step S2, the target sample data is formatted to obtain an intermediate processing result.
[0112] In step S3, the first classification model and the second classification model are trained based on the intermediate processing result to obtain a target classification model, wherein the first classification model includes an initial encoder and a first classifier, the second classification model includes a target encoder and a second classifier, the first classifier is used for classifying the first sample data, and the second classifier is used for classifying the second sample data.
[0113] The embodiment of the present application also provides an electronic device including a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the method embodiments.
[0114] Optionally, the electronic device can further include a transmission device and an input and output device, wherein the transmission device is connected with the processor, and the input and output device is connected with the processor.
[0115] Optionally, in the embodiment, the processor can be configured to execute the following steps by using the computer program:
[0116] In step S1, target sample data is obtained, wherein the target sample data includes first sample data and second sample data, the sample quantity of the first sample data is greater than a preset threshold, and the sample quantity of the second sample data is less than the preset threshold.
[0117] In step S2, the target sample data is formatted to obtain an intermediate processing result.
[0118] In step S3, machine learning training is performed on the first classification model and the second classification model based on the intermediate processing result to obtain a target classification model, wherein the first classification model comprises an initial encoder and a first classifier, the second classification model comprises a target encoder and a second classifier, the first classifier is configured to perform classification processing on the first sample data, and the second classifier is configured to perform classification processing on the second sample data.
[0119] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation manners, and this embodiment will not be described here.
[0120] The above-mentioned serial numbers of the embodiments of the application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0121] In the above-mentioned embodiments of the application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0122] In several embodiments provided in the present application, it should be understood that the disclosed technical contents can be implemented by other manners. Among them, the above-mentioned device embodiments are only schematic, for example, the division of the units can be a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or modules shown or discussed can be indirect coupling or communication connection through some interfaces, units or modules, which can be electrical or other forms.
[0123] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or they can be distributed on multiple units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment scheme.
[0124] In addition, each functional unit in each embodiment of the application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be realized in the form of hardware or in the form of software functional unit.
[0125] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to make a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0126] The above is only the preferred embodiment of the present application, and it should be pointed out that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.
Claims
1. A model training method applied to an electronic device, the electronic device comprising: A memory and a processor configured to execute program instructions stored in the memory, the program instructions comprising: obtaining target sample data, wherein the target sample data comprises first sample data and second sample data, the number of samples of the first sample data is greater than a preset threshold, the number of samples of the second sample data is less than the preset threshold, and the target sample data comprises numerical fields and / or non-numerical fields in a financial risk control scenario; obtaining type information of an initial encoder; determining a target processing mode corresponding to the target sample data based on the type information of the initial encoder; performing format processing on the target sample data using the target processing mode to obtain an intermediate processing result; performing machine learning training on a first classification model and a second classification model based on the intermediate processing result to obtain a target classification model, wherein the first classification model comprises an initial encoder and a first classifier, the second classification model comprises a target encoder and a second classifier, the first classifier is configured to perform classification processing on the first sample data, the second classifier is configured to perform classification processing on the second sample data, and the target classification model is configured to perform classification processing on test sample data in the financial risk control scenario; wherein performing machine learning training on the first classification model and the second classification model based on the intermediate processing result comprises: for the first classification model, repeatedly performing the following operations: training the first classification model based on the intermediate processing result corresponding to the first sample data and recording a first loss error, wherein the first loss error is used to determine the target encoder; and for the second classification model, repeatedly performing the following operations: training the second classification model based on the intermediate processing result corresponding to the second sample data and recording a second loss error, wherein the second loss error is used to determine the target classification model.
2. The model training method of claim 1, wherein, The method further comprises: obtaining first sample data corresponding to a first classification label and second sample data corresponding to a second classification label, wherein the first classification label is used to train the first classifier, the second classification label is used to train the second classifier, and the first classification label is associated with the second classification label.
3. The model training method of claim 1, wherein, The method further comprises: obtaining test sample data and a business evaluation index; performing classification processing on the test sample data using the target classification model to obtain a classification result; performing a prediction score on the classification result based on the business evaluation index to obtain a score result, wherein the score result is used to determine whether the classification result is accurate. 4.A model training apparatus applied to an electronic device, the electronic device comprising: A memory and a processor configured to execute program instructions stored in the memory, the model training apparatus comprising: An acquisition module is configured to acquire target sample data, wherein the target sample data includes first sample data and second sample data, the number of samples of the first sample data is greater than a preset threshold, the number of samples of the second sample data is less than the preset threshold, and the target sample data includes numerical fields and / or non-numerical fields in a financial risk control scenario. A processing module is configured to acquire type information of an initial encoder, determine a target processing manner corresponding to the target sample data based on the type information of the initial encoder, and perform format processing on the target sample data by using the target processing manner to obtain an intermediate processing result. A training module is configured to perform machine learning training on a first classification model and a second classification model based on the intermediate processing result to obtain a target classification model, wherein the first classification model includes an initial encoder and a first classifier, the second classification model includes a target encoder and a second classifier, the first classifier is configured to perform classification processing on the first sample data, the second classifier is configured to perform classification processing on the second sample data, and the target classification model is configured to perform classification processing on test sample data in the financial risk control scenario. The training module is further configured to, for the first classification model, repeatedly perform the following operations: training the first classification model based on the intermediate processing result corresponding to the first sample data and recording a first loss error, wherein the first loss error is used to determine the target encoder; and for the second classification model, repeatedly perform the following operations: training the second classification model based on the intermediate processing result corresponding to the second sample data and recording a second loss error, wherein the second loss error is used to determine the target classification model.
5. A non-volatile storage medium, characterized by, The storage medium has a computer program stored therein, wherein the computer program is configured to execute the model training method described in any one of claims 1 to 3 when running.
6. A processor, comprising: The processor is configured to run a program, wherein the program is configured to execute the model training method described in any one of claims 1 to 3 when running. 7.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory has a computer program stored therein, and the processor is configured to run the computer program to execute the model training method described in any one of claims 1 to 3.
Citation Information
Patent Citations
Video classification model training method, classification method, device and equipment
CN110781960A