Prophet-based time sequence prediction method and device, storage medium and computer equipment

By decomposing business metrics and screening exogenous variables in the Prophet model, and combining multi-stage parameter tuning and optimization of the objective function, the shortcomings of Prophet in multi-sequence modeling are solved, and the prediction accuracy and efficiency in freight scenarios are improved.

CN120930482APending Publication Date: 2025-11-11SHENZHEN YISHIHUOLALA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511034246.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-25
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

The Prophet model has shortcomings in multi-sequence modeling and exogenous variable screening, resulting in poor prediction performance in enterprise business scenarios, especially in freight scenarios.

Method used

By breaking down the target business metrics, identifying effective exogenous variables and key dates of interest, an initial Prophet model is constructed, and prediction accuracy is improved through multi-stage parameter tuning and optimization of the objective function.

Benefits of technology

It effectively reduces the coupling effect of sub-indicators, reduces the number of models, improves the model's ability to identify and fit key dates, and enhances prediction accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120930482A_ABST
    Figure CN120930482A_ABST
Patent Text Reader

Abstract

The invention is suitable for time sequence prediction in a freight scene, and provides a Prophet-based time sequence prediction method and device, a storage medium and computer equipment, and the method comprises the steps: carrying out the prediction index disassembly of a target business index, and obtaining a prediction index disassembly result; determining an effective exogenous variable of each prediction index according to the business knowledge; based on the historical time series data of each prediction index, determining a focus attention date for the prediction index; constructing training data for each prediction index based on the historical time sequence data of each prediction index; constructing an initial Prophet model for each prediction index according to the effective exogenous variable and the focus attention date of the prediction index; training an initial Prophet model of each prediction index according to the training data of each prediction index to obtain a Prophet time sequence prediction model of each prediction index; and determining a predicted value of the target business index according to the Prophet time sequence prediction model corresponding to each prediction index. According to the method, the Prophet model is combined with business analysis and a model training strategy, accurate and efficient prediction is realized, and enterprise-level landing is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of time series forecasting in freight scenarios, and particularly relates to a time series forecasting method, apparatus, computer-readable storage medium and computer equipment based on Prophet. Background Technology

[0002] The Prophet-based time series forecasting method is an open-source forecasting framework proposed by Facebook. Its core model is the Generalized Additive Model (GAM), which makes predictions by decomposing the trend, seasonality, and holiday effects of the time series.

[0003] Trend term g(t): Employs piecewise linear or logistic regression functions, capturing abrupt trend changes by setting changepoints;

[0004] Seasonal term s(t): Fourier series is used to fit periodic patterns (such as annual / monthly / weekly seasonality);

[0005] Holiday item h(t): Special dates (such as Chinese New Year) are marked with 0 and 1;

[0006] Error term ∈(t): Assume it follows a normal distribution N(0, σ2).

[0007] Prophet is highly interpretable, but its design itself has at least the following shortcomings:

[0008] Prophet is designed as a univariate time series forecasting model, and its core architecture and functionality do not natively support joint modeling of multiple series. If N series need to be modeled, N models need to be built, which greatly increases the workload. Furthermore, exogenous variables require manual analysis and selection; the importance of exogenous variables cannot be automatically analyzed. Unimportant exogenous variables complicate the model, increase its degrees of freedom, and may cause the model to overfit the training data.

[0009] Due to the aforementioned shortcomings of Prophet, its predictive performance is poor when implemented and applied in enterprises, especially in freight scenarios where business volume is significantly affected by holidays. Summary of the Invention

[0010] The purpose of this application is to provide a time series prediction method, apparatus, computer-readable storage medium, and computer device based on Prophet, in order to solve the problems involved in the background art.

[0011] Firstly, this application provides a time series prediction method based on Prophet, the method comprising:

[0012] The target business metric to be predicted is decomposed into predictive metrics, resulting in one or more predictive metrics. Based on business knowledge, effective exogenous variables are determined for each predictive metric. Key dates of focus for each predictive metric are determined based on historical time-series data. Training data is constructed for each predictive metric based on its historical time-series data. An initial Prophet model is constructed for each predictive metric based on its effective exogenous variables and key dates of focus. The initial Prophet model is trained using the training data for each predictive metric, resulting in a Prophet time-series prediction model for each metric. Finally, the predicted value of the target business metric is determined based on the Prophet time-series prediction model for each metric.

[0013] In some embodiments, the target business indicator to be predicted is decomposed into a predictive indicator, including: detecting whether the target business indicator meets a preset decomposition condition; the decomposition condition is that the target business indicator is obtained by summing sub-indicators of different business lines, and it is not necessary to predict the value of each sub-indicator; when the target business indicator does not meet the decomposition condition, the target business indicator is used as a predictive indicator; when the target business indicator meets the decomposition condition, the target business indicator is decomposed into sub-indicators of different business lines, the time series trend of each sub-indicator is analyzed, sub-indicators with consistent time series trends are grouped together to obtain multiple groups of sub-indicators, and the sum of the indicators of each group of sub-indicators is used as a predictive indicator.

