Model training method and device, storage medium and electronic equipment
By preprocessing and feature importance analysis of high-dimensional data, combined with neural networks and decision tree algorithms, the problem of low efficiency and low accuracy of high-dimensional data training models is solved, and efficient data analysis and prediction in the financial field are achieved. .
Patent Information
- Application Number
- CN202410725085.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-09-27
AI Technical Summary
When existing technology uses high-dimensional data to train models, the training efficiency is low and the prediction accuracy is not high. Especially in the field of online finance, it is difficult to effectively analyze the interaction of multiple data features and mine deep information.
By obtaining training data sets for preprocessing, we determine important data features, use neural network algorithms and decision tree algorithms to train and generate models, and combine feature importance analysis toolkits and build tree models to reduce unnecessary data attributes and improve model training efficiency. and prediction accuracy.
On the basis of retaining the salient features of the data, the model training efficiency is greatly improved and the high prediction accuracy of the trained model is ensured. It is suitable for high-dimensional data analysis in fields such as financial fraud and anti-money laundering.
Smart Images

Figure CN118709754A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer software technology, and in particular to a model training method, device, storage medium and electronic equipment. Background Art
[0002] As technology advances, data collection becomes easier and easier, resulting in larger and more complex databases. For example, various types of trade transaction data, user data, network usage data, and document data, the dimensions of the data can usually reach hundreds or thousands of dimensions, or even higher.
[0003] In the field of online finance, in order to identify whether a person has engaged in suspicious behaviors such as concealing or quickly transferring funds, it is necessary to perform data analysis on high-dimensional data with multiple attributes. However, due to the large amount of data and the large number of data attributes, it is difficult to analyze the interaction of multiple data features and to mine deep information from a large amount of data using conventional methods based on parameter statistical analysis. At the same time, for neural network models, a large number of data samples are input for training, which takes a long time and is inefficient. Therefore, there is an urgent need for a technical solution to solve the above technical problems, so as to improve the training efficiency when building a model using high-dimensional data training, and to ensure that the constructed model has a high prediction accuracy. Summary of the invention
[0004] The present invention provides a model training method, device, storage medium and electronic device to solve the technical problems in the prior art of low model training efficiency and low prediction accuracy of the trained model when training the model using high-dimensional data.
[0005] In a first aspect, a model training method is provided, comprising:
[0006] Obtaining a training data set, and preprocessing the training data set to obtain a first training sample set;
[0007] According to the first training sample set and based on the neural network algorithm, training and generating a first model;
[0008] Determine the important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model;
[0009] Determining a second training sample set according to the important data features;
[0010] According to the second training sample set and based on a neural network algorithm or a decision tree algorithm, a second model is trained and generated.
[0011] In a second aspect, a model training device is provided, comprising:
[0012] Training data set preprocessing module: used to obtain the training data set and preprocess the training data set to obtain the first training sample set;
[0013] A first model training generation module: used to train and generate a first model according to a first training sample set and based on a neural network algorithm;
[0014] Important data feature determination module: used to determine the important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model;
[0015] A second training sample set determination module: used to determine a second training sample set according to the important data features;
[0016] The second model training generation module is used to train and generate a second model according to the second training sample set and based on a neural network algorithm or a decision tree algorithm.
[0017] In a third aspect, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned model training method are implemented.
[0018] In a fourth aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned model training method when executing the computer program.
[0019] The above-mentioned model training method, device, storage medium and electronic device obtain a first training sample set by acquiring a training data set and preprocessing the training data set; train and generate a first model based on the first training sample set and a neural network algorithm; determine important data features in the first training sample set through a feature importance analysis toolkit or by building a tree model; determine a second training sample set based on the important data features; and train and generate a second model based on the second training sample set and a neural network algorithm or a decision tree algorithm.
[0020] This application determines the important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model. Then, the second training sample set is determined by using the automatically discovered important data features, which can greatly reduce unnecessary data attributes in high-dimensional data while retaining the significant features of the data, thereby improving the efficiency of subsequent model training and ensuring that the trained model can maintain a high prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0022] Figure 1 is a flow chart of a method for model training in one embodiment of the present invention;
[0023] Figure 2 yes Figure 1 A schematic flow chart of a specific implementation of step S10;
[0024] Figure 3 yes Figure 1 Another specific implementation flow diagram of step S10;
[0025] Figure 4 yes Figure 1 A schematic flow chart of a specific implementation of step S30;
[0026] Figure 5 is a schematic diagram for explaining SHAP values corresponding to data features in one embodiment of the present invention;
[0027] Figure 6 yes Figure 1 Another specific implementation flow diagram of step S30;
[0028] Figure 7 is a structural schematic diagram of a device for model training in one embodiment of the present invention;
[0029] Figure 8 It is a structural diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0031] Before introducing the technical solution in the embodiment of the present invention, the application scenario in the technical solution is first introduced.
[0032] With the rapid development of e-commerce, people generally conduct transactions through electronic payment. Compared with paper payment, electronic payment is more convenient and faster. At the same time, it can easily become an important means for criminals to transfer illegal funds, helping criminals to conceal and quickly transfer funds and conduct illegal activities. In order to timely discover and monitor illegal activities in the payment process and maintain the healthy operation of the economy and financial security, it is necessary to use technical means to timely discover illegal transactions in the payment process, prevent financial risks, and maintain the stability of the financial system.
[0033] However, the above illegal activities are highly concealed and feature judgment is not obvious. Therefore, it is necessary to collect massive amounts of user data for data mining, analysis and processing. The above massive user data includes multiple attributes, such as the user's gender, province, age, number of transaction days in the past 100 days, first card binding time, number of device changes in the past 90 days, number of debit card bindings, etc. When using the above high-dimensional data for modeling, due to the complex data attributes and large amount of data, the training efficiency and training results of the model are not very good. The technical solution in the embodiment of the present application is proposed based on the above application scenario, and the present invention is described in detail below through specific embodiments.
[0034] See also Figure 1 As shown, Figure 1 : is a flow chart of a method for model training in one embodiment of the present invention, comprising the following steps:
[0035] S10: Obtain a training data set, and preprocess the training data set to obtain a first training sample set.
[0036] The training data set in the embodiment of the present application is heterogeneous tabular data, which comes from high-dimensional data in the database. There are many attributes in the data set, and the calculation complexity is high when analyzing and processing the data. At the same time, since the training data set in the embodiment of the present application has the problem of imbalance between positive and negative samples, for example, in the field of financial fraud and anti-money laundering, there are few cases of real financial fraud and anti-money laundering, resulting in fewer positive samples in the database. Therefore, it is necessary to pre-process the training data set to solve the technical problem of poor model training effect due to imbalance between positive and negative samples.
[0037] In one embodiment, the preprocessing includes stratified sampling, see Figure 2 As shown, Figure 2 yes Figure 1 A specific implementation flow diagram of step S10 includes the following steps:
[0038] S11: Obtain key data features in the training data set;
[0039] S12: Obtain the distribution ratio value of the key data feature, and perform sampling based on the distribution ratio value.
[0040] Stratified sampling is mainly based on the distribution ratio of different groups, and sampling is performed in the data at a predefined ratio to reduce sampling errors and ensure uniformity in sampling space or type selection. On the other hand, the key data features in the training data set refer to the data features that have a greater impact on the model prediction results. For example, in the prediction of financial fraud and anti-money laundering behavior, the user's order volume, transaction amount, etc. will be identified as key data features. Please refer to Table 1, which shows the distribution of users' monthly orders. From the table data, it can be seen that there are as many as 450,000 users who only have one order per month, and the distribution ratio is relatively high. Then, in order to ensure the uniformity of the sampled data, a smaller sampling ratio can be predefined for user data with only one order per month. For user data with a small distribution ratio, a larger sampling ratio can be predefined.
[0041] For example, for user data with seven, eight, or nine orders per month, the sampling ratio can be larger.
[0042] Number of orders per month Number of users Distribution 1 450000 65.63% 2 130000 18.96% 3 50000 7.29% 4 20000 2.92% 5 8288 1.21% 6 4202 0.61% 7 2245 0.33% 8 1449 0.21% 9 1213 0.18%
[0043] Table 1
[0044] In another embodiment, the preprocessing includes data enhancement, see Figure 3 As shown, Figure 3 yes Figure 1 Another specific implementation flow diagram of step S10 includes the following steps:
[0045] SS11: Obtain the positive sample training data set and / or negative sample training data set that need to be enhanced in the training data set;
[0046] SS12: determining in sequence whether the feature data in the positive sample training data set and / or the negative sample training data set is continuous variable feature data;
[0047] SS13: Based on the continuous variable characteristic data, the data is noise-amplified.
[0048] Data enhancement refers to a method of increasing the amount of data by adding minor changes to existing data or creating new synthetic data from existing data. The technical means of data enhancement is also to solve the problem of imbalance between positive and negative samples. In the embodiment of the present application, due to the small number of positive samples in the fields of financial fraud and anti-money laundering, the data in the positive sample training data set is enhanced. Among them, in order to improve the accuracy of the enhanced data and ensure that the attributes of the increased data volume are close to the sample attributes, the method of adding noise to the continuous variable feature data is adopted.
[0049] Continuous variable feature data mainly refers to feature data involving transaction amounts, transaction order quantities, etc. After data enhancement, the above continuous variable feature data will not significantly affect the overall attributes of the data after data enhancement, and thus will be similar to the real data samples, which is conducive to model training. On the contrary, when data enhancement is performed on user gender or similar category feature data, the new data created will often differ greatly from the overall attributes of the real data, which will affect the training effect of the model.
[0050] In the embodiments of the present application, by performing stratified sampling and / or data enhancement on the training data set, the technical problem of imbalance between positive and negative samples in actual application scenarios can be solved, thereby improving the sample quality of the training sample set, assisting model training, and promoting the improvement of model training efficiency and prediction accuracy.
[0051] S20: According to the first training sample set and based on the neural network algorithm, train and generate a first model.
[0052] The training data set in the embodiment of the present application is heterogeneous tabular data, which comes from high-dimensional data in the database. Similarly, the data in the first training sample set after preprocessing the training data set is also high-dimensional data. In order to improve the efficiency of data analysis and processing of high-dimensional data, a training generation model is performed through a neural network algorithm. The neural network algorithm can convert meaning into vectors and geometric spaces, and then gradually learn the complex geometric transformations that map one space to another space, automatically discover the significant features of the data, and realize automatic feature extraction, which can overcome the omissions and deviations that may be caused by conventional data analysis, and greatly reduce the difficulty of artificially setting features. The neural network algorithm in the embodiment of the present application includes CNN (Convolutional Neural Networks) convolutional neural network, DNN (Deep Neural Networks) deep neural network and LSTM (Long Short Term Memory) long short-term memory network algorithm, etc. This application does not limit the specific neural network algorithm.
[0053] S30: Determine important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model.
[0054] In order to significantly reduce unnecessary data attributes in high-dimensional data while retaining important data features, thereby improving model training efficiency and prediction accuracy, the embodiments of the present application adopt a technical approach to automatically determine important data features.
[0055] In one embodiment, the feature importance analysis toolkit is the SHAP package, see Figure 4 As shown, Figure 4 yes Figure 1A specific implementation flow diagram of step S30 includes the following steps:
[0056] S31: Obtain each feature data in the first training sample set, and calculate the SHAP value of each feature based on the SHAP package;
[0057] S32: Determine important data features in the first training sample set according to the SHAP value.
[0058] SHAP (SHapley Additive explanation) is a game theory method for explaining the output of any machine learning model. By importing the SHAP package and calculating the SHAP value of the model, it is possible to rank the importance of the training data features in the model. See Figure 5 As shown, Figure 5 Schematic diagram of the SHAP value corresponding to the data feature in one embodiment of the present invention. Figure 5 As shown, it can be seen that in the process of identifying financial fraud behavior, data features such as the number of transaction days in the past 120 days and the difference from the registration date are of higher importance.
[0059] In another embodiment, the tree model is a LightGBM model, see Figure 6 As shown, Figure 6 yes Figure 1 Another specific implementation flow diagram of step S30 includes the following steps:
[0060] SS31: Import the LightGBM model and train the LightGBM model based on the first training sample set;
[0061] SS32: Determine the important data features in the first training sample set by calling the important feature function interface in the LightGBM model.
[0062] The LightGBM (Light Gradient Boosting Machine) model is a type of tree model. It implements classification and regression through a decision tree algorithm, and then trains to obtain a model. Similar models also include the XGBoost (eXtremeGradient Boosting) model. The LightGBM model has certain advantages in terms of computing speed and memory space occupation. For example, during the training process, LightGBM uses a unilateral gradient algorithm to filter out samples with small gradients, reducing a large amount of calculations. At the same time, during the training process, LightGBM uses a mutually exclusive feature bundling algorithm to reduce the number of features and memory consumption. Neural network algorithms and decision tree algorithms are two different types of algorithms, each with its own advantages. As shown in Table 2, neural network algorithms have obvious advantages in the application of large amounts of data with geometric distribution. As the number of data features increases, the advantages of neural network algorithms become more prominent. However, decision tree algorithms often generalize better than neural network algorithms in structured data applications. When the number of data features decreases, the advantages of the LightGBM algorithm gradually become apparent. In the embodiment of the present application, the neural network model is effectively combined with the tree model to complement each other's advantages and further improve the performance and training efficiency of the model.
[0063]
[0064] Table 2
[0065] In one embodiment, the first training sample set includes a basic feature data set and a non-basic feature data set, and SS31 includes the following steps:
[0066] A1: Obtain the low-dimensional output data of the fully connected layer of the neural network in the first model;
[0067] A2: Based on a predefined ratio, the basic feature data set, the non-basic feature data set and the low-dimensional output data are combined in batches, and the first training sample set is updated in sequence;
[0068] A3: Train the LightGBM model based on the updated first training sample set.
[0069] In the neural network model, most of the learning near the input end is basic concepts, such as feature information such as edges, visual shapes, and geometric changes, while the learning near the output end is abstract concepts. At the same time, the fully connected layer data near the output end generally has a low dimension. Therefore, low-dimensional data near the output end of the trained neural network model can be extracted. These data are highly result-oriented. By training the low-dimensional output data of the fully connected layer of the above neural network, the model training efficiency can be accelerated and the prediction accuracy of the model can be improved.
[0070] Furthermore, in order to give full play to the advantages of the LightGBM model in low-dimensional data training, and to prevent the lack of sufficient original feature data when training the lightGBM model, the first training sample set is divided into a basic feature data set and a non-basic feature data set, and the basic feature data set, the non-basic feature data set and the low-dimensional output data are combined into a training data set in a certain proportion, and the first training sample set is updated to train the LightGBM model. Among them, the basic feature data set mainly includes user basic attribute data, such as gender, age, province, and registered IP. Non-basic feature data sets mainly include user transaction behavior data, such as the number of transactions and transaction amount in the past 10 days.
[0071] Further, in order to improve the training efficiency of the lightGBM model, the non-basic feature data set is divided into multiple non-basic feature sub-data sets, and then the lightGBM model is trained in batches. In one embodiment, the non-basic feature data set includes 600 feature data, and the non-basic feature data set is divided into 6 non-basic feature sub-data sets, each of which includes 100 feature data. At the same time, half of the feature data is extracted from the low-dimensional output data of the fully connected layer of the neural network and combined with the basic feature data set and the non-basic feature data of 100 features to form a training sample set for the LightGBM model. After the LightGBM model is trained, the data features are sorted by importance, and obviously unimportant data features are eliminated, and then combined with 100 feature data of another non-basic feature sub-data set, the first training sample set is updated, the LightGBM model is trained again, and the data features are sorted by importance, and obviously unimportant data features are eliminated again. By analogy, the data training of the above non-basic feature data set is completed. At this point, the number of data features in the first training sample set will be significantly reduced, and all important data features are retained.
[0072] In one embodiment, step SS32 includes: determining the important data features of multiple sub-data sets in the non-basic features in sequence by calling the important feature function interface in the LightGBM model. The important feature function interface in the LightGBM model is the feature_importances method in the LightGBM model. The Feature_importances method measures the importance by the number of times the feature is split or by the gain after the feature is split. Therefore, the important data features of multiple sub-data sets in the non-basic features can be determined by the feature_importances method.
[0073] S40: Determine a second training sample set according to the important data features.
[0074] S50: According to the second training sample set, and based on a neural network algorithm or a decision tree algorithm, train and generate a second model.
[0075] In an embodiment of the present application, after the important data features in the first training sample set are automatically screened and extracted, a second training sample set is formed. Compared with the first training sample set, the amount of data in the second training sample set is greatly reduced, and the reduced feature data is unnecessary data, so that a lightweight model with a simple structure and good prediction effect can be obtained on the basis of training based on the second training sample set. Similarly, through the feature importance analysis toolkit, after the important data features in the first training sample set and the second training sample set are successively determined, the second model can be generated by training based on the neural network algorithm. Or, by constructing a tree model, after the important data features in the first training sample set and the second training sample set are successively determined, the second model can be generated by training based on the decision tree algorithm. However, combining the neural network algorithm and the decision tree algorithm to train the model can complement the advantages of the two types of algorithms, improve the model training efficiency, and improve the model recognition accuracy and prediction accuracy.
[0076] It can be seen that the embodiment of the present application obtains a training data set and preprocesses the training data set to obtain a first training sample set; according to the first training sample set, and based on the neural network algorithm, a first model is trained and generated; through a feature importance analysis toolkit or building a tree model, important data features in the first training sample set are determined; according to the important data features, a second training sample set is determined; according to the second training sample set, and based on the neural network algorithm or the decision tree algorithm, a second model is trained and generated.
[0077] The embodiment of the present application determines the important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model. Then, the second training sample set is determined by using the automatically discovered important data features, which can greatly reduce unnecessary data attributes in high-dimensional data while retaining the significant features of the data, thereby improving the efficiency of subsequent model training and ensuring that the trained model can maintain a high prediction accuracy.
[0078] It should be understood that the order of execution of the steps in the above embodiments does not necessarily mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention. In addition, the term "including" and its variants should be interpreted as an open term of "including but not limited to".
[0079] In one embodiment, a model training device is provided, and the training device corresponds to the model training method in the above embodiment. Figure 7As shown, the training device includes: a training data set preprocessing module 201, a first model training generation module 202, an important data feature determination module 203, a second training sample set determination module 204 and a second model training generation module 205. The functional modules are described in detail as follows:
[0080] The training data set preprocessing module 201 is used to obtain a training data set and preprocess the training data set to obtain a first training sample set.
[0081] The first model training generation module 202 is used to train and generate a first model according to a first training sample set and based on a neural network algorithm.
[0082] The important data feature determination module 203 is used to determine the important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model.
[0083] The second training sample set determination module 204 is configured to determine the second training sample set according to the important data features.
[0084] The second model training generation module 205 is used to train and generate a second model according to the second training sample set and based on a neural network algorithm or a decision tree algorithm.
[0085] A possible implementation is provided in an embodiment of the present application, wherein the preprocessing includes stratified sampling, and the training data set preprocessing module 201 is further used for:
[0086] Obtain key data features in the training data set;
[0087] The distribution ratio value of the key data feature is obtained, and sampling is performed based on the distribution ratio value.
[0088] A possible implementation method is provided in an embodiment of the present application, wherein the preprocessing further includes data enhancement, and the training data set preprocessing module 201 is further used to:
[0089] Obtaining a positive sample training data set and / or a negative sample training data set that needs to be enhanced in the training data set;
[0090] Determining in turn whether the feature data in the positive sample training data set and / or the negative sample training data set is continuous variable feature data;
[0091] Based on the continuous variable characteristic data, the data is noise-amplified.
[0092] A possible implementation method is provided in an embodiment of the present application, wherein the feature importance analysis toolkit is a SHAP package, and the important data feature determination module 203 is further used to:
[0093] Obtain each feature data in the first training sample set, and calculate the SHAP value of each feature based on the SHAP package;
[0094] According to the SHAP value, important data features in the first training sample set are determined.
[0095] A possible implementation method is provided in an embodiment of the present application, wherein the tree model is a LightGBM model, and the important data feature determination module 203 is further used to:
[0096] Import the LightGBM model and train the LightGBM model based on the first training sample set;
[0097] By calling the important feature function interface in the LightGBM model, the important data features in the first training sample set are determined.
[0098] In an embodiment of the present application, a possible implementation is provided, wherein the first training sample set includes a basic feature data set and a non-basic feature data set, and the important data feature determination module 203 is further used to:
[0099] Obtain low-dimensional output data of the fully connected layer of the neural network in the first model;
[0100] Based on a predefined ratio, the basic feature data set, the non-basic feature data set and the low-dimensional output data are combined in batches, and the first training sample set is updated in sequence;
[0101] The LightGBM model is trained according to the updated first training sample set.
[0102] A possible implementation method is provided in an embodiment of the present application, wherein the non-basic feature data set includes a plurality of non-basic feature sub-data sets, and the important data feature determination module 203 is further used to:
[0103] By calling the important feature function interface in the LightGBM model, the important data features of multiple sub-datasets in the non-basic features are determined in turn.
[0104] The present application provides a device for model training, which obtains a first training sample set by acquiring a training data set and preprocessing the training data set; trains and generates a first model based on the first training sample set and a neural network algorithm; determines important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model; determines a second training sample set based on the important data features; and trains and generates a second model based on the second training sample set and a neural network algorithm or a decision tree algorithm.
[0105] This application determines the important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model. Then, the second training sample set is determined by using the automatically discovered important data features, which can greatly reduce unnecessary data attributes in high-dimensional data while retaining the significant features of the data, thereby improving the efficiency of subsequent model training and ensuring that the trained model can maintain a high prediction accuracy.
[0106] For the specific definition of the device for model training, please refer to the definition of the method for model training above, which will not be repeated here. Each module in the above-mentioned device for model training can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0107] In one embodiment, a computer device is provided, whose internal structure diagram can be as follows: Figure 8 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer program is executed by the processor, it implements the functions or steps of a model training method.
[0108] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0109] Obtaining a training data set, and preprocessing the training data set to obtain a first training sample set;
[0110] According to the first training sample set and based on the neural network algorithm, training and generating a first model;
[0111] Determine the important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model;
[0112] Determining a second training sample set according to the important data features;
[0113] According to the second training sample set and based on a neural network algorithm or a decision tree algorithm, a second model is trained and generated.
[0114] In one embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0115] Obtaining a training data set, and preprocessing the training data set to obtain a first training sample set;
[0116] According to the first training sample set and based on the neural network algorithm, training and generating a first model;
[0117] Determine the important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model;
[0118] Determining a second training sample set according to the important data features;
[0119] According to the second training sample set and based on a neural network algorithm or a decision tree algorithm, a second model is trained and generated.
[0120] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant description in the aforementioned method embodiment. In order to avoid repetition, they will not be described one by one here.
[0121] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0122] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0123] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A model training method, characterized in that: include: Obtaining a training data set, and preprocessing the training data set to obtain a first training sample set; According to the first training sample set and based on the neural network algorithm, training and generating a first model; Determine the important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model; Determining a second training sample set according to the important data features; According to the second training sample set and based on a neural network algorithm or a decision tree algorithm, a second model is trained and generated.
2. The method according to claim 1, characterized in that The feature importance analysis toolkit is a SHAP package, and determining the important data features in the first training sample set by using the feature importance analysis toolkit includes: Obtain each feature data in the first training sample set, and calculate the SHAP value of each feature based on the SHAP package; According to the SHAP value, important data features in the first training sample set are determined.
3. The method according to claim 1, characterized in that The tree model is a LightGBM model. The important data features in the first training sample set are determined by constructing the tree model, including: Import the LightGBM model and train the LightGBM model based on the first training sample set; By calling the important feature function interface in the LightGBM model, the important data features in the first training sample set are determined.
4. The method according to claim 3, characterized in that The first training sample set includes a basic feature data set and a non-basic feature data set, and the importing of the LightGBM model and training the LightGBM model based on the first training sample set include: Obtain low-dimensional output data of the fully connected layer of the neural network in the first model; Based on a predefined ratio, the basic feature data set, the non-basic feature data set and the low-dimensional output data are combined in batches, and the first training sample set is updated in sequence; The LightGBM model is trained according to the updated first training sample set.
5. The method according to claim 4, characterized in that The non-basic feature data set includes a plurality of non-basic feature sub-data sets, and determining the important data features in the first training sample set by calling the important feature function interface in the LightGBM model includes: By calling the important feature function interface in the LightGBM model, the important data features of multiple sub-datasets in the non-basic features are determined in turn.
6. The method according to claim 1, characterized in that The preprocessing includes stratified sampling, including: Obtain key data features in the training data set; The distribution ratio value of the key data feature is obtained, and sampling is performed based on the distribution ratio value.
7. The method according to any one of claims 1 to 6, characterized in that: The preprocessing also includes data enhancement, specifically including: Obtaining a positive sample training data set and / or a negative sample training data set that needs to be enhanced in the training data set; Determining in turn whether the feature data in the positive sample training data set and / or the negative sample training data set is continuous variable feature data; Based on the continuous variable characteristic data, the data is noise-amplified.
8. A model training device, characterized in that: include: Training data set preprocessing module: used to obtain the training data set and preprocess the training data set to obtain the first training sample set; A first model training generation module: used to train and generate a first model according to a first training sample set and based on a neural network algorithm; Important data feature determination module: used to determine the important data features in the first training sample set by using a feature importance analysis toolkit or building a tree model; A second training sample set determination module: used to determine a second training sample set according to the important data features; The second model training generation module is used to train and generate a second model according to the second training sample set and based on a neural network algorithm or a decision tree algorithm.
9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 7 when executed.
10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Financial risk assessment method and device based on feature construction and electronic equipment
CN112270547A
Satisfaction degree prediction model training method, device, electronic equipment and storage medium
CN113837323A
Insurance case importance confirmation method and device, server and storage medium
CN116843480A
Rule training method, apparatus, device, and storage medium
WO2021017293A1
Cited By
Large model data pollution monitoring and evaluation method and system based on keyword library
CN119088975A
Heart disease prediction method and device, electronic equipment and storage medium
CN119480139A
