Load prediction model training method and device, storage medium and computer equipment
By constructing the historical load linear regression equation of the power system and combining the deep belief network model training, the shortcomings of the traditional load prediction model in capturing nonlinear relationships are solved, and the accuracy and efficiency of load prediction are improved.
Patent Information
- Application Number
- CN202411933006.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-30
AI Technical Summary
Traditional load prediction model training methods have shortcomings in capturing complex nonlinear relationships, resulting in low prediction accuracy.
By constructing the historical load linear regression equation of the power system, the abnormal data is removed, and the deep belief network model is trained using a small batch gradient descent algorithm and a limited Boltzmann machine until the mean square error of the loss function is less than the preset threshold.
It improves the accuracy and efficiency of load prediction and ensures the safe and stable operation of the power system.
Smart Images

Figure CN120067671A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of power generation load identification, and particularly to a method and device for training a load prediction model, a storage medium, and a computer device. Background Art
[0002] Load modeling is a key link in power system management. Accurate training of a load prediction model is crucial for power dispatching, resource allocation, and the safe and stable operation of the power grid. Traditional load prediction model training methods include time series analysis and regression models. Among them, time series analysis uses historical data for prediction, but it is often difficult to capture complex non-linear relationships. The regression model is based on linear or non-linear regression for modeling, which is limited by feature selection and model assumptions. Therefore, the accuracy of traditional load prediction model training methods is not high. Summary of the Invention
[0003] In view of this, this application provides a method and device for training a load prediction model, a storage medium, and a computer device. According to historical load data, historical voltage data, and the frequency of the power system, a historical load linear regression equation of the power system is constructed; based on the historical load linear regression equation, abnormal historical power data in the historical power data is removed to obtain initial historical power data, and the initial historical power data is normalized to obtain target input historical power data; the input layer of the load prediction model is trained using the mini-batch gradient descent algorithm and the target input historical power data, and the first hidden layer and the second hidden layer of the load prediction model are trained based on the restricted Boltzmann machine until the mean square error of the loss function of the load prediction model is less than a preset threshold. The trained model can improve the accuracy and efficiency of load prediction, thereby ensuring the safe and stable operation of the power system.
[0004] According to one aspect of this application, a method for training a load prediction model is provided, and the method includes:
[0005] Collect historical power data of the power system within a preset historical period and obtain the frequency of the power system, where the historical power data includes historical load data and historical voltage data, the historical load data includes historical load values at multiple historical moments, and the historical voltage data includes historical voltage values at multiple historical moments;
[0006] Construct a historical load linear regression equation of the power system according to the historical load data, the historical voltage data, and the frequency of the power system;
[0007] Based on the historical load linear regression equation, remove abnormal historical power data in the historical power data to obtain initial historical power data, and normalize the initial historical power data to obtain target input historical power data;
[0008] Using the mini-batch gradient descent algorithm and the target input historical power data, train the input layer of the load forecasting model, and the first hidden layer and the second hidden layer of the load forecasting model based on the restricted Boltzmann machine until the mean square error of the loss function of the load forecasting model is less than a preset threshold, where the load forecasting model is constructed based on a deep belief network, and the load forecasting model includes an input layer, a first hidden layer, a second hidden layer, and an output layer.
[0009] Optionally, constructing the historical load linear regression equation of the power system according to the historical load data, the historical voltage data, and the frequency of the power system includes:
[0010] Construct the historical load linear regression equation of the power system according to the historical load data, the historical voltage data, the frequency of the power system, and the time series linear regression equation formula, where the time series linear regression equation formula is:
[0011] P (t) =a 0 +a 1 V (t) +a 2 f (t) +ε,
[0012] t represents the time series within a preset historical period, P (t) represents the historical load value of the power system at the t-th moment, V (t) represents the historical voltage value of the power system at the t-th moment, f (t) represents the frequency of the power system at the t-th moment, a 0 、a 1 and a 3 represent the first linear parameter, the second linear parameter, and the third linear parameter respectively, and ε represents a preset error term.
[0013] Optionally, removing the abnormal historical power data from the historical power data based on the historical load linear regression equation to obtain the initial historical power data includes:
[0014] Select any type of historical power data in the historical load linear regression equation, calculate the Z-Score value of each historical power data in the selected type of historical power data based on the Z-Score (standard score) value calculation formula, and determine the historical power data with the absolute value of any Z-Score value greater than the preset threshold as the abnormal historical power data;
[0015] In the historical load linear regression equation, the abnormal historical power data of each type of historical power data is removed to obtain the initial historical power data corresponding to each type of historical power data. Among them, the calculation formula of the Z-Score (standard score) value is:
[0016]
[0017] Z i represents the Z-Score value of the i-th historical power data in the currently selected type of historical power data, x i represents the i-th historical power data in the currently selected type of historical power data, μ represents the mean value of the currently selected type of historical power data, and σ represents the standard deviation of the currently selected type of historical power data.
[0018] Optionally, the normalization process for the initial historical power data to obtain the target input historical power data includes:
[0019] Select any one of the initial historical power data in the historical load linear regression equation, and perform normalization processing on the selected type of initial historical power data based on the normalization processing calculation formula to obtain the target input historical power data corresponding to the selected type of initial historical power data. Among them, the normalization processing calculation formula is:
[0020]
[0021] X j ′ represents the target input historical power data of the j-th initial historical power data in the currently selected type of initial historical power data, X j represents the j-th initial historical power data in the currently selected type of initial historical power data, X min represents the minimum value in the currently selected type of initial historical power data, X max represents the maximum value in the currently selected type of initial historical power data.
[0022] Optionally, the use of the mini-batch gradient descent algorithm and the target input historical power data to train the input layer of the load prediction model includes:
[0023] Divide the target input historical power data into multiple mini-batch training data sets. For any one mini-batch training data set, based on the loss function and the mini-batch training data set, perform parameter update training on the load prediction model. Among them, the loss function is:
[0024]
[0025] L represents the loss function, u represents the total number of target input historical power data in the mini-batch training data set, y gRepresents the actual value of the historical power data of the g-th target input in the load forecasting model, Represents the predicted value of the historical power data of the g-th target input in the load forecasting model.
[0026] Optionally, before the mean square error of the loss function of the load forecasting model is less than a preset threshold, the method further includes:
[0027] Based on the mean square error calculation formula of the loss function, calculate the mean square error of the loss function of the load forecasting model, where the mean square error calculation formula of the loss function is:
[0028]
[0029] MSE represents the mean square error value of the loss function, u represents the total number of historical power data of the target input in the mini-batch training dataset, y g Represents the actual value of the historical power data of the g-th target input in the load forecasting model, Represents the predicted value of the historical power data of the g-th target input in the load forecasting model.
[0030] Optionally, training the first hidden layer and the second hidden layer of the load forecasting model based on the restricted Boltzmann machine includes:
[0031] Select the first hidden layer or the second hidden layer in the load forecasting model as the target hidden layer, and train the target hidden layer based on the restricted Boltzmann machine energy function formula, where the restricted Boltzmann machine energy function formula is:
[0032]
[0033] E(v, h) represents the load forecasting model including the input layer v and the target hidden layer h, n represents the number of historical power data of the target input in the input layer v, m represents the number of hidden layer data in the target hidden layer h, v p Represents the p-th historical power data of the target input in the input layer v, h q Represents the q-th hidden layer data in the target hidden layer h, W p,q Represents the weight matrix between the p-th historical power data of the target input and the q-th hidden layer data, b p Represents the bias vector of the p-th historical power data of the target input, c q Represents the bias vector of the q-th hidden layer data.
[0034] According to another aspect of the present application, a load forecasting model training device is provided, and the device includes:
[0035] A power data acquisition module, which is used to acquire historical power data of a power system within a preset historical period and obtain the frequency of the power system. Among them, the historical power data includes historical load data and historical voltage data. The historical load data includes historical load values at multiple historical moments, and the historical voltage data includes historical voltage values at multiple historical moments;
[0036] A linear equation construction module, which is used to construct a historical load linear regression equation of the power system according to the historical load data, the historical voltage data, and the frequency of the power system;
[0037] An input data preprocessing module, which is used to remove abnormal historical power data in the historical power data based on the historical load linear regression equation to obtain initial historical power data, and perform normalization processing on the initial historical power data to obtain target input historical power data;
[0038] A prediction model training module, which is used to train the input layer of the load prediction model by using the mini-batch gradient descent algorithm and the target input historical power data, and train the first hidden layer and the second hidden layer of the load prediction model based on the restricted Boltzmann machine until the mean square error of the loss function of the load prediction model is less than a preset threshold. Among them, the load prediction model is constructed based on a deep belief network, and the load prediction model includes an input layer, a first hidden layer, a second hidden layer, and an output layer.
[0039] Optionally, the linear equation construction module is further used to:
[0040] Construct a historical load linear regression equation of the power system according to the historical load data, the historical voltage data, the frequency of the power system, and the time series linear regression equation formula. Among them, the time series linear regression equation formula is:
[0041] P (t) =a 0 +a 1 V (t) +a 2 f (t) +ε,
[0042] t represents the time series within the preset historical period, P (t) represents the historical load value of the power system at the t-th moment, V (t) represents the historical voltage value of the power system at the t-th moment, f (t) represents the frequency of the power system at the t-th moment, a 0 、a 1 and a 3 respectively represent the first linear parameter, the second linear parameter, and the third linear parameter, and ε represents the preset error term.
[0043] Optionally, the input data preprocessing module is further configured to:
[0044] Select any kind of historical power data in the historical load linear regression equation, calculate the Z-Score value of each historical power data in the selected kind of historical power data based on the Z-Score (standard score) value calculation formula, and determine the historical power data with the absolute value of any Z-Score value greater than the preset threshold as abnormal historical power data;
[0045] Remove the abnormal historical power data of each kind of historical power data in the historical load linear regression equation to obtain the initial historical power data corresponding to each kind of historical power data, where the Z-Score (standard score) value calculation formula is:
[0046]
[0047] Z i represents the Z-Score value of the i-th historical power data in the currently selected kind of historical power data, x i represents the i-th historical power data in the currently selected kind of historical power data, μ represents the mean value of the currently selected kind of historical power data, and σ represents the standard deviation of the currently selected kind of historical power data.
[0048] Optionally, the input data preprocessing module is further configured to:
[0049] Select any kind of initial historical power data in the historical load linear regression equation, perform normalization processing on the selected kind of initial historical power data based on the normalization processing calculation formula to obtain the target input historical power data corresponding to the selected kind of initial historical power data, where the normalization processing calculation formula is:
[0050]
[0051] X j ′ represents the target input historical power data of the j-th initial historical power data in the currently selected kind of initial historical power data, X j represents the j-th initial historical power data in the currently selected kind of initial historical power data, X min represents the minimum value in the currently selected kind of initial historical power data, X max represents the maximum value in the currently selected kind of initial historical power data.
[0052] Optionally, the prediction model training module is further configured to:
[0053] Divide the target input historical power data into multiple mini - batch training data sets. For any mini - batch training data set, update and train the parameters of the load forecasting model based on the loss function and the mini - batch training data set, where the loss function is:
[0054]
[0055] L represents the loss function, u represents the total number of target input historical power data in the mini - batch training data set, y g represents the actual value of the g - th target input historical power data in the load forecasting model, represents the predicted value of the g - th target input historical power data in the load forecasting model.
[0056] Optionally, the prediction model training module is further configured to:
[0057] Calculate the mean squared error of the loss function of the load forecasting model based on the mean squared error calculation formula of the loss function, where the mean squared error calculation formula of the loss function is:
[0058]
[0059] MSE represents the mean squared error value of the loss function, u represents the total number of target input historical power data in the mini - batch training data set, y g represents the actual value of the g - th target input historical power data in the load forecasting model, represents the predicted value of the g - th target input historical power data in the load forecasting model.
[0060] Optionally, the prediction model training module is further configured to:
[0061] Select the first hidden layer or the second hidden layer in the load forecasting model as the target hidden layer, and train the target hidden layer based on the restricted Boltzmann machine energy function formula, where the restricted Boltzmann machine energy function formula is:
[0062]
[0063] E(v,h) represents the load forecasting model including the input layer v and the target hidden layer h, n represents the number of target input historical power data in the input layer v, m represents the number of hidden layer data in the target hidden layer h, v p represents the p - th target input historical power data in the input layer v, h q represents the q - th hidden layer data in the target hidden layer h, W p,q represents the weight matrix between the p - th target input historical power data and the q - th hidden layer data, b pdenotes the bias vector of the p-th target input historical power data, c q denotes the bias vector of the q-th hidden layer data.
[0064] According to another aspect of the present application, there is provided a storage medium on which a computer program is stored, and when the program is executed by a processor, the above load prediction model training method is implemented.
[0065] According to still another aspect of the present application, there is provided a computer device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor. When the processor executes the program, the above load prediction model training method is implemented.
[0066] By means of the above technical solutions, a load prediction model training method, device, storage medium, and computer device provided by the present application construct a historical load linear regression equation of the power system according to historical load data, historical voltage data, and the frequency of the power system; based on the historical load linear regression equation, abnormal historical power data in the historical power data is removed to obtain initial historical power data, and the initial historical power data is normalized to obtain target input historical power data; the input layer of the load prediction model is trained using the mini-batch gradient descent algorithm and the target input historical power data, and the first hidden layer and the second hidden layer of the load prediction model are trained based on the restricted Boltzmann machine until the mean square error of the loss function of the load prediction model is less than a preset threshold. The trained model can improve the accuracy and efficiency of load prediction, thereby ensuring the safe and stable operation of the power system.
[0067] The above description is only an overview of the technical solutions of the present application. In order to be able to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features, and advantages of the present application more obvious and understandable, the following specific embodiments of the present application are specifically exemplified. Brief Description of the Drawings
[0068] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0069] Figure 1 shows a schematic flowchart of a load prediction model training method provided by an embodiment of the present application;
[0070] Figure 2 shows a schematic flowchart of another load prediction model training method provided by an embodiment of the present application;
[0071] Figure 3The flowchart shows another method for training a load prediction model provided by an embodiment of the present application;
[0072] Figure 4 The structural diagram shows a load prediction model training device provided by an embodiment of the present application. Detailed implementation manners
[0073] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other.
[0074] In this embodiment, a method for training a load prediction model is provided. As Figure 1 shown, the method includes:
[0075] Step 101, collect historical power data of the power system within a preset historical period, and obtain the frequency of the power system. Among them, the historical power data includes historical load data and historical voltage data. The historical load data includes historical load values at multiple historical moments, and the historical voltage data includes historical voltage values at multiple historical moments.
[0076] Deep learning models (such as DBN, convolutional neural network, etc.) can effectively process high-dimensional data and capture complex patterns in the data. As an unsupervised learning deep learning model, DBN has the following advantages: feature learning ability, which can automatically extract important features from data and reduce manual intervention. Nonlinear modeling ability, which can model complex nonlinear relationships and adapt to changing load patterns.
[0077] In the above embodiments of the present application, a load forecasting model is constructed based on a DBN (Deep Belief Network). The load forecasting model can be applied to various application scenarios in the power system. For example: 1. Grid planning: In the grid planning stage, the load forecasting model can help determine the scale and layout of the grid, that is, by predicting future load demands to ensure that grid construction can meet the needs of future load growth; 2. Power dispatch: In the grid operation stage, the load forecasting model is also important for formulating dispatch strategies. By predicting future load changes, it is possible to reasonably arrange the operation and shutdown times of power generation equipment, optimize the allocation of power resources, and improve the grid operation efficiency; 3. Electricity price policy formulation: Load forecasting is also an important basis for formulating electricity price policies. By predicting future load demands, it is possible to better formulate electricity price policies and promote the healthy development of the electricity market; 4. Electricity market trading: The load forecasting model can provide a reference basis for electricity market trading. Each power enterprise can make better electricity trading decisions based on the results of load forecasting, avoid market trading risks, and improve trading efficiency; 5. New energy access assessment: When new energy is connected to the power system, by predicting future load changes and new energy generation conditions, it is possible to better assess the impact of new energy access on the power system and ensure the safe and stable operation of the power system. In addition, through the load forecasting model, load scheduling and optimization can be better carried out. For example, the peak and off-peak electricity consumption times in different regions can be reasonably arranged to avoid excessive grid pressure, thereby improving the utilization efficiency of power resources.
[0078] Specifically, first, historical power data of the power system within a preset historical period is collected, and the frequency of the power system is obtained. For example, historical power data can be obtained from the online monitoring system of the power company. The historical power data has a cycle of at least one month, and one data is collected every minute. The collected data is recorded in the form of a time series, with the time unit being hours and the data format being a CSV file. In particular, if missing data is found during data collection, the records containing the missing data can be directly deleted.
[0079] Step 102, construct a historical load linear regression equation of the power system according to the historical load data, the historical voltage data, and the frequency of the power system.
[0080] Step 103, based on the historical load linear regression equation, remove the abnormal historical power data from the historical power data to obtain initial historical power data, and perform normalization processing on the initial historical power data to obtain target input historical power data.
[0081] Step 104, using a small batch gradient descent algorithm and the target input historical power data, training the input layer of the load forecasting model, and training the first hidden layer and the second hidden layer of the load forecasting model based on a restricted Boltzmann machine, until the mean square error of the loss function of the load forecasting model is less than a preset threshold, wherein the load forecasting model is constructed based on a deep belief network, and the load forecasting model includes an input layer, a first hidden layer, a second hidden layer and an output layer.
[0082] Next, based on the historical load data, historical voltage data and the frequency of the power system, the historical load linear regression equation of the power system is constructed to explore the potential relationship between load and voltage. Based on the historical load linear regression equation, the abnormal historical power data in the historical power data is removed to obtain the initial historical power data, and normalization is performed to obtain the target input historical power data. The collected data is cleaned, including removing missing values and outliers. Interpolation is used to fill in missing data to ensure data integrity. Data normalization is performed to convert feature data of different magnitudes to the same range for model training. By optimizing the measured data processing process, extracting key features, and combining advanced optimization algorithms, the rapid and accurate calculation of parameter identification of the load forecasting model can be achieved, which can effectively shorten the parameter identification time of the load forecasting model, improve the identification accuracy of the load forecasting model, and provide an important basis for real-time scheduling and optimized operation of the power system.
[0083] By applying the technical solution of this embodiment, a historical load linear regression equation of the power system is constructed according to the historical load data, the historical voltage data and the frequency of the power system; based on the historical load linear regression equation, the abnormal historical power data in the historical power data is removed to obtain the initial historical power data, and the initial historical power data is normalized to obtain the target input historical power data; a small batch gradient descent algorithm and the target input historical power data are used to train the input layer of the load prediction model, and the first hidden layer and the second hidden layer of the load prediction model are trained based on the restricted Boltzmann machine, until the mean square error of the loss function of the load prediction model is less than the preset threshold value, and the trained model can improve the accuracy and efficiency of load prediction, thereby ensuring the safe and stable operation of the power system.
[0084] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another load forecasting model training method is provided, such as Figure 2 As shown, the method includes:
[0085] Step 201: Collect historical power data of the power system within a preset historical period, and obtain the frequency of the power system. Among them, the historical power data includes historical load data and historical voltage data. The historical load data includes historical load values at multiple historical moments, and the historical voltage data includes historical voltage values at multiple historical moments.
[0086] In the above embodiments of the present application, collecting historical power data of the power system within a preset historical period and obtaining the frequency of the power system prepares for subsequent training of the load prediction model.
[0087] Step 202: Construct a historical load linear regression equation of the power system according to the historical load data, the historical voltage data, the frequency of the power system, and the time series linear regression equation formula. Among them, the time series linear regression equation formula is:
[0088] P (t) = a 0 + a 1 V (t) + a 2 f (t) + ε,
[0089] t represents the time series within the preset historical period, P (t) represents the historical load value of the power system at the t-th moment, V (t) represents the historical voltage value of the power system at the t-th moment, f (t) represents the frequency of the power system at the t-th moment, a 0 、a 1 and a 3 respectively represent the first linear parameter, the second linear parameter, and the third linear parameter, and ε represents the preset error term.
[0090] Step 203: Select any one type of historical power data in the historical load linear regression equation, calculate the Z-Score value of each piece of historical power data in the selected type of historical power data based on the Z-Score (standard score) value calculation formula, and determine the historical power data with the absolute value of any Z-Score value greater than the preset threshold as abnormal historical power data.
[0091] Next, construct a historical load linear regression equation of the power system according to the historical load data, the historical voltage data, the frequency of the power system, and the time series linear regression equation formula. For this reason, the relationship between the load and the voltage can be characterized.
[0092] Step 204: Remove the abnormal historical power data of each type of historical power data in the historical load linear regression equation to obtain the corresponding initial historical power data of each type of historical power data. The calculation formula of the Z-Score (standard score) value is as follows:
[0093]
[0094] Z i represents the Z-Score value of the i-th historical power data in the currently selected type of historical power data, and x i represents the i-th historical power data in the currently selected type of historical power data, μ represents the mean value of the currently selected type of historical power data, and σ represents the standard deviation of the currently selected type of historical power data.
[0095] Next, remove the abnormal historical power data of each type of historical power data in the historical load linear regression equation to obtain the corresponding initial historical power data of each type of historical power data. When removing outliers, the Z-Score method can be used to help identify outliers, that is, calculate the Z-Score value of each data point. When |Z i |>3, this value can be considered an outlier.
[0096] Step 205: Select any one of the initial historical power data in the historical load linear regression equation, and perform normalization processing on the selected type of initial historical power data based on the normalization processing calculation formula to obtain the target input historical power data corresponding to the selected type of initial historical power data. The normalization processing calculation formula is as follows:
[0097]
[0098] X j ′ represents the target input historical power data of the j-th initial historical power data in the currently selected type of initial historical power data, and X j represents the j-th initial historical power data in the currently selected type of initial historical power data, and X min represents the minimum value in the currently selected type of initial historical power data, and X max represents the maximum value in the currently selected type of initial historical power data.
[0099] Then, perform data normalization processing, that is, scale the data to the specified range ([0,1]). Specifically, select any one of the initial historical power data in the historical load linear regression equation, and perform normalization processing on the selected type of initial historical power data based on the normalization processing calculation formula to obtain the target input historical power data corresponding to the selected type of initial historical power data.
[0100] Step 206: Use the mini-batch gradient descent algorithm and the target input historical power data to train the input layer of the load forecasting model, and train the first hidden layer and the second hidden layer of the load forecasting model based on the restricted Boltzmann machine until the mean square error of the loss function of the load forecasting model is less than a preset threshold. Herein, the load forecasting model is constructed based on a deep belief network, and the load forecasting model includes an input layer, a first hidden layer, a second hidden layer, and an output layer.
[0101] Next, construct a load forecasting model based on a deep belief network (DBN). This load forecasting model consists of an input layer, two hidden layers (the first hidden layer and the second hidden layer), and an output layer. Among them, the input layer receives historical power data, historical voltage data, and frequency data. Each hidden layer is trained layer by layer using a restricted Boltzmann machine (RBM) to capture the potential features of the data. The load forecasting model uses a non-linear activation function (ReLU) to enhance the model's expressive ability. During the training process of the load forecasting model, the mini-batch gradient descent algorithm is combined with the backpropagation method to fine-tune the network, and the Dropout regularization technique is used to prevent overfitting. Compared with traditional linear regression models and shallow neural networks, the load forecasting model established using a deep belief network shows stronger capabilities in modeling complex load change patterns, can effectively train using unlabeled data, and improves the prediction accuracy of the model in the case of small samples.
[0102] Therefore, the trained load forecasting model can effectively capture the complex non-linear relationships in the load data and can provide higher prediction accuracy compared with traditional linear models. This is of great significance for power dispatching and resource allocation. At the same time, due to the hierarchical structure and random characteristics of the DBN, it has strong robustness to noise and outliers and can also maintain good performance in an imperfect data environment.
[0103] By applying the technical solution of this embodiment, according to the historical load data, historical voltage data, the frequency of the power system, and the time series linear regression equation formula, a historical load linear regression equation of the power system is constructed. Any kind of historical power data in the historical load linear regression equation is selected. Based on the Z-Score (standard score) value calculation formula, the Z-Score value of each historical power data in the selected type of historical power data is calculated, and the historical power data with the absolute value of any Z-Score value greater than the preset threshold is determined as abnormal historical power data. The abnormal historical power data is removed to obtain the initial historical power data, and the initial historical power data is normalized to obtain the target input historical power data. The input layer of the load prediction model is trained using the mini-batch gradient descent algorithm and the target input historical power data, and the first hidden layer and the second hidden layer of the load prediction model are trained based on the restricted Boltzmann machine until the mean square error of the loss function of the load prediction model is less than the preset threshold. The load prediction model based on the deep belief network has the ability of automatic feature extraction, can learn important features from the original data, reduces the time and cost of manual feature selection, and improves the adaptability and generalization ability of the model.
[0104] Further, as a refinement and extension of the specific implementation manner of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another load prediction model training method is provided, as Figure 3 shown. This method includes:
[0105] Step 301, collect the historical power data of the power system within a preset historical period, and obtain the frequency of the power system, where the historical power data includes historical load data and historical voltage data, the historical load data includes historical load values at multiple historical moments, and the historical voltage data includes historical voltage values at multiple historical moments.
[0106] Step 302, construct a historical load linear regression equation of the power system according to the historical load data, the historical voltage data, and the frequency of the power system.
[0107] In the above embodiment of the present application, the historical power data of the power system within a preset historical period is collected, and the frequency of the power system is obtained. Then, a historical load linear regression equation of the power system is constructed according to the historical load data, the historical voltage data, and the frequency of the power system. Specifically, the collected historical power data can also be divided into a training set, a test set, and a validation set according to a ratio of 8:1:1 to train the model to ensure the generalization ability of the model.
[0108] Step 303: Based on the historical load linear regression equation, remove the abnormal historical power data from the historical power data to obtain the initial historical power data, and perform normalization processing on the initial historical power data to obtain the target input historical power data.
[0109] Next, clean the collected historical power data, including removing missing values and outliers. Interpolation can also be used to fill in the missing data to ensure data integrity. Then, perform data normalization processing to convert feature data of different magnitudes to the same range for easy model training.
[0110] Step 304: Divide the target input historical power data into multiple mini-batch training data sets. For any mini-batch training data set, update the parameters of the load prediction model based on the loss function and the mini-batch training data set. Among them, the load prediction model is constructed based on a deep belief network, and the load prediction model includes an input layer, a first hidden layer, a second hidden layer, and an output layer. The loss function is:
[0111]
[0112] L represents the loss function, u represents the total number of target input historical power data in the mini-batch training data set, y g represents the actual value of the g-th target input historical power data in the load prediction model, represents the predicted value of the g-th target input historical power data in the load prediction model.
[0113] Then, divide the target input historical power data into multiple mini-batch training data sets. For any mini-batch training data set, update the parameters of the load prediction model based on the loss function and the mini-batch training data set. Specifically, the loss function (mean squared error) can be selected to measure the gap between the predicted value and the true value in the load prediction model. At the same time, the optimization algorithm Stochastic Gradient Descent (SGD) can be used to update the network weights and set the learning rate. Perform multiple iterations (100 epochs). In each epoch, input the training set into the load prediction model for forward propagation to calculate the predicted value. Calculate the loss value and perform backpropagation to update the network weights. Use mini-batch training (for example, 64 samples each time) to improve the training efficiency and convergence speed. After each epoch ends, use the validation set to evaluate the model performance, record the validation loss and evaluation metrics (mean squared error). According to the validation set results, adjust the hyperparameters in a timely manner and adopt cross-validation technology to select the best model. Monitor the loss of the validation set. If there is no improvement in several consecutive epochs, stop training in advance to prevent overfitting.
[0114] Specifically, when using Dropout during training, for each neuron, its activation value is set to 0 with a certain probability, which is represented by the following formula: a i ′ = a i ·r i , where r i is a binary random variable that satisfies r i ~ Bernoulli(p). During training, neurons are retained with probability p and discarded with probability 1 - p.
[0115] Step 305: Select the first hidden layer or the second hidden layer in the load prediction model as the target hidden layer, and train the target hidden layer based on the restricted Boltzmann machine energy function formula. The restricted Boltzmann machine energy function formula is as follows:
[0116]
[0117] E(v, h) represents the load prediction model that includes the input layer v and the target hidden layer h. n represents the number of target input historical power data in the input layer v, m represents the number of hidden layer data in the target hidden layer h, v p represents the p-th target input historical power data in the input layer v, h q represents the q-th hidden layer data in the target hidden layer h, W p,q represents the weight matrix between the p-th target input historical power data and the q-th hidden layer data, b p represents the bias vector of the p-th target input historical power data, and c q represents the bias vector of the q-th hidden layer data.
[0118] Next, use the restricted Boltzmann machine (RBM) to perform layer-by-layer pre-training on each hidden layer (the first hidden layer and the second hidden layer) to capture the latent features of the data. Specifically, during training, the visible layer v 1 and the first hidden layer h 1 are used to form the RBM1 to be trained. Then, h 1 is regarded as the visible layer v 2 , and the second hidden layer h 2 and v 2 form the RBM2. The hidden layer of RBM2 is regarded as the visible layer of RBM3, and so on until all RBMs are trained. Specifically, the optimization algorithm Stochastic Gradient Descent (SGD) can be used to update the network weights, and the learning rate η is set to 0.001. Its mathematical expression is: where ω is the current weight, η is the learning rate, which controls the step size of each update. is the gradient of the loss function L with respect to the weight ω.
[0119] When training a deep learning model through multiple iterations, the main formulas involved include forward propagation, loss calculation, backpropagation, and weight update. The calculation formula for forward propagation is expressed as: z = Wx + b, a = f(z), where x is the input vector, W is the weight matrix, b is the bias term, z is the linear combination, f is the activation function (ReLU), and a is the activated output. The loss can be calculated using the mean squared error (MSE). When calculating the gradient during backpropagation, the chain rule is used. In the gradient calculation of the loss function, if the loss function is L, then the gradient with respect to the weight W is:
[0120]
[0121] Step 306: Calculate the mean squared error of the loss function of the load prediction model based on the mean squared error calculation formula of the loss function until the mean squared error of the loss function of the load prediction model is less than a preset threshold. The mean squared error calculation formula of the loss function is:
[0122]
[0123] MSE represents the value of the mean squared error of the loss function, u represents the total number of target input historical power data in the mini-batch training dataset, y g represents the actual value of the g-th target input historical power data in the load prediction model, represents the predicted value of the g-th target input historical power data in the load prediction model.
[0124] Next, calculate the mean squared error of the loss function of the load prediction model based on the mean squared error calculation formula of the loss function. The smaller the calculated MSE, the more accurate the prediction of the model. Therefore, a preset threshold can be set to determine whether the load prediction model meets the training standard.
[0125] By applying the technical solution of this embodiment, historical load data and voltage frequency are collected, and the collected data is cleaned, including removing missing values and outliers, filling in missing data using interpolation method to ensure data integrity, and performing data normalization to convert feature data of different magnitudes to the same range for convenient model training. Each neuron in the network input layer receives an input feature, and each hidden layer is trained layer by layer using the Restricted Boltzmann Machine (RBM) to capture the latent features of the data. The network uses the non-linear activation function (ReLU) to enhance the model's expressive ability. The mean squared error of the loss function is selected to measure the gap between the predicted value and the true value, and the optimization algorithm Stochastic Gradient Descent (SGD) is used to update the network weights. When training the deep learning model through multiple iterations, including forward propagation, loss calculation, backpropagation, and weight update, hyperparameters are adjusted in a timely manner according to the results of the validation set, and cross-validation technology is adopted to select the best model. Through load model identification based on the deep belief network, the parameter identification time is effectively shortened, the identification accuracy is improved, and an important basis is provided for the real-time scheduling and optimal operation of the power system.
[0126] Further, as Figure 1 a specific implementation of the method, an embodiment of the present application provides a load prediction model training device, as Figure 4 shown. The device includes:
[0127] A power data acquisition module 401, configured to collect historical power data of the power system within a preset historical period and obtain the frequency of the power system. Wherein, the historical power data includes historical load data and historical voltage data, the historical load data includes historical load values at multiple historical moments, and the historical voltage data includes historical voltage values at multiple historical moments;
[0128] A linear equation construction module 402, configured to construct a historical load linear regression equation of the power system according to the historical load data, the historical voltage data, and the frequency of the power system;
[0129] An input data preprocessing module 403, configured to remove abnormal historical power data from the historical power data based on the historical load linear regression equation to obtain initial historical power data, and perform normalization processing on the initial historical power data to obtain target input historical power data;
[0130] The prediction model training module 404 is used to train the input layer of the load prediction model by using the mini-batch gradient descent algorithm and the target input historical power data, and to train the first hidden layer and the second hidden layer of the load prediction model based on the restricted Boltzmann machine until the mean square error of the loss function of the load prediction model is less than a preset threshold. Wherein, the load prediction model is constructed based on a deep belief network, and the load prediction model includes an input layer, a first hidden layer, a second hidden layer and an output layer.
[0131] Optionally, the linear equation construction module 402 is further used to:
[0132] Construct the historical load linear regression equation of the power system according to the historical load data, the historical voltage data, the frequency of the power system, and the time series linear regression equation formula, where the time series linear regression equation formula is:
[0133] P (t) = a 0 + a 1 V (t) + a 2 f (t) + ε,
[0134] t represents the time series within a preset historical period, P (t) represents the historical load value of the power system at the t-th moment, V (t) represents the historical voltage value of the power system at the t-th moment, f (t) represents the frequency of the power system at the t-th moment, a 0 、a 1 and a 3 respectively represent the first linear parameter, the second linear parameter and the third linear parameter, and ε represents the preset error term.
[0135] Optionally, the input data preprocessing module 403 is further used to:
[0136] Select any kind of historical power data in the historical load linear regression equation, calculate the Z-Score value of each historical power data in the selected kind of historical power data based on the Z-Score (standard score) value calculation formula, and determine the historical power data with the absolute value of any Z-Score value greater than the preset threshold as abnormal historical power data;
[0137] Remove the abnormal historical power data of each kind of historical power data in the historical load linear regression equation to obtain the initial historical power data corresponding to each kind of historical power data, where the Z-Score (standard score) value calculation formula is:
[0138]
[0139] Z i represents the Z-Score value of the i-th historical power data in the currently selected category of historical power data, x i represents the i-th historical power data in the currently selected category of historical power data, μ represents the mean of the currently selected category of historical power data, and σ represents the standard deviation of the currently selected category of historical power data.
[0140] Optionally, the input data preprocessing module 403 is further configured to:
[0141] Select any initial historical power data in the historical load linear regression equation, and perform normalization processing on the selected category of initial historical power data based on the normalization processing calculation formula to obtain the target input historical power data corresponding to the selected category of initial historical power data, where the normalization processing calculation formula is:
[0142]
[0143] X j ′ represents the target input historical power data of the j-th initial historical power data in the currently selected category of initial historical power data, X j represents the j-th initial historical power data in the currently selected category of initial historical power data, X min represents the minimum value in the currently selected category of initial historical power data, X max represents the maximum value in the currently selected category of initial historical power data.
[0144] Optionally, the prediction model training module 404 is further configured to:
[0145] Divide the target input historical power data into multiple mini-batch training data sets, and for any mini-batch training data set, update and train the parameters of the load prediction model based on the loss function and the mini-batch training data set, where the loss function is:
[0146]
[0147] L represents the loss function, u represents the total number of target input historical power data in the mini-batch training data set, y g represents the actual value of the g-th target input historical power data in the load prediction model, represents the predicted value of the g-th target input historical power data in the load prediction model.
[0148] Optionally, the prediction model training module 404 is further configured to:
[0149] Based on the calculation formula of the mean squared error of the loss function, calculate the mean squared error of the loss function of the load forecasting model, where the calculation formula of the mean squared error of the loss function is:
[0150]
[0151] MSE represents the value of the mean squared error of the loss function, u represents the total number of target input historical power data in the mini-batch training dataset, y g represents the actual value of the g-th target input historical power data in the load forecasting model, represents the predicted value of the g-th target input historical power data in the load forecasting model.
[0152] Optionally, the prediction model training module 404 is further configured to:
[0153] Select the first hidden layer or the second hidden layer in the load forecasting model as the target hidden layer, and train the target hidden layer based on the restricted Boltzmann machine energy function formula, where the restricted Boltzmann machine energy function formula is:
[0154]
[0155] E(v,h) represents the load forecasting model including the input layer v and the target hidden layer h, n represents the number of target input historical power data in the input layer v, m represents the number of hidden layer data in the target hidden layer h, v p represents the p-th target input historical power data in the input layer v, h q represents the q-th hidden layer data in the target hidden layer h, W p,q represents the weight matrix between the p-th target input historical power data and the q-th hidden layer data, b p represents the bias vector of the p-th target input historical power data, c q represents the bias vector of the q-th hidden layer data.
[0156] It should be noted that for other corresponding descriptions of each functional unit involved in the load forecasting model training device provided in the embodiments of the present application, reference can be made to Figures 1 to 3 the corresponding descriptions in the method, which will not be elaborated here.
[0157] Based on the above method as Figures 1 to 3 shown, correspondingly, the embodiments of the present application further provide a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the load forecasting model training method as Figures 1 to 3 shown above.
[0158] Based on such understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes several instructions for causing a computer device (such as a personal computer, a server, or a network device, etc.) to execute the methods described in various implementation scenarios of the present application.
[0159] Based on the above such Figures 1 to 3 shown method, and Figure 4 shown virtual device embodiments, for the purpose of achieving the above object, the embodiments of the present application further provide a computer device, which may specifically be a personal computer, a server, a network device, etc. The computer device includes a storage medium and a processor; the storage medium is used for storing a computer program; the processor is used for executing the computer program to implement the load prediction model training method shown above such as Figures 1 to 3 shown.
[0160] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, sensors, an audio circuit, a WI-FI module, etc. The user interface may include a display screen (Display), an input unit such as a keyboard (Keyboard), etc. Optionally, the user interface may further include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a WI-FI interface), etc.
[0161] Those skilled in the art can understand that the structure of a computer device provided in this embodiment does not limit the computer device, and it may include more or fewer components, or combine certain components, or have different component arrangements.
[0162] The storage medium may further include an operating system and a network communication module. The operating system is a program for managing and saving the hardware and software resources of the computer device, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to implement the communication between the components inside the storage medium, as well as the communication between the storage medium and other hardware and software in the entity device.
[0163] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or can also be implemented by hardware. According to historical load data, historical voltage data, and the frequency of the power system, a historical load linear regression equation of the power system is constructed; based on the historical load linear regression equation, abnormal historical power data in the historical power data is removed to obtain initial historical power data, and the initial historical power data is normalized to obtain target input historical power data; the input layer of the load prediction model is trained using the mini-batch gradient descent algorithm and the target input historical power data, and the first hidden layer and the second hidden layer of the load prediction model are trained based on the restricted Boltzmann machine until the mean square error of the loss function of the load prediction model is less than a preset threshold. The trained model can improve the accuracy and efficiency of load prediction, thereby ensuring the safe and stable operation of the power system.
[0164] Those skilled in the art can understand that the drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the drawings are not necessarily essential for implementing the present application. Those skilled in the art can understand that the modules in the device in the implementation scenario can be distributed in the device in the implementation scenario according to the description of the implementation scenario, or can be correspondingly changed and located in one or more devices different from the present implementation scenario. The modules in the above implementation scenario can be combined into one module, or can be further split into multiple sub-modules.
[0165] The above serial numbers of the present application are only for description and do not represent the advantages or disadvantages of the implementation scenarios. The above disclosure is only several specific implementation scenarios of the present application. However, the present application is not limited thereto, and any changes that can be thought of by those skilled in the art should fall within the protection scope of the present application.
Claims
1. A load forecasting model training method, characterized in that: The method comprises: Collecting historical power data of the power system within a preset historical period and acquiring the frequency of the power system, wherein the historical power data includes historical load data and historical voltage data, the historical load data includes historical load values at multiple historical moments, and the historical voltage data includes historical voltage values at multiple historical moments; Constructing a historical load linear regression equation of the power system according to the historical load data, the historical voltage data and the frequency of the power system; Based on the historical load linear regression equation, abnormal historical power data in the historical power data is removed to obtain initial historical power data, and the initial historical power data is normalized to obtain target input historical power data; A small batch gradient descent algorithm and the target input historical power data are used to train the input layer of the load forecasting model, and the first hidden layer and the second hidden layer of the load forecasting model are trained based on the restricted Boltzmann machine until the mean square error of the loss function of the load forecasting model is less than a preset threshold, wherein the load forecasting model is constructed based on a deep belief network, and the load forecasting model includes an input layer, a first hidden layer, a second hidden layer and an output layer.
2. The method according to claim 1, characterized in that The constructing a historical load linear regression equation of the power system according to the historical load data, the historical voltage data and the frequency of the power system comprises: According to the historical load data, the historical voltage data, the frequency of the power system, and the time series linear regression equation formula, a historical load linear regression equation of the power system is constructed, wherein the time series linear regression equation formula is: P (t) =a0+a1V (t) +a2f (t) +ε, t represents the time series within the preset historical period, P (t) represents the historical load value of the power system at time t, V (t) represents the historical voltage value of the power system at time t, f (t) represents the frequency of the power system at the tth moment, a0, a1 and a3 represent the first linear parameter, the second linear parameter and the third linear parameter respectively, and ε represents the preset error term.
3. The method according to claim 1, characterized in that The removing abnormal historical power data from the historical power data based on the historical load linear regression equation to obtain the initial historical power data includes: Select any kind of historical power data in the historical load linear regression equation, calculate the Z-Score value of each historical power data in the selected kind of historical power data based on the Z-Score (standard score) value calculation formula, and determine any historical power data whose absolute value of the Z-Score value is greater than a preset threshold as abnormal historical power data; The abnormal historical power data of each of the various historical power data in the historical load linear regression equation are removed to obtain the initial historical power data corresponding to each of the various historical power data, wherein the Z-Score (standard score) value calculation formula is: Z i Indicates the Z-Score value of the i-th historical power data in the currently selected type of historical power data, x i represents the i-th historical power data in the currently selected type of historical power data, μ represents the mean of the currently selected type of historical power data, and σ represents the standard deviation of the currently selected type of historical power data.
4. The method according to claim 1, characterized in that: The normalizing the initial historical power data to obtain target input historical power data includes: Select any type of initial historical power data in the historical load linear regression equation, perform normalization processing on the selected type of initial historical power data based on the normalization processing calculation formula, and obtain the target input historical power data corresponding to the selected type of initial historical power data, wherein the normalization processing calculation formula is: X j ′ represents the target input historical power data of the jth initial historical power data in the current type of initial historical power data, X j Indicates the jth initial historical power data in the current type of initial historical power data, X min Indicates the minimum value in the initial historical power data of the current category, X max Indicates the maximum value in the initial historical power data of the current category.
5. The method according to claim 1, characterized in that The input layer of the load prediction model is trained by using the small batch gradient descent algorithm and the target input historical power data, including: The target input historical power data is divided into multiple small batch training data sets. For any small batch training data set, the load forecasting model is trained for parameter update based on the loss function and the small batch training data set, wherein the loss function is: L represents the loss function, u represents the total number of target input historical power data in the mini-batch training dataset, and y g represents the actual value of the g-th target input historical power data in the load forecasting model, Represents the predicted value of the g-th target input historical power data in the load forecasting model.
6. The method according to claim 5, characterized in that Until the mean square error of the loss function of the load forecasting model is less than a preset threshold, the method further comprises: Based on the loss function mean square error calculation formula, the loss function mean square error of the load forecasting model is calculated, wherein the loss function mean square error calculation formula is: MSE represents the mean square error value of the loss function, u represents the total number of target input historical power data in the small batch training data set, and y g represents the actual value of the g-th target input historical power data in the load forecasting model, Represents the predicted value of the g-th target input historical power data in the load forecasting model.
7. The method according to claim 1, characterized in that The first hidden layer and the second hidden layer of the restricted Boltzmann machine-based training load prediction model include: The first hidden layer or the second hidden layer in the load forecasting model is selected as the target hidden layer, and the target hidden layer is trained based on the restricted Boltzmann machine energy function formula, wherein the restricted Boltzmann machine energy function formula is: E(v,h) represents the load forecasting model including the input layer v and the target hidden layer h, n represents the number of target input historical power data in the input layer v, m represents the number of hidden layer data in the target hidden layer h, v p represents the pth target input historical power data in the input layer v, h q represents the qth hidden layer data in the target hidden layer h, W p,q represents the weight matrix between the pth target input historical power data and the qth hidden layer data, b p represents the bias vector of the pth target input historical power data, c q Represents the bias vector of the qth hidden layer data.
8. A load forecasting model training device, characterized in that: The device comprises: A power data acquisition module, used to collect historical power data of the power system within a preset historical period and obtain the frequency of the power system, wherein the historical power data includes historical load data and historical voltage data, the historical load data includes historical load values at multiple historical moments, and the historical voltage data includes historical voltage values at multiple historical moments; A linear equation building module, used to build a historical load linear regression equation of the power system according to the historical load data, the historical voltage data and the frequency of the power system; An input data preprocessing module, used for removing abnormal historical power data from the historical power data based on the historical load linear regression equation to obtain initial historical power data, and performing normalization processing on the initial historical power data to obtain target input historical power data; A prediction model training module is used to use a small batch gradient descent algorithm and the target input historical power data to train the input layer of the load prediction model, and to train the first hidden layer and the second hidden layer of the load prediction model based on a restricted Boltzmann machine until the mean square error of the loss function of the load prediction model is less than a preset threshold, wherein the load prediction model is constructed based on a deep belief network, and the load prediction model includes an input layer, a first hidden layer, a second hidden layer and an output layer.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for training a load forecasting model as described in any one of claims 1 to 7 is implemented.
10. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method for training a load forecasting model as described in any one of claims 1 to 7 is implemented.