[0014] In some embodiments, determining the effective exogenous variable corresponding to each predictive indicator based on business knowledge includes: determining the effective exogenous variable corresponding to each predictive indicator in the predictive indicator decomposition results by performing the following operations: determining candidate exogenous variables corresponding to the predictive indicator based on business knowledge; there are multiple candidate exogenous variables; acquiring historical time-series data related to each candidate exogenous variable; performing statistical tests and visualization analysis based on the historical time-series data related to each candidate exogenous variable to obtain the statistical test results and visualization analysis results of each candidate exogenous variable; and combining the statistical test results and visualization analysis results of all candidate exogenous variables to determine the effective exogenous variable corresponding to the predictive indicator from the candidate exogenous variables corresponding to the predictive indicator.

[0015] In some embodiments, the training data corresponding to each predictive indicator includes a training set and a test set; the training data for each predictive indicator is constructed based on the historical time-series data related to each predictive indicator, including: preprocessing the historical time-series data related to each predictive indicator; the preprocessing includes outlier correction processing and logarithmic transformation processing of indicator values; the outlier correction processing is used to identify sudden events based on business knowledge, identify indicator values ​​related to sudden events in the historical time-series data as outliers, and correct outliers through data analysis methods; the logarithmic transformation processing of indicator values ​​is used to perform logarithmic transformation on the indicator values ​​in the historical time-series data; the preprocessed historical time-series data related to each predictive indicator is divided into a training set and a test set according to time order; the training set and the test set do not overlap in time, and the training set includes training samples for the complete period; the duration of the complete period is determined based on the seasonality of the relevant predictive indicator.

[0016] In some embodiments, there are multiple key dates of interest for each predictive metric; the objective function of the initial Prophet model for each predictive metric is defined based on the error of each key date of interest for each predictive metric, and is used to minimize the error of each key date of interest through a preset optimization constraint model.

[0017] In some embodiments, training an initial Prophet model for each prediction metric based on the training data corresponding to each prediction metric includes:

[0018] When training each initial Prophet model, the following parameter tuning strategy is implemented: based on the current training status of the initial Prophet model corresponding to the prediction metric, parameter combinations are selected from a pre-built historical high-quality parameter library as initial values ​​for model parameters, and a multi-stage parameter tuning method is used to adjust the model parameters of the initial Prophet model corresponding to the prediction metric.

[0019] In some embodiments, determining the predicted value of the target business indicator based on the Prophet time-series forecasting model corresponding to each forecast indicator includes: using the Prophet time-series forecasting model corresponding to each forecast indicator to make a forecast, obtaining an initial predicted value for each forecast indicator; performing an exponential transformation on the initial predicted value of each forecast indicator to obtain a final predicted value for each forecast indicator; and calculating the sum of the final predicted values ​​of all forecast indicators as the predicted value of the target business indicator.

[0020] Secondly, this application provides a Prophet-based time series prediction device, the device comprising:

[0021] The predictive indicator decomposition module is used to decompose the target business indicators that need to be predicted into predictive indicators, and obtain the predictive indicator decomposition results; the predictive indicator decomposition results include one or more predictive indicators.

[0022] The exogenous variable identification module is used to determine the effective exogenous variables corresponding to each prediction indicator based on business knowledge;

[0023] The key date identification module is used to determine the key dates of focus for each forecast indicator based on the historical time-series data related to each forecast indicator.

[0024] The training data construction module is used to construct corresponding training data for each prediction indicator based on the historical time-series data related to each prediction indicator.

[0025] The initial model building module is used to build an initial Prophet model for each predictor based on the effective exogenous variables and key dates of focus for each predictor.

[0026] The model training module is used to train the initial Prophet model corresponding to each prediction indicator based on the training data corresponding to each prediction indicator, so as to obtain the Prophet time series prediction model corresponding to each prediction indicator.

[0027] The forecasting module is used to determine the predicted value of the target business indicator based on the Prophet time series forecasting model corresponding to each forecast indicator.

[0028] Thirdly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the Prophet-based timing prediction method provided in any embodiment of the first aspect.

[0029] Fourthly, this application provides a computer device, including: one or more processors; a memory; and one or more computer programs, wherein the processors and the memory are connected via a bus, and the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, wherein when the processors execute the computer programs, they implement the steps of the Prophet-based timing prediction method provided in any embodiment of the first aspect.

