Business income prediction method and device, electronic equipment and storage medium
By acquiring and tuning the decision tree model, combining the probability model and the segmented loss function, the problem of insufficient business revenue prediction accuracy is solved, and higher prediction accuracy and model stability are achieved.
Patent Information
- Application Number
- CN202411562489.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-03-18
AI Technical Summary
The prediction accuracy of business revenue in the prior art is insufficient and it is difficult to meet actual needs.
By obtaining at least two decision tree models and training data for the target business, the hyperparameters of the decision tree model are tuned using the probability model and the segmented loss function to obtain a business revenue prediction model, and improve prediction accuracy through weight prediction and model fusion.
It effectively improves the accuracy of business revenue forecasts, reduces the risk of overfitting or underfitting, and improves the robustness and stability of the model.
Smart Images

Figure CN119647988A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method for predicting business income, a device for predicting business income, an electronic device, and a computer-readable storage medium. Background Art
[0002] With the development of science and technology, the emergence of business support systems has enabled users in different regions to use the same business support system to handle different businesses. The prediction of the monthly income of each business in each region in the business support system plays an important role in the update of the business support system. However, in the process of predicting business income, there is a problem of insufficient prediction accuracy. Summary of the invention
[0003] The embodiments of the present invention provide a method, device, electronic device and computer-readable storage medium for predicting business revenue, so as to solve or partially solve the problem of insufficient prediction accuracy of business revenue.
[0004] The embodiment of the present invention discloses a method for predicting business income, comprising:
[0005] Acquire at least two decision tree models and training data for a target business, wherein the training data at least includes historical business revenue data of the target business and expansion data for the target business;
[0006] Obtaining a probability model and a segmentation loss function for the decision tree model;
[0007] Tuning the hyperparameters of the at least two decision tree models according to the training data, the probability model, and the piecewise loss function to obtain a business revenue prediction model corresponding to the decision tree model;
[0008] Perform weight prediction on the business revenue prediction model according to the training data and the piecewise loss function to obtain weight coefficients corresponding to each of the business revenue prediction models;
[0009] Based on the weight coefficient, each of the business revenue prediction models is fused to obtain a target fusion model for the target business, and the target fusion model is used to predict the revenue of the target business.
[0010] In some feasible implementations, the step of tuning the hyperparameters of the at least two decision tree models according to the training data, the probability model, and the piecewise loss function to obtain a business revenue prediction model corresponding to the decision tree model includes:
[0011] Dividing the training data into a plurality of subsets;
[0012] Each subset is used as a validation set in turn, and the subsets other than the validation set are used as training sets;
[0013] Obtaining a hyperparameter search space for the probability model, and inputting the hyperparameter search space into the probability model for prediction, to obtain a hyperparameter distribution range for the decision tree;
[0014] The decision tree model is trained according to the hyperparameter distribution range, the validation set, the training set and the segmented loss function to obtain a business revenue prediction model corresponding to the decision tree model.
[0015] In some feasible implementations, inputting the hyperparameter search space into the probability model for prediction to obtain a hyperparameter distribution range for the decision tree includes:
[0016] The hyperparameter search space is input into the first formula corresponding to the probability model for prediction to obtain the hyperparameter distribution range for the decision tree; wherein the first formula is as follows:
[0017]
[0018] where p(x|θ) is the probability density function of the hyperparameter x given the parameter θ, and π j is the mixing weight, μ j is the mean, is the variance, is the hyperparameter search space.
[0019] In some feasible implementations, the performing model training on the decision tree model according to the hyperparameter distribution range, the validation set, the training set, and the piecewise loss function to obtain a business revenue prediction model corresponding to the decision tree model includes:
[0020] Determining a hyperparameter combination from the hyperparameter distribution range by using the probability model;
[0021] In response to substituting the hyperparameter combination into the decision tree model for updating, the training set and the validation set are respectively input into the updated decision tree model for model training to obtain a first training result corresponding to the training set and a second training result corresponding to the validation set;
[0022] The steps of calculating a first target error between the first training result and the second training result based on the piecewise loss function, inputting the first target error into the probability model for iteration, determining a new hyperparameter set from the hyperparameter distribution range through the probability model, and returning a response to substituting the hyperparameter combination into the decision tree model for updating, inputting the training set and the validation set into the updated decision tree model for model training, and obtaining a first training result corresponding to the training set and a second training result corresponding to the validation set;
[0023] Until the number of iterations of the probability model reaches a first preset threshold and / or the first target error is less than or equal to a second preset threshold, determining a target hyperparameter combination for the decision tree model;
[0024] The target hyperparameter combination is used as the parameter configuration of the decision tree model to obtain a business revenue prediction model corresponding to the decision tree model.
[0025] In some feasible implementations, the segmentation loss function corresponds to a first segmentation threshold and a second segmentation threshold, and the calculating a first target error between the first training result and the second training result based on the segmentation loss function includes:
[0026] Calculating a first error between the first training result and the second training result;
[0027] Selecting a target loss function from a second formula corresponding to the segment loss function according to the first error, calculating a second error between the first training result and the second training result based on the target loss function, and using the second error as a first target error;
[0028] Wherein, the second formula is as follows:
[0029]
[0030] in, represents the first training result, y i represents the second training result, c1 and c2 both represent fixed parameters that make the function continuous, a is the first segmentation threshold of the segmentation loss function, and b is the second segmentation threshold of the segmentation loss function.
[0031] In some feasible implementations, performing weight prediction on the business revenue prediction model according to the training data and the piecewise loss function to obtain weight coefficients corresponding to each of the business revenue prediction models includes:
[0032] Inputting the training set and the validation set into the business revenue prediction model for prediction respectively, and obtaining a first prediction result corresponding to the training set and a second prediction result corresponding to the validation set;
[0033] Calculate a second target error between the first prediction result and the second prediction result based on the piecewise loss function;
[0034] The weight adjustment is performed according to the second target error corresponding to each of the business revenue prediction models to obtain the weight coefficient corresponding to each of the business revenue prediction models.
[0035] In some feasible implementations, the segmentation loss function corresponds to a first segmentation threshold and a second segmentation threshold, and the calculating a second target error between the first prediction result and the second prediction result based on the segmentation loss function includes:
[0036] Calculating a third error between the first prediction result and the second prediction result;
[0037] Selecting a target loss function from a second formula corresponding to the segmented loss function according to the third error, calculating a fourth error between the first prediction result and the second prediction result based on the target loss function, and using the fourth error as a second target error;
[0038] The second formula is as follows:
[0039]
[0040] in, Represents the first prediction result, y i represents the second prediction result, c1 and c2 both represent fixed parameters that make the function continuous, a is the first segmentation threshold of the segmentation loss function, and b is the second segmentation threshold of the segmentation loss function.
[0041] In some feasible implementations, performing weight adjustment according to the second target error corresponding to each of the business revenue prediction models to obtain the weight coefficient corresponding to each of the business revenue prediction models includes:
[0042] Obtaining mean square error values corresponding to each of the second target errors;
[0043] Each of the mean square error values is used to calculate the weight coefficient corresponding to each of the business revenue prediction models.
[0044] In some feasible implementations, the extended data includes at least one of date data, user behavior data, settlement data, and geographic location data.
[0045] The embodiment of the present invention also discloses a device for predicting business income, including:
[0046] A data acquisition module, used to acquire at least two decision tree models and training data for a target business, wherein the training data at least includes historical business revenue data of the target business and expansion data for the target business;
[0047] A model determination module, used to obtain a probability model and a segmentation loss function for the decision tree model;
[0048] A parameter tuning module, used to tune the hyperparameters of the at least two decision tree models according to the training data, the probability model, and the piecewise loss function, to obtain a business revenue prediction model corresponding to the decision tree model;
[0049] A coefficient determination module, used to perform weight prediction on the business revenue prediction model according to the training data and the piecewise loss function, and obtain weight coefficients corresponding to each of the business revenue prediction models;
[0050] The model fusion module is used to fuse the various business revenue prediction models based on the weight coefficients to obtain a target fusion model for the target business, and the target fusion model is used to predict the revenue of the target business.
[0051] In some feasible implementations, the parameter tuning module is specifically used to:
[0052] Dividing the training data into a plurality of subsets;
[0053] Each subset is used as a validation set in turn, and the subsets other than the validation set are used as training sets;
[0054] Obtaining a hyperparameter search space for the probability model, and inputting the hyperparameter search space into the probability model for prediction, to obtain a hyperparameter distribution range for the decision tree;
[0055] The decision tree model is trained according to the hyperparameter distribution range, the validation set, the training set and the segmented loss function to obtain a business revenue prediction model corresponding to the decision tree model.
[0056] In some feasible implementations, the parameter tuning module is specifically used to:
[0057] The hyperparameter search space is input into the first formula corresponding to the probability model for prediction to obtain the hyperparameter distribution range for the decision tree; wherein the first formula is as follows:
[0058]
[0059] where p(x|θ) is the probability density function of the hyperparameter x given the parameter θ, and π j is the mixing weight, μ j is the mean, is the variance, is the hyperparameter search space.
[0060] In some feasible implementations, the parameter tuning module is specifically used to:
[0061] Determining a hyperparameter combination from the hyperparameter distribution range by using the probability model;
[0062] In response to substituting the hyperparameter combination into the decision tree model for updating, the training set and the validation set are respectively input into the updated decision tree model for model training to obtain a first training result corresponding to the training set and a second training result corresponding to the validation set;
[0063] The steps of calculating a first target error between the first training result and the second training result based on the piecewise loss function, inputting the first target error into the probability model for iteration, determining a new hyperparameter set from the hyperparameter distribution range through the probability model, and returning a response to substituting the hyperparameter combination into the decision tree model for updating, inputting the training set and the validation set into the updated decision tree model for model training, and obtaining a first training result corresponding to the training set and a second training result corresponding to the validation set;
[0064] Until the number of iterations of the probability model reaches a first preset threshold and / or the first target error is less than or equal to a second preset threshold, determining a target hyperparameter combination for the decision tree model;
[0065] The target hyperparameter combination is used as the parameter configuration of the decision tree model to obtain a business revenue prediction model corresponding to the decision tree model.
[0066] In some feasible implementations, the segmentation loss function corresponds to a first segmentation threshold and a second segmentation threshold, and the parameter tuning module is specifically used for:
[0067] Calculating a first error between the first training result and the second training result;
[0068] Selecting a target loss function from a second formula corresponding to the segment loss function according to the first error, calculating a second error between the first training result and the second training result based on the target loss function, and using the second error as a first target error;
[0069] Wherein, the second formula is as follows:
[0070]
[0071] in, represents the first training result, y i represents the second training result, c1 and c2 both represent fixed parameters that make the function continuous, a is the first segmentation threshold of the segmentation loss function, and b is the second segmentation threshold of the segmentation loss function.
[0072] In some feasible implementations, the coefficient determination module is specifically used to:
[0073] Inputting the training set and the validation set into the business revenue prediction model for prediction respectively, and obtaining a first prediction result corresponding to the training set and a second prediction result corresponding to the validation set;
[0074] Calculate a second target error between the first prediction result and the second prediction result based on the piecewise loss function;
[0075] The weight adjustment is performed according to the second target error corresponding to each of the business revenue prediction models to obtain the weight coefficient corresponding to each of the business revenue prediction models.
[0076] In some feasible implementations, the segmentation loss function corresponds to a first segmentation threshold and a second segmentation threshold, and the coefficient determination module is specifically used for:
[0077] Calculating a third error between the first prediction result and the second prediction result;
[0078] Selecting a target loss function from a second formula corresponding to the segmented loss function according to the third error, calculating a fourth error between the first prediction result and the second prediction result based on the target loss function, and using the fourth error as a second target error;
[0079] Wherein, the second formula is as follows:
[0080]
[0081] in, Represents the first prediction result, y i represents the second prediction result, c1 and c2 both represent fixed parameters that make the function continuous, a is the first segmentation threshold of the segmentation loss function, and b is the second segmentation threshold of the segmentation loss function.
[0082] In some feasible implementations, the coefficient determination module is specifically used to:
[0083] Obtaining mean square error values corresponding to each of the second target errors;
[0084] Each of the mean square error values is used to calculate the weight coefficient corresponding to each of the business revenue prediction models.
[0085] In some feasible implementations, the extended data includes at least one of date data, user behavior data, settlement data, and geographic location data.
[0086] The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0087] The memory is used to store computer programs;
[0088] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0089] The embodiment of the present invention further discloses a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the method described in the embodiment of the present invention.
[0090] The embodiments of the present invention include the following advantages:
[0091] In an embodiment of the present invention, at least two decision tree models and training data for the target business are obtained, the training data at least includes historical business revenue data of the target business and expansion data for the target business, and a probability model and a segmented loss function for the decision tree model are obtained, and then the hyperparameters of at least two decision tree models are tuned according to the training data, the probability model, and the segmented loss function to obtain a business revenue prediction model corresponding to the decision tree model, and then the business revenue prediction model is weighted predicted according to the training data and the segmented loss function to obtain the weight coefficients corresponding to each business revenue prediction model, and then each business revenue prediction model is fused based on the weight coefficient to obtain a target fusion model for the target business, so as to perform revenue prediction for the target business through the target fusion model, thereby effectively improving the accuracy of model prediction by combining the prediction results of multiple models, and at the same time, the model training is tuned based on the segmented loss function and the probability model to further improve the prediction accuracy of the algorithm, while reducing the risk of overfitting or underfitting, and improving the robustness and stability of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0092] Figure 1 is a flowchart of a method for predicting business income provided in an embodiment of the present invention;
[0093] Figure 2 is a schematic diagram of a scenario of income prediction provided in an embodiment of the present invention;
[0094] Figure 3 It is a structural block diagram of a device for predicting business income provided in an embodiment of the present invention;
[0095] Figure 4 It is a block diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0096] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0097] As an example, in the process of operator revenue forecasting, in addition to the problem of insufficient forecasting accuracy of the forecasting method itself, there are also some specific difficulties, which further increase the complexity of the forecast, especially under the high standard of requiring the forecast accuracy to reach more than 99.8%. For example, for some of the difficulties:
[0098] 1. Prediction accuracy requirements: Some revenue items of city-level operators fluctuate within 0.5% of revenue each month, so the prediction error must be limited to 0.2% of revenue. Currently, existing algorithms cannot meet this accuracy requirement.
[0099] 2. Diversity of charging methods: Operators’ charging methods vary according to user types. Existing users are usually charged monthly, while new users may be charged daily. This difference requires the prediction model to distinguish different charging modes and make predictions separately.
[0100] 3. Diversity of service packages: Operators offer a wide variety of service packages, each with different fee structures and user groups.
[0101] 4. Huge number of users: Operators usually have a huge user base, and the consumption behavior of each user may have an impact on the total revenue. How to extract valuable information from massive user data and use it for prediction models is a huge challenge.
[0102] 5. Uncertainty of user behavior: User consumption behavior is affected by many factors, including personal preferences, economic conditions, market competition, etc. These factors may lead to unpredictability of user behavior, thus affecting the accuracy of revenue forecasts.
[0103] 6. Market competition: The market environment in which operators operate is changing dynamically, and technological developments may have a significant impact on operators’ revenues. The forecasting model needs to be able to adapt to these external changes and update the forecast results in a timely manner.
[0104] Based on the above process, the prediction of business revenue by related technologies cannot meet actual needs.
[0105] In this regard, in the present invention, by obtaining at least two decision tree models and training data for the target business, the training data at least includes the historical business revenue data of the target business and the expansion data for the target business, and obtaining the probability model and the segmented loss function for the decision tree model, then firstly tune the hyperparameters of the at least two decision tree models according to the training data, the probability model and the segmented loss function to obtain the business revenue prediction model corresponding to the decision tree model, then perform weight prediction on the business revenue prediction model according to the training data and the segmented loss function to obtain the weight coefficient corresponding to each business revenue prediction model, and then fuse each business revenue prediction model based on the weight coefficient to obtain the target fusion model for the target business, so as to perform revenue prediction for the target business through the target fusion model, thereby effectively improving the accuracy of model prediction by combining the prediction results of multiple models, and at the same time, tuning the model training based on the segmented loss function and the probability model to further improve the prediction accuracy of the algorithm, while reducing the risk of overfitting or underfitting, and improving the robustness and stability of the model.
[0106] Reference Figure 1 , shows a flowchart of a method for predicting business income provided in an embodiment of the present invention, which may specifically include the following steps:
[0107] Step 101, obtaining at least two decision tree models and training data for a target business, wherein the training data at least includes historical business revenue data of the target business and expansion data for the target business;
[0108] In an embodiment of the present invention, the target business may be a business that requires revenue forecasting, such as mobile voice service, mobile data service, SMS and MMS service, fixed-line telephone service, broadband Internet service, television service, etc. By predicting the revenue corresponding to the business, it plays an important role in updating the business support system.
[0109] In the process of predicting the income corresponding to the target business, you can first build a business income prediction model for the target business, and then obtain the corresponding data and input the obtained data into the business income prediction model for prediction to obtain the business income corresponding to the target business.
[0110] In a specific implementation, by obtaining at least two decision tree models and training data for the target business, the decision tree model can be used to train the corresponding business revenue prediction model, and the training data can be used as the data basis for model training. Among them, the training data at least includes the historical business revenue data of the target business and the extended data for the target business. The prediction method of the model can be determined through the historical business revenue data, and more relevant information can be introduced through the extended data, so that the model can better understand the internal structure and laws of the data, so that the model takes into account more factors related to revenue, and improves the coverage and accuracy of the model finally trained.
[0111] Optionally, the extended data may include at least one of date data, user behavior data, settlement data and geographic location data. By introducing the extended data as features and using aggregated features to reflect income conditions, the coverage and accuracy of the final model can be improved.
[0112] In one example, date data may be data associated with holidays, working days, rest days, etc. For example, statutory holidays and adjusted holidays may be converted into corresponding feature variables, marking whether the month contains a certain holiday, and generating corresponding features to better capture the impact of these dates on income. In addition, date data may also be associated with working days, rest days, etc., by adding the number of days corresponding to working days and rest days in each month as features to analyze their impact on consumer spending habits and income levels; user behavior data may include features obtained by quantifying the user growth and churn of each month, including the number of existing, new network users, and dismantled users, and the average monthly non-package consumption level may be used as a feature by product to reflect the user's consumption behavior; settlement data may be related to the settlement system with the operator, and the corresponding settlement data may be obtained by taking the daily points data as a feature, thereby taking into account the impact of the points type and quantity generated by different services on user behavior; for geographic location data, by using the user's geographic location information as a feature, the impact of regional factors on income is explored, thereby improving the coverage and accuracy of the final model by introducing extended data as a feature for model training.
[0113] In addition, the decision tree model can represent the decision-making process through a tree structure. Each internal node represents a test of a feature or attribute, each branch represents a possible result, and each leaf node represents a category or continuous value. By introducing at least two decision tree models for model training, the advantages of different decision tree models can be brought into play, and model complementarity can be achieved, thereby taking advantage of different features and data structures. Integrating multiple models can reduce the risk of poor performance on certain edge cases or noisy data, overfitting or underfitting, and improve the robustness and stability of the model.
[0114] Step 102, obtaining a probability model and a segment loss function for the decision tree model;
[0115] In a specific implementation, the probability model can be a model that describes the data generation process through probability distribution. It assumes that the data is generated by a random mechanism. The goal of the model is to learn the parameters of this random mechanism so that new data can be predicted. The segmented loss function can be used to measure the difference between the model prediction result and the actual result. When training the model, the optimization algorithm adjusts the model parameters by minimizing the loss function. Optionally, during the model training process, the probability model can be used to tune the model hyperparameters, and the loss function is used to quantify the model error. By adjusting the hyperparameters, the best parameter combination that minimizes the loss function can be found. Therefore, by obtaining the probability model for the decision tree model and the segmented loss function, the model training can be effectively performed to improve the accuracy of the model prediction.
[0116] Step 103, tuning the hyperparameters of the at least two decision tree models according to the training data, the probability model, and the piecewise loss function to obtain a business revenue prediction model corresponding to the decision tree model;
[0117] In an embodiment of the present invention, after the training data, probability model and segmented loss function are determined, the hyperparameters of each decision tree model can be tuned based on the three, and based on the results of the tuning, the business revenue prediction model corresponding to the decision tree model can be obtained.
[0118] In some feasible implementations, during the hyperparameter tuning process, the training data can be first divided into several subsets, and then each subset is used as a validation set in turn, and the subsets other than the validation set are used as training sets. Then, by obtaining the hyperparameter search space for the probability model, and inputting the hyperparameter search space into the probability model for prediction, the hyperparameter distribution range for the decision tree is obtained, and then the decision tree model is trained according to the hyperparameter distribution range, validation set, training set and piecewise loss function to obtain a business revenue prediction model corresponding to the decision tree model.
[0119] The hyperparameter search space may be information for limiting the search range of the hyperparameters, including but not limited to the maximum tree depth, the minimum number of leaf node samples, the learning rate, etc. Specifically, after the hyperparameter search space is determined, the hyperparameter search space may be input into the probability model for prediction to output the corresponding hyperparameter distribution range, so as to select appropriate hyperparameters from the hyperparameter distribution range for model training.
[0120] In some feasible implementations, the hyperparameter search space may be input into a first formula corresponding to the probability model for prediction to obtain a hyperparameter distribution range for the decision tree; wherein the first formula is as follows:
[0121]
[0122] where p(x|θ) is the probability density function of the hyperparameter x given the parameter θ, and π j is the mixing weight, μ j is the mean, is the variance, is the hyperparameter search space.
[0123] Further, after the hyperparameter distribution range is determined, a hyperparameter combination can be determined from the hyperparameter distribution range through a probability model, and then in response to substituting the hyperparameter combination into the decision tree model for updating, the training set and the validation set are respectively input into the updated decision tree model for model training to obtain a first training result corresponding to the training set and a second training result corresponding to the validation set, and then a first target error between the first training result and the second training result is calculated based on a piecewise loss function, and the first target error is input into the probability model for iteration, and a new hyperparameter set is determined from the hyperparameter distribution range through the probability model, and the step of returning to the step of substituting the hyperparameter combination into the decision tree model for updating, the training set and the validation set are respectively input into the updated decision tree model for model training to obtain a first training result corresponding to the training set and a second training result corresponding to the validation set is returned, until the number of iterations of the probability model reaches a first preset threshold and / or the first target error is less than or equal to a second preset threshold, and the target hyperparameter combination for the decision tree model is determined, and finally the target hyperparameter combination can be used as a parameter configuration of the decision tree model to obtain a business revenue prediction model corresponding to the decision tree model.
[0124] It should be noted that during the training process, training can be performed using k-fold cross-validation, which involves dividing the training data into k subsets and performing k rounds of cross-validation based on the k subsets. In each round of cross-validation, one of the subsets can be used as a validation set, and the remaining k-1 subsets can be used as training sets for k rounds of cross-validation. In the next round of validation, another subset is selected as a new validation set, and the remaining subsets are used as training sets for a new round of cross-validation, until k rounds of cross-validation are completed.
[0125] In each round of cross-validation, the prediction accuracy of the error quantification model can be calculated through the segmented loss function. By specifying different penalty mechanisms for prediction errors of different sizes, the errors in the data can be captured and processed more carefully. Specifically, the segmented loss function corresponds to the first segmentation threshold and the second segmentation threshold. The first error between the first training result and the second training result can be calculated first, and then the target loss function can be selected from the second formula corresponding to the segmented loss function according to the first error. The second error between the first training result and the second training result is calculated based on the target loss function, and the second error is used as the first target error.
[0126] Among them, the second formula is as follows:
[0127]
[0128] in, represents the first training result, y i represents the second training result, c1 and c2 both represent fixed parameters that make the function continuous, a is the first segmentation threshold of the segmentation loss function, and b is the second segmentation threshold of the segmentation loss function. The error is calculated by the segmentation loss function to quantify the prediction accuracy of the model. By specifying different penalty mechanisms for prediction errors of different sizes, errors in the data can be captured and processed more carefully.
[0129] It should be noted that due to the accuracy requirements, it is necessary to ensure that the accuracy of the model prediction meets the actual needs. In this regard, in the embodiment of the present invention, a piecewise loss function is introduced. The square root error is used in the range of small errors to avoid the model from over-punishing small prediction errors; in the acceptable error range, 1 / 2 square error is used, which will balance the penalty for medium errors and avoid excessive punishment for these errors; for large errors, the use of square error can significantly increase the penalty for large errors, thereby prompting the model to pay more attention to reducing large errors and improving robustness to outliers. This piecewise loss function helps to impose more penalties on large errors while avoiding excessive punishment for small errors, thereby effectively improving the prediction accuracy of the algorithm.
[0130] Optionally, the segmentation threshold may be set according to actual needs. For example, a may be set to 50, b may be set to 200, etc., to optimize the model's response to business needs and prediction accuracy. The present invention does not impose any limitation on this.
[0131] In one example, it is assumed that the decision tree model uses the LightGBM model and the CatBoost model to train the training set, and uses the TPE algorithm (Tree of ParzenEstimators) (ie, a probability model) for hyperparameter tuning, and generates the final prediction output by weighting the prediction results of the two models.
[0132] Specifically, the model training process can be as follows:
[0133] Step S1: Define the hyperparameter search space, including but not limited to the maximum tree depth, the minimum number of leaf node samples, and the learning rate, and define a reasonable search range for each hyperparameter.
[0134] Step S2: Initialize the TPE instance, replace the original uniform distribution with a truncated Gaussian mixture and provide a search space for hyperparameters. TPE uses a probability model to estimate the distribution of hyperparameters, and the formula is as follows:
[0135]
[0136] Where p(x|θ) is the probability density function of the hyperparameter x given the parameter θ, and π j is the mixing weight, μ j is the mean, is the variance, is the limited range of hyperparameters.
[0137] Step S3: Use the hyperparameter combination recommended by TPE to obtain the hyperparameter combination x. * Perform model training and evaluate the hyperparameter combination x * Corresponding model performance:
[0138] Step S4: Feedback the model performance to the TPE algorithm. Feedback the model performance on the validation set to TPE so as to update the probability model based on the prediction results.
[0139] Step S5: The TPE algorithm iteratively selects a new hyperparameter combination x according to the current probability model new , repeat steps S3 and S4 until the predetermined number of iterations is reached or the performance improvement is no longer significant.
[0140] Step S6: From all the hyperparameter combinations tried, select a set of hyperparameter combinations x with the best average performance on the validation set. best , as the configuration of the final model, and use these parameters to train the final model on the training set and verify it on the independent test set to ensure that the model has strong generalization ability, thereby obtaining a business revenue prediction model.
[0141] Step 104, performing weight prediction on the business revenue prediction model according to the training data and the piecewise loss function, and obtaining a weight coefficient corresponding to each business revenue prediction model;
[0142] Through the above process, the hyperparameter combination with the best average performance is selected as the configuration of the decision tree model. After obtaining at least two business revenue prediction models, the business revenue prediction models can be weighted and fused to obtain the corresponding fusion model, and then the revenue of the target business can be predicted based on the fusion model. Among them, the weights corresponding to each business revenue prediction model can be predicted based on the training data and the piecewise loss function to obtain the weight coefficients corresponding to each business revenue prediction model, so as to fuse each business revenue prediction model based on the weight coefficients to obtain the corresponding fusion model.
[0143] In some feasible implementation methods, the training set and the validation set can be respectively input into the business revenue prediction model for prediction to obtain a first prediction result corresponding to the training set and a second prediction result corresponding to the validation set, and then the second target error between the first prediction result and the second prediction result is calculated based on the piecewise loss function, and then the weight is adjusted according to the second target error corresponding to each business revenue prediction model to obtain the weight coefficient corresponding to each business revenue prediction model.
[0144] Wherein, the segmentation loss function corresponds to the first segmentation threshold and the second segmentation threshold, and the third error between the first prediction result and the second prediction result can be calculated, and then the target loss function is selected from the second formula corresponding to the segmentation loss function according to the third error, and the fourth error between the first prediction result and the second prediction result is calculated based on the target loss function, and the fourth error is used as the second target error;
[0145] Among them, the second formula is as follows:
[0146]
[0147] in, Represents the first prediction result, y i Represents the second prediction result, c1 and c2 both represent fixed parameters that make the function continuous, a is the first segmentation threshold of the segmentation loss function, and b is the second segmentation threshold of the segmentation loss function.
[0148] It should be noted that for the processing process of the piecewise loss function, reference can be made to the description in the aforementioned process and will not be repeated here.
[0149] Furthermore, after obtaining the corresponding errors, the mean square error values corresponding to the second target errors may be obtained, and then the weight coefficients corresponding to the business revenue prediction models may be calculated using the mean square error values.
[0150] In one example, the best hyperparameter combination x is selected best, retrain the LightGBM model and CatBoost model, and the final prediction model fusion method adopts weighted average to determine the respective weights according to the mean square error (RMSE) values of the LightGBM model and the CatBoost model:
[0151]
[0152] Among them, W lightgbm Can be the weight coefficient corresponding to the LightGBM model, W CatBoost It can be the weight coefficient corresponding to the CatBoost model.
[0153] Through the above process, the prediction errors of the two models are calculated using the piecewise loss function. According to the calculated errors, the weights of the LightGBM model and the CatBoost model in the final prediction are adjusted. Then, each model is trained using the optimal hyperparameters on the complete training set to obtain the final integrated model. Finally, the piecewise loss function is used on the test set to verify the generalization ability of the fusion model, which can integrate learning by combining the prediction results of multiple models to obtain prediction results with higher accuracy. At the same time, it can ensure that in the process of model fusion use of the actual prediction model, it helps to impose more penalties on large errors, while avoiding excessive penalties on small errors, further effectively improving the prediction accuracy of the algorithm, and its accuracy can be further refined based on the degree of optimization of the existing results, significantly improving the accuracy of the prediction results.
[0154] Step 105 , fusing the business revenue prediction models based on the weight coefficients to obtain a target fusion model for the target business, wherein the target fusion model is used to predict the revenue of the target business.
[0155] Based on the above process, after determining the weight coefficients corresponding to each business revenue prediction model, the various business revenue prediction models can be fused according to the weight coefficients to obtain a target fusion model for the target business, so as to predict the revenue of the target business through the target fusion model. By combining the prediction results of multiple models, the accuracy of model prediction is effectively improved. At the same time, the model training is tuned based on the piecewise loss function and probability model to further improve the prediction accuracy of the algorithm, while reducing the risk of overfitting or underfitting, and improving the robustness and stability of the model.
[0156] In one example, as the weight coefficients involved in the above-mentioned embodiment, the prediction result of the final fusion model can be as follows:
[0157]
[0158] in, and They are the prediction results of the Lightgbm model and the CatBoost model respectively.
[0159] It should be noted that the embodiments of the present invention include but are not limited to the above examples. It is understandable that those skilled in the art can also make settings according to actual needs under the guidance of the ideas of the embodiments of the present invention, and the present invention is not limited to this.
[0160] In an embodiment of the present invention, at least two decision tree models and training data for the target business are obtained, the training data at least includes historical business revenue data of the target business and expansion data for the target business, and a probability model and a segmented loss function for the decision tree model are obtained, and then the hyperparameters of at least two decision tree models are tuned according to the training data, the probability model, and the segmented loss function to obtain a business revenue prediction model corresponding to the decision tree model, and then the business revenue prediction model is weighted predicted according to the training data and the segmented loss function to obtain the weight coefficients corresponding to each business revenue prediction model, and then each business revenue prediction model is fused based on the weight coefficient to obtain a target fusion model for the target business, so as to perform revenue prediction for the target business through the target fusion model, thereby effectively improving the accuracy of model prediction by combining the prediction results of multiple models, and at the same time, the model training is tuned based on the segmented loss function and the probability model to further improve the prediction accuracy of the algorithm, while reducing the risk of overfitting or underfitting, and improving the robustness and stability of the model.
[0161] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the following examples are used for exemplary description:
[0162] Reference Figure 2 , shows a schematic diagram of the scenario of revenue prediction provided in an embodiment of the present invention. After obtaining the original user data, data preprocessing (including data cleaning, data filling, etc.) can be performed first, and at the same time, by obtaining external data (such as holiday data, geographic location data, points data, etc.), feature extraction is performed on the external data, and multiple features are introduced. Then, the model training is performed in combination with the cleaned user data to obtain the corresponding prediction model, so as to predict the business revenue based on the prediction model. The specific processing process can be as follows:
[0163] First, we can collect business revenue data for a certain period of time in the past (such as the past three years) and clean it thoroughly, including processing missing values, outliers, and duplicate records to ensure the accuracy and consistency of the data set. At the same time, we normalize the numerical features to eliminate the effects of different magnitudes and dimensions.
[0164] Next, in order to enrich the information input of the model, external data was introduced as features, and aggregated features were used to more comprehensively reflect the revenue situation, including the introduction of corresponding holiday information, user behavior data, the points system of operator settlement, the number of working days and rest days per month, and geographic location information.
[0165] Again, in order to ensure the effectiveness of model training, the K-fold cross-validation method can be used to split the training set into 5 subsets, and each subset is used as a validation set in turn. In the process of model construction, the LightGBM model and the CatBoost model are used to train the training set. In order to further improve the prediction performance of the model, the TPE algorithm is used to fine-tune the hyperparameters of the model. In each round of cross-validation, the prediction accuracy of the model is quantified by calculating the error through the piecewise loss function. By specifying different penalty mechanisms for prediction errors of different sizes, the errors in the data can be captured and processed more carefully. After determining the optimal hyperparameters, these parameters are used to train the final model on the training set and validated on an independent test set to ensure that the model has strong generalization ability. In each round of cross-validation, the prediction error of the two models is calculated using the piecewise loss function. According to the calculated error, the weights of the LightGBM model and the CatBoost model in the final prediction are adjusted, and then each model is trained with the optimal hyperparameters on the complete training set. Finally, the generalization ability of the fusion model is verified using the piecewise loss function on the test set.
[0166] Finally, the optimized ensemble model achieved significant improvements in the monthly income forecasting task. The root mean square error (RMSE) of the final model was reduced to a certain threshold, indicating that the forecast error was effectively controlled, thus achieving high accuracy in income forecasting. This improvement not only verifies the effectiveness of the proposed optimization method, but also improves the forecasting performance of the model in practical applications, significantly enhancing the ability to predict monthly income fluctuations.
[0167] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0168] Reference Figure 3 , shows a structural block diagram of a business income prediction device provided in an embodiment of the present invention, which may specifically include the following modules:
[0169] A data acquisition module 301 is used to acquire at least two decision tree models and training data for a target business, wherein the training data at least includes historical business revenue data of the target business and expansion data for the target business;
[0170] A model determination module 302 is used to obtain a probability model and a segment loss function for the decision tree model;
[0171] A parameter tuning module 303, configured to tune the hyperparameters of the at least two decision tree models according to the training data, the probability model, and the piecewise loss function, to obtain a business revenue prediction model corresponding to the decision tree model;
[0172] A coefficient determination module 304 is used to perform weight prediction on the business revenue prediction model according to the training data and the piecewise loss function to obtain weight coefficients corresponding to each of the business revenue prediction models;
[0173] The model fusion module 305 is used to fuse the various business revenue prediction models based on the weight coefficients to obtain a target fusion model for the target business, and the target fusion model is used to predict the revenue of the target business.
[0174] In some feasible implementations, the parameter tuning module 303 is specifically used to:
[0175] Dividing the training data into a plurality of subsets;
[0176] Each subset is used as a validation set in turn, and the subsets other than the validation set are used as training sets;
[0177] Obtaining a hyperparameter search space for the probability model, and inputting the hyperparameter search space into the probability model for prediction, to obtain a hyperparameter distribution range for the decision tree;
[0178] The decision tree model is trained according to the hyperparameter distribution range, the validation set, the training set and the segmented loss function to obtain a business revenue prediction model corresponding to the decision tree model.
[0179] In some feasible implementations, the parameter tuning module 303 is specifically used to:
[0180] The hyperparameter search space is input into the first formula corresponding to the probability model for prediction to obtain the hyperparameter distribution range for the decision tree; wherein the first formula is as follows:
[0181]
[0182] where p(x|θ) is the probability density function of the hyperparameter x given the parameter θ, and π j is the mixing weight, μ j is the mean, is the variance, is the hyperparameter search space.
[0183] In some feasible implementations, the parameter tuning module 303 is specifically used to:
[0184] Determining a hyperparameter combination from the hyperparameter distribution range by using the probability model;
[0185] In response to substituting the hyperparameter combination into the decision tree model for updating, the training set and the validation set are respectively input into the updated decision tree model for model training to obtain a first training result corresponding to the training set and a second training result corresponding to the validation set;
[0186] The steps of calculating a first target error between the first training result and the second training result based on the piecewise loss function, inputting the first target error into the probability model for iteration, determining a new hyperparameter set from the hyperparameter distribution range through the probability model, and returning a response to substituting the hyperparameter combination into the decision tree model for updating, inputting the training set and the validation set into the updated decision tree model for model training, and obtaining a first training result corresponding to the training set and a second training result corresponding to the validation set;
[0187] Until the number of iterations of the probability model reaches a first preset threshold and / or the first target error is less than or equal to a second preset threshold, determining a target hyperparameter combination for the decision tree model;
[0188] The target hyperparameter combination is used as the parameter configuration of the decision tree model to obtain a business revenue prediction model corresponding to the decision tree model.
[0189] In some feasible implementations, the segmentation loss function corresponds to a first segmentation threshold and a second segmentation threshold, and the parameter tuning module 303 is specifically used for:
[0190] Calculating a first error between the first training result and the second training result;
[0191] Selecting a target loss function from a second formula corresponding to the segment loss function according to the first error, calculating a second error between the first training result and the second training result based on the target loss function, and using the second error as a first target error;
[0192] The second formula is as follows:
[0193]
[0194] in, represents the first training result, y i represents the second training result, c1 and c2 both represent fixed parameters that make the function continuous, a is the first segmentation threshold of the segmentation loss function, and b is the second segmentation threshold of the segmentation loss function.
[0195] In some feasible implementations, the coefficient determination module 304 is specifically used to:
[0196] Inputting the training set and the validation set into the business revenue prediction model for prediction respectively, and obtaining a first prediction result corresponding to the training set and a second prediction result corresponding to the validation set;
[0197] Calculate a second target error between the first prediction result and the second prediction result based on the piecewise loss function;
[0198] The weight adjustment is performed according to the second target error corresponding to each of the business revenue prediction models to obtain the weight coefficient corresponding to each of the business revenue prediction models.
[0199] In some feasible implementations, the segmentation loss function corresponds to a first segmentation threshold and a second segmentation threshold, and the coefficient determination module 304 is specifically used for:
[0200] Calculating a third error between the first prediction result and the second prediction result;
[0201] Selecting a target loss function from a second formula corresponding to the segmented loss function according to the third error, calculating a fourth error between the first prediction result and the second prediction result based on the target loss function, and using the fourth error as a second target error;
[0202] The second formula is as follows:
[0203]
[0204] in, Represents the first prediction result, y i represents the second prediction result, c1 and c2 both represent fixed parameters that make the function continuous, a is the first segmentation threshold of the segmentation loss function, and b is the second segmentation threshold of the segmentation loss function.
[0205] In some feasible implementations, the coefficient determination module 304 is specifically used to:
[0206] Obtaining mean square error values corresponding to each of the second target errors;
[0207] Each of the mean square error values is used to calculate the weight coefficient corresponding to each of the business revenue prediction models.
[0208] In some feasible implementations, the extended data includes at least one of date data, user behavior data, settlement data, and geographic location data.
[0209] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0210] In addition, an embodiment of the present invention further provides an electronic device, including: 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 business revenue prediction method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0211] 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 business revenue prediction 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.
[0212] Figure 4 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0213] The electronic device 400 includes but is not limited to: a radio frequency unit 401, a network module 402, an audio output unit 403, an input unit 404, a sensor 405, a display unit 406, a user input unit 407, an interface unit 408, a memory 409, a processor 410, and a power supply 411. Those skilled in the art will appreciate that the electronic device structure involved in the embodiments of the present invention does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a wearable device, and a pedometer.
[0214] It should be understood that in the embodiment of the present invention, the radio frequency unit 401 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving downlink data from the base station, it is sent to the processor 410 for processing; in addition, uplink data is sent to the base station. Generally, the radio frequency unit 401 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 401 can also communicate with the network and other devices through a wireless communication system.
[0215] The electronic device provides users with wireless broadband Internet access through the network module 402, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0216] The audio output unit 403 can convert the audio data received by the RF unit 401 or the network module 402 or stored in the memory 409 into an audio signal and output it as sound. Moreover, the audio output unit 403 can also provide audio output related to a specific function performed by the electronic device 400 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 403 includes a speaker, a buzzer, a receiver, etc.
[0217] The input unit 404 is used to receive audio or video signals. The input unit 404 may include a graphics processor (GPU) 4041 and a microphone 4042, and the graphics processor 4041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 406. The image frame processed by the graphics processor 4041 can be stored in the memory 409 (or other storage medium) or sent via the radio frequency unit 401 or the network module 402. The microphone 4042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 401 in the case of a telephone call mode.
[0218] The electronic device 400 also includes at least one sensor 405, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 4061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 4061 and / or the backlight when the electronic device 400 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 405 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0219] The display unit 406 is used to display information input by the user or information provided to the user. The display unit 406 may include a display panel 4061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0220] The user input unit 407 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 407 includes a touch panel 4071 and other input devices 4072. The touch panel 4071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 4071 or near the touch panel 4071 using any suitable object or accessory such as a finger, stylus, etc.). The touch panel 4071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the contact point coordinates, and then sends it to the processor 410, receives the command sent by the processor 410 and executes it. In addition, the touch panel 4071 can be implemented using various types such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch panel 4071, the user input unit 407 may also include other input devices 4072. Specifically, other input devices 4072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail here.
[0221] Further, the touch panel 4071 may be covered on the display panel 4061. When the touch panel 4071 detects a touch operation on or near it, it is transmitted to the processor 410 to determine the type of the touch event, and then the processor 410 provides a corresponding visual output on the display panel 4061 according to the type of the touch event. It can be understood that in one embodiment, the touch panel 4071 and the display panel 4061 are used as two independent components to implement the input and output functions of the electronic device, but in some embodiments, the touch panel 4071 and the display panel 4061 can be integrated to implement the input and output functions of the electronic device, which is not limited here.
[0222] The interface unit 408 is an interface for connecting an external device to the electronic device 400. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 408 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 400 or may be used to transmit data between the electronic device 400 and an external device.
[0223] The memory 409 can be used to store software programs and various data. The memory 409 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 409 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0224] The processor 410 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 409, and calling data stored in the memory 409, so as to monitor the electronic device as a whole. The processor 410 may include one or more processing units; preferably, the processor 410 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 410.
[0225] The electronic device 400 may also include a power supply 411 (such as a battery) for supplying power to each component. Preferably, the power supply 411 may be logically connected to the processor 410 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.
[0226] In addition, the electronic device 400 includes some functional modules not shown, which will not be described in detail here.
[0227] 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.
[0228] 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.
[0229] 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.
[0230] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0231] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0232] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0233] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0234] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0235] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0236] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for predicting business income, characterized in that: include: Acquire at least two decision tree models and training data for a target business, wherein the training data at least includes historical business revenue data of the target business and expansion data for the target business; Obtaining a probability model and a segmentation loss function for the decision tree model; Tuning the hyperparameters of the at least two decision tree models according to the training data, the probability model, and the piecewise loss function to obtain a business revenue prediction model corresponding to the decision tree model; Perform weight prediction on the business revenue prediction model according to the training data and the piecewise loss function to obtain weight coefficients corresponding to each of the business revenue prediction models; Based on the weight coefficient, each of the business revenue prediction models is fused to obtain a target fusion model for the target business, and the target fusion model is used to predict the revenue of the target business.
2. The method according to claim 1, characterized in that The step of tuning the hyperparameters of the at least two decision tree models according to the training data, the probability model, and the piecewise loss function to obtain a business revenue prediction model corresponding to the decision tree model includes: Dividing the training data into a plurality of subsets; Each subset is used as a validation set in turn, and the subsets other than the validation set are used as training sets; Obtaining a hyperparameter search space for the probability model, and inputting the hyperparameter search space into the probability model for prediction, to obtain a hyperparameter distribution range for the decision tree; The decision tree model is trained according to the hyperparameter distribution range, the validation set, the training set and the segmented loss function to obtain a business revenue prediction model corresponding to the decision tree model.
3. The method according to claim 2, characterized in that The step of inputting the hyperparameter search space into the probability model for prediction to obtain a hyperparameter distribution range for the decision tree includes: The hyperparameter search space is input into the first formula corresponding to the probability model for prediction to obtain the hyperparameter distribution range for the decision tree; wherein the first formula is as follows: where p(x|θ) is the probability density function of the hyperparameter x given the parameter θ, and π j is the mixing weight, μ j is the mean, is the variance, is the hyperparameter search space.
4. The method according to claim 2 or 3, characterized in that: The performing model training on the decision tree model according to the hyperparameter distribution range, the validation set, the training set, and the piecewise loss function to obtain a business revenue prediction model corresponding to the decision tree model includes: Determining a hyperparameter combination from the hyperparameter distribution range by using the probability model; In response to substituting the hyperparameter combination into the decision tree model for updating, the training set and the validation set are respectively input into the updated decision tree model for model training to obtain a first training result corresponding to the training set and a second training result corresponding to the validation set; The steps of calculating a first target error between the first training result and the second training result based on the piecewise loss function, inputting the first target error into the probability model for iteration, determining a new hyperparameter set from the hyperparameter distribution range through the probability model, and returning a response to substituting the hyperparameter combination into the decision tree model for updating, inputting the training set and the validation set into the updated decision tree model for model training, and obtaining a first training result corresponding to the training set and a second training result corresponding to the validation set; Until the number of iterations of the probability model reaches a first preset threshold and / or the first target error is less than or equal to a second preset threshold, determining a target hyperparameter combination for the decision tree model; The target hyperparameter combination is used as the parameter configuration of the decision tree model to obtain a business revenue prediction model corresponding to the decision tree model.
5. The method according to claim 4, characterized in that The segmentation loss function corresponds to a first segmentation threshold and a second segmentation threshold, and the calculating a first target error between the first training result and the second training result based on the segmentation loss function includes: Calculating a first error between the first training result and the second training result; Selecting a target loss function from a second formula corresponding to the segment loss function according to the first error, calculating a second error between the first training result and the second training result based on the target loss function, and using the second error as a first target error; The second formula is as follows: in, represents the first training result, y i represents the second training result, c1 and c2 both represent fixed parameters that make the function continuous, a is the first segmentation threshold of the segmentation loss function, and b is the second segmentation threshold of the segmentation loss function.
6. The method according to claim 2 or 3, characterized in that: The performing weight prediction on the business revenue prediction model according to the training data and the piecewise loss function to obtain the weight coefficient corresponding to each business revenue prediction model includes: Inputting the training set and the validation set into the business revenue prediction model for prediction respectively, and obtaining a first prediction result corresponding to the training set and a second prediction result corresponding to the validation set; Calculate a second target error between the first prediction result and the second prediction result based on the piecewise loss function; The weight adjustment is performed according to the second target error corresponding to each of the business revenue prediction models to obtain the weight coefficient corresponding to each of the business revenue prediction models.
7. The method according to claim 6, characterized in that The segmentation loss function corresponds to a first segmentation threshold and a second segmentation threshold, and the calculating a second target error between the first prediction result and the second prediction result based on the segmentation loss function includes: Calculating a third error between the first prediction result and the second prediction result; Selecting a target loss function from a second formula corresponding to the segmented loss function according to the third error, calculating a fourth error between the first prediction result and the second prediction result based on the target loss function, and using the fourth error as a second target error; Wherein, the second formula is as follows: in, Represents the first prediction result, y i represents the second prediction result, c1 and c2 both represent fixed parameters that make the function continuous, a is the first segmentation threshold of the segmentation loss function, and b is the second segmentation threshold of the segmentation loss function.
8. The method according to claim 6 or 7, characterized in that: The step of performing weight adjustment according to the second target error corresponding to each of the business revenue prediction models to obtain a weight coefficient corresponding to each of the business revenue prediction models includes: Obtaining mean square error values corresponding to each of the second target errors; Each of the mean square error values is used to calculate the weight coefficient corresponding to each of the business revenue prediction models.
9. The method according to claim 1, characterized in that: The extended data includes at least one of date data, user behavior data, settlement data and geographic location data.
10. A device for predicting business income, characterized in that: include: A data acquisition module, used to acquire at least two decision tree models and training data for a target business, wherein the training data at least includes historical business revenue data of the target business and expansion data for the target business; A model determination module, used to obtain a probability model and a segmentation loss function for the decision tree model; A parameter tuning module, used to tune the hyperparameters of the at least two decision tree models according to the training data, the probability model, and the piecewise loss function, to obtain a business revenue prediction model corresponding to the decision tree model; A coefficient determination module, used to perform weight prediction on the business revenue prediction model according to the training data and the piecewise loss function, and obtain weight coefficients corresponding to each of the business revenue prediction models; The model fusion module is used to fuse the various business revenue prediction models based on the weight coefficients to obtain a target fusion model for the target business, and the target fusion model is used to predict the revenue of the target business.
11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 10 when executing the program stored in the memory.
12. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 10.
Citation Information
Cited By
Interstellar molecule rotation mode prediction method, system, equipment and medium
CN120412770A