Short-term power load prediction method and device, storage medium and electronic equipment
Through the short-term power load prediction method of Prophet and LightGBM combined with time series and non-time series characteristic factors, the problems of low prediction accuracy and poor generalization ability in the existing technology are solved, and higher power load prediction accuracy and Generalization ability.
Patent Information
- Application Number
- CN202411577482.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-01-14
AI Technical Summary
The existing power load prediction algorithm cannot effectively combine the influence of time series and non-time series, resulting in low prediction accuracy and poor generalization ability.
The short-term power load prediction method based on the combination model of Prophet and LightGBM is adopted. By determining key feature factors, data preprocessing, training the model in parallel, adjusting parameters, and integrating it by adding the penalty term of the loss function, the least squares method is used to calculate the optimal model. The weight ratio is weighted to obtain the final prediction result.
It improves the accuracy and generalization ability of power load prediction, can more effectively integrate time series and non-time series characteristic factors, and improves the accuracy and reliability of prediction results.
Smart Images

Figure CN119312984A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of power load forecasting, and specifically, to a short-term power load forecasting method based on a Prophet and LightGBM combined model, a short-term power load forecasting device based on a Prophet and LightGBM combined model, a computer-readable storage medium, and an electronic device. Background Art
[0002] Power load forecasting is one of the important research topics in building a smart grid. It provides an important reference for the rational allocation of power resources, the balance of local power supply and demand, the measurement of line losses, and the investment in power equipment. High-precision load forecasting is not only conducive to achieving a balance between power supply and demand, but also a necessary technical support for building a new power system.
[0003] Although short-term power load forecasting is a typical time series forecasting problem, power load is greatly affected by factors such as time, weather, economy, season, holidays, etc., and is also affected by distributed energy and electric vehicles, which places higher requirements on the accuracy and robustness of the forecast, and often requires a more complex forecast model with strong generalization capabilities. The existing technology uses time series analysis and machine learning analysis to obtain better results than the original forecasting algorithm, but no explanation is given on the cleaning and preprocessing of the original data. At the same time, the influence of non-time factors is not considered when applying the time series analysis method. When using machine learning analysis, the time series forecasting effect cannot be improved. Various algorithms themselves do not perform targeted optimization of power load data. The above defects are problems that need to be solved urgently. Summary of the invention
[0004] The main purpose of this application is to provide a short-term power load forecasting method based on a Prophet and LightGBM combined model, a short-term power load forecasting device based on a Prophet and LightGBM combined model, a computer-readable storage medium and an electronic device, so as to at least solve the problem that the existing power load forecasting algorithm cannot combine the influence of time series and non-time series, resulting in low prediction accuracy and poor generalization ability.
[0005] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a short-term power load forecasting method based on a combined model of Prophet and LightGBM is provided, including: determining key characteristic factors affecting the power load based on historical data and historical fluctuations of the power load; collecting initial data corresponding to the key characteristic factors, and preprocessing the initial data to obtain preprocessed data, wherein the key characteristic factors are the data type of the initial data; using the preprocessed data to train the initial Prophet algorithm and the initial LightGBM model in parallel, and adjusting the operating parameters of the initial Prophet algorithm and the operating parameters of the initial LightGBM model based on the prediction accuracy to obtain the target Prophet algorithm and the target LightGBM model, and finally outputting the corresponding confidence value and confidence interval; by adding two loss function penalty terms, the target Prophet algorithm and the target LightGBM model are integrated, and the final load forecasting result is obtained according to the confidence value and confidence interval of the target Prophet algorithm and the confidence value and confidence interval of the target LightGBM model.
[0006] According to another aspect of the present application, a short-term power load forecasting device based on a combined model of Prophet and LightGBM is provided, including: a determination unit, used to determine the key characteristic factors affecting the power load based on the historical data and historical fluctuations of the power load; a first processing unit, used to collect initial data corresponding to the key characteristic factors, and preprocess the initial data to obtain preprocessed data, wherein the key characteristic factors are the data type of the initial data; a second processing unit, used to use the preprocessed data to perform parallel training on the initial Prophet algorithm and the initial LightGBM model, and adjust the operating parameters of the initial Prophet algorithm and the operating parameters of the initial LightGBM model based on the prediction accuracy to obtain a target Prophet algorithm and a target LightGBM model, and finally output the corresponding confidence value and confidence interval, wherein the confidence value is the corresponding model prediction value; a third processing unit, used to integrate the model prediction value of the target Prophet algorithm with the model prediction value of the target LightGBM model by adding two loss function penalty terms to obtain a final load forecasting result.
[0007] According to another aspect of the present application, a computer-readable storage medium is provided, which includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the short-term power load forecasting methods based on the Prophet and LightGBM combined model.
[0008] According to another aspect of the present application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for executing any one of the above-mentioned short-term power load forecasting methods based on the Prophet and LightGBM combined model.
[0009] Applying the technical solution of the present application, the above-mentioned short-term power load forecasting method based on the combined model of Prophet and LightGBM first determines the key characteristic factors affecting the power load according to the historical data and historical fluctuations of the power load; then collects the initial data corresponding to the key characteristic factors, and preprocesses the initial data to obtain the preprocessed data, and the key characteristic factors are the data type of the initial data; then, the preprocessed data is used to train the initial Prophet algorithm and the initial LightGBM model in parallel, and the operating parameters of the initial Prophet algorithm and the operating parameters of the initial LightGBM model are adjusted based on the prediction accuracy to obtain the target Prophet algorithm and the target LightGBM model, and finally output the corresponding confidence value and confidence interval; finally, by adding two loss function penalty terms, the target Prophet algorithm and the target LightGBM model are integrated, and the final load forecasting result is obtained according to the confidence value and confidence interval of the target Prophet algorithm and the confidence value and confidence interval of the target LightGBM model. This method trains the two models in parallel, adds a prediction value optimization module, introduces penalty terms and regularization terms, and uses the least squares method to calculate the optimal weight ratio of the two algorithms, and takes the weighted average of the prediction values as the final prediction result. Finally, the two algorithms are effectively integrated, so that the two algorithms can ensure the training effect of their respective models under the characteristic factors that they are good at, thereby making the prediction value more accurate as a whole. In addition, there are many factors affecting the power load. The Pearson correlation coefficient is used to calculate the correlation between the influencing factors and the power load, and the key influencing factors are extracted according to the correlation sorting, eliminating interference from other factors. For a large amount of "dirty data" in the engineering data, the data cleaning of zero values, missing values and outliers in the original data is achieved through interpolation, which solves the problem that the existing power load prediction algorithm cannot combine the influence of time series and non-time series, resulting in low prediction accuracy and poor generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0011] Figure 1A flow chart of a short-term power load forecasting method based on a Prophet and LightGBM combined model provided according to an embodiment of the present application is shown;
[0012] Figure 2 A Prophet model cycle structure diagram provided according to an embodiment of the present application is shown;
[0013] Figure 3 A Prophet schematic diagram according to an embodiment of the present application is shown;
[0014] Figure 4 A schematic diagram of a trend item in the Prophet algorithm principle provided according to an embodiment of the present application is shown;
[0015] Figure 5 A schematic diagram of a periodic term in the Prophet algorithm principle provided according to an embodiment of the present application is shown;
[0016] Figure 6 A schematic diagram of a holiday term in the Prophet algorithm principle provided according to an embodiment of the present application is shown;
[0017] Figure 7 A schematic diagram showing a prediction result in the Prophet algorithm principle provided according to an embodiment of the present application is shown;
[0018] Figure 8 A regression tree structure diagram of the LightGBM model training provided according to an embodiment of the present application is shown;
[0019] Fig. 9 A schematic diagram showing the principle of a Boosting algorithm provided according to an embodiment of the present application is shown;
[0020] Fig.10 A flow chart of the Prophet parallel algorithm provided according to an embodiment of the present application is shown;
[0021] Fig.11 A flowchart of the LightGBM parallel algorithm provided according to an embodiment of the present application is shown;
[0022] Fig.12 A flow chart of another short-term power load forecasting method based on a Prophet and LightGBM combined model provided according to an embodiment of the present application is shown;
[0023] Fig.13 A structural block diagram of a short-term power load forecasting device based on a Prophet and LightGBM combined model provided according to an embodiment of the present application is shown.
[0024] The above drawings include the following reference numerals:
[0025] 102, processor; 104, memory; 106, transmission device; 108, input and output devices. DETAILED DESCRIPTION
[0026] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] As introduced in the background technology, the commonly used methods currently include two categories: time series analysis and machine learning analysis: time series analysis includes traditional forecasting methods such as exponential smoothing method and autoregression method, as well as new forecasting models such as Prophet; machine learning analysis includes Random Forest, Support Vector Machine, XGBoost, Recurrent Neural Network (RNN), Long Short Term Memory Network (LSTM) and other methods. A method for power load forecasting based on a stacked autoencoder neural network is proposed in the prior art. This method combines an autoencoder and a logistic regression classifier to construct a multi-input single-output forecasting model, and inputs the reconstructed historical load, meteorological information and other data into the forecasting model, uses a stacked autoencoder to learn and extract deep features layer by layer, and finally connects the logistic regression model at the top layer of the network for short-term load forecasting. Other schemes have also proposed a short-term load forecasting method based on PCC and LSTM, which uses Pearson correlation analysis to perform correlation analysis on the time series composed of the original multi-dimensional input variables, selects influencing factors with greater correlation with power load data as input, and realizes dimensionality reduction and optimization of the original data; then, through LSTM combined with Adam optimization algorithm, a network model is established for the nonlinear relationship between the influencing factors with greater correlation with power load and the actual output sequence of load, thereby realizing the prediction of power load.
[0030] In order to solve the problem that the existing power load forecasting algorithm cannot combine the influence of time series and non-time series, resulting in low prediction accuracy and poor generalization ability, the embodiments of the present application provide a short-term power load forecasting method based on the Prophet and LightGBM combined model, a short-term power load forecasting device based on the Prophet and LightGBM combined model, a computer-readable storage medium and an electronic device.
[0031] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0032] Figure 1 : is a flow chart of a short-term power load forecasting method based on a Prophet and LightGBM combined model according to an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:
[0033] Step S201, determining key characteristic factors affecting the power load according to the historical data and historical fluctuations of the power load;
[0034] Specifically, the correlation between influencing factors and power load is calculated by the Pearson correlation coefficient, and the key influencing factors are extracted by sorting according to the correlation. It can be used for scientific research and engineering applications in the field of user-side power load forecasting to improve the prediction accuracy and generalization ability of the model.
[0035] Among them, according to the historical data and historical fluctuations of the power load, determining the key characteristic factors affecting the above power load includes the following steps:
[0036] Step S301, determining a first preset pre-influencing factor according to historical data and historical fluctuations of power load;
[0037] Step S302, using the Pearson correlation coefficient calculation formula Calculate the Pearson correlation coefficient between the above-mentioned pre-influencing factors and the above-mentioned power load, where ρ X,Y is the Pearson correlation coefficient between the above pre-influencing factors and the above power load, N represents the number of variables X, X is the above pre-influencing factors, and Y is the above power load;
[0038] Step S303, arrange the absolute values of the Pearson correlation coefficients of the above-mentioned pre-influencing factors from large to small, and determine the above-mentioned pre-influencing factors ranked first and second preset as the above-mentioned key characteristic factors affecting the above-mentioned power load, wherein the above-mentioned first preset number is greater than the above-mentioned second preset number.
[0039] Specifically, there are many factors that affect power load. The Pearson correlation coefficient is used to calculate the correlation between the influencing factors and power load, and the key influencing factors are extracted according to the correlation ranking to eliminate interference from other factors.
[0040] In some cases, the fluctuation of power load is affected by a series of periodic and non-periodic changes. In order to ensure the accuracy of power load forecasting, the present invention proposes 15 possible influencing factors in 8 categories based on historical experience, academic research, actual investigation and related paper results. The influencing factors are as follows:
[0041] 1. Temperature: select the three possible influencing factors: maximum temperature, minimum temperature and average temperature;
[0042] 2. Holidays: Select two influencing factors: week and statutory holidays;
[0043] 3. Weather: select weather and humidity factors;
[0044] 4. Seasonal aspect: select seasonal factors;
[0045] 5. Wind speed: select wind speed and wind direction factors;
[0046] 6. Historical load: select the lowest load of the previous day, the average load of the previous day, and the highest load of the previous day;
[0047] 7. Economic aspects: Economic factors usually affect medium- and long-term load changes, so they are not selected in this paper;
[0048] 8. Other aspects: Select two factors: emergencies and major festivals.
[0049] Furthermore, for the load data of a province, the Pearson correlation coefficient theory was applied to conduct a correlation analysis on the above 15 influencing factors, and the factors with strong correlation with power load were screened, so as to screen the correlation factors. The Pearson correlation coefficient is used to analyze the correlation between two variables. Assuming X 1 ~X 15 are the 15 possible influencing factors mentioned above, Y represents the power load value, then X 1 ~X 15 The Pearson correlation coefficient with Y is calculated by formula (1)-(4), where formula (1)-(4) are equivalent:
[0050]
[0051] In the formula, ρ X,Y represents the correlation between X and Y; σ represents the standard deviation of the sample; E is the mathematical expectation; μ x =E(X) is the expected value of X; cov(X, Y) represents the covariance of X and Y; N represents the number of variables X; and represent the mean values of X and Y respectively.
[0052] The Pearson correlation coefficient can be calculated according to formulas (1)-(4), and the correlation between X and Y can be determined by this coefficient: X,Y is 0, indicating that X and Y variables are independent; if the Pearson correlation coefficient ρ X,Y ∈(0,1), indicating that X and Y are positively correlated; if the Pearson correlation coefficient ρ X,Y ∈(-1, 0), indicating that X and Y are negatively correlated.
[0053] In addition, when |ρ X,Y The larger | is, the stronger the correlation between X and Y is.
[0054] Furthermore, since the relevant influencing factors are described in text, it is necessary to quantify the influencing factors. Among them, factors such as temperature, historical load, and wind speed do not need to be quantified, while other factors such as holidays and weather need to be quantified. Apply Pearson correlation analysis to the above influencing factors and load, that is, calculate Considering that when there are too many influencing factors, the model will over-learn the relationship between the influencing factors and the load, resulting in overfitting, which affects the model's ability to distinguish unfamiliar data. The present invention sorts the absolute values of the Pearson correlation coefficient to obtain the 10 most relevant influencing factors. The influencing factors are from high to low: the lowest load of the previous day, the average load of the previous day, the highest load of the previous day, weather type, minimum temperature, average temperature, maximum temperature, humidity, week, and statutory holidays. Among them, weather type, week, and statutory holidays need to be quantified, and the quantification standards are as follows:
[0055] 1. Weather type:
[0056] "Clear": "0"; "Sunny to cloudy": "1"; "Cloudy": "2"; "Cloudy to overcast": "3"; "Overcast": "4"; "Overcast to rain": "5"; "Rain": "6"; "Heavy to torrential rain": "7"; "Snow": "8".
[0057] 2. Week:
[0058] "Sunday": "0"; "Monday": "1"; "Tuesday": "2"; "Wednesday": "3"; "Thursday": "4"; "Friday": "5"; "Saturday": "6".
[0059] 3. Legal holidays:
[0060] “Non-holiday”: “0”; “Holiday (three days)”: “1”; “Holiday (seven days)”: “2”.
[0061] Step S202, collecting initial data corresponding to the key characteristic factors, and preprocessing the initial data to obtain preprocessed data, wherein the key characteristic factors are the data types of the initial data;
[0062] Specifically, data collection and preprocessing based on key characteristic factors can ensure the accuracy and effectiveness of the analysis. Preprocessing can eliminate the differences between different characteristic factors and improve stability and accuracy.
[0063] Among them, preprocessing steps include dividing the data set, sample standardization, label vectorization, etc.; and processing of outliers, missing values, and zero-value data is achieved through data cleaning.
[0064] The steps of collecting initial data corresponding to the key characteristic factors and preprocessing the initial data to obtain preprocessed data include:
[0065] Step S401, collecting initial data corresponding to the key characteristic factors, and performing vectorization processing on the initial data to obtain vectorized data;
[0066] Step S402, performing standardization processing on the above-mentioned vectorized data, scaling the above-mentioned vectorized data that is a continuous feature factor into first standardized data, scaling the above-mentioned vectorized data that is a discrete feature factor into second standardized data, and determining the sum of the above-mentioned first standardized data and the above-mentioned second standardized data as standardized data, the above-mentioned first standardized data is data with a mean of 0 and a variance of 1, and the above-mentioned second standardized data is data located in the interval [0, 1];
[0067] Step S403, performing data cleaning processing on the abnormal values, zero values and missing values in the above-mentioned standardized data to obtain the above-mentioned preprocessed data, and the standardization processing can eliminate the differences between different characteristic factors and improve stability and accuracy.
[0068] Specifically, for a large amount of "dirty data" in engineering data, data cleaning of zero values, missing values and outliers in the original data is achieved through interpolation. Data cleaning processing can effectively remove outliers, zero values and missing values, and improve the quality and reliability of data.
[0069] In some instances, after analyzing the influencing factors and quantitative indicators, the data set structure is modified to retain only the above ten influencing factors as feature quantities; further, the data is preprocessed.
[0070] In order to avoid using For loops, the first step of data preprocessing is to vectorize the load data of a province and obtain {X′ n×M}, n represents the number of samples, M represents the number of influencing factors, and in the present invention, s1 is taken as 10. At the same time, to ensure the time continuity of the data, the label value requires two columns of data 'ds' and 'y', where 'ds' represents the timestamp corresponding to the sample, and 'y' represents the load value (kw·h) at the corresponding time. Since the samples are vectorized, the corresponding labels should also be vectorized to form {Y′ n×m}, m represents the number of labels, which is 2.
[0071] Further sample standardization is performed. In the prediction problem, due to the different dimensions of each feature quantity of the experimental data and the large difference in the absolute value of the data, the mean and variance of the distribution of each feature quantity are greatly different. At this time, the feature with large variance will dominate the model training process, and the model performance will deteriorate. The sample is usually standardized to eliminate the above influence. The present invention uses the StandardScaler() function in the sklearn library to scale the continuous feature factors to a mean of 0 and a variance of 1; the discrete feature factors (i.e., the factors that need to be quantified) are scaled to the interval [0, 1].
[0072] The Prophet and LightGBM combined model used has a better processing method for data cleaning. First, outliers in the data are removed and assigned to none; zero values are searched for the four influencing factors of "previous day minimum load", "previous day average load", "previous day maximum load" and "humidity", and the values are assigned to none; the combined model is used to interpolate the data assigned "none" and the original missing value data, so that the outliers, zero values and missing value data can be cleaned.
[0073] Furthermore, the cleaned data set is divided into 60% training set, 20% test set, and 20% validation set.
[0074] Step S203, using the above preprocessed data to train the initial Prophet algorithm and the initial LightGBM model in parallel, and adjusting the operating parameters of the above initial Prophet algorithm and the operating parameters of the above initial LightGBM model based on the prediction accuracy, to obtain the target Prophet algorithm and the target LightGBM model, and finally output the corresponding confidence value and confidence interval;
[0075] Specifically, by training the initial Prophet algorithm and the initial LightGBM model in parallel, the two models can be optimized at the same time, reducing training time and improving efficiency. Moreover, by adjusting the model parameters, more accurate confidence values and confidence intervals can be obtained.
[0076] The above preprocessed data is used to train the initial Prophet algorithm, and the operating parameters of the initial Prophet algorithm are adjusted based on the prediction accuracy to obtain the target Prophet algorithm, and finally the corresponding confidence value and confidence interval are output, including the following steps:
[0077] Step S501, determine the Prophet algorithm principle formula p(t)=g(t)+s(t)+h(t)+ε t , where p(t) is the predicted value, g(t) is the trend term, which represents the non-periodic trend of the time series, s(t) is the periodic term, which represents the periodic trend, h(t) represents the holiday term, and ε t is the error term, and the above error term is the fluctuation that is not predicted by the above initial Prophet algorithm;
[0078] Step S502, setting the trend item, the cycle item, the holiday item and the error item of the initial Prophet algorithm, and calling the fbprophet software library to set the hyper parameters of the initial Prophet algorithm;
[0079] Step S503, input the above preprocessed data into the above initial Prophet algorithm for training, and adjust the operating parameters of the above initial Prophet algorithm based on the prediction accuracy to obtain the target Prophet algorithm, and finally output the confidence value and confidence interval of the above target Prophet algorithm.
[0080] Specifically, by adjusting and training the parameters of the initial Prophet algorithm, the prediction accuracy can be improved, making the prediction results more accurate and reliable, and the target Prophet algorithm can output confidence values and confidence intervals to reduce uncertainty.
[0081] The above preprocessed data is used to train the initial LightGBM model, and the operating parameters of the initial LightGBM model are adjusted based on the prediction accuracy to obtain the target LightGBM model, and finally the corresponding confidence value and confidence interval are output, including the following steps:
[0082] Step S601, training M small decision trees based on the training set in the preprocessed data, and performing negative gradient accumulation on the loss functions of the trained small decision trees to obtain M weak regression trees;
[0083] Step S602: According to the Boosting algorithm All the trained weak regression trees are linearly superimposed to obtain a strong regression tree, where: is the above strong regression tree, T(x; Θ i ) is the parameter of the i-th weak regression tree, and M is the number of the weak regression trees;
[0084] Step S603, using the MSE mean square error loss function as the objective function to iteratively solve the objective function so that the objective function reaches the minimum value, so as to train the initial LightGBM model;
[0085] Step S604, based on the prediction accuracy, the operating parameters of the initial LightGBM model are adjusted to obtain the target LightGBM model, and finally the corresponding confidence value and confidence interval are output.
[0086] Specifically, the two models are trained in parallel, and the penalty term of the LightGBM algorithm is introduced by adding a prediction value optimization module to penalize the mismatch problem of the confidence intervals of the two parallel algorithms.
[0087] Figure 2 FIG. 1 shows a prophet model loop structure diagram provided according to an embodiment of the present application. Figure 2As shown, first the model is built, then the prediction and evaluation are carried out, the problem is presented, the prediction results are visualized, and finally the model is fed back. The analysis is automated during the cycle and no manual analysis is required.
[0088] Figure 3 The Prophet principle diagram provided according to the embodiment of the present application is shown. The Prophet model is divided into trend term, period term, holiday term and noise term. Among them, g(t) is the trend term, which indicates the change trend of the time series in the non-periodic state; s(t) is the period term, which indicates the periodic change trend; h(t) indicates the holiday term, which indicates that the day is a holiday; ε t It is called the residual term or error term, which is the fluctuation not predicted by the model and generally follows a Gaussian distribution.
[0089] Figure 4 , Figure 5 , Figure 6 and Figure 7 The schematic diagram of the Prophet algorithm principle is shown in the figure. The Prophet algorithm principle is shown in the figure. Figure 4 is the trend item, is the relationship between trend and time, with trend as the ordinate and time as the abscissa; Figure 5 is the periodic term, is the relationship between the period and the week, the period is the ordinate and the week is the abscissa; Figure 6 is the holiday item, is the relationship between the holiday and the timestamp corresponding to the sample, the holiday is the ordinate, and the timestamp corresponding to the sample is the abscissa; after superimposing the remaining items, the prediction result is as follows Figure 7 , A is the trend value, B is the true value, C is the predicted value, and D is the predicted confidence interval.
[0090] The trend term g(t) is based on a piecewise logistic regression growth model, as shown in formulas (5)-(8):
[0091]
[0092] a(t)=(a 1 (t),a 2 (t),……,a s (t)) T (6)
[0093] δ=(δ 1 , δ 2 ,......,δ s ) T (7)
[0094] γ=(γ 1 , γ 2 ,……,γ s ) T (8)
[0095] C(t) represents the expected capacity of the model and needs to be preset. s represents the timestamp. a(t) is the indicator function. k represents the growth rate. m represents the offset. γ is the piecewise linear parameter. δ represents the change in the growth rate. In this case, the model corresponds to the hyperparameter growth = 'linear'.
[0096] The periodic term s(t) simulates the periodicity of the time series according to the Fourier series that only retains the periodic term, as shown in formulas (9)-(10):
[0097]
[0098] Where N is 3 and T is 7, indicating a sequence with a period of one week. Substituting this into the formula yields:
[0099]
[0100] Forming parameter vector β = (a 1 , b 1 ,......,a n , b n ) T , thus obtaining s(t)=x(t)β, where β is initialized, and the result is β~Normal(0,σ 2 ), σ is the hyperparameter 'seasonality_prior_scale', and the size of σ is related to the strength of seasonality.
[0101] In the time series, each of the above events can be modeled separately, and a separate time window is set for each model, and the impact of the same time window is the same value. The holiday model can be estimated as shown in formulas (11)-(12):
[0102]
[0103] Z(t)=[1(t∈D 1 ),......,1(t∈D L )],k=(k 1 ,......,k 1 ) T (12)
[0104] Where L is the holiday event set; i is the i-th holiday event; is the impact factor of the corresponding holiday on the predicted value; is the time t and k included in the window period for initialization, and the result is k~Normal(0,v 2 ), v is the hyperparameter 'holidays_prior_scale', and the larger its value is, the more the model is affected by holidays.
[0105] The fbprophet software library is called, and the key hyperparameters are set as follows: the growth trend model growth selects 'linear'; the parameter turning point n_changepoints is set to 1 according to the load data law; the turning point control parameter changepoint_prior_scale is 0.05; the initial values of the periodic fitting degree seasonality_prior_scale and the holiday event fitting degree holidays_prior_scale are both set to 10 according to experience; the mutation point range changepoint_range is set to 0.9; the confidence interval width interval_width is 0.8; the error function is set to the MSE root mean square error loss function; the rest of the hyperparameters are default values.
[0106] After setting the above parameters, import the training set to train the model, import the test set data to test, and fine-tune the parameters according to the fitting results of the test set. Finally, use the validation set data for verification to ensure that the validation data is not leaked into the training model, verify the generalization ability of the model, and avoid "overfitting". The model output results are the confidence value y1_hat and confidence interval [y1_hat_lower, y1_hat_upper] of the load data to be predicted at each time node.
[0107] The LightGBM algorithm is an optimization algorithm for the gradient boosting decision tree (GBDT), and is a distributed gradient boosting framework based on GBDT. The GBDT algorithm uses the Boosting idea in ensemble learning. The principle is as follows Figure 8 and Fig. 9 Use training samples to train M small decision trees respectively, accumulate the negative gradient of the loss function of the decision tree obtained in each step of training, build the final strong regression tree through M weak regression trees, and use the loss function as the objective function to build the optimization algorithm. The optimization direction is the negative gradient direction of the loss function. The optimization algorithm is to make partial derivatives of all influencing factors at each leaf node. In practical applications, the greedy algorithm is usually used, that is, all available features are enumerated for each leaf node, and the features are sorted in ascending order to find the best split point through linear scanning. The split point with the largest benefit is selected as the split position to grow two new leaf nodes, and it is repeated until the target depth or target number of leaf nodes is reached. Based on GBDT, the LightGBM algorithm has the characteristics of discretizing continuous eigenvalues using histogram indexes, controlling model complexity using a Leaf-wise growth strategy with depth restrictions, natively supporting category features and parallel operations, and further improving computational efficiency.
[0108] Figure 8 The figure shows a regression tree structure diagram of the LightGBM model training provided according to an embodiment of the present application. Fig. 9A schematic diagram showing the principle of a Boosting algorithm provided according to an embodiment of the present application is shown.
[0109] like Figure 8 and Fig. 9 As shown, the training process of LightGBM used in this article is as follows:
[0110] It is specified as the mth decision tree, represents the parameters of the decision tree, and M is the number of trees. According to the principle of Boosting algorithm, the strong regression tree is formed by linearly superimposing all the weak regression trees obtained by training, as shown in formula (13):
[0111]
[0112] Among them, f i (x i )=T(xΘ i ) represents the parameters of the i-th weak regression tree, is the strong regression tree parameter.
[0113] Then the i-th step in the training process is expressed as formula (14):
[0114]
[0115] The loss function MSE is formula (15)-(16):
[0116]
[0117]
[0118] Formula (16) is the loss function, i.e., the objective function. Obviously, the loss function needs to be solved iteratively. The core of the LightGBM algorithm is to construct a weak regression tree; f i (x i )=T(x;Θ i ) makes the objective function To reach the minimum value, for the regression problem, the MSE mean square error loss function with the best model effect is selected, as shown in (16). The settings of other hyperparameters are as follows: the number of leaves num_leaves is set to 30; the learning rate learning_rate is set to 0.001; the number of cycles boost_round is 500; the optimization algorithm boosting_type selects gbdt; the loss function is MSE; the target problem objective selects regression; and the others keep the default values. After training and parameter adjustment, the confidence value y2_hat and confidence interval [y2_hat_lower, y2_hat_upper] of the LightGBM algorithm for the load data prediction of each time node are output.
[0119] Fig.10 A flow chart of the Prophet and LightGBM parallel algorithm provided according to an embodiment of the present application is shown. First, the divided data set is input, and then the trend item, cycle phase, holiday item, and hyperparameters are set. The prediction model is trained to determine whether the training set and test set data meet the accuracy requirements. If so, the validation set data meets the accuracy requirements. Otherwise, the parameters are adjusted. If the validation set data meets the accuracy requirements, the confidence value and confidence interval of the Prophet model are output. If not, the parameters are adjusted.
[0120] Fig.11 A flow chart of the LightGBM parallel algorithm provided according to an embodiment of the present application is shown. First, a divided data set is input to establish a LightGEM model. Then, parameters and weights are initialized, model pre-training is performed, parameters are automatically adjusted, parameters are manually fine-tuned, and model training is performed. Then, it is determined whether the training set and test set data meet the accuracy requirements. If so, the verification set data meets the accuracy requirements. Otherwise, the parameters are adjusted. If the verification set data meets the accuracy requirements, the confidence value and confidence interval of the LightGBM model are output. If not, the parameters are adjusted.
[0121] Step S204, by adding two loss function penalty terms, the target Prophet algorithm and the target LightGBM model are integrated, and the final load forecasting result is obtained according to the confidence value and confidence interval of the target Prophet algorithm and the confidence value and confidence interval of the target LightGBM model.
[0122] Specifically, the Prophet algorithm is optimized through regularization, and the optimal weight ratio of the two algorithms is calculated using the least squares method. The weighted average of the predicted values is taken as the final prediction result. The two algorithms complement each other and ensure the training effect of their respective models under their respective characteristic factors, thereby making the predicted values more accurate overall.
[0123] Among them, two loss function penalty terms are added to integrate the model. The first penalty term is an additional term, which is used to ensure that the prediction values of the two models are within the confidence interval of the other model; the second penalty term is a regularization term, which is used to optimize the Prophet algorithm and perform weighted averaging of the prediction values of the two models to obtain the final power load forecasting result.
[0124] Among them, by adding two loss function penalty terms, the target Prophet algorithm and the target LightGBM model are integrated, and according to the confidence value and confidence interval of the target Prophet algorithm and the confidence value and confidence interval of the target LightGBM model, the final load forecasting result is obtained, including the following steps:
[0125] Step S701, adding two penalty terms of the loss function, the two penalty terms of the loss function are an additional term and a regularization term respectively;
[0126] Step S702, calculating the proportion of the confidence value of the above-mentioned target Prophet algorithm as the first proportion, and the proportion of the confidence value of the above-mentioned target LightGBM model as the second proportion;
[0127] Step S703, using the additional item to ensure that the model prediction value of the target Prophet algorithm and the model prediction value of the target LightGBM model are both within the confidence interval of the other model;
[0128] Step S704, using the regularization term to optimize the target Prophet algorithm, and using the regularization term to weight the model prediction value of the target Prophet algorithm and the model prediction value of the target LightGBM model according to the first proportion and the second proportion to obtain the final load forecast result.
[0129] Specifically, the least squares method is used to calculate the optimal weight ratio of the two algorithms, and the weighted average of the predicted values is taken as the final prediction result. Finally, the two algorithms are effectively integrated, so that the two algorithms can ensure the training effect of their respective models under the characteristic factors that they are good at, thereby making the predicted values more accurate as a whole.
[0130] Among them, by adding two loss function penalty terms, the target Prophet algorithm and the target LightGBM model are integrated, and according to the confidence value and confidence interval of the target Prophet algorithm and the confidence value and confidence interval of the target LightGBM model, the final load forecasting result is obtained, including the following steps:
[0131] Step S801, determine the first penalty item and the second penalty in, is the upper limit of the confidence interval of the above target Prophet algorithm, is the lower limit of the confidence interval of the above target Prophet algorithm, is the upper limit of the confidence interval of the above target LightGBM model, is the lower limit of the confidence interval of the above target LightGBM model, λ is the penalty coefficient, T is the number of weight vectors, which is controlled by the model parameters, and wj is the jth weight matrix;
[0132] Step S802: According to the first penalty term and the second penalty term, the target Prophet algorithm is integrated with the target LightGBM model to determine the optimized loss function. in, It is the overall error function after integrating the above target Prophet algorithm with the above target LightGBM model and adding the two above penalty terms, P 1 is the first penalty term mentioned above, P 2 The second penalty item mentioned above;
[0133] Step S803, solving the above optimization loss function to determine the above final load forecast result Among them, w 1 +w 2 =1,w 1 and w 2 is the optimal solution obtained by the least squares method.
[0134] Specifically, the least squares method is used to calculate the optimal weight ratio of the two algorithms, and the weighted average of the predicted values is taken as the final prediction result. Finally, the two algorithms are effectively integrated, so that the two algorithms can ensure the training effect of their respective models under the characteristic factors that they are good at, thereby making the predicted values more accurate as a whole.
[0135] In some instances, the Prophet algorithm has inherent advantages in processing time series problems, especially the effect of processing periodic factors is significantly better than other algorithms such as machine learning, while machine learning algorithms are good at mining historical information, especially the previous day's load information and non-periodic factors such as historical weather and humidity in the present invention. In addition, because the Prophet algorithm processes the periodic term as an item of the objective function alone, it is inevitable that overfitting will occur in this processing.
[0136] The prediction value optimization module uses the regularization term of LightGBM to optimize the overfitting problem of Prophet, calculates the weight ratio of the confidence values of the two models, and weights the results of the two models to effectively combine the two models.
[0137] First, add two penalty terms P 1 and P 2 , which are used to fit the confidence interval and find the weight ratio of the two models, and then perform weighted averaging on the predicted values of the two models, as shown in formulas (17)-(21):
[0138]
[0139] Among them, λ is the penalty coefficient; That is, y1_hat_upper, That is, y1_hat_lower is the lower and upper limits of the confidence interval of the Prophet algorithm, That is, y2_hat_lower, That is, y2_hat_upper, which are the lower and upper limits of the confidence interval of the Light GBM algorithm.
[0140] The optimized loss function expression is as follows:
[0141]
[0142] That is, it represents the overall error function after combining the two models and adding two penalty terms.
[0143] The final prediction result of the model is as shown in formula (20), where w 1 +w 2 =1,w 1 and w 2 The least squares method is used to obtain the optimal solution. The specific steps are shown in formulas (21)-(22):
[0144]
[0145] in, is the final predicted value, calculated according to formula (20), y is the true value, and the optimal solution is formula (21). In order to minimize the error value, let w 1 and w 2 Direction f(w 1 , w 2 ) has a partial derivative of 0:
[0146]
[0147] Further verification is not f(w 1 , w 2 ) is the inflection point, which can be calculated as w 1 and w 2 At this time, f(w 1 , w 2 ) is the optimal solution, so that Reach the optimal solution.
[0148] Finally, w is obtained according to formula (22): 1 and w 2 Substituting into formula (21) we can get as the predicted value of the combined model.
[0149] By fine-tuning the parameters of the Prophet and LightGBM combination model, the overall loss function is achieved After reaching the minimum, the model can achieve good results on the training set and test set data, and further use the validation set data for verification. The validation set is data that the model has never been exposed to, thereby verifying the generalization ability of the model.
[0150] The above-mentioned short-term power load forecasting method based on the Prophet and LightGBM combined model of the present application first determines the key characteristic factors affecting the power load according to the historical data and historical fluctuations of the power load; then collects the initial data corresponding to the key characteristic factors, and preprocesses the initial data to obtain the preprocessed data, and the key characteristic factors are the data type of the initial data; then the preprocessed data is used to train the initial Prophet algorithm and the initial LightGBM model in parallel, and the operating parameters of the initial Prophet algorithm and the operating parameters of the initial LightGBM model are adjusted based on the prediction accuracy to obtain the target Prophet algorithm and the target LightGBM model, and finally output the corresponding confidence value and confidence interval; finally, by adding two loss function penalty terms, the target Prophet algorithm and the target LightGBM model are integrated, and the final load forecasting result is obtained according to the confidence value and confidence interval of the target Prophet algorithm and the confidence value and confidence interval of the target LightGBM model. This method trains the two models in parallel, adds a prediction value optimization module, introduces penalty terms and regularization terms, and uses the least squares method to calculate the optimal weight ratio of the two algorithms. The weighted average of the prediction values is used as the final prediction result, and the two algorithms are effectively integrated. The two algorithms can ensure the training effect of their respective models under the characteristic factors that they are good at, so that the prediction value has higher accuracy as a whole. In addition, there are many factors affecting the power load. The Pearson correlation coefficient is used to calculate the correlation between the influencing factors and the power load, and the key influencing factors are extracted according to the correlation sorting, eliminating interference from other factors. For a large amount of "dirty data" in the engineering data, the data cleaning of zero values, missing values and outliers in the original data is achieved through interpolation, which solves the problem that the existing power load prediction algorithm cannot combine the influence of time series and non-time series, resulting in low prediction accuracy and poor generalization ability.
[0151] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the implementation process of the short-term power load forecasting method based on the Prophet and LightGBM combined model of the present application will be described in detail below in combination with specific embodiments.
[0152] This embodiment relates to a specific short-term power load forecasting method based on the Prophet and LightGBM combined model. Fig.12 As shown, the following steps are included:
[0153] Step S1: Input data set, power load influencing factors analysis, by analyzing the load historical data and fluctuations, analyze the key characteristic factors affecting the load value;
[0154] Step S2: data preprocessing and data cleaning;
[0155] Step S3: Parallel training of the Prophet algorithm and the LightGBM model, outputting the confidence value and confidence interval of each model respectively, and using the confidence value as the prediction value of each model;
[0156] Step S4: evaluating the respective models of the parallel training models, by evaluating the loss function value and prediction accuracy on each data set, and adjusting the parameters in a targeted manner to achieve the best performance of each model;
[0157] Step S5: Add a prediction value optimization module, which integrates the model by adding two loss function penalty terms. The first penalty term is an additional term, which is used to ensure that the prediction values of the two models are within the confidence interval of the other model; the second penalty term is a regularization term, which is used to optimize the Prophet algorithm and perform weighted averaging of the prediction values of the two models to obtain the final power load forecasting result.
[0158] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0159] The embodiment of the present application also provides a short-term power load forecasting device based on the Prophet and LightGBM combined model. It should be noted that the short-term power load forecasting device based on the Prophet and LightGBM combined model in the embodiment of the present application can be used to execute the short-term power load forecasting method based on the Prophet and LightGBM combined model provided in the embodiment of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation modes, and those that have been explained will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0160] The following is an introduction to the short-term power load forecasting device based on the Prophet and LightGBM combined model provided in an embodiment of the present application.
[0161] Fig.13 Schematic diagram of a short-term power load forecasting device based on a Prophet and LightGBM combined model according to an embodiment of the present application. Fig.13As shown, the device includes: a determination unit 10, a first processing unit 20, a second processing unit 30, and a third processing unit 40. The determination unit 10 is used to determine the key characteristic factors affecting the above-mentioned power load according to the historical data and historical fluctuations of the power load; the first processing unit 20 is used to collect initial data corresponding to the above-mentioned key characteristic factors, and preprocess the above-mentioned initial data to obtain preprocessed data, and the above-mentioned key characteristic factors are the data type of the above-mentioned initial data; the second processing unit 30 is used to use the above-mentioned preprocessed data to train the initial Prophet algorithm and the initial LightGBM model in parallel, and adjust the operating parameters of the above-mentioned initial Prophet algorithm and the operating parameters of the above-mentioned initial LightGBM model based on the prediction accuracy to obtain the target Prophet algorithm and the target LightGBM model, and finally output the corresponding confidence value and confidence interval, and the above-mentioned confidence value is the corresponding model prediction value; the third processing unit 40 is used to integrate the model prediction value of the above-mentioned target Prophet algorithm with the model prediction value of the above-mentioned target LightGBM model by adding two loss function penalty terms to obtain the final load forecasting result.
[0162] The above-mentioned short-term power load forecasting device based on the Prophet and LightGBM combined model of the present application includes: a determination unit, a first processing unit, a second processing unit, and a third processing unit. The determination unit is used to determine the key characteristic factors affecting the power load based on the historical data and historical fluctuations of the power load; the first processing unit is used to collect initial data corresponding to the key characteristic factors, and preprocess the initial data to obtain preprocessed data, and the key characteristic factors are the data type of the initial data; the second processing unit is used to use the preprocessed data to train the initial Prophet algorithm and the initial LightGBM model in parallel, and adjust the operating parameters of the initial Prophet algorithm and the operating parameters of the initial LightGBM model based on the prediction accuracy to obtain the target Prophet algorithm and the target LightGBM model, and finally output the corresponding confidence value and confidence interval, and the confidence value is the corresponding model prediction value; the third processing unit is used to integrate the model prediction value of the target Prophet algorithm with the model prediction value of the target LightGBM model by adding two loss function penalty terms to obtain the final load forecasting result. The device trains two models in parallel, adds a prediction value optimization module, introduces penalty terms and regularization terms, and uses the least squares method to calculate the optimal weight ratio of the two algorithms. The weighted average of the prediction values is used as the final prediction result, and the two algorithms are effectively integrated. The two algorithms can ensure the training effect of their respective models under the characteristic factors that they are good at, so that the prediction value has higher accuracy as a whole. In addition, there are many factors affecting the power load. The Pearson correlation coefficient is used to calculate the correlation between the influencing factors and the power load, and the key influencing factors are extracted according to the correlation sorting, eliminating interference from other factors. For a large amount of "dirty data" in the engineering data, the data cleaning of zero values, missing values and outliers in the original data is achieved through interpolation, which solves the problem that the existing power load prediction algorithm cannot combine the influence of time series and non-time series, resulting in low prediction accuracy and poor generalization ability.
[0163] In some examples, the determination unit includes a first determination module, a first calculation module and a first processing module. The first determination module is used to determine a first preset influencing factor according to the historical data and historical fluctuation of the power load; the first calculation module is used to calculate the first preset influencing factor using the Pearson correlation coefficient calculation formula Calculate the Pearson correlation coefficient between the above-mentioned pre-influencing factors and the above-mentioned power load, where ρ X,Yis the Pearson correlation coefficient between the above-mentioned pre-influencing factors and the above-mentioned power load, N represents the number of variables X, X is the above-mentioned pre-influencing factors, and Y is the above-mentioned power load; the first processing module is used to arrange the absolute values of the above-mentioned Pearson correlation coefficients of the above-mentioned pre-influencing factors from large to small, and determine the above-mentioned pre-influencing factors ranked in the first second preset number as the above-mentioned key characteristic factors affecting the above-mentioned power load, wherein the above-mentioned first preset number is greater than the above-mentioned second preset number. There are many factors affecting the power load, and the Pearson correlation coefficient is used to calculate the correlation between the influencing factors and the power load, and the key influencing factors are extracted according to the correlation sorting, eliminating the interference of other factors.
[0164] In some examples, the first processing unit includes a first adoption module, a second processing module and a third processing module, the first adoption module is used to collect initial data corresponding to the above key characteristic factors, and perform vectorization processing on the above initial data to obtain vectorized data; the above vectorized data is standardized, the above vectorized data for continuous characteristic factors is scaled to first standardized data, the above vectorized data for discrete characteristic factors is scaled to second standardized data, and the sum of the above first standardized data and the above second standardized data is determined as standardized data, the above first standardized data is data with a mean of 0 and a variance of 1, and the above second standardized data is data in the interval [0, 1]; data cleaning processing is performed on the abnormal values, zero values and missing values in the above standardized data to obtain the above preprocessed data. For a large amount of "dirty data" in engineering data, data cleaning of zero values, missing values and abnormal values in the original data is achieved by interpolation, and data cleaning processing can effectively remove abnormal values, zero values and missing values, and improve the quality and reliability of data.
[0165] In some examples, the second processing unit includes a second determination module, a fourth processing module and a first training module, and the second determination module is used to determine the Prophet algorithm principle formula p(t)=g(t)+s(t)+h(t)+ε t , where p(t) is the predicted value, g(t) is the trend term, which represents the non-periodic trend of the time series, s(t) is the periodic term, which represents the periodic trend, h(t) represents the holiday term, and ε tis an error term, and the error term is the fluctuation that the initial Prophet algorithm has not predicted; the fourth processing module is used to set the trend term, the cycle term, the holiday term and the error term of the initial Prophet algorithm, and call the fbprophet software library to set the hyperparameters of the initial Prophet algorithm; the first training module is used to input the preprocessed data into the initial Prophet algorithm for training, and adjust the operating parameters of the initial Prophet algorithm based on the prediction accuracy to obtain the target Prophet algorithm, and finally output the confidence value and confidence interval of the target Prophet algorithm. By adjusting and training the parameters of the initial Prophet algorithm, the prediction accuracy can be improved, making the prediction results more accurate and reliable, and the target Prophet algorithm can output confidence values and confidence intervals to reduce uncertainty.
[0166] In some examples, the second processing unit includes a second training module, a fifth processing module, a third training module and a sixth processing module, the second training module is used to train M small decision trees based on the training set in the preprocessed data, and perform negative gradient accumulation on the loss function of the small decision trees obtained by training to obtain M weak regression trees; the fifth processing module is used to train the M small decision trees based on the Boosting algorithm. All the trained weak regression trees are linearly superimposed to obtain a strong regression tree, where: is the above strong regression tree, T(x; Θ i ) is the parameter of the i-th weak regression tree, and M is the number of the weak regression trees; the third training module is used to iteratively solve the MSE mean square error loss function as the objective function, so that the objective function reaches the minimum value, so as to train the initial LightGBM model; the sixth processing module is used to adjust the operating parameters of the initial LightGBM model based on the prediction accuracy, obtain the target LightGBM model, and finally output the corresponding confidence value and confidence interval. The two models are trained in parallel, and the penalty term of the LightGBM algorithm is introduced by adding a prediction value optimization module to punish the mismatch problem of the confidence intervals of the two parallel algorithms.
[0167] In some instances, the third processing module includes a seventh processing module, a second calculation module, a second adoption module and a first optimization module, the seventh processing module is used to add two penalty items of the above-mentioned loss function, and the two penalty items of the above-mentioned loss function are an additional item and a regularization item respectively; the second calculation module is used to calculate the proportion of the confidence value of the above-mentioned target Prophet algorithm as the first proportion, and the proportion of the confidence value of the above-mentioned target LightGBM model as the second proportion; the second adoption module is used to use the above-mentioned additional item to ensure that the model prediction value of the above-mentioned target Prophet algorithm and the model prediction value of the above-mentioned target LightGBM model are both within the confidence interval of the other model; the first optimization module is used to use the above-mentioned regularization item to optimize the above-mentioned target Prophet algorithm, and use the above-mentioned regularization item to weightedly process the model prediction value of the above-mentioned target Prophet algorithm and the model prediction value of the above-mentioned target LightGBM model according to the above-mentioned first proportion and the above-mentioned second proportion to obtain the above-mentioned final load forecasting result. The least squares method is used to calculate the optimal weight ratio of the two algorithms, and the weighted average of the predicted values is taken as the final prediction result. The two algorithms are finally effectively integrated, so that the two algorithms can ensure the training effect of their respective models under the characteristic factors they are good at, thereby making the predicted values more accurate as a whole.
[0168] In some examples, the third processing unit includes a third determining module, a fourth determining module and a fifth determining module, and the third determining module is used to determine the first penalty item and the second penalty in, is the upper limit of the confidence interval of the above target Prophet algorithm, is the lower limit of the confidence interval of the above target Prophet algorithm, is the upper limit of the confidence interval of the above target LightGBM model, is the lower limit of the confidence interval of the above target LightGBM model, λ is the penalty coefficient, T is the number of weight vectors, and wj is the jth weight matrix; the fourth determination module is used to integrate the above target Prophet algorithm with the above target LightGBM model according to the above first penalty term and the above second penalty term to determine the optimization loss function in, It is the overall error function after integrating the above target Prophet algorithm with the above target LightGBM model and adding the two above penalty terms, P 1 is the first penalty term mentioned above, P 2 is the second penalty term mentioned above; the fifth determination module is used to solve the above optimization loss function and determine the above final load forecast result Among them, w 1 +w 2 =1,w1 and w 2 The optimal solution is obtained by the least square method. The two algorithms can ensure the training effect of their respective models under their respective characteristics, so that the prediction value has a higher accuracy overall.
[0169] The short-term power load forecasting device based on the Prophet and LightGBM combined model includes a processor and a memory. The above-mentioned determination units and the like are stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize the corresponding functions. The above-mentioned modules are all located in the same processor; or, the above-mentioned modules are located in different processors in any combination.
[0170] The processor includes a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters can be adjusted to solve the problem that the existing power load forecasting algorithm cannot combine the influence of time series and non-time series, resulting in low prediction accuracy and poor generalization ability.
[0171] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0172] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the short-term power load forecasting method based on the Prophet and LightGBM combined model.
[0173] An embodiment of the present invention provides a processor, which is used to run a program, wherein the program executes the short-term power load forecasting method based on the Prophet and LightGBM combined model when running.
[0174] An embodiment of the present invention provides a device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the steps of a short-term power load forecasting method based on at least a Prophet and LightGBM combined model are implemented.
[0175] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0176] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program of initializing the steps of a short-term power load forecasting method based on at least a Prophet and LightGBM combined model.
[0177] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0178] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0179] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0180] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0181] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0182] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0183] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0184] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0185] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0186] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
[0187] 1) The short-term power load forecasting method based on the Prophet and LightGBM combined model of the present application trains the two models in parallel, adds a prediction value optimization module, introduces penalty terms and regular terms, and uses the least squares method to calculate the optimal weight ratio of the two algorithms. The weighted average of the prediction values is used as the final prediction result, and the two algorithms are effectively integrated. The two algorithms ensure the training effect of their respective models under the characteristic factors that they are good at, so that the prediction value has higher accuracy as a whole. In addition, there are many factors affecting the power load. The Pearson correlation coefficient is used to calculate the correlation between the influencing factors and the power load, and the key influencing factors are extracted according to the correlation sorting, and interference from other factors is eliminated. For a large amount of "dirty data" in the engineering data, the data cleaning of zero values, missing values and outliers in the original data is realized through interpolation, so as to solve the problem that the existing power load forecasting algorithm cannot combine the influence of time series and non-time series, resulting in low prediction accuracy and poor generalization ability.
[0188] 2) The short-term power load forecasting device based on the Prophet and LightGBM combined model of the present application trains the two models in parallel, adds a prediction value optimization module, introduces penalty terms and regularization terms, and uses the least squares method to calculate the optimal weight ratio of the two algorithms. The weighted average of the prediction values is used as the final prediction result, and the two algorithms are effectively integrated. The two algorithms ensure the training effect of their respective models under the characteristic factors that they are good at, thereby making the prediction value more accurate as a whole. In addition, there are many factors affecting the power load. The Pearson correlation coefficient is used to calculate the correlation between the influencing factors and the power load, and the key influencing factors are extracted according to the correlation sorting, eliminating interference from other factors. For a large amount of "dirty data" in the engineering data, the data cleaning of zero values, missing values and outliers in the original data is achieved through interpolation, so as to solve the problem that the existing power load forecasting algorithm cannot combine the influence of time series and non-time series, resulting in low prediction accuracy and poor generalization ability.
[0189] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A short-term power load forecasting method based on a Prophet and LightGBM combined model, characterized in that: include: Determine key characteristic factors affecting the power load based on historical data and historical fluctuations of the power load; Collecting initial data corresponding to the key characteristic factor and preprocessing the initial data to obtain preprocessed data, wherein the key characteristic factor is the data type of the initial data; The preprocessed data is used to train the initial Prophet algorithm and the initial LightGBM model in parallel, and the operating parameters of the initial Prophet algorithm and the initial LightGBM model are adjusted based on the prediction accuracy to obtain the target Prophet algorithm and the target LightGBM model, and finally the corresponding confidence value and confidence interval are output; By adding two loss function penalty terms, the target Prophet algorithm and the target LightGBM model are integrated, and the final load forecasting result is obtained according to the confidence value and confidence interval of the target Prophet algorithm and the confidence value and confidence interval of the target LightGBM model.
2. The method according to claim 1, characterized in that Based on the historical data and historical fluctuations of the power load, determine the key characteristic factors affecting the power load, including: Determine a first preset influencing factor according to historical data and historical fluctuations of power load; Pearson correlation coefficient calculation formula Calculate the Pearson correlation coefficient between the pre-influencing factor and the power load, where ρ X,Y is the Pearson correlation coefficient between the pre-influencing factor and the power load, N represents the number of variables X, X is the pre-influencing factor, and Y is the power load; The absolute values of the Pearson correlation coefficients of the pre-influencing factors are arranged from large to small, and the pre-influencing factors ranked in the first second preset number are determined as the key characteristic factors affecting the power load, wherein the first preset number is greater than the second preset number.
3. The method according to claim 1, characterized in that Collecting initial data corresponding to the key characteristic factors and preprocessing the initial data to obtain preprocessed data includes: Collecting initial data corresponding to the key characteristic factors, and performing vectorization processing on the initial data to obtain vectorized data; Performing standardization processing on the vectorized data, scaling the vectorized data that is a continuous feature factor into first standardized data, scaling the vectorized data that is a discrete feature factor into second standardized data, and determining the sum of the first standardized data and the second standardized data as standardized data, wherein the first standardized data is data with a mean of 0 and a variance of 1, and the second standardized data is data in the interval [0, 1]; Data cleaning is performed on abnormal values, zero values and missing values in the standardized data to obtain the preprocessed data.
4. The method according to claim 1, characterized in that: The initial Prophet algorithm is trained using the preprocessed data, and the operating parameters of the initial Prophet algorithm are adjusted based on the prediction accuracy to obtain the target Prophet algorithm, and finally the corresponding confidence value and confidence interval are output, including: Determine the principle formula of Prophet algorithm p(t)=g(t)+s(t)+h(t)+ε t , where p(t) is the predicted value, g(t) is the trend term, which represents the non-periodic change trend of the time series, s(t) is the periodic term, which represents the periodic change trend, h(t) represents the holiday term, and ε t is an error term, and the error term is the fluctuation not predicted by the initial Prophet algorithm; Setting the trend term, the cycle term, the holiday term and the error term of the initial Prophet algorithm, and calling the fbprophet software library to set the hyperparameters of the initial Prophet algorithm; The preprocessed data is input into the initial Prophet algorithm for training, and the operating parameters of the initial Prophet algorithm are adjusted based on the prediction accuracy to obtain the target Prophet algorithm, and finally the confidence value and confidence interval of the target Prophet algorithm are output.
5. The method according to claim 1, characterized in that The preprocessed data is used to train the initial LightGBM model, and the operating parameters of the initial LightGBM model are adjusted based on the prediction accuracy to obtain the target LightGBM model, and finally the corresponding confidence value and confidence interval are output, including: Based on the training set in the preprocessed data, M small decision trees are trained respectively, and the loss functions of the trained small decision trees are accumulated with negative gradients to obtain M weak regression trees; According to the Boosting algorithm All the trained weak regression trees are linearly superimposed to obtain a strong regression tree, where: is the strong regression tree, T(x; Θ i ) is the parameter of the i-th weak regression tree, and M is the number of the weak regression trees; The MSE mean square error loss function is used as the objective function for iterative solution, so that the objective function reaches the minimum value to train the initial LightGBM model; Based on the prediction accuracy, the operating parameters of the initial LightGBM model are adjusted to obtain the target LightGBM model, and finally the corresponding confidence value and confidence interval are output.
6. The method according to claim 1, characterized in that By adding two loss function penalty terms, the target Prophet algorithm and the target LightGBM model are integrated, and according to the confidence value and confidence interval of the target Prophet algorithm and the confidence value and confidence interval of the target LightGBM model, the final load forecasting result is obtained, including: Adding two penalty terms of the loss function, the two penalty terms of the loss function are an additional term and a regularization term respectively; The proportion of the confidence value of the target Prophet algorithm is calculated as the first proportion, and the proportion of the confidence value of the target LightGBM model is calculated as the second proportion; The additional item is used to ensure that the model prediction value of the target Prophet algorithm and the model prediction value of the target LightGBM model are both within the confidence interval of the other model; The target Prophet algorithm is optimized by using the regularization term, and the model prediction value of the target Prophet algorithm and the model prediction value of the target LightGBM model are weighted by using the regularization term according to the first proportion and the second proportion to obtain the final load forecast result.
7. The method according to claim 6, characterized in that By adding two loss function penalty terms, the target Prophet algorithm and the target LightGBM model are integrated, and according to the confidence value and confidence interval of the target Prophet algorithm and the confidence value and confidence interval of the target LightGBM model, the final load forecasting result is obtained, including: Determine the first penalty term and the second penalty in, is the upper limit of the confidence interval of the target Prophet algorithm, is the lower limit of the confidence interval of the target Prophet algorithm, is the upper limit of the confidence interval of the target LightGBM model, is the lower limit of the confidence interval of the target LightGBM model, λ is the penalty coefficient, T is the number of weight vectors, and wj is the jth weight matrix; According to the first penalty term and the second penalty term, the target Prophet algorithm is integrated with the target LightGBM model to determine the optimized loss function in, It is the overall error function after the target Prophet algorithm is integrated with the target LightGBM model and the two penalty terms are added, P1 is the first penalty term, and P2 is the second penalty term; Solve the optimization loss function to determine the final load forecast result Among them, w1+w2=1, w1 and w2 are the optimal solutions obtained by the least squares method.
8. A short-term power load forecasting device based on a Prophet and LightGBM combined model, characterized in that: include: A determination unit, used to determine key characteristic factors affecting the power load according to historical data and historical fluctuations of the power load; A first processing unit is used to collect initial data corresponding to the key characteristic factor and preprocess the initial data to obtain preprocessed data, wherein the key characteristic factor is a data type of the initial data; The second processing unit is used to use the preprocessed data to perform parallel training on the initial Prophet algorithm and the initial LightGBM model, and adjust the operating parameters of the initial Prophet algorithm and the initial LightGBM model based on the prediction accuracy to obtain the target Prophet algorithm and the target LightGBM model, and finally output the corresponding confidence value and confidence interval, where the confidence value is the corresponding model prediction value; The third processing unit is used to integrate the model prediction value of the target Prophet algorithm with the model prediction value of the target LightGBM model by adding two loss function penalty terms to obtain a final load forecast result.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the short-term power load forecasting method based on the Prophet and LightGBM combined model as described in any one of claims 1 to 7.
10. An electronic device, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for executing the short-term power load forecasting method based on the Prophet and LightGBM combined model as described in any one of claims 1 to 7.
Citation Information
Cited By
Underlying data reporting optimization method and device based on cloud platform
CN120512469A