[0030] This application addresses the shortcomings of Prophet by adapting its prediction framework to real-world business scenarios. By combining the Prophet model with business analysis and model training strategies, it achieves accurate and efficient predictions, enabling enterprise-level implementation. Specifically, this application first performs a series of business analysis operations. These operations include decomposing the target business metric into one or more predictive metrics (when there are multiple targets, the target is the sum of a set of sub-metrics), determining the effective exogenous variables for each predictive metric based on business knowledge, and identifying key focus dates for each predictive metric based on historical time-series data. Next, it constructs corresponding training data for each predictive metric based on the historical time-series data, and builds an initial Prophet model for each predictive metric based on the effective exogenous variables and key focus dates. Then, it trains the initial Prophet model for each predictive metric using the training data, resulting in a Prophet time-series prediction model for each predictive metric. After model training, the predicted value of the target business metric can be determined based on the Prophet time-series prediction model for each predictive metric. In this application, by splitting the target business metric into one or more predictive metrics, the coupling and mutual influence of different sub-metrics can be effectively reduced, and the number of models that need to be trained can be reduced; by using different exogenous variable strategies for different business lines, the influence of the same exogenous variable strategy on all business lines can be avoided; by identifying key dates, key attention dates can be determined, which can be used as holiday parameters or exogenous variables for modeling in the future, thereby improving the model's ability to identify and fit key attention dates. Attached Figure Description

[0031] Figure 1 This is a flowchart of a time-series prediction method based on Prophet provided in an embodiment of this application.

[0032] Figure 2 This is a schematic diagram of a time series prediction architecture based on Prophet provided in an embodiment of this application.

[0033] Figure 3 This is a functional block diagram of a Prophet-based timing prediction device provided in an embodiment of this application.

[0034] Figure 4 This is a structural block diagram of a computer device provided in one embodiment of this application. Detailed Implementation

[0035] To make the objectives, technical solutions, and beneficial effects of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0036] To illustrate the technical solution described in this application, specific embodiments are provided below.

[0037] Please see Figure 1 This is a flowchart of a Prophet-based time series prediction method provided in an embodiment of this application. This embodiment mainly uses the application of the Prophet-based time series prediction method to a computer device as an example for illustration. The method includes the following steps:

[0038] S101. Decompose the target business indicators that need to be predicted into predictive indicators to obtain the prediction indicator decomposition results.

[0039] After determining the target business indicator to be predicted (such as freight volume), this application does not directly use time-series data related to the target business indicator for model training (i.e., data unrelated to the business), but instead conducts business analysis first. Business analysis includes a series of operations, specifically including predictive indicator decomposition (corresponding to step S101), exogenous variable identification (corresponding to step S102), and key date identification (corresponding to step S103), etc. Figure 2 The diagram shown below illustrates the architecture of this method. The following section will combine... Figure 2 Let me introduce each step in the method.

[0040] Target business metrics refer to the business indicators that need to be predicted, such as freight volume. The prediction metric decomposition result is obtained by breaking down the target business metrics. By decomposing the target business metrics into prediction metrics, various business sub-indicators can be decoupled from business coupling, avoiding the impact of coupling between different sub-indicators on model accuracy and reducing the number of training models.

[0041] The forecast indicator decomposition result includes one or more forecast indicators. The target business indicator to be predicted is decomposed into forecast indicators, including: checking whether the target business indicator meets preset decomposition conditions; if the target business indicator does not meet the decomposition conditions, it is used as a forecast indicator; if the target business indicator meets the decomposition conditions, it is decomposed into sub-indicators for different business lines, the time-series trend of each sub-indicator is analyzed, sub-indicators with consistent time-series trends are grouped together to obtain multiple groups of sub-indicators, and the sum of the indicators in each group of sub-indicators is used as the forecast indicator.

[0042] The decomposition condition is that the target business indicator is obtained by summing up the sub-indicators of different business lines, and it is not necessary to predict the value of each sub-indicator.

[0043] If the target business metric does not meet the decomposition conditions, the target business metric will not be decomposed. In this way, only a Prophet model needs to be built to predict the metric value of the target business metric on a specified date.

[0044] When a target business indicator meets the decomposition criteria, it is broken down into sub-indicators for different business lines. For example, if the target business indicator is X, then X is decomposed into n sub-indicators: X_1, X_2, ..., X_n. Next, the time-series trend of each sub-indicator is analyzed. Sub-indicators with consistent time-series trends are grouped together, resulting in multiple groups of sub-indicators. For example, analyzing the time-series trends of sub-indicators X_1, X_2, ..., X_n, groups with similar trends are grouped together, resulting in multiple groups. For instance, groups with stable business performance are grouped into T1, and those with rapid growth are grouped into T2. This results in T1 = {X_1, X_2, ..., X_k} and T2 = {X_k+1, X_k+2, ..., X_n}. After grouping multiple sub-indicators, the sum of the sub-indicators from different groups can be used as a predictive indicator. For example, the sum of the sub-indicators in group T1 is S_t1 = X_1 + X_2 + ... + X_k, and the sum of the sub-indicators in group T2 is S_t2 = X_k+1 + X_k+2 + ... + X_n. This yields two predicted indices, S_t1 and S_t2. Traditional methods require training n Prophet models, but this application only requires training a Prophet model for predicting S_t1 and a Prophet model for predicting S_t2. The target business indicator X can then be obtained based on the predicted values ​​from these two Prophet models.

[0045] S102. Determine the effective exogenous variables corresponding to each forecasting indicator based on business knowledge.

