A training method and device for a random forest model for predicting broadband service handling probability
The random forest model is used to preprocess and train user broadband service data, which solves the problem of difficulty in predicting user wishes in the existing technology, achieving efficient and accurate user prediction and improving business promotion efficiency.
Patent Information
- Application Number
- CN202010673425.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-14
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2040-07-14
AI Technical Summary
The existing technology is difficult to effectively predict users' willingness to handle broadband services, resulting in inefficient business sales.
The random forest model is used to preprocess and train the user's broadband service data, multiple decision tree models are constructed through integrated learning methods, and the model is optimized through the test set to obtain the optimal random forest model.
It achieves efficient prediction of the probability of users handling broadband services, can accurately mine potential users, improves business promotion efficiency, is less affected by noise points, and has high calculation efficiency.
Smart Images

Figure CN113935758B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing, and in particular to a training method and device for a random forest model for predicting the probability of handling broadband services. Background Art
[0002] In the field of business marketing, different businesses often have different characteristics and are suitable for different user groups, but it is difficult for salespeople to find potential users of the business. In the prior art, salespeople can obtain users' needs for business handling through survey methods such as questionnaires and telephone calls, but this method is cumbersome, takes a lot of time and has a poor user experience.
[0003] How to predict the user's willingness to handle business is the technical problem to be solved by this application. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a method and device for predicting the probability of business processing based on a random forest algorithm, so as to solve the problem of difficulty in predicting the willingness of users to process business.
[0005] In a first aspect, a training method for a random forest model for predicting a broadband service processing probability is provided, comprising:
[0006] Collecting user broadband service data, wherein the user broadband service data at least includes household user characteristic parameters, consumption level characteristic parameters, user behavior characteristic parameters, and an identifier indicating whether to apply for a target broadband service;
[0007] Preprocessing the collected user broadband service data to obtain a sample data set, wherein the sample characteristics in the sample data set include a household user characteristic parameter, a consumption level characteristic parameter, and a user behavior characteristic parameter, and the label corresponding to the sample in the sample data set is the identifier corresponding to the sample;
[0008] Dividing the sample data set into a test set and multiple data sets;
[0009] The random forest models are trained respectively according to the multiple data sets to obtain multiple different random forest models;
[0010] The multiple different random forest models are tested according to the test set to obtain an optimal random forest model.
[0011] In a second aspect, a training device for a random forest model for predicting the probability of handling a broadband service is provided, comprising:
[0012] A collection module collects user broadband service data, wherein the user broadband service data at least includes family user characteristic parameters, consumption level characteristic parameters, user behavior characteristic parameters and an identifier indicating whether to handle a target broadband service;
[0013] A processing module pre-processes the collected user broadband service data to obtain a sample data set, wherein the sample characteristics in the sample data set include a household user characteristic parameter, a consumption level characteristic parameter, and a user behavior characteristic parameter, and the label corresponding to the sample in the sample data set is the identifier corresponding to the sample;
[0014] A partitioning module, which divides the sample data set into a test set and multiple data sets;
[0015] A training module, which trains the random forest models according to the multiple data sets to obtain multiple different random forest models;
[0016] The optimization module tests the multiple different random forest models according to the test set to obtain the optimal random forest model.
[0017] In a third aspect, an electronic device is provided, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and when the computer program is executed by the processor, the steps of the method in the first aspect are implemented.
[0018] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method in the first aspect are implemented.
[0019] In an embodiment of the present application, user broadband service data is collected; the collected user broadband service data is preprocessed to obtain a sample data set; the sample data set is divided into a test set and multiple data sets; the random forest model is trained according to the multiple data sets to obtain multiple different random forest models; the multiple different random forest models are tested according to the test set to obtain the optimal random forest model. The scheme of the embodiment of the present invention can predict the probability of a user handling a target service through a random forest algorithm, and can efficiently mine potential users corresponding to the target service. This scheme is less affected by noise point information, has the characteristics of high computational efficiency and accurate prediction, is applicable to various types of services, and has a wide range of applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0021] Figure 1a is a basic structural diagram of an integrated learning method according to an embodiment of the present invention;
[0022] Figure 1b is a schematic diagram showing the degree to which different learners are affected by noise points in one embodiment of the present invention;
[0023] Figure 1c This is one of the flow charts of a training method of a random forest model for predicting the probability of handling broadband services according to an embodiment of the present invention;
[0024] Figure 2a This is a second flow chart of a training method of a random forest model for predicting the probability of handling broadband services according to an embodiment of the present invention;
[0025] Figure 2b It is a schematic diagram of dividing a sample data set according to an embodiment of the present invention;
[0026] Figure 2c Schematic diagram of the relationship between the number of variables and the AUC of the corresponding model in one embodiment of the present invention;
[0027] Figure 3 This is a third flow chart of a training method of a random forest model for predicting the probability of handling broadband services according to an embodiment of the present invention;
[0028] Figure 4 This is a fourth flow chart of a training method of a random forest model for predicting the probability of handling broadband services according to an embodiment of the present invention;
[0029] Figure 5 This is a fifth flow chart of a training method of a random forest model for predicting the probability of handling broadband services according to an embodiment of the present invention;
[0030] Figure 6 This is a sixth flow chart of a training method of a random forest model for predicting the probability of handling broadband services according to an embodiment of the present invention;
[0031] Figure 7a This is a seventh flow chart of a training method of a random forest model for predicting the probability of handling broadband services according to an embodiment of the present invention;
[0032] Figure 7b It is a schematic diagram of the influence of parameter values on the model according to an embodiment of the present invention;
[0033] Figure 8 It is a structural diagram of a training device for a random forest model for predicting the probability of handling broadband services in the present application. DETAILED DESCRIPTION
[0034] 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 in 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. The figure numbers in this application are only used to distinguish the various steps in the scheme, and are not used to limit the execution order of the various steps. The specific execution order is subject to the description in the specification.
[0035] First, the random forest model is introduced. Random forest is an ensemble learning method. Compared with general learning methods, general learning methods build a single learner based on the training set, while the random forest used in this scheme is an ensemble method that attempts to build a group or multiple learners and integrate them. Figure 1a shows the basic structure of the ensemble learning method.
[0036] At the same time, since the ensemble learner is composed of multiple base learners, the ensemble learner is often stronger than a single learner in terms of generalization ability. Figure 1b As shown, the vertical axis represents the error rate of the learner's sample prediction, and the horizontal axis represents the number of noise points, such as Figure 1b It can be seen that the impact of the ensemble learning method (conbination) on noise points is lower than that of the single classifier (bestsingle). Therefore, the random forest algorithm used in this scheme is less affected by noise points, and the trained model can make predictions more accurately.
[0037] In order to solve the problems existing in the prior art, the present application provides a training method for a random forest model for predicting the probability of handling broadband services, such as Figure 1c As shown, the following steps are included:
[0038] S11: Collecting user broadband service data, wherein the user broadband service data at least includes household user characteristic parameters, consumption level characteristic parameters, user behavior characteristic parameters, and an identifier indicating whether to apply for a target broadband service;
[0039] S12: preprocessing the collected user broadband service data to obtain a sample data set, wherein the sample characteristics in the sample data set include a household user characteristic parameter, a consumption level characteristic parameter, and a user behavior characteristic parameter, and the label corresponding to the sample in the sample data set is the identifier corresponding to the sample;
[0040] S13: dividing the sample data set into a test set and multiple data sets;
[0041] S14: training the random forest models respectively according to the multiple data sets to obtain multiple different random forest models;
[0042] S15: Testing the multiple different random forest models according to the test set to obtain an optimal random forest model.
[0043] The solution of the embodiment of the present invention can predict the probability of users applying for target services through the random forest algorithm, and can efficiently mine potential users corresponding to the target services. This solution is less affected by noise point information, has the characteristics of high computational efficiency and accurate prediction, is applicable to various types of services, and has a wide range of applications.
[0044] In the above step S11, the household user characteristic parameters in the collected user broadband service data can characterize whether the sample user's family has preset characteristics, such as whether it includes users of a preset age group. The consumption level characteristic parameters can characterize whether the sample user's family consumption level meets the preset consumption level standard. The user behavior characteristic parameters can characterize the frequency with which the sample user performs operations associated with the target broadband service. For example, when the target broadband service is a home broadband TV service, the user behavior characteristic parameters can include the frequency with which the user turns on the TV. The collected information also includes an identification of whether the user has applied for the target broadband service. In addition to the household user characteristic parameters listed above, the user's communication willingness can also be included. The user's communication willingness can refer to the user's willingness to make outbound calls or text messages, which is used to characterize the user's preferred communication method. In order to promote the target broadband service to the user through the user's preferred communication method, the probability of the user applying for the target broadband service can be increased.
[0045] The following are examples of the collected user broadband service data. In actual applications, the collected user broadband service data can also be adjusted according to actual needs. In this embodiment, assuming that the target broadband service is a home broadband TV children's service, this embodiment collects the following characteristic data to define the target group of the target broadband service.
[0046]
[0047]
[0048] The above family user characteristic parameters can be used to indicate the probability that there are children in the user's home.
[0049]
[0050] The above consumption level characteristic parameters can indicate the customer's value level to the user, including monthly consumption level, main package level, etc.
[0051]
[0052] Based on the analysis of user behavior, the collected user behavior characteristics can represent whether the user watches TV frequently. Customers who turn on the TV frequently will have a higher probability of applying for the product.
[0053]
[0054] By analyzing the willingness to make outbound calls and send text messages when promoting products, we can use methods that customers are more willing to accept to promote the products, thereby increasing the probability of users applying for target broadband services.
[0055] The collected user broadband service data may include multiple items. Specifically, the data collection caliber for collecting the data may be determined based on the validity of each item of data. The data collection caliber may refer to the period of time during which the data is collected. The data collection caliber for each item of data collected may be automatically generated by the electronic device based on historical data, or may be pre-set by the staff based on experience. For example, assuming that the target broadband service is a home broadband TV children's product, the field names of the collected data and the corresponding data collection calibers may be as shown in Table 1 below:
[0056] Table 1
[0057] Field Name Data acquisition caliber Are you currently a child VIP annual user? up to date Is he currently a child VIP monthly subscriber? up to date Are you currently handling children's watches? Previous month Have you ordered other children's products? Previous month Is this a School Message user? Previous month Number of family network members Previous month Have you used children's apps in the past month? Previous month Consumption level ARPU in the last month Previous month The price of the main package used in the last month Previous month Number of times the TV was turned on in the last month Previous month Average number of times video apps were used in the last three months First three months Average traffic usage of video apps in the last three months First three months Have you subscribed to IPTV value-added services in the last 6 months? First five months Have you canceled your IPTV subscription in the last 6 months? First five months age Previous month gender Previous month Average number of text messages sent in the last 3 months First three months Average number of SMS messages received in the last three months First three months Average number of outgoing calls in the last three months First three months Average number of called calls in the last three months First three months Number of calls to 10085 / 10086 in the past two months First three months Number of 10085 / 10086 calls answered in the past two months First three months
[0058] The collected user broadband service data is a parameter associated with whether the user applies for the target broadband service. The data items shown in the above table are used to illustrate this solution. In actual applications, the number of items of collected user broadband service data may be more or less.
[0059] Then, in step S12, the collected user broadband service data is preprocessed to obtain a sample data set, wherein the preprocessing of each item of data can be performed in combination with the features of each item of data collected and the features of the model to be trained.
[0060] For example, the above preprocessing step may include missing value processing. Based on the above collected data, missing value processing may include filling missing values with median value, 0 value, and mode value according to the understanding of feature variables and the characteristics of the variables themselves, such as the price of the main package used in the last month, age, the number of times video apps were used in the last three months, the number of family network members, the main package, app usage behavior, gender, etc. In the following, the feature variables are referred to as variables for explanation.
[0061] Based on the solution provided in the above embodiment, optionally, in the above step S12, the collected user broadband service data is pre-processed, such as Figure 2a As shown, the following steps are included:
[0062] S21: Determine the number of target features for each sample according to the user broadband service data by using a K-fold crossover algorithm;
[0063] S22: When the number of characteristic parameters of samples in the user broadband service data is greater than the target characteristic number, a sample data set is generated according to the user broadband service data and the target characteristic number, and the number of sample characteristics of each sample in the sample data set is the target characteristic number.
[0064] The above K is a positive integer. In this embodiment, a 5-fold crossover algorithm is used to determine the number of target features, that is, K is 5. In fact, a suitable K value can be selected according to actual needs.
[0065] Specifically, first divide the collected user broadband service data into 5 parts, and then conduct 5 tests as follows: Figure 2b As shown in the figure, model 1 uses the data of the first fold 1 as the test set Test, and the remaining four folds as the data set Train. Finally, each model calculates an accuracy, and the average is taken as the accuracy AUC of this validation set.
[0066] Then, the calculated AUC is used as the performance indicator to test the basic random forest model of several decision trees without parameter adjustment. In this example, the number of decision trees is 100, and the data in the training set before parameter adjustment each contains 20 variables. The calculated average AUC is 0.8593. Figure 2c As shown in the figure, among the 20 variables in the training set, when 13 variables are retained, the effect is best, and the AUC of the cross-validation is 0.8613.
[0067] Based on the AUC results corresponding to the number of variables, when the number of variables is greater than or equal to 11, the performance has no obvious improvement, so the 11 most critical variables can be retained in the end. In the process of screening variables, variables can be screened according to the importance of each variable to select 11 relatively important variable features. For example, the selected variables are whether IPTV value-added services have been subscribed in the past 6 months, the consumption level ARPU in the past month, the price of the main package used in the past month, age, the number of family network members, the average number of times video apps are used, the average amount of traffic used by video apps, the average number of text messages sent, the average number of calls, the average number of calls, and the number of times the TV is turned on in the past month.
[0068] Then, the grid search method was used to optimize the parameters for the maximum number of variables and decision trees used for each split in the random forest. After adjustment, when the maximum number of variables was 2 and the number of decision trees was 1000, the model effect was the best, with an AUC of 0.8754. Finally, the model output results were arranged from high to low according to the predicted probability, and the user numbers were integrated to predict the probability of users applying for the target broadband service.
[0069] Based on the solution provided in the above embodiment, optionally, in the above step S22, when the number of characteristic parameters of the sample in the user broadband service data is greater than the target characteristic number, a sample data set is generated according to the user broadband service data and the target characteristic number, such as Figure 3 As shown, the following steps are included:
[0070] S31: determining the information gain of the feature corresponding to each feature parameter in the user broadband service data, wherein the information gain is used to characterize the degree to which the feature parameter corresponding to the feature reduces the uncertainty of the classification category of the sample to which the feature belongs;
[0071] S32: determining a target feature number target feature parameters from the feature parameters in the user broadband service data according to the information gain of the feature corresponding to each feature parameter;
[0072] S33: Generate a sample data set according to target feature parameters of samples in the user broadband service data and labels corresponding to samples in the sample data set.
[0073] Based on the above example, when 11 relatively important variables are screened out from 20 variables, the scheme provided in this embodiment can be used to determine the information gain of each feature to quantify the importance of each feature.
[0074] First, we introduce the concept of information entropy. Let X be a discrete random variable with a finite state and its probability distribution be P(X = x i )=p i , i = 1, 2, 3, ... n, then the entropy of the random variable X is defined as follows (1-1):
[0075]
[0076] Given the random variable X, the conditional entropy of the random variable Y is defined as follows (1-2):
[0077]
[0078] Among them, p i =P(X=x i ).
[0079] Information gain indicates the degree to which the uncertainty of information about category Y is reduced by knowing the information about feature X. Assume that the dataset used for training is D, the sample size is |D|, and there are K categories C K ,|C k | for category C K A feature has A different values a1, a2, ...a n According to the value of feature A, the training data set D can be divided into n subsets D1, D2, ...D n ,|D i | for D i And record subset D i Belongs to class C K The sample set is D ik ,|D ik | for D ik The number of samples. Then the information gain algorithm is as follows:
[0080] First, calculate the information entropy H(D) of the training data set D according to the following formula (1-3):
[0081]
[0082] Then, the information entropy H(D|A) of feature A for the training data set D is calculated according to the following formula (1-4):
[0083]
[0084] Next, the information gain is calculated according to the following formula (1-5):
[0085] g(D,A)=H(D)-H(D|A) (1-5)
[0086] Among them, the information gain ratio of feature A to the data set D used for training is defined as the ratio of its information gain to the entropy of the value of feature A in the training set D, as shown in the following formula (1-6), that is:
[0087]
[0088] in:
[0089]
[0090] Through the scheme provided by the above embodiment, the importance of each feature determined is shown in the following Table 2:
[0091] Table 2
[0092] feature importance Consumption level ARPU in the last month 0.15 Average traffic usage of video apps 0.1044 Average number of times video apps are used 0.0944 The price of the main package used in the last month 0.0608 Number of times the TV was turned on in the last month 0.0583 Number of family network members 0.0573 Have you subscribed to IPTV value-added services in the last 6 months? 0.0428 Average number of calls to service number 0.0127
[0093] Through the above scheme of this embodiment, the importance of each feature can be quantified so as to screen the collected features, reduce the amount of calculation and improve efficiency while ensuring the prediction accuracy of the trained model.
[0094] In addition, the preprocessing step may further include correlation analysis. Based on the solution provided in the above embodiment, optionally, in the above step S32, according to the information gain of the feature corresponding to each feature parameter, a target feature number target feature parameters are determined from the feature parameters in the user broadband service data, such as Figure 4 As shown, the following steps are included:
[0095] S41: determining the correlation coefficient between the features corresponding to each feature parameter in the user broadband service data according to the Pearson correlation coefficient;
[0096] S42: Based on a preset correlation coefficient standard, a target feature number and target feature parameters are screened out from the user broadband service data according to the correlation coefficients between the features.
[0097] Based on the data collected above, the Pearson correlation coefficient can be used for correlation analysis to eliminate variables with high correlation. The Pearson correlation coefficient is used to measure the correlation (linear correlation) between two variables X and Y, and its value is between -1 and 1. The simplified expression is as follows (1-7):
[0098]
[0099] The scope of application of the Pearson correlation coefficient: When the standard deviation of the two variables is not zero, the correlation coefficient is defined. The Pearson correlation coefficient is applicable to:
[0100] (1) There is a linear relationship between the two variables and both are continuous data;
[0101] (2) The populations of the two variables are normally distributed, or have a unimodal distribution close to normal;
[0102] (3) The observations of two variables are paired, and each pair of observations is independent of each other.
[0103] Therefore, this solution can use the Pearson correlation coefficient to eliminate variables with high correlation. The features with high feature correlation are shown in Table 3 below:
[0104] Table 3
[0105]
[0106] Among them, X and Y represent two related features respectively, and R represents the correlation coefficient between X and Y.
[0107] The above-mentioned preprocessing step may also include binning of some numerical variables, which can be used to reduce the impact of distribution skew, such as the number of calls made or received to 10086 / 10085 in the past two months.
[0108] Based on the solution provided in the above embodiment, optionally, in the above step S42, based on a preset correlation coefficient standard, after selecting a target feature number of target feature parameters from the user broadband service data according to the correlation coefficient between each feature, as follows: Figure 5 As shown, the following steps are also included:
[0109] S51: performing correction processing on the target feature number target feature parameters using the Z standard score method;
[0110] S52: performing normalization processing on the corrected target feature parameters.
[0111] The above-mentioned preprocessing step may also include using the Z standard score method to calculate the upper and lower limits of the normal value of the numerical variable as the threshold, that is, the mean ± standard deviation * 3. The values exceeding the threshold can be replaced by the threshold.
[0112] The above-mentioned preprocessing step may also include normalization processing, such as using Z-Score normalization, as shown in the following formula (1-8). Through the following Z-Score formula, data of different magnitudes are uniformly converted to the same magnitude and uniformly measured with the calculated Z-Score value to ensure comparability between data.
[0113]
[0114] Based on the solution provided in the above embodiment, optionally, in the above step S14, the random forest model is trained according to the multiple data sets to obtain multiple different random forest models, such as Figure 6 As shown, the following steps are included:
[0115] S61: Selecting a plurality of training sample subsets from the data set by sampling with replacement;
[0116] S62: Establishing multiple decision trees for the training sample subset according to the sample features in the training sample subset;
[0117] S63: Construct a random forest model according to the multiple decision trees.
[0118] For the random forest model, the selection of parameters will affect the training effect of the random forest. Optionally, this embodiment optimizes the parameters of the random forest. In this example, the following two parameters are mainly optimized: the number of decision trees n_estimators and the number of features max_features.
[0119] Among them, if the number of decision trees of the random forest model is too large, the model will often be overfitted. If the number of trees is too small, the model training will be insufficient and underfitting will occur easily. The purpose of this embodiment is to find a set of parameters n_estimators and max_features that are more suitable for the data set. In the following, N is used to represent n_estimators and M is used to represent max_features for explanation.
[0120] Based on the solution provided in the above embodiment, optionally, Figure 7a As shown, the above step S62, establishing multiple decision trees for the training sample subset according to the sample features in the training sample subset, includes the following steps:
[0121] S71: Determine the maximum number of split variables and the number of decision trees in the random forest model by a grid search algorithm, wherein the maximum number of split variables is used to characterize the number of changes in sample features when a root decision node in a decision tree is split to obtain a child decision node;
[0122] S72: Establish multiple decision trees for the training sample subset according to the sample features in the training sample subset, the maximum number of splitting variables and the number of decision trees.
[0123] Specifically, this embodiment uses a grid search Gridsearch combined with a cross-validation method to find the optimal parameters. First, the range of the number of decision trees n_estimators and the maximum number of split variables max_features can be defined by manual preset or automatic generation:
[0124] n estimators ∈[100, 200, 300, 400, 500, 600, 700]
[0125] max_features∈[2, 4, 6, 8, 10, 12]
[0126] Based on the above defined parameters M and N, the following random forest parameter combination table 4 can be obtained:
[0127] Table 4
[0128] <![CDATA[N1=100]]> <![CDATA[N2=200]]> … <![CDATA[N n =700]]> <![CDATA[M1=2]]> <![CDATA[RF(N1,M1)]]> <![CDATA[RF(N2,M1)]]> … <![CDATA[RF(N n ,M1)]]> <![CDATA[M2=4]]> <![CDATA[RF(N1,M2)]]> <![CDATA[RF(N2,M2)]]> … <![CDATA[RF(N n ,M1)]]> … … … … … <![CDATA[M m =12]]> <![CDATA[RF(N1,M m )]]> <![CDATA[RF(N2,M m )]]> … <![CDATA[RF(N n ,M m )]]>
[0129] Subsequently, the grid search algorithm process is as shown in the following grid search algorithm:
[0130] Input: training set T = {(x1, y1), (x2, y2), .... (x m ,y m )};
[0131] Random Forest Classifier: ε
[0132] Minimum MSE value: μ = 1
[0133] Optimal parameter combination: (N, M) best
[0134] process:
[0135]
[0136]
[0137] Output:
[0138] Optimal parameter combination: (N, M) best
[0139] In the above grid search algorithm, the algorithm searches for the optimal parameter combination by traversing all possible combinations, i.e., exhaustive search. In addition, Figure 7b The influence of parameter values is shown. The MSE values (mean square error) corresponding to most parameter combinations in the grid are high. The smaller the MSE value, the higher the accuracy of the trained model. In the above algorithm, a better parameter optimization space can be selected based on MSE, and then an accurate local search can be performed, which can further shorten the search time of this solution.
[0140] Then, in step S13, this solution divides the data set into a training set and a test set, and the test set is used to evaluate the quality of the model. In the training process, the model often overfits. If a partial test set subset is used to adjust the parameters of the model, the model obtains the information of the test sample, which directly affects the accuracy of the model prediction. In order to solve this problem, this solution extracts a part of the data in the training set as a validation set to evaluate the training effect of the model.
[0141] This solution uses a five-fold cross-validation method to evaluate the performance of the model under a certain set of parameter combinations. Specifically, the training set is first divided into five groups (Five-fold), each data subset is used as a validation set, and the remaining four groups of data subsets are used as training sets, and so on. In step S14 of this embodiment, the random forest model is trained according to the multiple data sets, and five models will be obtained. In step S15, the obtained model can be tested with the test set to obtain the accuracy corresponding to the model, and the optimal random forest model parameters are obtained according to the test accuracy results, thereby obtaining the optimal random forest model. Among them, in the step of estimating the accuracy, the accuracy of the five models can be averaged as an estimate of the accuracy of the algorithm under this parameter combination. The five-cross-validation five-fold cross algorithm process is as follows:
[0142] Input: training set T = {(x1, y1), (x2, y2), .... (x m ,y m )};
[0143] Random Forest Classifier: ε
[0144] Random Forest parameters: (N, M)
[0145] process:
[0146]
[0147] Output
[0148]
[0149] From the above scheme, it can be seen that this embodiment can well judge the performance of the model under a certain parameter combination. In this embodiment, the tuned grid search can be combined with the ten-fold crossover algorithm to select the optimal random forest parameter combination. The specific algorithm flow is as follows:
[0150] Input: training set T = {(x1, y1), (x2, y2), .... (x m ,y m )};
[0151] Random Forest Classifier: ε
[0152] Minimum Value: μ = 1
[0153] Optimal parameter combination: (N, M) best
[0154] process:
[0155] Narrow the range of possible values for the parameter by performing a rough search on the grid
[0156]
[0157]
[0158] Output:
[0159] Optimal parameter combination (N, M) best
[0160] The solution provided in the embodiment of the present application uses the Bootstrap sampling technique with replacement and the node random splitting technique to construct multiple decision trees through random forest, and obtains the final classification result through voting. Random forest is mainly divided into two parts: training sample subset and sub-classification model. The training sample subset is obtained from the original training set by sampling with replacement, and the sub-classification model is generally a decision tree algorithm; multiple sub-classification models can obtain multiple classification results, and then the final prediction value is determined by voting or averaging the prediction value of each sub-classification model. Random forest improves the prediction accuracy without significantly increasing the amount of calculation. Random forest is not sensitive to multivariate collinearity, and the results are relatively robust to missing data and unbalanced data, and can well predict the effects of up to thousands of explanatory variables.
[0161] The random forest algorithm provided in the embodiment of the present application includes the bagging ensemble learning method and the decision tree classification method. Among them, bagging is an ensemble learning algorithm proposed based on the Bootstrap idea in statistics. It can repeatedly sample different Bootstrap training samples from the original sample set, and then train each basic classifier to ensure the difference of each training sample subset. For unstable classifiers such as decision trees (i.e., sensitive to training data), the bagging algorithm can improve the accuracy of classification. In addition, the bagging algorithm can train multiple basic classifiers in parallel, which can save a lot of time overhead, which is also one of the advantages of the algorithm. The algorithm is as follows:
[0162] Input: Dataset D = {(x1, y1), (x2, y2), .... (x m ,y m )};
[0163] Base learner: ε
[0164] The number of base learners: T
[0165] process:
[0166]
[0167] Output:
[0168]
[0169] Among them, decision tree is the main technology used for classification and prediction, and is a classification and regression method. The decision tree learning algorithm is a process of recursively selecting the optimal feature and segmenting the training data according to the feature so that each sub-data set has the best classification. This process corresponds to the division of the feature space and the construction of the decision tree. When predicting an instance, starting from the root node, a certain feature of the instance is tested, and the instance is assigned to its child nodes according to the test results. At this time, each child node corresponds to a value of the feature. The instance is recursively tested and assigned until it reaches the leaf node, and finally the instance is assigned to the class of the leaf node.
[0170] Specifically, first, sampling with replacement is performed from the preprocessed data to construct sub-datasets. Since the sampling technique with replacement is used, data may appear repeatedly in different sub-datasets. Then, multiple new data sets formed by multiple samplings are used to construct multiple sub-decision trees, and each sub-decision tree outputs a result. Finally, if there is new data that needs to be classified through random forest, the output result of the random forest can be obtained by voting on the judgment results of the sub-decision trees. Assuming that there are 3 sub-decision trees in the random forest, the classification results of 2 sub-trees are Class A, and the classification result of 1 sub-tree is Class B, then the classification result of the random forest is Class A.
[0171] The model obtained by training with the solution provided by the embodiment of the present application can be used to predict the probability of the user to be tested handling the target broadband service. First, the broadband service data of the user to be tested is collected, and the collected data is pre-processed and input into the trained model, and the probability of the user to be tested handling the target broadband service is determined according to the output result of the model. Subsequently, the target broadband service can be promoted to the user to be tested with a higher probability through the communication method preferred by the user, and the identification of the result of the handling of the target broadband service of the user to be tested is obtained. Subsequently, the above-mentioned random forest model can be further optimized according to the identification of whether the user to be tested handles the target broadband service.
[0172] In an embodiment of the present application, user broadband service data is collected; the collected user broadband service data is preprocessed to obtain a sample data set; the sample data set is divided into a test set and multiple data sets; the random forest model is trained according to the multiple data sets to obtain multiple different random forest models; the multiple different random forest models are tested according to the test set to obtain the optimal random forest model. The scheme of the embodiment of the present invention can predict the probability of a user handling a target service through a random forest algorithm, and can efficiently mine potential users corresponding to the target service. This scheme is less affected by noise point information, has the characteristics of high computational efficiency and accurate prediction, is applicable to various types of services, and has a wide range of applications.
[0173] In order to solve the problems existing in the prior art, the embodiment of the present application also provides a training device 80 for a random forest model for predicting the probability of handling broadband services, such as Figure 8 As shown, including:
[0174] The collection module 81 collects user broadband service data, wherein the user broadband service data at least includes family user characteristic parameters, consumption level characteristic parameters, user behavior characteristic parameters, and an identifier indicating whether to apply for a target broadband service;
[0175] The processing module 82 pre-processes the collected user broadband service data to obtain a sample data set, wherein the sample characteristics in the sample data set include a household user characteristic parameter, a consumption level characteristic parameter, and a user behavior characteristic parameter, and the label corresponding to the sample in the sample data set is the identifier corresponding to the sample;
[0176] A division module 83 divides the sample data set into a test set and multiple data sets;
[0177] A training module 84, training the random forest model according to the multiple data sets respectively to obtain multiple different random forest models;
[0178] The optimization module 85 tests the multiple different random forest models according to the test set to obtain the optimal random forest model.
[0179] Preferably, an embodiment of the present invention further provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned image processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0180] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned image processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0181] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0182] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0183] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. A training method for a random forest model for predicting the probability of handling broadband services, characterized in that: include: Collecting user broadband service data, the user broadband service data at least includes household user characteristic parameters, consumption level characteristic parameters, user behavior characteristic parameters, communication mode preference and an identifier indicating whether to apply for a target broadband service, wherein the communication mode preference represents the user's willingness to accept a product promotion channel; Preprocessing the collected user broadband service data to obtain a sample data set, wherein the sample characteristics in the sample data set include household user characteristic parameters, consumption level characteristic parameters, user behavior characteristic parameters, and communication mode preference, and the label corresponding to the sample in the sample data set is the identifier corresponding to the sample; Dividing the sample data set into a test set and multiple data sets; The random forest models are trained respectively according to the multiple data sets to obtain multiple different random forest models; Testing the multiple different random forest models according to the test set to obtain an optimal random forest model; The collected user broadband service data is preprocessed, including: Determine the number of target features for each sample according to the user broadband service data by using a K-fold crossover algorithm; When the number of characteristic parameters of samples in the user broadband service data is greater than the target characteristic number, generating a sample data set according to the user broadband service data and the target characteristic number, the number of sample characteristics of each sample in the sample data set being the target characteristic number; Wherein, when the number of characteristic parameters of samples in the user broadband service data is greater than the target characteristic number, generating a sample data set according to the user broadband service data and the target characteristic number includes: Determine the information gain of the feature corresponding to each feature parameter in the user broadband service data, where the information gain is used to characterize the degree to which the feature parameter corresponding to the feature reduces the uncertainty of the classification category of the sample to which it belongs; Determining a target feature quantity target feature parameters from the feature parameters in the user broadband service data according to the information gain of the feature corresponding to each feature parameter; Generate a sample data set according to target feature parameters of samples in the user broadband service data and labels corresponding to samples in the sample data set; Wherein, according to the information gain of the feature corresponding to each feature parameter, a target feature quantity target feature parameters are determined from the feature parameters in the user broadband service data, including: Determine the correlation coefficient between the features corresponding to each feature parameter in the user broadband service data according to the Pearson correlation coefficient; Based on a preset correlation coefficient standard, a target feature number of target feature parameters are screened out from the user broadband service data according to the correlation coefficients between the features; Among them, based on the preset correlation coefficient standard, after selecting the target feature number target feature parameters from the user broadband service data according to the correlation coefficients between the features, it also includes: Using the Z standard score method, a correction process is performed on the target feature number target feature parameters; The corrected target feature parameters are normalized.
2. The method according to claim 1, characterized in that The random forest models are trained respectively according to the multiple data sets to obtain multiple different random forest models, including: Selecting a plurality of training sample subsets from the data set by sampling with replacement; Establishing multiple decision trees for the training sample subset according to the sample features in the training sample subset; A random forest model is constructed based on the multiple decision trees.
3. The method according to claim 2, characterized in that Establishing a plurality of decision trees for the training sample subset according to the sample features in the training sample subset includes: Determine the maximum number of split variables and the number of decision trees in the random forest model by a grid search algorithm, wherein the maximum number of split variables is used to characterize the number of changes in sample features when a root decision node in a decision tree is split to obtain a child decision node; A plurality of decision trees are established for the training sample subset according to the sample features in the training sample subset, the maximum number of splitting variables and the number of decision trees.
4. A training device for a random forest model for predicting the probability of handling broadband services, characterized in that: include: A collection module collects user broadband service data, wherein the user broadband service data at least includes household user characteristic parameters, consumption level characteristic parameters, user behavior characteristic parameters, communication mode preference, and an identifier indicating whether to apply for a target broadband service, wherein the communication mode preference represents the user's willingness to accept a product promotion channel; A processing module pre-processes the collected user broadband service data to obtain a sample data set, wherein the sample characteristics in the sample data set include household user characteristic parameters, consumption level characteristic parameters, user behavior characteristic parameters, and communication mode preference, and the label corresponding to the sample in the sample data set is the identifier corresponding to the sample; A partitioning module, which divides the sample data set into a test set and multiple data sets; A training module, which trains the random forest models according to the multiple data sets to obtain multiple different random forest models; An optimization module, testing the multiple different random forest models according to the test set to obtain an optimal random forest model; The collected user broadband service data is preprocessed, including: Determine the number of target features for each sample according to the user broadband service data by using a K-fold crossover algorithm; When the number of characteristic parameters of samples in the user broadband service data is greater than the target characteristic number, generating a sample data set according to the user broadband service data and the target characteristic number, the number of sample characteristics of each sample in the sample data set being the target characteristic number; Wherein, when the number of characteristic parameters of samples in the user broadband service data is greater than the target characteristic number, generating a sample data set according to the user broadband service data and the target characteristic number includes: Determine the information gain of the feature corresponding to each feature parameter in the user broadband service data, where the information gain is used to characterize the degree to which the feature parameter corresponding to the feature reduces the uncertainty of the classification category of the sample to which it belongs; Determining a target feature quantity target feature parameters from the feature parameters in the user broadband service data according to the information gain of the feature corresponding to each feature parameter; Generate a sample data set according to target feature parameters of samples in the user broadband service data and labels corresponding to samples in the sample data set; Wherein, according to the information gain of the feature corresponding to each feature parameter, a target feature quantity target feature parameters are determined from the feature parameters in the user broadband service data, including: Determine the correlation coefficient between the features corresponding to each feature parameter in the user broadband service data according to the Pearson correlation coefficient; Based on a preset correlation coefficient standard, a target feature number of target feature parameters are screened out from the user broadband service data according to the correlation coefficients between the features; Among them, based on the preset correlation coefficient standard, after selecting the target feature number target feature parameters from the user broadband service data according to the correlation coefficients between the features, it also includes: Using the Z standard score method, a correction process is performed on the target feature number target feature parameters; The corrected target feature parameters are normalized.
5. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the method according to any one of claims 1 to 3 when executed by the processor.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Method for recognizing Raman spectrum substances on basis of random forest models
CN109142317A
A user portrait method and device, and a storage medium
CN109543734A