Decision tree model construction method and device, customer classification method and device based on decision tree model, electronic equipment and computer readable storage medium
By using mean difference information, mean variance information and sample number proportional coefficients in the decision tree model, the problem of feature selection affecting prediction accuracy in the existing technology is solved, and high-precision prediction and The effect of model robustness.
Patent Information
- Application Number
- CN202411311839.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-13
AI Technical Summary
The existing decision tree model has insufficient information gain calculation method when selecting feature, which affects the prediction accuracy. Especially on data sets related to financial products overdue payment, it is difficult to obtain high-precision prediction results at a smaller tree depth.
The information gain formula based on mean difference information, mean variance information and sample number proportional coefficient is used to iterate the information gain of the characteristic attributes of each node, divide the data set according to the maximum information gain until the preset stop condition is reached, and a decision tree model is constructed.
Improve prediction accuracy at smaller tree depths, the model converges quickly, is highly robust, and reduces the risk of overfitting.
Smart Images

Figure CN119128703A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning technology, and in particular to a decision tree model construction method and device, a customer classification method and device based on a decision tree model, an electronic device, and a computer-readable storage medium. Background Art
[0002] The decision tree model is a classic algorithm model in the field of machine learning. The decision tree is a tree structure that represents the classification of samples based on features. The classification process of the decision tree can be summarized as recursively selecting the optimal partitioning features from a given data set based on the feature selection criteria, and splitting the data set according to the selected optimal partitioning features, so that each sub-data set has the best classification process.
[0003] The feature selection criteria of the decision tree model include information gain. Information gain is the difference between the information entropy before and after a data set is divided by a certain feature. Information entropy is used to measure the uncertainty of random variables. Therefore, information gain can be used to measure the effect of using a certain feature to divide the data set, thereby affecting the final prediction accuracy of the decision tree model. Summary of the invention
[0004] The embodiments of the present application provide a decision tree model construction method and device, a customer classification method and device based on a decision tree model, an electronic device and a computer-readable storage medium, so as to calculate the optimal partitioning features through a special information gain formula to improve the final prediction accuracy of the decision tree model.
[0005] The present application embodiment adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a decision tree model construction method, the method comprising:
[0007] Acquire a training data set including a plurality of training samples, wherein the training samples have known category attributes and feature information of different feature attributes related to overdue financial products;
[0008] Obtaining an information gain formula, wherein the information gain formula is pre-constructed based on mean difference information between sub-datasets after the data set contained in the node is divided, variance mean information between the sub-datasets, and a sample quantity ratio coefficient before and after the data set is divided;
[0009] In the process of generating a decision tree model according to the training data set, the information gain of each feature attribute under each node is iteratively calculated according to the information gain formula, and the data set contained in the current node is divided according to the feature attribute corresponding to the maximum information gain, so as to form multiple child nodes based on the current node splitting, until a preset stop condition is reached;
[0010] Output a decision tree model constructed according to the training data set.
[0011] In a second aspect, an embodiment of the present application further provides a customer classification method based on a decision tree model, the method comprising:
[0012] Obtaining a customer sample of bank customers, wherein the customer sample includes characteristic information of different characteristic attributes related to overdue financial products;
[0013] Using a decision tree model to make classification decisions on the customer samples, and obtaining the probability of each category attribute of the bank customers;
[0014] The customer group to which the bank customer belongs is determined according to the probability of each category attribute of the bank customer.
[0015] In a third aspect, an embodiment of the present application provides a decision tree model construction device, the device comprising:
[0016] A first acquisition unit is used to acquire a training data set including a plurality of training samples, wherein the training samples have known category attributes and feature information of different feature attributes related to overdue financial products;
[0017] A second acquisition unit is used to acquire an information gain formula, wherein the information gain formula is pre-constructed according to the mean difference information between the sub-data sets after the data set contained in the node is divided, the variance mean information between the sub-data sets, and the sample quantity ratio coefficient before and after the data set is divided;
[0018] A model generation unit, used to iteratively calculate the information gain of each feature attribute under each node according to the information gain formula in the process of generating a decision tree model according to the training data set, and divide the data set contained in the current node according to the feature attribute corresponding to the maximum information gain, so as to form multiple child nodes based on the current node split, until a preset stop condition is reached;
[0019] The model output unit is used to output the decision tree model constructed according to the training data set.
[0020] In a fourth aspect, an embodiment of the present application further provides a customer classification device based on a decision tree model, the device comprising:
[0021] A customer sample acquisition unit, used to acquire customer samples of bank customers, wherein the customer samples include feature information of different feature attributes related to overdue financial products;
[0022] A classification decision unit, used to make classification decisions on the customer samples using a decision tree model to obtain the probability of each category attribute of the bank customer;
[0023] The customer group division unit is used to determine the customer group to which the bank customer belongs according to the probability of each category attribute of the bank customer.
[0024] In a fifth aspect, an embodiment of the present application further provides an electronic device, including:
[0025] A processor; and a memory arranged to store computer executable instructions, which, when executed, cause the processor to perform a decision tree model building method or a customer classification method based on a decision tree model.
[0026] In a sixth aspect, an embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, and when the one or more programs are executed by an electronic device including multiple application programs, the electronic device executes a decision tree model construction method or a customer classification method based on a decision tree model.
[0027] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0028] The embodiment of the present application constructs an information gain formula in advance according to the mean difference information between the sub-datasets after the data set is divided, the variance mean information between the sub-datasets, and the sample quantity ratio coefficient before and after the data set is divided. In the process of generating a decision tree model according to the training data set, the information gain of each feature attribute under each node is iteratively calculated according to the information gain formula, and the data set contained in the current node is divided according to the feature attribute corresponding to the maximum information gain, so as to form multiple child nodes based on the current node splitting until the preset stop condition is reached. The method of the embodiment of the present application can obtain a relatively high-precision prediction result under a small tree depth, and the model converges quickly and has high robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0030] Figure 1 This is a schematic diagram of the structure of a decision tree model in an embodiment of the present application;
[0031] Figure 2 A flowchart of a decision tree model construction method in an embodiment of the present application;
[0032] Figure 3 A flowchart of a customer classification method based on a decision tree model in an embodiment of the present application;
[0033] Figure 4A schematic diagram of the structure of a decision tree model building device in an embodiment of the present application;
[0034] Figure 5 This is a schematic diagram of the structure of a customer classification device based on a decision tree model in an embodiment of the present application;
[0035] Figure 6 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0037] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0038] Figure 1 is a schematic diagram of the structure of a decision tree model in an embodiment of the present application, such as Figure 1 As shown in the figure, a decision tree consists of several nodes, which are connected by branches. The nodes include internal nodes and leaf nodes. Each internal node represents a classification test on a feature attribute, and each branch represents the output of this feature attribute in a certain value range; each leaf node represents a class or class distribution, and the node at the top level of the tree structure is called the root node.
[0039] The generation process of a decision tree is a supervised learning process. By giving a number of training samples, each of which has a set of feature attributes and a classification result, that is, the category attributes are known, a decision tree model can be obtained by learning the classification results of these samples. This decision tree model can predict the correct classification for the feature attributes of new samples.
[0040] The process of generating a decision tree is essentially a process of continuously dividing a data set into optimal data subsets using the criteria that meet the feature selection. For each division of the data set, it is hoped that the optimal data subset will be obtained, so that the final decision tree structure generated is optimal. The feature selection criteria based on which the decision tree is generated mainly include information gain and information entropy, that is, whether each division of the data set is optimal is measured by information gain and information entropy. Among them, information entropy is used to measure the uncertainty of random variables, and information gain is the difference between the information entropy before and after the data set is divided by a certain feature attribute. For the data set to be divided, the information entropy before the division is usually certain, and the information entropy after the division is uncertain. The smaller the information entropy after the division, the smaller the uncertainty of the data subset obtained by the current feature division, that is, the greater the difference in the information entropy before and after the division, the smaller the uncertainty of the data set divided by the current feature attribute. Therefore, the difference in the information entropy of the data set before and after the division (i.e., information gain) can be used to measure the effect of using the current feature attribute for the data set division.
[0041] In the process of building a decision tree, we always hope to achieve a data set partition with less uncertainty more quickly so that the decision tree structure can achieve better classification results. Therefore, the feature with the largest information gain is usually selected as the optimal partitioning feature to divide the current data set.
[0042] The study found that when the existing technology selects the optimal partitioning feature according to information gain to partition the data set, the calculation method of the information gain value will affect the selection of the optimal partitioning feature, and then affect the prediction effect of the decision tree model. Therefore, it is necessary to design a reasonable information gain value calculation formula to improve the prediction accuracy of the decision tree model.
[0043] The present application embodiment provides a decision tree model construction method, such as Figure 2 As shown, a flow chart of a decision tree model construction method in an embodiment of the present application is provided, and the method at least includes the following steps S210 to S240:
[0044] Step S210, obtaining a training data set including a plurality of training samples, wherein the training samples have known category attributes and feature information of different feature attributes related to overdue financial products.
[0045] The construction of a decision tree model is to obtain a data model for classification by learning the association between the feature attributes of several training samples and the classification results. Its essential process is to continuously divide the data set formed by the feature information of several features into optimal data subsets using the criteria that meet the feature selection. Therefore, for the construction of a decision tree model, it is necessary to obtain a training data set formed by the feature information of multiple training samples under different feature attributes, and the category attributes of each training sample are known. Subsequently, the training data set is continuously divided to generate the nodes and branches of the decision tree model accordingly, that is, the nodes are continuously split until the data set contained in the child nodes obtained by the split can determine the attribute category and reach the preset stop condition, thereby finally obtaining a decision tree model with data classification function.
[0046] It should be noted that feature information refers to specific feature values, and feature attributes are attributes used to describe the same type of feature information. Taking the classification of bank customers as an example, the deposit amount, total investment, total liabilities, credit card limit, number of credit card secondary cards, whether there is an overdue situation, whether there is cash withdrawal behavior, etc. are all feature attributes. The feature value of the bank customer under the corresponding feature attribute is the specific feature information. For example, a bank customer has a deposit amount of 500,000 yuan, a total investment of 100,000 yuan, a credit card limit of 20,000 yuan, a number of credit card secondary cards of 2, no overdue situation, and no cash withdrawal behavior. These are the feature information of the bank customer under different feature attributes. It should be understood that the feature information of the training sample and the feature attributes corresponding to the feature information should be determined according to the actual scenario. The above example does not represent a restriction on the feature information under different feature attributes. Those skilled in the art can determine the feature attributes related to the overdue of financial products according to application requirements.
[0047] In some applications, the decision tree model is used for data regression processing, and each feature information of the training sample should be in the form of a 0-1 numerical value.
[0048] The execution subject of the decision tree model construction method of the embodiment of the present application is a computing device. It is understandable that the above computing device can be hardware or software. When the computing device is hardware, it can be a distributed cluster composed of multiple servers or terminal devices, or a single server or a single terminal device. When the computing device is embodied as software, it can be installed in the hardware devices listed above. The computing device can also be multiple software or software modules used to provide distributed services, or it can be implemented as a single software or software module, which is not specifically limited here.
[0049] Step S220, obtaining an information gain formula, wherein the information gain formula is pre-constructed based on the mean difference information between the sub-datasets after the data set contained in the node is divided, the variance mean information between the sub-datasets, and the sample quantity ratio coefficient before and after the data set is divided.
[0050] Step S230, in the process of generating a decision tree model according to the training data set, the information gain of each feature attribute under each node is iteratively calculated according to the information gain formula, and the data set contained in the current node is divided according to the feature attribute corresponding to the maximum information gain, so as to form multiple child nodes based on the current node splitting, until the preset stopping condition is reached.
[0051] In the process of building a decision tree model, it is necessary not only to build each node of the decision tree model, including internal nodes (the root node at the top of the tree structure) and leaf nodes, but also to build branches for connecting nodes.
[0052] Since the internal nodes represent classification tests on a feature attribute, in the process of generating a decision tree model based on the training data set, it is necessary to iteratively calculate the information gain of each feature attribute under each node, and divide the data set contained in the current node according to the feature attribute corresponding to the maximum information gain, so as to form multiple child nodes based on the current node splitting, until the preset stopping condition is reached.
[0053] Among them, the current node can be called the parent node corresponding to the child node obtained by splitting, and the relationship between the parent node and the child node is called a branch, which is usually the output of the feature attribute represented by the parent node in a certain value range.
[0054] Step S240, outputting a decision tree model constructed according to the training data set.
[0055] The above steps reflect the process of supervised learning based on the training data set. By learning the classification results of the training samples contained in the training data set through the above process, a decision tree model constructed based on the training data set can be obtained. This decision tree model can predict the correct attribute category for the characteristic attributes of the new sample.
[0056] like Figure 2It can be seen from the decision tree model construction method shown that the embodiment of the present application constructs the information gain formula in advance according to the mean difference information between the sub-data sets after the data set is divided, the variance mean information between the sub-data sets, and the sample quantity ratio coefficient before and after the data set is divided. In the process of generating a decision tree model according to the training data set, the information gain of each feature attribute under each node is iteratively calculated according to the information gain formula, and the data set contained in the current node is divided according to the feature attribute corresponding to the maximum information gain, so as to form multiple child nodes based on the current node splitting until the preset stop condition is reached. The method of the embodiment of the present application can obtain a relatively high-precision prediction result under a small tree depth, and the model converges quickly and has high robustness.
[0057] In some embodiments of the present application, the information gain formula is constructed by the following steps:
[0058] Calculating the proportionality coefficient according to the number of samples in the data set contained in the node to be split and the number of samples in the data set contained in each child node formed by splitting the node to be split;
[0059] Calculating the mean difference information of the node to be split according to the known category attributes of the training samples in the data set contained in each child node;
[0060] Calculate the variance mean information according to the number of samples in the data set contained in the node to be split, the number of samples in the data set contained in each child node, and the category attributes of the training samples in the data set contained in each child node;
[0061] The information gain formula of the node to be split is obtained according to the proportional coefficient, the mean difference information and the variance mean information.
[0062] Specifically, the proportional coefficient weight is calculated by formula (1):
[0063] weight = -2 / (log2(len_1 / len_all)+log2(len_2 / len_all)) (1)
[0064] The mean difference information mean_diff is calculated by formula (2):
[0065] mean_diff = abs(mean(x1)-mean(x2)) (2)
[0066] The variance mean information var_all is calculated by formula (3):
[0067] var_all = (var(x1)*len_1 + var(x2)*len_2) / len_all (3)
[0068] The formula of the information gain gain_split of the node to be split is:
[0069] gain_split = weight*mean_diff / var_all (4)
[0070] In the above formula, len_all is the number of samples in the data set contained in the node to be split, len_1 and len_2 are the number of samples in the data set contained in the two child nodes formed by the node to be split, x1 and x2 are the category attribute values of the training samples in the data set contained in the two child nodes formed by the node to be split, log is the logarithm operator, mean() is the mean operator, abs() is the absolute value operator, and var() is the variance operator.
[0071] This embodiment uses the logarithm of the proportion of the number of samples of the left and right child nodes formed by the split and the proportional coefficient of the information gain formula, which can effectively avoid the influence of a small number of samples on the optimal partitioning features and thus reduce the overfitting of the algorithm, and can improve the prediction effect of the model while reducing the tree depth.
[0072] In some embodiments of the present application, the above Figure 2 The decision tree model building method in also includes:
[0073] Obtain a tree depth reference value of the decision tree model and a sample quantity threshold for each category attribute. The tree depth reference value here can be set based on experience. The preset stop condition for building the decision tree model includes that the tree depth of the generated decision tree model reaches the tree depth reference value; the sample quantity threshold should be a value greater than 2, and the sample quantity threshold can be set based on experience.
[0074] Accordingly, in the above step S230, the information gain of each feature attribute under each node is iteratively calculated according to the information gain formula, specifically including:
[0075] Get the number of samples in the data set contained in each child node formed by splitting the current node;
[0076] If the number of samples in the data set contained in one of the child nodes formed by splitting the current node is not greater than the sample number threshold, then determining that the information gain of the current node is zero;
[0077] If the number of samples in the data set contained in each child node formed by splitting the current node is greater than the sample number threshold, the information gain of the current node is calculated according to the information gain formula.
[0078] For example, if the sample quantity threshold is 20, if the data set contained in the current node is divided according to a certain characteristic attribute, the number of samples in the data set contained in the left child node obtained by the division is M and the number of samples in the data set contained in the right child node is N. If both M and N are greater than 20, the information gain gain_split of the current node is calculated according to the information gain formula shown in formula (4); if M and / or N is less than or equal to 20, the information gain of the current node is set to 0.
[0079] The following describes in detail the process of constructing the decision tree model of the embodiment of the present application by taking the construction of a decision tree model for classifying bank customers as an example.
[0080] Firstly, a training data set is constructed through the customer data of a bank's existing credit card customers. The training data set includes multiple training samples. The category attribute of each training sample is known. It is assumed that the category attributes are two categories: having overdue risk and not having overdue risk. Each training sample has feature information of different feature attributes related to overdue financial products.
[0081] Then, a regression tree model algorithm is constructed, and the input variables of the regression tree model algorithm are set to be a tree depth reference value and a sample quantity threshold value of each category attribute;
[0082] Next, the information gain of each feature segmentation point of the current node under each feature attribute is calculated according to formula (4), and the maximum information gain Gain_var of the current node under each feature attribute is calculated according to formula (5):
[0083] Gain_var = max(gain_split) (5)
[0084] According to formula (6), the maximum information gain Gain of the current node among all feature attributes is calculated:
[0085] Gain = max(Gain_var) (6)
[0086] The feature segmentation point corresponding to the maximum information gain Gain of the current node among all feature attributes is taken as the optimal partitioning feature, and the data set contained in the current node is partitioned according to the optimal partitioning feature to obtain the left child node and the right child node split from the current node.
[0087] Repeat the above steps until the regression tree model reaches the tree depth reference value.
[0088] The above embodiment clearly describes the detailed process of constructing a decision tree model. However, the final acquisition of the decision tree model, in addition to the training generation stage as described above, usually also includes a stage of testing the decision tree model obtained in the training generation stage. After the generated decision tree model is verified to meet the requirements through testing, the decision tree model is used for actual classification prediction.
[0089] It can be seen from the above embodiments of the present application that the decision tree model constructed in the embodiments of the present application has the following characteristics:
[0090] Fast convergence, able to get relatively good prediction results with a small tree depth;
[0091] High robustness, smaller difference in prediction effect between training dataset and test dataset;
[0092] When calculating the optimal partitioning features, the algorithm for splitting points with more even distribution of samples between the left and right leaf nodes will be given a higher calculation weight;
[0093] The minimum number of samples in the data set contained in the leaf node of the decision tree model is 2;
[0094] In the process of building a decision tree model, the characteristic information of the training samples supports numerical variables, and categorical variables need to be converted from 0 to 1.
[0095] The present application embodiment provides a customer classification method based on a decision tree model, such as Figure 3 As shown, a flow chart of a customer classification method based on a decision tree model in an embodiment of the present application is provided, and the method at least includes the following steps S310 to S330:
[0096] Step S310, obtaining a customer sample of bank customers, wherein the customer sample includes feature information of different feature attributes related to overdue financial products.
[0097] In this embodiment, the characteristic attributes of the customer samples correspond one-to-one to the characteristic attributes of the training samples.
[0098] Step S320, using a decision tree model to perform classification decisions on the customer data, and obtaining the probability of each category attribute of the bank customer.
[0099] The decision tree model in this embodiment is constructed based on the previous embodiments, and will not be described in detail in this embodiment.
[0100] Step S330: determining the customer group to which the bank customer belongs according to the probability of each category attribute of the bank customer.
[0101] If the category attributes of the decision tree model include two categories: those with overdue risk and those without overdue risk, then it is possible to determine whether the bank customer belongs to the risky customer group based on the probability of the bank customer in each category attribute. For example, when the probability corresponding to the category attribute of having overdue risk is greater than 0.85, the bank customer is classified as a risky customer group.
[0102] The present application also provides a decision tree model construction device, such as Figure 4 As shown, a schematic diagram of the structure of a decision tree model construction device in an embodiment of the present application is provided, wherein the decision tree model construction device 400 includes: a first acquisition unit 410, a second acquisition unit 420, a model generation unit 430 and a model output unit 440, wherein:
[0103] A first acquisition unit 410 is used to acquire a training data set including a plurality of training samples, wherein the training samples have known category attributes and feature information of different feature attributes related to overdue financial products;
[0104] A second acquisition unit 420 is used to acquire an information gain formula, wherein the information gain formula is pre-constructed according to the mean difference information between the sub-data sets after the data set contained in the node is divided, the variance mean information between the sub-data sets, and the sample quantity ratio coefficient before and after the data set is divided;
[0105] The model generation unit 430 is used to iteratively calculate the information gain of each feature attribute under each node according to the information gain formula in the process of generating a decision tree model according to the training data set, and divide the data set contained in the current node according to the feature attribute corresponding to the maximum information gain, so as to form multiple child nodes based on the current node split, until a preset stop condition is reached;
[0106] The model output unit 440 is used to output the decision tree model constructed according to the training data set.
[0107] In some embodiments of the present application, the decision tree model construction device 400 further includes an information gain formula construction unit;
[0108] The information gain formula construction unit is used to calculate the proportionality coefficient according to the number of samples in the data set contained in the node to be split and the number of samples in the data set contained in each child node formed by splitting the node to be split; calculate the mean difference information of the node to be split according to the known category attributes of the training samples in the data set contained in each child node; calculate the variance mean information according to the number of samples in the data set contained in the node to be split, the number of samples in the data set contained in each child node, and the category attributes of the training samples in the data set contained in each child node; and obtain the information gain formula of the node to be split according to the proportionality coefficient, the mean difference information and the variance mean information.
[0109] In some embodiments of the present application, the proportionality coefficient is calculated by the formula weight=-2 / (log2(len_1 / len_all)+log2(len_2 / len_all)); the mean difference information is calculated by the formula mean_diff=abs(mean(x1)-mean(x2)); the variance mean information is calculated by the formula var_all=(var(x1)*len_1+var(x2)*len_2) / len_all; the information gain formula of the node to be split is gain_split=weight*mean_diff / var_all; wherein len_all is the number of samples in the data set contained in the node to be split, len_1 and len_2 are the number of samples in the data set contained in the two child nodes formed by the node to be split, x1 and x2 are the category attribute values of the training samples in the data set contained in the two child nodes formed by the node to be split, weight is the proportionality coefficient, mean_diff is the mean difference information, var_all is the variance mean information, and gain_split is the information gain of the node to be split.
[0110] In some embodiments of the present application, the second acquisition unit 420 is further used to acquire a tree depth reference value of the decision tree model and a sample quantity threshold value of each category attribute;
[0111] The model generation unit 430 is specifically used to obtain the number of samples in the data set contained in each child node formed by splitting the current node; if the number of samples in the data set contained in one of the child nodes formed by splitting the current node is not greater than the sample number threshold, the information gain of the current node is determined to be zero; if the number of samples in the data set contained in each child node formed by splitting the current node is greater than the sample number threshold, the information gain of the current node is calculated according to the information gain formula.
[0112] In some embodiments of the present application, the preset stop condition includes that the tree depth of the generated decision tree model reaches the tree depth reference value.
[0113] It can be understood that the above-mentioned decision tree model construction device can implement each step of the decision tree model construction method provided in the aforementioned embodiment, and the relevant explanations about the decision tree model construction method are applicable to the decision tree model construction device, which will not be repeated here.
[0114] The present application also provides a customer classification device based on a decision tree model. Figure 5 As shown, a schematic diagram of the structure of a customer classification device based on a decision tree model in an embodiment of the present application is provided, wherein the customer classification device 500 comprises: a customer sample acquisition unit 510, a classification decision unit 520 and a customer group division unit 530, wherein:
[0115] A customer sample acquisition unit 510 is used to acquire customer samples of bank customers, wherein the customer samples include feature information of different feature attributes related to overdue financial products;
[0116] A classification decision unit 520, configured to perform classification decision on the customer sample using a decision tree model to obtain the probability of each category attribute of the bank customer;
[0117] The customer group division unit 530 is used to determine the customer group to which the bank customer belongs according to the probability of each category attribute of the bank customer.
[0118] It can be understood that the above-mentioned customer classification device based on the decision tree model can implement the various steps of the customer classification method based on the decision tree model provided in the aforementioned embodiment, and the relevant explanations on the customer classification method based on the decision tree model are applicable to the customer classification device based on the decision tree model, which will not be repeated here.
[0119] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 6 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0120] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0121] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0122] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a decision tree model construction device or a customer classification device based on the decision tree model at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0123] Acquire a training data set including a plurality of training samples, wherein the training samples have known category attributes and feature information of different feature attributes related to overdue financial products;
[0124] Obtaining an information gain formula, wherein the information gain formula is pre-constructed based on mean difference information between sub-datasets after the data set contained in the node is divided, variance mean information between the sub-datasets, and a sample quantity ratio coefficient before and after the data set is divided;
[0125] In the process of generating a decision tree model according to the training data set, the information gain of each feature attribute under each node is iteratively calculated according to the information gain formula, and the data set contained in the current node is divided according to the feature attribute corresponding to the maximum information gain, so as to form multiple child nodes based on the current node splitting, until a preset stop condition is reached;
[0126] Output a decision tree model constructed according to the training data set.
[0127] Or, to do the following:
[0128] Obtaining a customer sample of bank customers, wherein the customer sample includes characteristic information of different characteristic attributes related to overdue financial products;
[0129] Using a decision tree model to make classification decisions on the customer samples, and obtaining the probability of each category attribute of the bank customers;
[0130] The customer group to which the bank customer belongs is determined according to the probability of each category attribute of the bank customer.
[0131] The above application Figure 2 The method or Figure 3 The method performed by the customer classification device based on the decision tree model disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a mature storage medium in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above-mentioned decision tree model construction method or the customer classification method based on the decision tree model in combination with its hardware.
[0132] The electronic device may also perform Figure 2 The method for executing the decision tree model building device in the Figure 2 The functions of the embodiments shown may also be performed Figure 3 A method for executing a customer classification device based on a decision tree model in a Figure 3 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0133] The present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by an electronic device including multiple application programs, enable the electronic device to execute Figure 2 The method executed by the decision tree model building device in the illustrated embodiment is specifically used to execute:
[0134] Acquire a training data set including a plurality of training samples, wherein the training samples have known category attributes and feature information of different feature attributes related to overdue financial products;
[0135] Obtaining an information gain formula, wherein the information gain formula is pre-constructed based on mean difference information between sub-datasets after the data set contained in the node is divided, variance mean information between the sub-datasets, and a sample quantity ratio coefficient before and after the data set is divided;
[0136] In the process of generating a decision tree model according to the training data set, the information gain of each feature attribute under each node is iteratively calculated according to the information gain formula, and the data set contained in the current node is divided according to the feature attribute corresponding to the maximum information gain, so as to form multiple child nodes based on the current node splitting, until a preset stop condition is reached;
[0137] Output a decision tree model constructed according to the training data set.
[0138] Alternatively, the electronic device can be enabled to execute Figure 3 The method performed by the customer classification device based on the decision tree model in the illustrated embodiment is specifically used to perform:
[0139] Obtaining a customer sample of bank customers, wherein the customer sample includes characteristic information of different characteristic attributes related to overdue financial products;
[0140] Using a decision tree model to make classification decisions on the customer samples, and obtaining the probability of each category attribute of the bank customers;
[0141] The customer group to which the bank customer belongs is determined according to the probability of each category attribute of the bank customer.
[0142] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0143] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0144] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0145] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0146] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0147] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0148] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0149] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0150] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0151] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A decision tree model construction method, It is characterized in that The decision tree model construction method comprises: Acquire a training data set including a plurality of training samples, wherein the training samples have known category attributes and feature information of different feature attributes related to overdue financial products; Obtaining an information gain formula, wherein the information gain formula is pre-constructed based on mean difference information between sub-datasets after the data set contained in the node is divided, variance mean information between the sub-datasets, and a sample quantity ratio coefficient before and after the data set is divided; In the process of generating a decision tree model according to the training data set, the information gain of each feature attribute under each node is iteratively calculated according to the information gain formula, and the data set contained in the current node is divided according to the feature attribute corresponding to the maximum information gain, so as to form multiple child nodes based on the current node splitting, until a preset stop condition is reached; Output a decision tree model constructed according to the training data set.
2. The decision tree model construction method according to claim 1, It is characterized in that The information gain formula is constructed by the following steps: Calculating the proportionality coefficient according to the number of samples in the data set contained in the node to be split and the number of samples in the data set contained in each child node formed by splitting the node to be split; Calculating the mean difference information of the node to be split according to the known category attributes of the training samples in the data set contained in each child node; Calculate the variance mean information according to the number of samples in the data set contained in the node to be split, the number of samples in the data set contained in each child node, and the category attributes of the training samples in the data set contained in each child node; The information gain formula of the node to be split is obtained according to the proportional coefficient, the mean difference information and the variance mean information.
3. The decision tree model construction method according to claim 2, It is characterized in that The proportionality coefficient is calculated by the formula weight=-2 / (log2(len_1 / len_all)+log2(len_2 / len_all)); The mean difference information is calculated by the formula mean_diff=abs(mean(x1)-mean(x2)); The variance mean information is calculated by the formula var_all=(var(x1)*len_1+var(x2)*len_2) / len_all; The information gain formula of the node to be split is gain_split=weight*mean_diff / var_all; Among them, len_all is the number of samples in the data set contained in the node to be split, len_1 and len_2 are the number of samples in the data set contained in the two child nodes formed by the node to be split, x1 and x2 are the category attribute values of the training samples in the data set contained in the two child nodes formed by the node to be split, weight is the proportional coefficient, mean_diff is the mean difference information, var_all is the variance mean information, and gain_split is the information gain of the node to be split.
4. The decision tree model construction method according to claim 1, It is characterized in that The method further comprises: Obtain the tree depth reference value of the decision tree model and the sample quantity threshold for each category attribute; The iterative calculation of the information gain of each feature attribute under each node according to the information gain formula includes: Get the number of samples in the data set contained in each child node formed by splitting the current node; If the number of samples in the data set contained in one of the child nodes formed by splitting the current node is not greater than the sample number threshold, then determining that the information gain of the current node is zero; If the number of samples in the data set contained in each child node formed by splitting the current node is greater than the sample number threshold, the information gain of the current node is calculated according to the information gain formula.
5. The decision tree model construction method according to claim 4, It is characterized in that The preset stop condition includes that the tree depth of the generated decision tree model reaches the tree depth reference value.
6. A customer classification method based on decision tree model, It is characterized in that The customer classification method includes: Obtaining a customer sample of bank customers, wherein the customer sample includes characteristic information of different characteristic attributes related to overdue financial products; Using a decision tree model to make classification decisions on the customer samples to obtain the probability of each category attribute of the bank customers, wherein the decision tree model is constructed according to the decision tree model construction method according to any one of claims 1 to 5; The customer group to which the bank customer belongs is determined according to the probability of each category attribute of the bank customer.
7. A decision tree model construction device, It is characterized in that The decision tree model building device comprises: A first acquisition unit is used to acquire a training data set including a plurality of training samples, wherein the training samples have known category attributes and feature information of different feature attributes related to overdue financial products; A second acquisition unit is used to acquire an information gain formula, wherein the information gain formula is pre-constructed according to the mean difference information between the sub-data sets after the data set contained in the node is divided, the variance mean information between the sub-data sets, and the sample quantity ratio coefficient before and after the data set is divided; A model generation unit, used to iteratively calculate the information gain of each feature attribute under each node according to the information gain formula in the process of generating a decision tree model according to the training data set, and divide the data set contained in the current node according to the feature attribute corresponding to the maximum information gain, so as to form multiple child nodes based on the current node split, until a preset stop condition is reached; The model output unit is used to output the decision tree model constructed according to the training data set.
8. A customer classification device based on a decision tree model, It is characterized in that The customer classification device comprises: A customer sample acquisition unit, used to acquire customer samples of bank customers, wherein the customer samples include feature information of different feature attributes related to overdue financial products; A classification decision unit, used for making classification decisions on the customer samples by using a decision tree model to obtain the probability of each category attribute of the bank customer, wherein the decision tree model is constructed by the decision tree model construction method according to any one of claims 1 to 5; The customer group division unit is used to determine the customer group to which the bank customer belongs according to the probability of each category attribute of the bank customer.
9. An electronic device, include: processor; as well as A memory arranged to store computer executable instructions, which, when executed, cause the processor to execute the decision tree model construction method described in any one of claims 1 to 5 or the customer classification method based on the decision tree model described in claim 6.
10. A computer-readable storage medium storing one or more programs, which, when executed by an electronic device including multiple application programs, enables the electronic device to execute the decision tree model construction method described in any one of claims 1 to 5 or the customer classification method based on the decision tree model described in claim 6.
Citation Information
Cited By
Baseboard management controller platform identification method, product, equipment and medium
CN120561757A
Metacosm player behavior off-line hosting method and system
CN122020409A