[0046] Exogenous variables are variables that originate from outside the time series being predicted, influence that time series, but are themselves unaffected by it. In the existing Prophet prediction framework, exogenous variables require manual analysis and selection, and their importance cannot be automatically analyzed. Unimportant exogenous variables complicate the model, increase its degrees of freedom, and may lead to overfitting of the training data. To address this deficiency, this application can select and retain potentially effective exogenous variables based on actual business needs and data analysis. By reducing unnecessary exogenous variables, the predictive accuracy of the model can be improved, and the training time can be effectively reduced.

[0047] Based on business knowledge, the effective exogenous variables corresponding to each predictive indicator are determined, including: determining the effective exogenous variables corresponding to each predictive indicator in the predictive indicator decomposition results by performing the following operations: determining candidate exogenous variables corresponding to the predictive indicators based on business knowledge; there are multiple candidate exogenous variables; obtaining historical time series data related to each candidate exogenous variable; performing statistical tests and visualization analysis based on the historical time series data related to each candidate exogenous variable to obtain the statistical test results and visualization analysis results of each candidate exogenous variable; and combining the statistical test results and visualization analysis results of all candidate exogenous variables to determine the effective exogenous variables corresponding to the predictive indicators from the candidate exogenous variables corresponding to the predictive indicators.

[0048] For any predictive indicator, its corresponding effective exogenous variable can be determined by following these steps:

[0049] a. Based on actual business operations, exogenous variables that may affect the forecast indicators are considered as candidate exogenous variables corresponding to the forecast indicators. For example, exogenous variables that may affect the order volume in the freight sector include subsidy rates, oil prices, GDP growth rates, and consumer confidence indices.

[0050] b. Based on the following statistical tests, determine the correlation between the time series (i.e., historical time series data) of each candidate exogenous variable and the predictor:

[0051] a) Pearson correlation coefficient: tests for linear correlation;

[0052] b) Spearman rank correlation coefficient: tests for monotonic relationships, whether linear or nonlinear but with consistent trends;

[0053] c) Granger causality test: Determine whether an exogenous variable has predictive power for the target variable.

[0054] c. Use the following visualization analysis methods to examine the correlation between the time series of each candidate exogenous variable and the predictive indicator:

[0055] a) Cross-correlation plot: used to test lagged correlations between variables;

[0056] b) Scatter plots and trend charts: Directly observe linear / non-linear relationships.

[0057] S103. Based on the historical time-series data related to each forecast indicator, determine the key dates to focus on for each forecast indicator.

[0058] Historical time-series data related to various predictive indicators can be used to identify dates with significant fluctuations in these indicators (the extent of fluctuation can be determined by whether the change exceeds a preset threshold). For example, if the predictive indicator is freight order volume, freight order volume will surge during major holidays such as May Day and National Day, necessitating adjustments to the backend resources of the freight ordering platform. These dates are therefore key dates to monitor.

[0059] S104. Construct corresponding training data for each prediction indicator based on the historical time-series data related to each prediction indicator.

[0060] The training data for each prediction metric includes a training set and a test set.

[0061] Training data is constructed for each predictive metric based on historical time-series data associated with that metric, including:

[0062] a. Preprocess the historical time-series data related to each predictive indicator; the preprocessing includes outlier correction and logarithmic transformation of indicator values.

[0063] Outlier correction processing is used to identify sudden events based on business knowledge, determine outlier values ​​in historical time-series data related to sudden events, and correct these outliers using data analysis methods. Outliers caused by sudden events (such as natural disasters like typhoons and floods, and social events like large-scale sporting events and concerts) can affect the normal trend of indicators and model training. Therefore, this application uses data analysis methods to correct outlier data and replaces the outliers with the corrected data to complete the outlier correction operation.

[0064] The logarithmic transformation of indicator values ​​is used to perform a logarithmic transformation on indicator values ​​in historical time series data. This application first performs logarithmic transformation on the indicator values, then makes predictions, and finally performs an exponential transformation on the predicted values ​​output by the model. This prevents Prophet's prediction results from being negative.

[0065] b. Divide the preprocessed historical time-series data related to each prediction indicator into training set and test set according to time order.

[0066] The training set and the test set do not overlap in time, and the training set includes training samples for the entire period; the duration of the entire period is determined based on the seasonality of the relevant predictive indicators.

[0067] When constructing training data for each prediction metric, it is necessary to divide the dataset into training and test sets.

[0068] The basic principles of classification include the following:

[0069] a. Prohibit random partitioning: Ensure that the training set and test set do not overlap in time;

[0070] b. Training set retains complete periods: When the predictive indicator has seasonality (such as annual seasonality, monthly seasonality, weekly seasonality or other periods), the training set should retain training samples for at least a complete period (such as two years).

[0071] There are various methods for partitioning, such as the following:

[0072] a. Single split: Split according to a time point, for example, using data from 2000-2023 as the training set and data from 2024-2025 as the test set. This method is suitable for situations with large datasets or limited computing resources.

[0073] b. Rolling Window Cross-Validation (CV), the operation is as follows:

