Power load prediction method, device, equipment and storage medium
By acquiring historical environmental and power load data, constructing a regularized loss function, and training a neural network model, the problem of insufficient power load prediction accuracy was solved, and higher accuracy power load prediction was achieved.
Patent Information
- Application Number
- CN202210100763.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-27
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-01-27
AI Technical Summary
Existing power load forecasting methods have poor forecasting accuracy because they fail to fully consider the impact of environmental factors.
By acquiring training datasets of historical environmental data and power load data, a regularized loss function is constructed for the preset neural network model, and N power load prediction training cycles are performed until the loss function converges, thus establishing a power load prediction model. The prediction accuracy of the model is improved by using an encoder, attention module, and decoder.
The prediction accuracy of the power system load forecasting model has been improved by taking into account the impact of environmental factors.
Smart Images

Figure CN114492641B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device and storage medium for predicting power load. Background Technology
[0002] The electricity demand obtained by forecasting the power load of a power system can provide data support for power supply and demand balance, power source construction planning, and grid users' operational decisions. Currently, methods for forecasting power load typically rely on historical power load data to predict future electricity demand at a specific point in time. However, in reality, different environmental factors can also influence the power load of a power system. For example, the power load on rainy days is usually greater than that on sunny days, resulting in lower accuracy of power load forecasts based on historical data. Summary of the Invention
[0003] The purpose of this application is to provide a power load prediction method, apparatus, device, and storage medium to solve the problem of poor accuracy in current power load prediction.
[0004] To address the aforementioned technical problems, this application provides a power load forecasting method, employing the following technical solution:
[0005] Obtain a training dataset of historical data; the historical data includes historical environmental data and historical power load data, and the training dataset includes at least one training independent variable and a training response variable corresponding to each training independent variable; construct a regularized loss function for a preset neural network model; perform N power load prediction training iterations on the preset neural network model based on the training dataset until the loss function converges to obtain a power load prediction model; obtain prediction independent variables and input the prediction independent variables into the power load prediction model to obtain the power load corresponding to the prediction independent variables. The predicted independent variables include current environmental data and current power load data. The i-th step in the N-fold power load prediction training includes: inputting the target training independent variable into the neural network model obtained in the (i-1)-fold training for power load prediction processing to obtain the predicted response variable of the target training independent variable; and, based on the information loss between the response variable corresponding to the target training independent variable and the predicted response variable, training the neural network model obtained in the (i-1)-fold training for power load prediction to adjust the parameters of the neural network model obtained in the (i-1)-fold training. The target training independent variable is any independent variable in the training dataset; the information loss is the function value of the loss function corresponding to the neural network model obtained in the i-fold training.
[0006] Furthermore, the acquisition of the training dataset for historical data includes: acquiring historical data within a historical time period; constructing a variable dataset of the historical data based on the historical time period; performing a preset number of sampling operations with replacement on the variable dataset, and determining the extracted variable dataset as the training dataset.
[0007] Furthermore, the variable dataset includes at least one independent variable and a response variable corresponding to each independent variable; the step of constructing the variable dataset of the historical data based on the historical time period includes: dividing the historical time period into M sub-time periods on average; processing the historical data corresponding to each of the M sub-time periods to obtain the variable dataset of the historical data; the processing operation includes: determining the historical data corresponding to the first sub-time period as the first independent variable, and determining the historical power load data in the historical data corresponding to the second sub-time period as the response variable corresponding to the first independent variable; the first sub-time period is any sub-time period other than the last sub-time period in the M sub-time periods, and the second sub-time period is the next sub-time period adjacent to the first sub-time period.
[0008] Furthermore, the preset neural network model includes an encoder, an attention module, and a decoder. The step of inputting the target training independent variable into the neural network model obtained after the (i-1)th training iteration for power load prediction processing to obtain the predicted response variable of the target training independent variable includes: encoding the target training independent variable using the encoder to obtain an encoding vector; obtaining the hidden state and score of each hidden unit in the encoder using the attention module, and calculating the power load vector of the target training independent variable based on the hidden state and score of each hidden unit; and decoding the encoding vector and the power load vector using the decoder to obtain the predicted response variable of the target training independent variable.
[0009] Furthermore, adjusting the parameters of the neural network model obtained from the (i-1)th training includes: calculating the parameter gradient of the neural network model obtained from the (i-1)th training using an adaptive momentum optimization algorithm based on the response variable corresponding to the target training independent variable, the predicted response variable, and the loss function; adjusting the parameters of the neural network model obtained from the (i-1)th training based on the parameter gradient to obtain the neural network model obtained from the i-th training.
[0010] Furthermore, after constructing a regularized loss function for the preset neural network model, the power load prediction further includes: during the process of training the preset neural network model for power load prediction N times based on the training dataset, the hidden units in the preset neural network model are deactivated according to preset rules.
[0011] Furthermore, if the historical time period consists entirely of weekdays or entirely of holidays, the power load prediction model is either a holiday prediction model or a weekday prediction model. When the historical time period consists entirely of weekdays, the step of training the preset neural network model N times based on the training dataset until the loss function converges to obtain the power load prediction model includes: training the preset neural network model N times based on the training dataset until the loss function converges to obtain a weekday prediction model. The weekday prediction model is used to predict the power load corresponding to the prediction variable of a weekday. Similarly, when the historical time period consists entirely of holidays, the step of training the preset neural network model N times based on the training dataset until the loss function converges to obtain the power load prediction model includes: training the preset neural network model N times based on the training dataset until the loss function converges to obtain a holiday prediction model. The holiday prediction model is used to predict the power load corresponding to the prediction variable of a holiday.
[0012] To address the aforementioned technical problems, this application also provides a power load forecasting device, which employs the following technical solution:
[0013] The system comprises: an acquisition module for acquiring a training dataset of historical data, including historical environmental data and historical power load data, wherein the training dataset includes at least one training independent variable and a corresponding training response variable for each training independent variable; a construction module for constructing a regularized loss function for a preset neural network model; and a training module for performing N power load prediction training iterations on the preset neural network model based on the training dataset until the loss function converges, thereby obtaining a power load prediction model. The i-th step in the N power load prediction training iterations includes: inputting the target training independent variable into the neural network model obtained from the (i-1)-th training iteration for power load prediction processing, thereby obtaining the target training... The predicted response variable of the independent variable is used to train the neural network model obtained in the (i-1)th training iteration for power load prediction, based on the information loss between the response variable corresponding to the target training independent variable and the predicted response variable, so as to adjust the parameters of the neural network model obtained in the (i-1)th training iteration; the target training independent variable is any independent variable in the training dataset; the information loss is the function value of the loss function corresponding to the neural network model obtained in the i-th training iteration; the prediction module is used to obtain the predicted independent variable and input the predicted independent variable into the power load prediction model to obtain the power load corresponding to the predicted independent variable; wherein, the predicted independent variable includes current environmental data and current power load data.
[0014] Furthermore, the acquisition module includes an acquisition submodule, a construction submodule, and a sampling module; the acquisition submodule is used to acquire historical data within a historical time period; the construction submodule is used to construct a variable dataset of the historical data based on the historical time period; the sampling module is used to perform a preset number of samplings with replacement on the variable dataset and determine the extracted variable dataset as the training dataset.
[0015] Furthermore, the variable dataset includes at least one independent variable and a response variable corresponding to each independent variable; the construction submodule includes a partitioning submodule and a processing submodule; the partitioning submodule is used to divide the historical time period into M sub-time periods on average; the processing submodule is used to process the historical data corresponding to each of the M sub-time periods to obtain the variable dataset of the historical data; the processing operation includes: determining the historical data corresponding to the first sub-time period as the first independent variable, and determining the historical power load data in the historical data corresponding to the second sub-time period as the response variable corresponding to the first independent variable; the first sub-time period is any sub-time period other than the last sub-time period in the M sub-time periods, and the second sub-time period is the next sub-time period adjacent to the first sub-time period.
[0016] Furthermore, the preset neural network model includes an encoder, an attention module, and a decoder. The training module includes an encoding submodule, a vector calculation submodule, and a decoding submodule. The encoding submodule is used to encode the target training independent variable using the encoder to obtain an encoded vector. The vector calculation submodule is used to obtain the hidden state and score of each hidden unit in the encoder through the attention module, and calculate the power load vector of the target training independent variable based on the hidden state and score of each hidden unit. The decoding submodule is used to decode the encoded vector and the power load vector using the decoder to obtain the predicted response variable of the target training independent variable.
[0017] Furthermore, the training module also includes a gradient calculation submodule and a parameter adjustment submodule; the gradient calculation submodule is used to calculate the parameter gradient corresponding to the neural network model obtained in the (i-1)th training by means of an adaptive momentum optimization algorithm based on the response variable corresponding to the target training independent variable, the predicted response variable, and the loss function; the parameter adjustment submodule is used to adjust the parameters of the neural network model obtained in the (i-1)th training by means of the parameter gradient, so as to obtain the neural network model obtained in the i-th training.
[0018] Furthermore, the power load prediction device also includes a processing module; the processing module is used to deactivate the hidden units in the preset neural network model according to preset rules during the process of training the preset neural network model for N power load predictions based on the training dataset.
[0019] Furthermore, if the historical time period consists entirely of weekdays or entirely of holidays, the power load prediction model is either a holiday prediction model or a weekday prediction model. When the historical time period consists entirely of weekdays, the training module is further configured to perform N power load prediction training iterations on the preset neural network model based on the training dataset until the loss function converges, thus obtaining a weekday prediction model. The weekday prediction model is used to predict the power load corresponding to the prediction variables of weekdays. Similarly, when the historical time period consists entirely of holidays, the training module is further configured to perform N power load prediction training iterations on the preset neural network model based on the training dataset until the loss function converges, thus obtaining a holiday prediction model. The holiday prediction model is used to predict the power load corresponding to the prediction variables of holidays.
[0020] To address the aforementioned technical problems, this application also provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the power load forecasting method described above.
[0021] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the power load forecasting method described above.
[0022] Compared with existing technologies, the embodiments of this application have the following main advantages: First, a training dataset of historical environmental data and historical power load data is obtained. Then, a regularized loss function is constructed for a preset neural network model, and the preset neural network model is trained N times on power load prediction based on the training dataset until the loss function converges, thus obtaining the power load prediction model. By using historical environmental data and historical power load data as training data for the power load prediction model, the impact of environmental factors on the power system's power load can be taken into account, improving the prediction accuracy of the trained power load prediction model. Attached Figure Description
[0023] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0025] Figure 2 This is a flowchart of an embodiment of the power load forecasting method according to this application;
[0026] Figure 3 yes Figure 2 A flowchart of one embodiment of step S21;
[0027] Figure 4 yes Figure 3 A flowchart of one embodiment of step S212;
[0028] Figure 5 This is a flowchart of an embodiment of the i-th training method in N training cycles of power load forecasting in this application;
[0029] Figure 6 yes Figure 5 A flowchart of an embodiment of step S51;
[0030] Figure 7 This is a schematic diagram of one embodiment of the power load forecasting device according to this application;
[0031] Figure 8 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0033] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0034] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0035] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0036] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0037] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0038] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0039] It should be noted that the power load forecasting method provided in this application embodiment can be applied to the aforementioned server device 105, as well as to the aforementioned terminal devices 101, 102, and 103. The server device 105 and the terminal devices 101, 102, and 103 can be collectively referred to as electronic devices. That is, the executing entity of the power load forecasting method provided in this application embodiment can be a power load forecasting device, and the power load forecasting device can be the aforementioned electronic devices (such as server device 105 or terminal devices 101, 102, and 103).
[0040] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0041] Continue to refer to Figure 2 A flowchart of an embodiment of the power load forecasting method according to this application is shown. The power load forecasting method includes the following steps:
[0042] Step S21: Obtain the training dataset of historical data.
[0043] Historical data includes historical environmental data and historical power load data. Historical environmental data is used to characterize the environmental conditions surrounding the power system. For example, historical environmental data may include data on ambient temperature, humidity, wind speed, etc.
[0044] The training dataset includes at least one training independent variable and a corresponding training response variable for each training independent variable.
[0045] Specifically, Figure 3 This is a flowchart for obtaining the training dataset from historical data, see reference. Figure 3 As shown, it includes the following steps S211-S213.
[0046] Step S211: Obtain historical data within the historical time period.
[0047] The historical periods are either all weekdays or all holidays.
[0048] Specifically, retrieve the historical data for each day of the period preceding the current date. Then, divide the historical data into weekdays and holidays, obtaining the historical data for weekdays and holidays within the period preceding the current date. Define the time period corresponding to the weekdays in the period preceding the current date as the historical time period (in this case, the historical data will be the historical data corresponding to the weekdays), or define the time period corresponding to the holidays in the period preceding the current date as the historical time period (in this case, the historical data will be the historical data corresponding to the holidays).
[0049] For example, historical data can be denoted as D = {x1, x2, ..., x...} i , ..., x n}, where D represents all historical data within the historical time period, and x i Let x be the historical data for day i within the historical time period, and x i ={x i1 x i2 , ..., x ik b i1 , ..., b im}={x i b i},(1≤i≤n),x i The data is used to represent the historical electricity load data for day i, where k represents the number of points on the electricity load curve for day i, and b... i The m represents the historical environmental data for day i.
[0050] Step S212: Construct a variable dataset of historical data based on historical time periods.
[0051] The variable dataset includes at least one independent variable and a corresponding response variable for each independent variable.
[0052] Specifically, Figure 4 This is a flowchart for constructing a variable dataset of historical data based on historical time periods, see reference. Figure 4 As shown, it includes the following steps S2121-S2122.
[0053] Step S2121: Divide the historical time period into M sub-time periods on average.
[0054] Step S2122: Process the historical data corresponding to each of the M sub-time periods to obtain the variable dataset of historical data.
[0055] The processing operations include: determining the historical data corresponding to the first sub-time period as the first independent variable, and determining the historical power load data in the historical data corresponding to the second sub-time period as the response variable corresponding to the first independent variable; the first sub-time period is any sub-time period other than the last one among the M sub-time periods, and the second sub-time period is the next sub-time period adjacent to the first sub-time period. For example, the variable dataset of historical data is denoted as D. * ={(x1,y1),(x2,y2),…,(x i y i ), ..., (x n-1 y n-1 )}, where D * The variable dataset used to represent historical data, where i represents the i-th sub-time period, and x...i (1≤i≤n-1) is the independent variable, y i (2≤i≤n) is the independent variable x i The response variable, and x i Used to represent historical data of the i-th sub-time period within a historical time period, y i This refers to the historical power load data in the (i+1)th sub-time period within the historical time period.
[0056] In this embodiment, the problem of power load forecasting is integrated into a preset neural network model by using independent variables and corresponding response variables, providing a way to generate a training dataset for a power load forecasting model.
[0057] Step S213: Perform a preset number of samplings with replacement on the variable dataset, and determine the extracted variable dataset as the training dataset.
[0058] The preset number of times can be a default value or a value set by relevant personnel according to the actual situation.
[0059] Optionally, in sampling with replacement, the probability that a sample is not selected in a single sampling is... The probability of not being selected in n attempts is If the number of sampling attempts and the sample size are sufficiently large, the probability of not being selected in n attempts is: Therefore, we can also directly extract 1-0.36=0.64×100%=64% of the variable dataset as the training dataset.
[0060] In this embodiment, historical data of weekdays and holidays in the historical time period are analyzed and predicted separately. At the same time, the impact of environmental factors on power load is considered, which conforms to the actual fluctuation law of power load and improves the robustness of the trained power load prediction model.
[0061] Step S22: Construct a regularized loss function for the preset neural network model.
[0062] Specifically, an L2 regularized loss function is constructed for the predefined neural network model. For example, the sequence of response variables in the variable dataset is denoted as y. i-1 =x i ={x i-1,1 x i-1,2 , ..., x i-1,k}(2≤i≤n), the predicted response variable predicted by the preset neural network model is denoted as The L2 regularization loss function is then... in, For sequence y i with sequence In the squared loss sense, J(ω) is the penalty applied to the coefficients of each layer of the pre-defined neural network model (using L2 regularization), λ is a pre-selected penalty parameter that is greater than zero, and ||W i ||2 is used to represent the L2 norm.
[0063] Step S23: Train the preset neural network model for power load prediction N times based on the training dataset until the loss function converges to obtain the power load prediction model.
[0064] Among them, the power load forecasting model is either a holiday forecasting model or a weekday forecasting model.
[0065] Specifically, when the historical time period consists entirely of weekdays, the preset neural network model is trained N times on the training dataset for power load prediction until the loss function converges, resulting in a weekday prediction model. This weekday prediction model is used to predict the power load corresponding to the predicted independent variables for weekdays. Similarly, when the historical time period consists entirely of holidays, the preset neural network model is trained N times on the training dataset for power load prediction until the loss function converges, resulting in a holiday prediction model. This holiday prediction model is used to predict the power load corresponding to the predicted independent variables for holidays.
[0066] In this embodiment, historical data for weekdays and holidays within a historical time period are trained separately to obtain a holiday prediction model and a weekday prediction model, which are used to predict power load during holidays and weekdays, respectively. This conforms to the actual fluctuation patterns of power load and improves the robustness of the trained power load prediction model.
[0067] To be more specific, Figure 5 This is the flowchart of the i-th training iteration in N training iterations of power load forecasting, refer to... Figure 5 As shown, it includes the following steps S51-S52.
[0068] S51, input the target training independent variable into the neural network model obtained from the (i-1)th training to perform power load prediction processing, and obtain the predicted response variable of the target training independent variable.
[0069] The target training independent variable is any independent variable in the training dataset.
[0070] Specifically, a pre-defined neural network model is established, using Long Short Term Memory (LSTM) neurons as the basic unit and a seq2seq recurrent neural network as the basic architecture. An attention module is added to the output of the encoder of the pre-defined neural network model to focus on training key features of the training dataset. Therefore, the pre-defined neural network model in this application includes an encoder, an attention module, and a decoder. Figure 6 This is a flowchart illustrating how the target training variables are input into the neural network model obtained from the (i-1)th training iteration to perform power load prediction processing, resulting in the predicted response variables of the target training variables. (Refer to...) Figure 6 As shown, it includes the following steps S511-S513.
[0071] Step S511: Encode the target training independent variables using an encoder to obtain an encoded vector.
[0072] Step S512: Obtain the hidden state and score of each hidden unit in the encoder through the attention module, and calculate the power load vector of the target training independent variable based on the hidden state and score of each hidden unit.
[0073] Specifically, the attention module reconstructs the score of each hidden unit using the softmax function, obtaining the score of each hidden unit during this training process. Then, the hidden state and score of each hidden unit are multiplied separately to obtain the updated hidden state sequence for each hidden unit. Finally, all the updated hidden state sequences are summed to obtain the power load vector of the target training variable.
[0074] Step S513: Decode the encoded vector and the power load vector using a decoder to obtain the predicted response variable of the target training independent variable.
[0075] Specifically, each neuron in the decoder sequentially follows the formula... The encoded vector and the power load vector are processed to obtain the predicted response variable of the target training independent variable. The predicted response variable is used to represent the target training independent variable; W3 represents the weight of the current neuron; and d represents the bias term of the current neuron. The hidden state of the current neuron is represented by c, and the electrical load vector is represented by h. t-1 Used to represent the hidden state of the previous neuron, Used to represent the output of the previous neuron (when the previous neuron is a neuron of the encoder). (W1 is the weight of the power load vector, and W2 is the weight of the previous neuron's hidden state). The weights used to represent the output of the previous neuron. d is used to represent the bias term of the current hidden state of the neuron.
[0076] In this embodiment, when constructing the architecture of the preset neural network model, an attention mechanism and an LSTM network with long-term memory characteristics are introduced, which can retain the key information and fluctuation characteristics of the training data in the training dataset for a long time, thereby improving the feature representation level of the trained power load prediction model.
[0077] S52, based on the information loss between the response variable corresponding to the target training independent variable and the predicted response variable, the neural network model obtained in the (i-1)th training is trained for power load prediction in order to adjust the parameters of the neural network model obtained in the (i-1)th training.
[0078] Here, the information loss is the function value of the loss function corresponding to the neural network model obtained in the i-th training.
[0079] Specifically, based on the target training independent variable, the predicted response variable, and the loss function, the loss function value corresponding to the neural network model obtained in the i-th training is calculated, and the parameter gradient corresponding to the neural network model obtained in the i-th training is calculated using the Adaptive Momentum Optimization Algorithm (ADAM). Then, the parameters of the neural network model obtained in the (i-1)-th training are adjusted based on the parameter gradient to obtain the neural network model obtained in the i-th training.
[0080] For example, the adjustment rule for the i-th time is as follows: in, The gradient of the corresponding parameter is used to represent the gradient at training iteration i-1, β1 and β2 are used to represent the preset weight coefficients, a is used to represent the update step size, and m is used to represent the step size. i The moving mean of the gradient of the neural network model obtained from the i-th training iteration, v i w is used to represent the squared gradient of the neural network model obtained after the i-th training iteration. i The weights are used to represent the weights of the target neuron, which is any neuron in the neural network model obtained during the i-th training.
[0081] In this embodiment, the adaptive momentum optimization algorithm (ADAM) is used to update parameters, ensuring that the generated power load prediction model converges to the global optimum, thereby improving the prediction accuracy of the trained power load prediction model.
[0082] Optionally, the power load forecasting method further includes: performing a preset number of samplings with replacement on the variable dataset, and determining the unsampled variable dataset as the test dataset. Then, the neural network model trained N times using the test dataset is tested, and the parameters of the power load forecasting model are adjusted based on the test results. The test dataset includes at least one test independent variable and a corresponding test response variable for each test independent variable. Specifically, the process of testing the neural network model trained N times using the test dataset and adjusting the parameters of the power load forecasting model based on the test results is the same as the process of training the neural network model in any of steps S51-S52, and will not be repeated here. In this embodiment, determining the unsampled variable dataset as the test dataset and performing out-of-package estimation on the trained power load forecasting model reduces the risk of overfitting that may occur during the training of the power load forecasting model.
[0083] Optionally, during the N training iterations of the preset neural network model for power load prediction based on the training dataset, the hidden units in the preset neural network model are deactivated (dropout) according to a preset rule. Specifically, while keeping the other parameters of the preset neural network model unchanged, the deactivation probability gradually changes between 0.3 and 0.8. After each training iteration, the test error on the test set is calculated, and the deactivation probability with the optimal test error is used as the deactivation probability of the corresponding hidden unit in the next training iteration. In this embodiment, deactivating (dropout) the hidden units in the preset neural network model according to probability reduces the risk of overfitting that may occur during the training of the power load prediction model.
[0084] Step S24: Obtain the prediction independent variables and input them into the power load prediction model to obtain the power load corresponding to the prediction independent variables.
[0085] The independent variables for prediction include current environmental data and current power load data.
[0086] Specifically, when the independent variable is data corresponding to a weekday, it is input into the weekday prediction model to obtain the corresponding electricity load. When the independent variable is data corresponding to a holiday, it is input into the holiday prediction model to obtain the corresponding electricity load.
[0087] In this embodiment, a training dataset of historical environmental data and historical power load data is obtained. Then, a regularized loss function is constructed for a preset neural network model, and the preset neural network model is trained N times on power load prediction based on the training dataset until the loss function converges, thus obtaining the power load prediction model. Using historical environmental data and historical power load data as training data for the power load prediction model takes into account the impact of environmental factors on the power system's power load, improving the prediction accuracy of the trained power load prediction model.
[0088] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0089] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0090] Further reference Figure 7 As a response to the above Figure 2 The present application provides an embodiment of a power load forecasting device, which is similar to the method shown. Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0091] like Figure 7 As shown, the power load forecasting device 700 of this embodiment includes: an acquisition module 701, a construction module 702, a training module 703, and a forecasting module 704, wherein:
[0092] Acquisition module 701 is used to acquire a training dataset of historical data; the historical data includes historical environmental data and historical power load data, and the training dataset includes at least one training independent variable and a training response variable corresponding to each training independent variable; construction module 702 is used to construct a regularized loss function for a preset neural network model; training module 703 is used to perform N power load prediction training iterations on the preset neural network model based on the training dataset until the loss function converges, thereby obtaining a power load prediction model; the i-th step in the N power load prediction training iterations includes: inputting the target training independent variable into the neural network model obtained from the (i-1)-th training iteration for power load prediction processing, thereby obtaining the target... The target training independent variable is used as the predicted response variable. Based on the information loss between the response variable corresponding to the target training independent variable and the predicted response variable, the neural network model obtained in the (i-1)th training is trained for power load prediction to adjust the parameters of the neural network model obtained in the (i-1)th training. The target training independent variable is any independent variable in the training dataset. The information loss is the function value of the loss function corresponding to the neural network model obtained in the i-th training. The prediction module 704 is used to obtain the predicted independent variable and input the predicted independent variable into the power load prediction model to obtain the power load corresponding to the predicted independent variable. The predicted independent variable includes current environmental data and current power load data.
[0093] In this embodiment, a training dataset of historical environmental data and historical power load data is obtained. Then, a regularized loss function is constructed for a preset neural network model, and the preset neural network model is trained N times on power load prediction based on the training dataset until the loss function converges, thus obtaining the power load prediction model. Using historical environmental data and historical power load data as training data for the power load prediction model takes into account the impact of environmental factors on the power system's power load, improving the prediction accuracy of the trained power load prediction model.
[0094] In some possible implementations of this embodiment, the acquisition module 701 includes an acquisition submodule, a construction submodule, and a sampling module; the acquisition submodule is used to acquire historical data within a historical time period; the construction submodule is used to construct a variable dataset of the historical data based on the historical time period; the sampling module is used to perform a preset number of sampling processes with replacement on the variable dataset and determine the extracted variable dataset as the training dataset.
[0095] In this embodiment, historical data of weekdays and holidays in the historical time period are analyzed and predicted separately. At the same time, the impact of environmental factors on power load is considered, which conforms to the actual fluctuation law of power load and improves the robustness of the trained power load prediction model.
[0096] In some optional implementations of this embodiment, the variable dataset includes at least one independent variable and a response variable corresponding to each independent variable; the construction submodule includes a partitioning submodule and a processing submodule; the partitioning submodule is used to divide the historical time period into M sub-time periods on average; the processing submodule is used to process the historical data corresponding to each of the M sub-time periods to obtain the variable dataset of the historical data; the processing operation includes: determining the historical data corresponding to the first sub-time period as the first independent variable, and determining the historical power load data in the historical data corresponding to the second sub-time period as the response variable corresponding to the first independent variable; the first sub-time period is any sub-time period other than the last sub-time period in the M sub-time periods, and the second sub-time period is the next sub-time period adjacent to the first sub-time period.
[0097] In this embodiment, the problem of power load forecasting is integrated into a preset neural network model by using independent variables and corresponding response variables, providing a way to generate a training dataset for a power load forecasting model.
[0098] In some possible implementations of this embodiment, the preset neural network model includes an encoder, an attention module, and a decoder; the training module 703 includes an encoding submodule, a vector calculation submodule, and a decoding submodule; the encoding submodule is used to encode the target training independent variable through the encoder to obtain an encoded vector; the vector calculation submodule is used to obtain the hidden state and score of each hidden unit in the encoder through the attention module, and calculate the power load vector of the target training independent variable based on the hidden state and score of each hidden unit; the decoding submodule is used to decode the encoded vector and the power load vector through the decoder to obtain the predicted response variable of the target training independent variable.
[0099] In this embodiment, when constructing the architecture of the preset neural network model, an attention mechanism and an LSTM network with long-term memory characteristics are introduced, which can retain the key information and fluctuation characteristics of the training data in the training dataset for a long time, thereby improving the feature representation level of the trained power load prediction model.
[0100] In some possible implementations of this embodiment, the training module 703 further includes a gradient calculation submodule and a parameter adjustment submodule; the gradient calculation submodule is used to calculate the parameter gradient corresponding to the neural network model obtained in the (i-1)th training by means of an adaptive momentum optimization algorithm based on the response variable corresponding to the target training independent variable, the predicted response variable, and the loss function; the parameter adjustment submodule is used to adjust the parameters of the neural network model obtained in the (i-1)th training according to the parameter gradient, so as to obtain the neural network model obtained in the i-th training.
[0101] In this embodiment, the adaptive momentum optimization algorithm (ADAM) is used to update parameters, ensuring that the generated power load prediction model converges to the global optimum, thereby improving the prediction accuracy of the trained power load prediction model.
[0102] In some possible implementations of this embodiment, the power load prediction device further includes a processing module; the processing module is used to deactivate the hidden units in the preset neural network model according to preset rules during the process of training the preset neural network model for N power load predictions based on the training dataset.
[0103] In this embodiment, the hidden units in the preset neural network model are deactivated (dropout) according to probability, which reduces the risk of overfitting that may occur during the training of the power load prediction model.
[0104] In some possible implementations of this embodiment, the historical time period consists entirely of weekdays or all of the historical time period consists entirely of holidays, and the power load prediction model is either a holiday prediction model or a weekday prediction model. When the historical time period consists entirely of weekdays, the training module 704 is further configured to perform N power load prediction training cycles on the preset neural network model based on the training dataset until the loss function converges, thereby obtaining a weekday prediction model. The weekday prediction model is used to predict the power load corresponding to the prediction variables of weekdays based on the prediction variables of weekdays. When the historical time period consists entirely of holidays, the training module 704 is further configured to perform N power load prediction training cycles on the preset neural network model based on the training dataset until the loss function converges, thereby obtaining a holiday prediction model. The holiday prediction model is used to predict the power load corresponding to the prediction variables of holidays based on the prediction variables of holidays.
[0105] In this embodiment, historical data for weekdays and holidays within a historical time period are trained separately to obtain a holiday prediction model and a weekday prediction model, which are used to predict power load during holidays and weekdays, respectively. This conforms to the actual fluctuation patterns of power load and improves the robustness of the trained power load prediction model.
[0106] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed] for details. Figure 8 , Figure 8 This is a basic structural block diagram of the computer device in this embodiment.
[0107] The computer device 8 includes a memory 81, a processor 82, and a network interface 83 that are interconnected via a system bus. It should be noted that only the computer device 8 with components 81-83 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0108] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0109] The memory 81 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 81 may be an internal storage unit of the computer device 8, such as the hard disk or memory of the computer device 8. In other embodiments, the memory 81 may also be an external storage device of the computer device 8, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Of course, the memory 81 may include both internal storage units and external storage devices of the computer device 8. In this embodiment, the memory 81 is typically used to store the operating system and various application software installed on the computer device 8, such as computer-readable instructions for power load forecasting methods. In addition, the memory 81 can also be used to temporarily store various types of data that have been output or will be output.
[0110] In some embodiments, the processor 82 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 82 is typically used to control the overall operation of the computer device 8. In this embodiment, the processor 82 is used to execute computer-readable instructions stored in the memory 81 or to process data, such as executing computer-readable instructions for the power load forecasting method.
[0111] The network interface 83 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 8 and other electronic devices.
[0112] The computer device provided in this embodiment can execute the steps of the above-described power load forecasting method. The steps of the power load forecasting method here can be the steps in the power load forecasting methods of the various embodiments described above.
[0113] In this embodiment, a training dataset of historical environmental data and historical power load data is obtained. Then, a regularized loss function is constructed for a preset neural network model, and the preset neural network model is trained N times on power load prediction based on the training dataset until the loss function converges, thus obtaining the power load prediction model. Using historical environmental data and historical power load data as training data for the power load prediction model takes into account the impact of environmental factors on the power system's power load, improving the prediction accuracy of the trained power load prediction model.
[0114] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the power load forecasting method described above.
[0115] In this embodiment, a training dataset of historical environmental data and historical power load data is obtained. Then, a regularized loss function is constructed for a preset neural network model, and the preset neural network model is trained N times on power load prediction based on the training dataset until the loss function converges, thus obtaining the power load prediction model. Using historical environmental data and historical power load data as training data for the power load prediction model takes into account the impact of environmental factors on the power system's power load, improving the prediction accuracy of the trained power load prediction model.
[0116] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0117] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A power load forecasting method characterized by, The method comprises the following steps: obtaining a training data set of historical data; the historical data comprises historical environmental data and historical power load data, and the training data set comprises at least one training independent variable and a training response variable corresponding to each training independent variable; constructing a regularization loss function for a preset neural network model; performing N times of power load prediction training on the preset neural network model according to the training data set until the loss function converges, to obtain a power load prediction model; the i-th time of power load prediction training in the N times of power load prediction training comprises: inputting a target training independent variable into a neural network model obtained through i-1 times of training to perform power load prediction processing, to obtain a predicted response variable of the target training independent variable; and performing power load prediction training on the neural network model obtained through i-1 times of training based on information loss between a response variable corresponding to the target training independent variable and the predicted response variable, to adjust parameters of the neural network model obtained through i-1 times of training; the target training independent variable is any independent variable in the training data set; and the information loss is a function value of a loss function corresponding to a neural network model obtained through i times of training; obtaining a prediction independent variable and inputting the prediction independent variable into the power load prediction model to obtain a power load corresponding to the prediction independent variable; wherein the prediction independent variable comprises current environmental data and current power load data; wherein the preset neural network model comprises an encoder, an attention module and a decoder, and the process of inputting the target training independent variable into the neural network model obtained through i-1 times of training to perform power load prediction processing to obtain the predicted response variable of the target training independent variable comprises: encoding the target training independent variable through the encoder to obtain an encoding vector; obtaining a hidden state and a score of each hidden unit in the encoder through the attention module, and calculating a power load vector of the target training independent variable according to the hidden state and the score of each hidden unit; decoding the encoding vector and the power load vector through the decoder to obtain the predicted response variable of the target training independent variable; wherein the hidden state and the score of each hidden unit are multiplied to obtain an updated hidden state sequence of each hidden unit, and the updated hidden state sequences of all hidden units are added to obtain the power load vector of the target training independent variable; wherein an L2 term regularization loss function is constructed for the preset neural network model, a response variable sequence in a variable data set is recorded as y i-1 = x i = {x i-1,1 , x i-1,2 , …, x i-1,k}(2≤i≤n), a predicted response variable predicted by the preset neural network model is recorded as The L2 term regularization loss function is wherein, is a sequence y i and a sequence is a loss function in the sense of square loss, J(ω) is a penalty (using L2 term regularization) to each layer coefficient of the preset neural network model, λ is a penalty parameter greater than zero selected in advance, and ||W i ||2 is used to represent L2 norm.
2. The electric power load forecasting method according to claim 1, characterized by, the process of obtaining the training data set of historical data comprises: obtaining historical data in a historical time period; constructing a variable data set of the historical data according to the historical time period; performing preset times of sampling with replacement on the variable data set, and determining the sampled variable data set as the training data set.
3. The power load forecasting method according to claim 2, characterized by, the variable data set comprises at least one independent variable and a response variable corresponding to each independent variable; the process of constructing the variable data set of the historical data according to the historical time period comprises: averaging the historical time period into M sub-time periods; performing a processing operation on historical data corresponding to each of the M sub-time periods to obtain the variable data set of the historical data; The processing operation includes: determining historical data corresponding to a first sub-time period as a first independent variable, and determining historical power load data in the historical data corresponding to a second sub-time period as a response variable corresponding to the first independent variable; the first sub-time period is any sub-time period except the last sub-time period in the M sub-time periods, and the second sub-time period is a next sub-time period adjacent to the first sub-time period.
4. The power load forecasting method according to claim 1, characterized by, The adjusting the parameters of the neural network model obtained through the i-1th training includes: According to the response variable corresponding to the target training independent variable, the predicted response variable, and the loss function, the parameter gradient corresponding to the neural network model obtained through the i-1th training is calculated through an adaptive momentum optimization algorithm; According to the parameter gradient, the parameters of the neural network model obtained through the i-1th training are adjusted to obtain the neural network model obtained through the ith training.
5. The power load forecasting method according to claim 1, characterized in that, After constructing the regularization loss function for the preset neural network model, the power load prediction further includes: In the process of performing N times of power load prediction training on the preset neural network model according to the training data set, the hidden units in the preset neural network model are inactivated according to a preset rule.
6. The power load forecasting method according to claim 2, characterized in that, The historical time periods are all working days or the historical time periods are all holidays, and the power load prediction model is a holiday prediction model or a working day prediction model; When the historical time periods are all working days, the performing N times of power load prediction training on the preset neural network model according to the training data set until the loss function converges to obtain a power load prediction model includes: According to the training data set, N times of power load prediction training are performed on the preset neural network model until the loss function converges to obtain a working day prediction model; the working day prediction model is used to predict a power load corresponding to a prediction independent variable of a working day according to the prediction independent variable of the working day; When the historical time periods are all holidays, the performing N times of power load prediction training on the preset neural network model according to the training data set until the loss function converges to obtain a power load prediction model includes: According to the training data set, N times of power load prediction training are performed on the preset neural network model until the loss function converges to obtain a holiday prediction model; the holiday prediction model is used to predict a power load corresponding to a prediction independent variable of a holiday according to the prediction independent variable of the holiday.
7. An electric power load forecasting device characterized by comprising: It includes: An acquisition module is configured to acquire a training data set of historical data; the historical data includes historical environmental data and historical power load data, and the training data set includes at least one training independent variable and a training response variable corresponding to each training independent variable; A construction module is configured to construct a regularization loss function for a preset neural network model; A training module is configured to perform N times of power load prediction training on the preset neural network model according to the training data set until a loss function converges to obtain a power load prediction model; The step of the i-th power load prediction training includes: inputting a target training independent variable into the neural network model obtained by the i-1-th training to perform power load prediction processing, obtaining a predicted response variable of the target training independent variable, and performing power load prediction training on the neural network model obtained by the i-1-th training based on the information loss between the corresponding response variable of the target training independent variable and the predicted response variable, to adjust the parameters of the neural network model obtained by the i-1-th training; the target training independent variable is any independent variable in the training data set; and the information loss is a function value of a loss function corresponding to the neural network model obtained by the i-th training. The prediction module is configured to obtain a prediction independent variable, and input the prediction independent variable into the power load prediction model to obtain a power load corresponding to the prediction independent variable; wherein the prediction independent variable includes current environmental data and current power load data. The preset neural network model includes an encoder, an attention module, and a decoder, and the training module includes an encoding submodule, a vector calculation submodule, and a decoding submodule; the encoding submodule is configured to encode the target training independent variable by using the encoder to obtain an encoding vector; the vector calculation submodule is configured to obtain a hidden state and a score of each hidden unit in the encoder by using the attention module, and calculate a power load vector of the target training independent variable according to the hidden state and the score of each hidden unit; and the decoding submodule is configured to decode the encoding vector and the power load vector by using the decoder to obtain a predicted response variable of the target training independent variable. The hidden state and the score of each hidden unit are multiplied to obtain an updated hidden state sequence of each hidden unit, and the updated hidden state sequences of all hidden units are added to obtain the power load vector of the target training independent variable. wherein an L2 term regularization loss function is constructed for the preset neural network model, a response variable sequence in a variable data set is recorded as y i-1 = x i = {x i-1,1 , x i-1,2 , …, x i-1,k}(2≤i≤n), a predicted response variable predicted by the preset neural network model is recorded as The L2 term regularization loss function is wherein, is a sequence y i and a sequence is a loss function in the sense of square loss, J(ω) is a penalty (using L2 term regularization) on each layer coefficient of the preset neural network model, λ is a penalty parameter greater than zero selected in advance, and ||W i ||2 is used to represent the L2 norm.
8. A computer device comprising a memory and a processor, wherein the memory stores computer readable instructions, and the processor executes the computer readable instructions to implement the steps of the power load prediction method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer readable instructions, and the computer readable instructions are executed by the processor to implement the steps of the power load prediction method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Power load prediction method, power load prediction device and terminal equipment
CN108197773A
Power system short-term load prediction method and prediction device under influence of extreme factors
CN112270454A