[0074] a) Fixed length of training set: During each validation, the window size of the training set remains unchanged, scrolling forward like a "sliding window";

[0075] b) The test set follows immediately: each time, a fixed-length training set is used to predict a future fixed-length (horizon) test set;

[0076] For example, during the initial training, the training set is [t0, t1, t2] → the test set is [t3, t4]; during the next training, the training set is [t1, t2, t3] → the test set is [t4, t5], that is, the length of the training set is always 3, and the length of the test set is 2.

[0077] c. Time series splitting (TimeSeriesSplit), the operation is as follows:

[0078] a) Training set grows gradually: During each validation, the training set gradually expands from the starting point to the current point, and the test set is the next time window;

[0079] b) Single-step or fixed-length test set: The default test set length is 1, but it can be adjusted via test_size.

[0080] For example, in the first round of training, the training set [t0,t1] → test set [t2], and in the second round of training, the training set [t0,t1,t2] → test set [t3]. In this partitioning method, the training set is gradually expanded, while the test set is usually shorter.

[0081] S105. Construct an initial Prophet model for each predictor based on the effective exogenous variables and key dates of interest for each predictor.

[0082] When constructing an initial Prophet-based time series forecasting model (referred to as the initial Prophet model) for each forecasting indicator, the key dates of interest can be handled using either of the following two methods or both simultaneously: (1) add the key dates of interest as holiday parameters into the model; (2) add the key dates of interest as exogenous variables into the model.

[0083] By modeling key dates as holiday parameters or exogenous variables, the model's ability to identify and fit key dates can be improved.

[0084] There are usually multiple key dates for each forecast indicator, but in some specific implementations, there may only be one key date for one or more forecast indicators.

[0085] The objective function of the initial Prophet model for each predictive metric is defined based on the error for each key date of interest for that predictive metric, and is used to minimize the error for each key date of interest through pre-defined optimization constraints. This application redefines the objective function, enabling the model to fit metric values ​​for multiple key dates of interest (such as holidays) during a single training cycle.

[0086] For any given predictor metric, the initial Prophet model can be defined by the following steps:

[0087] (1) Determine the metrics used to evaluate model error, such as mean absolute error, mean absolute percentage error, mean squared error, etc.

[0088] (2) Construct the objective function;

[0089] The original Prophet prediction framework focuses on overall error, which may lead to higher local errors. For example, while the model's overall error is smaller when business metrics are affected by different holidays, the prediction error may be larger on specific holidays. To address this, this application redesigns the objective function.

[0090] Specifically, to enable the model to learn the temporal patterns of different key dates, the objective can be set as: minimizing the prediction error of multiple key dates. This means finding a set of hyperparameters θ from the Prophet parameter space. * This makes Max(Error1, Error2, ..., Error) n (Minimum)

[0091] Among them, Error is an error assessment metric selected from error assessment metrics such as mean absolute error, mean absolute percentage error, and mean squared error, which aligns with the business logic of the prediction metrics. Error1, Error2, ..., Error n It is the error of the n key dates of focus for the forecast indicator.

[0092] Based on the above analysis, the objective function for model training can be defined as:

[0093] ibj=min Max(Error1,Error2,...,Error n ).

[0094] The optimization objective of the model is to find a θ * The optimization objective is achieved through the following formula:

[0095]

[0096] S106. Train the initial Prophet model corresponding to each prediction indicator based on the training data corresponding to each prediction indicator, and obtain the Prophet time series prediction model corresponding to each prediction indicator.

[0097] When training any initial Prophet model, this application employs the following parameter tuning strategy: selecting parameter combinations from a pre-built historical high-quality parameter library as initial values ​​for model parameters based on the current training status of the initial Prophet model corresponding to each prediction metric; and using a multi-stage parameter tuning approach to adjust the model parameters of the initial Prophet model corresponding to each prediction metric.

[0098] The historical high-quality parameter library is pre-built. During each model training, the relatively good Prophet model parameters during the parameter tuning process are recorded and saved to the historical high-quality parameter library as reference values ​​for the parameters during subsequent model training.

[0099] When performing multi-stage hyperparameter tuning, different learning rates are used in each stage to accelerate model training efficiency, as follows:

[0100] a. Set a step size η1, and after several training iterations, the objective function gradually converges to obtain the parameter θ1;

[0101] b. Set a step size η2, and obtain the parameter θ2 through training based on θ1; the step size η2 is smaller than the step size η1.

[0102] If the optimization goal is still not achieved after the above two parameter tuning steps, then reset to a smaller step size and perform more training steps.

[0103] By setting initial model parameter values ​​for the initial Prophet model using a historical database of high-quality parameters, the search space can be directly reduced, improving training efficiency. Furthermore, a multi-stage parameter tuning strategy is employed to further reduce the time spent on parameter tuning.

[0104] When training each initial Prophet model, perform at least one of the following performance testing strategies:

[0105] a. Backtest the predictions for each key date corresponding to the prediction target. Based on the errors of each key date corresponding to the prediction target (as shown in Table 1), determine the prediction performance of the initial Prophet model for each key date corresponding to the prediction target.

[0106] Table 1:

[0107] Key dates to watch New Year's Day 2024 2024 Spring Festival May Day 2024 National Day 2024 error Error1 Error2 Error3 Error4

[0108] b. Cross-validate the initial Prophet model corresponding to the prediction target using a pre-defined model evaluation function (such as the cross_validation function provided by Prophet). The cross-validation operation provides an evaluation method that most closely approximates the real-world scenario for the time series prediction model by using a rolling time window and a strict causal partitioning method (the test set time must be strictly later than the end of the training set).

[0109] c. Use a pre-defined trend validation function (such as Prophet's plot_components function) to validate the trend of the initial Prophet model corresponding to the prediction target. Trend validation can plot the overall trend learned by the model, the seasonality of the year / month / week, the holiday effect, and the trend of exogenous variables, and determine whether the trend learned by the model matches the business.

[0110] By performing the above operations to test the performance of the initial Prophet model corresponding to the prediction target, the model's true predictive ability can be effectively evaluated. Then, based on the evaluation results, the model's problems can be identified, and the model can be optimized in a targeted manner.

[0111] When identifying problems in the initial Prophet model corresponding to the prediction target, sub-indicators with poor prediction performance can be determined based on the model performance evaluation results, and the problems corresponding to these sub-indicators can be further identified. These problems can be trend prediction, seasonality prediction, holiday effect prediction, and / or exogenous variable prediction. Finally, based on the identified problems, the model parameters are adjusted to achieve model tuning.

[0112] This application combines backtesting, cross-validation, and trend validation on key dates to comprehensively evaluate the model's predictive ability on both key and unkey dates.

[0113] S107. Determine the predicted value of the target business indicator based on the Prophet time series forecasting model corresponding to each forecast indicator.

[0114] In one implementation, the sum of the final predicted values ​​of all forecast indicators can be used as the predicted value of the target business indicator.

[0115] In another implementation, the operation of determining the predicted value of the target business indicator based on the Prophet time-series forecasting model corresponding to each forecast indicator includes: using the Prophet time-series forecasting model corresponding to each forecast indicator to make a forecast and obtain the initial forecast value of each forecast indicator; performing an exponential transformation on the initial forecast value of each forecast indicator to obtain the final forecast value of each forecast indicator; and calculating the sum of the final forecast values ​​of all forecast indicators as the predicted value of the target business indicator.

[0116] In this implementation, the indicator data in the training data undergoes a logarithmic transformation before training. Based on this, when using the Prophet time series prediction model for prediction, the prediction results need to be exponentially transformed, and then the sum of the final predicted values ​​of all predicted indicators is used as the predicted value of the target business indicator.

[0117] Please see Figure 3 The Prophet-based timing prediction device provided in one embodiment of this application can be a computer program or a piece of program code running on a computer device, such as an application software; the Prophet-based timing prediction device can be used to execute corresponding steps in the Prophet-based timing prediction method provided in the embodiments of this application. The Prophet-based timing prediction device provided in one embodiment of this application includes:

[0118] The predictive indicator decomposition module 101 is used to decompose the target business indicators that need to be predicted into predictive indicators, and obtain the predictive indicator decomposition results; the predictive indicator decomposition results include one or more predictive indicators.

[0119] The exogenous variable identification module 102 is used to determine the effective exogenous variables corresponding to each prediction indicator based on business knowledge.

[0120] The key date identification module 103 is used to determine the key dates of attention for each predictive indicator based on the historical time-series data related to each predictive indicator.

[0121] The training data construction module 104 is used to construct corresponding training data for each prediction indicator based on the historical time series data related to each prediction indicator.

[0122] The initial model building module 105 is used to build the corresponding initial Prophet model for each predictive indicator based on the effective exogenous variables and key dates of focus for each predictive indicator.

[0123] The model training module 106 is used to train the initial Prophet model corresponding to each prediction indicator based on the training data corresponding to each prediction indicator, so as to obtain the Prophet time series prediction model corresponding to each prediction indicator.

[0124] The prediction module 107 is used to determine the predicted value of the target business indicator based on the Prophet time series prediction model corresponding to each prediction indicator.

[0125] In some embodiments, the predictive indicator decomposition module 101 performs predictive indicator decomposition operations on the target business indicator to be predicted, including: detecting whether the target business indicator meets the preset decomposition conditions; the decomposition conditions are that the target business indicator is obtained by summing the sub-indicators of different business lines, and it is not necessary to predict the value of each sub-indicator; when the target business indicator does not meet the decomposition conditions, the target business indicator is used as the predictive indicator; when the target business indicator meets the decomposition conditions, the target business indicator is decomposed into sub-indicators of different business lines, the time series trend of each sub-indicator is analyzed, sub-indicators with consistent time series trends are grouped together to obtain multiple groups of sub-indicators, and the sum of the indicators of each group of sub-indicators is used as the predictive indicator.

[0126] In some embodiments, the exogenous variable identification module 102 determines the effective exogenous variable corresponding to each predictive indicator based on business knowledge, including: determining the effective exogenous variable corresponding to each predictive indicator in the predictive indicator decomposition result by performing the following operations: identifying candidate exogenous variables corresponding to the predictive indicator based on business knowledge; there are multiple candidate exogenous variables; acquiring historical time series data related to each candidate exogenous variable; performing statistical tests and visualization analysis based on the historical time series data related to each candidate exogenous variable to obtain the statistical test results and visualization analysis results of each candidate exogenous variable; and combining the statistical test results and visualization analysis results of all candidate exogenous variables to determine the effective exogenous variable corresponding to the predictive indicator from the candidate exogenous variables corresponding to the predictive indicator.

[0127] In some embodiments, the training data corresponding to each predictive indicator includes a training set and a test set; the training data construction module 104 constructs corresponding training data for each predictive indicator based on the historical time-series data related to each predictive indicator, including: preprocessing the historical time-series data related to each predictive indicator; the preprocessing includes outlier correction processing and indicator value logarithmic transformation processing; the outlier correction processing is used to determine sudden events based on business knowledge, identify indicator values ​​related to sudden events in the historical time-series data as outliers, and correct outliers through data analysis methods; the indicator value logarithmic transformation processing is used to perform logarithmic transformation on the indicator values ​​in the historical time-series data; the preprocessed historical time-series data related to each predictive indicator is divided into a training set and a test set according to time order; the training set and the test set do not overlap in time, and the training set includes training samples for the complete period; the duration of the complete period is determined based on the seasonality of the relevant predictive indicator.

[0128] In some embodiments, there are multiple key dates of interest for each predictive metric; the objective function of the initial Prophet model for each predictive metric is defined based on the error of each key date of interest for each predictive metric, and is used to minimize the error of each key date of interest through a preset optimization constraint model.

[0129] In some embodiments, the model training module 106 trains the initial Prophet model corresponding to each prediction metric based on the training data corresponding to each prediction metric, including: when training each initial Prophet model, performing the following parameter tuning strategy: selecting parameter combinations from a pre-built historical high-quality parameter library as initial values ​​of model parameters based on the current training status of the initial Prophet model corresponding to the prediction metric, and adjusting the model parameters of the initial Prophet model corresponding to the prediction metric using a multi-stage parameter tuning method.

[0130] In some embodiments, the operation of the prediction module 107 in determining the predicted value of the target business indicator based on the Prophet time series prediction model corresponding to each prediction indicator includes: using the Prophet time series prediction model corresponding to each prediction indicator to make a prediction and obtain the initial predicted value of each prediction indicator; performing an exponential transformation on the initial predicted value of each prediction indicator to obtain the final predicted value of each prediction indicator; and calculating the sum of the final predicted values ​​of all prediction indicators as the predicted value of the target business indicator.

[0131] The timing prediction device based on Prophet provided in one embodiment of this application and the timing prediction method based on Prophet provided in one embodiment of this application belong to the same concept. The specific implementation process is detailed in the full text of the specification and will not be repeated here.

[0132] One embodiment of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the Prophet-based timing prediction method provided in one embodiment of this application.

[0133] Figure 4 This diagram illustrates a specific structural block diagram of a computer device according to an embodiment of this application. The computer device 100 includes one or more processors 101, a memory 102, and one or more computer programs. The processors 101 and the memory 102 are connected via a bus. The one or more computer programs are stored in the memory 102 and configured to be executed by the one or more processors 101. When the processors 101 execute the computer programs, they implement the steps of the Prophet-based timing prediction method provided in an embodiment of this application. The computer device includes servers and / or terminals, etc. The computer device can be a desktop computer, a mobile terminal, or an in-vehicle device. The mobile terminal includes at least one of a mobile phone, tablet computer, personal digital assistant, or wearable device, etc.

[0134] It should be understood that the steps in the various embodiments of this application are not necessarily executed sequentially according to the order indicated by the step numbers. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in each embodiment may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.

[0135] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0136] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0137] The above embodiments merely illustrate several implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.

Claims

1. A time series prediction method based on Prophet, characterized in that, The method includes: The target business indicators that need to be predicted are decomposed into predictive indicators to obtain predictive indicator decomposition results; the predictive indicator decomposition results include one or more predictive indicators. Based on business knowledge, determine the effective exogenous variables corresponding to each of the aforementioned predictive indicators; Based on the historical time-series data related to each of the predicted indicators, determine the key dates of focus for each of the predicted indicators; Training data is constructed for each prediction indicator based on historical time-series data related to each prediction indicator. Based on the effective exogenous variables and key dates of focus for each of the predicted indicators, an initial Prophet model is constructed for each of the predicted indicators. Train an initial Prophet model for each prediction indicator based on the training data corresponding to each prediction indicator, and obtain a Prophet time series prediction model for each prediction indicator. The predicted value of the target business indicator is determined based on the Prophet time-series prediction model corresponding to each of the predicted indicators.

2. The method according to claim 1, characterized in that, The step of breaking down the target business indicators that need to be predicted includes: The system detects whether the target business indicator meets the preset decomposition conditions. The decomposition conditions are that the target business indicator is obtained by summing up the sub-indicators of different business lines, and it is not necessary to predict the value of each sub-indicator. When the target business indicator does not meet the decomposition conditions, the target business indicator is used as the prediction indicator. When the target business indicator meets the decomposition conditions, the target business indicator is decomposed into sub-indicators of different business lines, the time series trend of each sub-indicator is analyzed, and sub-indicators with consistent time series trends are grouped together to obtain multiple groups of sub-indicators. The sum of the indicators of each group of sub-indicators is used as the prediction indicator.

3. The method according to claim 1, characterized in that, The step of determining the effective exogenous variables corresponding to each of the predicted indicators based on business knowledge includes: The effective exogenous variables corresponding to each predictive indicator in the predictive indicator decomposition results are determined by performing the following operations: Based on business knowledge, candidate exogenous variables corresponding to the predictive indicators are determined; there are multiple candidate exogenous variables. Obtain historical time-series data related to each of the candidate exogenous variables; Statistical tests and visualization analyses are performed on the historical time-series data related to each candidate exogenous variable to obtain the statistical test results and visualization analysis results for each candidate exogenous variable. By combining the statistical test results and visualization analysis results of all the candidate exogenous variables, the effective exogenous variable corresponding to the predictive indicator is determined from the candidate exogenous variables corresponding to the predictive indicator.

4. The method according to claim 1, characterized in that, The training data for each prediction metric includes a training set and a test set; training data for each prediction metric is constructed based on historical time-series data related to each prediction metric, including: The historical time-series data related to each of the predicted indicators are preprocessed; the preprocessing includes outlier correction processing and indicator value logarithmic transformation processing; the outlier correction processing is used to identify sudden events based on business knowledge, identify indicator values ​​related to the sudden events in the historical time-series data as outliers, and correct the outliers through data analysis methods; the indicator value logarithmic transformation processing is used to perform a logarithmic transformation on the indicator values ​​in the historical time-series data. The preprocessed historical time-series data related to each of the prediction indicators are divided into a training set and a test set according to time order; the training set and the test set do not overlap in time, and the training set includes training samples for a complete period; the duration of the complete period is determined based on the seasonality of the relevant prediction indicators.

5. The method according to claim 1, characterized in that, There are multiple key dates for each of the predicted indicators; the objective function of the initial Prophet model for each predicted indicator is defined based on the error of each key date for each predicted indicator, and is used to minimize the error corresponding to each key date for each key date through a preset optimization constraint model.

6. The method according to claim 1, characterized in that, The step of training an initial Prophet model corresponding to each prediction metric based on the training data corresponding to each prediction metric includes: When training each of the initial Prophet models, the following parameter tuning strategy is implemented: based on the current training status of the initial Prophet model corresponding to the prediction metric, parameter combinations are selected from a pre-built historical high-quality parameter library as initial values ​​for model parameters, and a multi-stage parameter tuning method is used to adjust the model parameters of the initial Prophet model corresponding to the prediction metric.

7. The method according to claim 4, characterized in that, The step of determining the predicted value of the target business indicator based on the Prophet time-series prediction model corresponding to each predicted indicator includes: The Prophet time series prediction model corresponding to each of the prediction indicators is used to make predictions, and the initial prediction value of each prediction indicator is obtained. The initial predicted value of each of the predicted indicators is subjected to an exponential transformation to obtain the final predicted value of each of the predicted indicators. The sum of the final predicted values ​​of all the predicted indicators is calculated as the predicted value of the target business indicator.

8. A time series prediction device based on Prophet, characterized in that, The device includes: The predictive indicator decomposition module is used to decompose the target business indicators that need to be predicted into predictive indicators, and obtain the predictive indicator decomposition results; the predictive indicator decomposition results include one or more predictive indicators. The exogenous variable identification module is used to determine the effective exogenous variables corresponding to each of the prediction indicators based on business knowledge. The key date identification module is used to determine the key dates of focus for each of the predicted indicators based on the historical time-series data related to each predicted indicator. The training data construction module is used to construct corresponding training data for each prediction indicator based on the historical time-series data related to each prediction indicator. The initial model building module is used to build an initial Prophet model for each of the predicted indicators based on the effective exogenous variables and key dates of focus for each predicted indicator. The model training module is used to train an initial Prophet model corresponding to each prediction indicator based on the training data corresponding to each prediction indicator, so as to obtain a Prophet time series prediction model corresponding to each prediction indicator. The prediction module is used to determine the predicted value of the target business indicator based on the Prophet time-series prediction model corresponding to each prediction indicator.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the Prophet-based time series prediction method as described in any one of claims 1 to 7.

10. A computer device, comprising: One or more processors; Memory; The processor and the memory are connected via a bus, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, characterized in that the processors, when executing the computer programs, implement the steps of the Prophet-based timing prediction method as described in any one of claims 1 to 7.