Power load prediction method and device, computer equipment and readable storage medium
By introducing a deep learning model with temporal and spatial attention mechanisms in power load forecasting and combining data from multiple sub-geographical regions, the problem of inaccurate power load forecasting in existing technologies is solved, and a more accurate and coherent power load forecast is achieved.
Patent Information
- Application Number
- CN202510618836.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-14
- Publication Date
- 2025-10-03
AI Technical Summary
In existing technologies, power load forecasting usually relies on localized models, which makes it difficult to accurately predict changes in power demand for the entire city from a macro perspective, resulting in inaccurate forecast results.
A deep learning model with temporal attention mechanism and spatial attention mechanism is adopted. The historical power load and meteorological data of multiple sub-geographical areas within the target geographical area are combined. The data sequence is intercepted through a sliding window to capture the temporal and spatial dependency features for prediction.
The accuracy and robustness of power load forecasting are improved, which enables a more comprehensive understanding and prediction of power load changes in the entire target geographical area, and enhances the consistency and reliability of the forecast.
Smart Images

Figure CN120749685A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of power load processing, and in particular to a power load forecasting method, apparatus, computer equipment, and readable storage medium. Background Art
[0002] The power industry is a vital foundational energy sector for economic development. Through power generation, transmission, and distribution, it provides society with a continuous and reliable supply of electricity. With the development of society and the improvement of people's living standards, the demand for electricity is increasing year by year. Power load forecasting has become a crucial component of power system planning, operation, and management. Power load forecasting allows for a scientific and rational estimation of future power demand, guiding the construction and operation of power grids and ensuring the safe, economical, and efficient operation of the power system.
[0003] In related technologies, when predicting power load, single-point predictions are usually based on some basic statistical methods or early machine learning algorithms. For example, multiple monitoring points are set up in different sub-regions of a region, and each monitoring point independently uses its own historical load data for prediction without considering the data of other monitoring points. However, for power companies, in order to achieve efficient resource allocation and cost control, unified planning and coordination from a macro perspective are required. Relying on localized models makes it difficult to accurately predict changes in power demand for the entire city, resulting in inaccurate power load forecasting results. Summary of the Invention
[0004] The main purpose of the embodiments of the present application is to propose a power load forecasting method, apparatus, computer equipment and readable storage medium, which can improve the accuracy of power load forecasting.
[0005] To achieve the above objectives, a first aspect of an embodiment of the present application provides a method for power load forecasting, the method comprising:
[0006] Obtaining historical power load impact data corresponding to each sub-geographical area within the target geographical area, wherein the historical power load impact data includes historical power load impact sub-data at multiple historical time points;
[0007] According to the target sliding window, sequentially extracting a plurality of historical power load impact data subsequences corresponding to a plurality of historical time periods from the historical power load impact data corresponding to each of the sub-geographical areas, and obtaining a sequence to be predicted for each of the historical time periods based on the plurality of historical power load impact data subsequences corresponding to the plurality of sub-geographical areas in each historical time period;
[0008] For each historical period, the sequence to be predicted is sequentially input into the pre-trained target model;
[0009] Through the time attention mechanism and the space attention mechanism in the target model, the time dependence characteristics between the multiple historical power load impact sub-data corresponding to the multiple historical time points contained in the sequence to be predicted, and the space dependence characteristics between the multiple sub-geographical areas are calculated, so as to predict the multiple power load sub-data of the multiple sub-geographical areas in the next adjacent time period based on the time dependence characteristics and the space dependence characteristics.
[0010] Accordingly, a second aspect of the embodiments of the present application provides a power load forecasting device, the device comprising:
[0011] An acquisition module, configured to acquire historical power load impact data corresponding to each sub-geographical area within the target geographical area, wherein the historical power load impact data includes historical power load impact sub-data at multiple historical time points;
[0012] an interception module, configured to sequentially intercept, according to a target sliding window, a plurality of historical power load impact data subsequences corresponding to a plurality of historical time periods from the historical power load impact data corresponding to each sub-geographical area, and obtain a sequence to be predicted for each historical time period based on the plurality of historical power load impact data subsequences corresponding to each historical time period for the plurality of sub-geographical areas;
[0013] An input module, configured to sequentially input the pre-trained target model for the sequence to be predicted corresponding to each historical period;
[0014] A calculation module is used to calculate the time dependence characteristics between multiple historical power load impact sub-data corresponding to multiple historical time points contained in the sequence to be predicted, as well as the spatial dependence characteristics between the multiple sub-geographical areas through the time attention mechanism and the spatial attention mechanism in the target model, so as to predict the multiple power load sub-data of the multiple sub-geographical areas in the next adjacent time period based on the time dependence characteristics and the spatial dependence characteristics.
[0015] In some embodiments, the historical power load impact sub-data corresponding to each sub-geographical area includes historical power load sub-data and historical meteorological sub-data; and the interception module is further configured to:
[0016] Obtaining the forecasted meteorological sub-data for each sub-geographical area for the next adjacent period corresponding to the forecast in each historical period;
[0017] adding the predicted meteorological sub-data to a historical power load impact sub-data sequence corresponding to each of the sub-geographical regions, so as to generate an updated historical power load impact sub-data sequence corresponding to each of the sub-geographical regions based on the predicted meteorological sub-data, the historical power load sub-data, and the historical meteorological sub-data;
[0018] Based on multiple updated historical power load impact data subsequences corresponding to multiple sub-geographical areas in each historical period, a sequence to be predicted in each historical period is obtained.
[0019] In some embodiments, the power load forecasting apparatus further includes a mask module configured to:
[0020] When the next adjacent period predicted for each historical period is not the target prediction period, masking the plurality of power load sub-data and outputting the masked result;
[0021] When the next adjacent period predicted in each historical period is the target prediction period, the plurality of power load sub-data are output.
[0022] In some embodiments, the power load forecasting device further includes a coding module for:
[0023] Encoding the historical power load impact sub-data contained in the sequence to be predicted to obtain a first encoding result;
[0024] Obtaining location information corresponding to each of the sub-geographical areas, and time information corresponding to each of the sub-geographical areas at multiple historical time points included in each historical period, encoding the time information and the location information, and embedding the encoded information into the first encoding result to obtain an encoded sequence to be predicted; wherein the time information includes holiday information for each historical time point and time interval information for the historical time point;
[0025] Then, the sequence to be predicted corresponding to each historical period is sequentially input into the pre-trained target model, including:
[0026] The encoded sequence to be predicted corresponding to each historical period is sequentially input into the pre-trained target model.
[0027] In some embodiments, the power load forecasting apparatus further includes a training module for:
[0028] Obtaining sample power load impact data corresponding to each sample sub-geographical area within the sample target geographical area, wherein the sample power load impact data includes sample power load impact sub-data at multiple sample time points;
[0029] sequentially extracting, according to the sample time step, a plurality of sample power load impact data subsequences corresponding to a plurality of sample time periods from the sample power load impact data corresponding to each sample sub-geographical area, and obtaining a sample sequence to be predicted for each sample time period based on the plurality of sample power load impact data subsequences corresponding to each sample time period for the plurality of sample sub-geographical areas;
[0030] For each sample period, the sample sequence to be predicted is sequentially input into the preset model;
[0031] By using the temporal attention mechanism and the spatial attention mechanism in the preset model, the sample time dependency features between the plurality of sample power load impact sub-data corresponding to the plurality of sample time points included in the sample sequence to be predicted, and the sample spatial dependency features between the plurality of sample sub-geographical areas are calculated, so as to predict the plurality of first power load sub-data of the plurality of sample sub-geographical areas in the next adjacent sample time period based on the sample time dependency features and the sample spatial dependency features;
[0032] Acquire a plurality of second power load sub-data of the plurality of sample sub-geographical areas in a next sample adjacent time period;
[0033] determining a target loss based on differences between the plurality of first power load sub-data and the plurality of second power load sub-data predicted in a plurality of sample time periods;
[0034] Based on the target loss, the parameters of the preset model are adjusted to obtain a target model.
[0035] In some embodiments, the training module is further configured to:
[0036] For each sample time point in a plurality of next sample adjacent time periods predicted for each sample time period, obtaining a first square of the first power load sub-data and a second square of the second power load sub-data corresponding to each sample sub-geographical area, and determining a first difference based on a difference between the second square and the first square;
[0037] Obtaining a first sub-loss corresponding to each sample time point according to a sum of multiple first differences corresponding to the multiple sample geographical areas;
[0038] The first target sub-loss is obtained by summing the multiple first sub-losses predicted at multiple sample time points;
[0039] For each sample time point in the plurality of next sample adjacent time periods predicted for each sample time period, obtaining a sum of the plurality of first power load sub-data corresponding to the plurality of sample geographical areas to obtain a first power load sum;
[0040] Obtaining a second power load sum of the sample target geographical area at each sample time point, and determining a second difference based on a difference between the second power load sum and the first power load sum;
[0041] Obtaining a second target sub-loss based on the sum of multiple second difference values corresponding to the multiple sample time points predicted by the preset model;
[0042] A target loss is determined based on the first target sub-loss and the second target sub-loss.
[0043] In some embodiments, the training module is further configured to:
[0044] For the sample sequence to be predicted corresponding to each sample period, determining a target sub-geographical area and a target covering time point that the sample sequence to be predicted needs to cover;
[0045] In the sample sequence to be predicted, masking is performed on the sample power load impact sub-data of the target sub-geographical area at the target covering time point to obtain a masked sample sequence to be predicted corresponding to each sample period;
[0046] The masked sample sequence to be predicted corresponding to each sample period is sequentially input into the preset model.
[0047] Correspondingly, the third aspect of the embodiments of the present application proposes a computer device, which includes a memory and a processor, the memory stores a computer program, and the processor implements the power load forecasting method described in any one of the embodiments of the first aspect of the present application when executing the computer program.
[0048] Correspondingly, the fourth aspect of the embodiments of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the power load forecasting method described in any one of the embodiments of the first aspect of the present application.
[0049] The embodiment of the present application obtains historical power load impact data corresponding to each sub-geographical area within a target geographic area, the historical power load impact data including historical power load impact sub-data at multiple historical time points; sequentially extracts multiple historical power load impact data sub-sequences corresponding to multiple historical time periods from the historical power load impact data corresponding to each sub-geographical area according to a target sliding window, and obtains a sequence to be predicted for each historical time period based on the multiple historical power load impact data sub-sequences corresponding to each historical time period for the multiple sub-geographical areas; sequentially inputs the sequence to be predicted corresponding to each historical time period into a pre-trained target model; and calculates the temporal dependency features between the multiple historical power load impact sub-data corresponding to the multiple historical time points contained in the sequence to be predicted, as well as the spatial dependency features between the multiple sub-geographical areas, through the temporal and spatial dependency features in the target model, so as to predict the multiple power load sub-data of the multiple sub-geographical areas in the next adjacent time period based on the temporal and spatial dependency features. In this way, the target model obtains the historical power load impact data of each sub-geographical area within the target geographic area, which means that the present application can capture a wider range of spatial correlations through a global perspective, thereby providing a more comprehensive and accurate prediction. On this basis, the present application introduces a temporal attention mechanism and a spatial attention mechanism, which allows the target model to effectively identify and utilize the temporal and spatial factors that have a significant impact on the power load in the sequence to be predicted corresponding to each historical period, so that the target model can more comprehensively understand and predict the changes in the power load of the entire target geographical area. In addition, by predicting the sequence to be predicted in each historical period in sequence, the target model can effectively learn the long-term dependencies in the historical power load impact data, so that the target model can fully learn the changing patterns of the data and improve the accuracy of power load prediction. In summary, the present application can improve the accuracy of power load prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 This is a schematic diagram of the architecture of the power load forecasting system provided in an embodiment of the present application;
[0051] Figure 2 This is a flow chart of the power load forecasting method provided by an embodiment of the present application;
[0052] Figure 3 This is a schematic diagram of target sliding window intercepting data provided by an embodiment of the present application;
[0053] Figure 4 It is a weekly information coding diagram provided in an embodiment of the present application;
[0054] Figure 5 It is a time information coding diagram provided by an embodiment of the present application;
[0055] Figure 6 This is an architecture diagram of the target model provided in the embodiment of the present application;
[0056] Figure 7 This is a schematic diagram of the temporal attention mechanism processing process provided by an embodiment of the present application;
[0057] Figure 8 This is a schematic diagram of the spatial attention mechanism processing process provided by an embodiment of the present application;
[0058] Figure 9 This is a schematic diagram of the model intermediate data processing provided by the embodiment of the present application;
[0059] Figure 10 This is an example diagram of the overall training process of the preset model provided in the embodiment of the present application;
[0060] Figure 11 This is a schematic diagram of a mask provided in an embodiment of the present application without considering data missing.
[0061] Figure 12 Schematic diagram of a mask considering data missing provided in an embodiment of the present application;
[0062] Figure 13 This is an overall flow chart of the power load forecasting method provided in the embodiment of the present application;
[0063] Figure 14 This is a functional module diagram of the power load forecasting device provided in an embodiment of the present application;
[0064] Figure 15 This is a schematic diagram of the hardware structure of the computer device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0066] It should be noted that although the device schematics illustrate functional module divisions and the flowcharts illustrate logical sequences, in certain circumstances, the steps shown or described may be performed in a sequence that differs from the module divisions in the device or the sequence in the flowcharts. The terms "first," "second," and so on, in the specification, claims, and drawings, are used to distinguish similar items and are not necessarily used to describe a specific sequence or precedence.
[0067] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0068] The power industry is a vital foundational energy sector for economic development. Through power generation, transmission, and distribution, it provides society with a continuous and reliable supply of electricity. With the development of society and the improvement of people's living standards, the demand for electricity is increasing year by year. Power load forecasting has become a crucial component of power system planning, operation, and management. Power load forecasting allows for a scientific and rational estimation of future power demand, guiding the construction and operation of power grids and ensuring the safe, economical, and efficient operation of the power system.
[0069] In related technologies, when predicting power load, single-point predictions are usually based on some basic statistical methods or early machine learning algorithms. For example, multiple monitoring points are set up in different sub-regions of a region, and each monitoring point independently uses its own historical load data for prediction without considering the data of other monitoring points. However, for power companies, in order to achieve efficient resource allocation and cost control, unified planning and coordination from a macro perspective are required. Relying on localized models makes it difficult to accurately predict changes in power demand for the entire city, resulting in inaccurate power load forecasting results.
[0070] Based on this, the embodiments of the present application provide a power load forecasting method, apparatus, computer equipment and readable storage medium, which can improve the accuracy of power load forecasting.
[0071] The power load forecasting method, apparatus, computer equipment, and readable storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the power load forecasting system in the embodiments of the present application is described.
[0072] Please refer to Figure 1 In some implementations, the present application provides an electric power load forecasting system.
[0073] Exemplarily, the power load forecasting system includes a terminal 11 and a server 12. Specifically, terminal 11 can be a weather station for collecting and recording power load data in real time, a sensor for monitoring the operating status of the power grid, a mobile device for inputting data, and so on. Terminal 11 can collect power load data and meteorological data in real time, perform preliminary processing on the collected data, and transmit the pre-processed data to server 12 via a network.
[0074] Furthermore, the server side 12 can be a cloud computing platform or a dedicated server cluster. The server side 12 can further process the collected data, such as data normalization and encoding, to provide high-quality input data for the target model, and run the target model to perform model training and prediction calculations to predict multiple power load sub-data corresponding to multiple sub-geographical areas and the total power load data of the target geographical area.
[0075] The terminal 11 and the server 12 work together to complete an efficient power load forecasting process, thereby improving the accuracy of the forecast and enhancing the system's response speed and service reliability.
[0076] The power load forecasting method in the embodiments of the present application can be illustrated by the following embodiments.
[0077] It should be noted that in each specific embodiment of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first. Moreover, the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0078] In the embodiment of the present application, the power load forecasting device will be described from the perspective of the power load forecasting device, which can be integrated into a computer device. Figure 2 , Figure 2 This is a flowchart of the steps of the power load forecasting method provided in an embodiment of the present application. In this embodiment of the present application, the power load forecasting device is specifically integrated into a terminal or server as an example. When the processor on the terminal or server executes the program instructions corresponding to the power load forecasting method, the specific process is as follows:
[0079] Step 101 : Obtain historical power load impact data corresponding to each sub-geographical area within a target geographical area. The historical power load impact data includes historical power load impact sub-data at multiple historical time points.
[0080] In some embodiments, to improve the accuracy of future charge predictions, relevant historical data of each sub-geographical area within the target geographic area can be comprehensively collected to ensure that there is sufficient information to capture the power load characteristics at different spatial locations and their trends over time.
[0081] The target geographic area can be the specific geographic location range for power load forecasting. The target geographic area can be an entire province or a larger area. The power grid company corresponding to the target geographic area is responsible for the production and distribution of electricity in all sub-geographical areas within the entire target geographic area, including power generation, transmission, distribution, and power consumption. Therefore, the power consumption of sub-geographical areas within the same target geographic area may be highly correlated. By obtaining historical power load impact data for multiple sub-geographical areas, it is possible to fully explore the changes in power consumption in different areas and improve the accuracy of power load forecasting for the entire target geographic area.
[0082] Among them, the sub-geographical area can be a more fine-grained division unit within the target geographical area, usually corresponding to a specific administrative area (such as a city, district, county, etc.). The sub-geographical area generally also corresponds to a set of data management systems for power load (such as a municipal power grid), and each sub-geographical area is under the unified management of the target geographical area.
[0083] Historical power load impact data may include, but is not limited to, various information directly or indirectly related to power consumption over the past period. Historical power load impact data can cover multiple dimensions, such as historical power load sub-data, historical meteorological sub-data (temperature, humidity, wind speed, etc.), holiday schedules, special events (such as large-scale events), and so on. These data collectively contribute to the changing patterns of power load.
[0084] Among them, the historical time point can be a timestamp set used to describe the historical power load impact data, indicating the data collection point at a specific moment. The historical time point can be a time unit of minutes, hours, days or even a longer time span, depending on the requirements of the prediction task.
[0085] The historical power load impact sub-data can be one or more sets of relevant variable values collected for a specific sub-geographical region at each historical time point. The historical power load impact sub-data represents the status of various factors that affect power load within the corresponding sub-geographical region at that historical time point. For example, at historical time point 1, a dataset is composed of factors such as the total historical power load, historical weather conditions, and date characteristics for sub-geographical region A.
[0086] For example, the historical power load impact data corresponding to each sub-geographical area within the target geographical area may be obtained from a weather station, a power grid company data center, or a third-party data provider through a data acquisition system.
[0087] In some embodiments, since power load impact data often has obvious periodicity and trend characteristics, for example, the daily load curve has morning peaks and evening peaks, the annual load curve has summer peaks and winter troughs, high temperature weather will lead to an increase in air-conditioning load, and rainy weather will lead to a decrease in industrial load, etc., therefore, historical power load impact sub-data at multiple historical time points can be obtained to help the target model capture these periodic and trend characteristics, thereby more accurately predicting the power load in future time periods.
[0088] By obtaining the historical power load impact data corresponding to each sub-geographical area within the target geographical area, a solid data foundation can be built to facilitate the subsequent efficient and accurate power load forecasting.
[0089] Step 102, according to the target sliding window, sequentially extract multiple historical power load impact data subsequences corresponding to multiple historical time periods from the historical power load impact data corresponding to each sub-geographical area, and obtain the sequence to be predicted for each historical time period based on the multiple historical power load impact data subsequences corresponding to the multiple sub-geographical areas in each historical time period.
[0090] In some embodiments, in order to ensure that the target model can effectively learn the spatiotemporal characteristics of power load changes, the historical power load impact data corresponding to each sub-geographical area can be sequentially intercepted according to the target sliding window, so as to ensure that the target model can correctly use historical information in the order of time development when making predictions, and at the same time enable the target model to capture the changing characteristics at different time scales, thereby improving the accuracy and robustness of the prediction.
[0091] Among them, the target sliding window can be the time interval unit selected when performing power load forecasting, which determines the data granularity of model processing and prediction. The target sliding window can be divided according to historical time points, such as 3 time points, 5 time points, etc.; the target sliding window can also be divided according to time periods, for example, a target sliding window can include 3 days, 5 days, 7 days of data, etc.
[0092] Among them, the historical period can include historical power load impact data of multiple historical time points, which is the historical power load impact data corresponding to the sliding window. These data are used to train the model or generate prediction input.
[0093] The historical power load impact data subsequence can be a continuous data segment extracted from the corresponding historical power load impact data within each sub-geographical region according to the target sliding window. The historical power load impact data subsequence includes the historical power load and associated historical influencing factors (such as temperature, humidity, etc.) at each historical time point in the sub-geographical region during the historical period. Each sub-geographical region corresponds to a historical power load impact data subsequence during each historical period.
[0094] The sequence to be predicted can be a comprehensive input sequence formed by integrating subsequences of historical power load impact data from multiple sub-geographical regions within the same historical period. This sequence serves as input to the target model, which calculates the spatiotemporal dependencies between all sub-geographical regions within that historical period and uses this to predict power load conditions for the next adjacent period.
[0095] Please refer to Figure 3 For example, assume that there are three sub-geographical areas (site 1, site 2, and site 3), and each site corresponds to historical power load impact data (including historical power load sub-data and historical meteorological sub-data, etc.). The historical power load impact data is organized in chronological order, and the historical power load impact sub-data corresponding to each site is intercepted according to the target sliding window (for example, every hour).
[0096] For example, if the target sliding window is 3 days, the historical power load impact data is intercepted in units of 3 days, and multiple historical power load impact data subsequences corresponding to the historical period from December 13, 2025 to December 15, 2025 of Site 1, Site 2, and Site 3 are intercepted. The multiple historical power load impact data subsequences corresponding to the historical period of Site 1, Site 2, and Site 3 are combined to generate the sequence to be predicted corresponding to the historical period (i.e. Figure 3 Then, according to the target time step (e.g., 2 days), the sliding window is moved to the historical period from December 15, 2025 to December 17, 2025, and the multiple historical power load impact data subsequences corresponding to site 1, site 2, and site 3 in the historical period are combined to generate the sequence to be predicted corresponding to the historical period (i.e., Figure 3 It will be appreciated that the above solution is merely an example. In practice, the number of sub-geographical areas may be 2, 6, 10, etc., and the target sliding window may also be determined based on actual conditions. This embodiment of the present application does not impose any specific limitation thereto.
[0097] Through the above method, the short-term fluctuations of historical power load impact data in different historical periods can be captured. At the same time, it can also facilitate the subsequent model to learn long-term trends in the process of predicting each sequence to be predicted in sequence, thereby adapting to the ever-changing power demand pattern and improving prediction accuracy.
[0098] In some embodiments, in order to fully utilize existing and predicted data resources and achieve a more accurate and practical prediction effect for power load, the historical power load impact sub-data corresponding to each sub-geographical area includes historical power load sub-data and historical meteorological sub-data. At the same time, the predicted meteorological sub-data for the time period to be predicted can also be introduced, and the historical power load impact sub-data sequence is updated with the predicted meteorological sub-data to improve the input quality of the model. For example, in step 102, "based on the multiple historical power load impact data sub-sequences corresponding to the multiple sub-geographical areas in each historical time period, obtaining the sequence to be predicted for each historical time period" may include:
[0099] (102.1) Obtaining the forecast meteorological sub-data for each sub-geographical area for the next adjacent period corresponding to the forecast in each historical period;
[0100] (102.2) adding the forecast meteorological sub-data to the historical power load impact sub-data sequence corresponding to each sub-geographical region to generate an updated historical power load impact sub-data sequence corresponding to each sub-geographical region based on the forecast meteorological sub-data, the historical power load sub-data, and the historical meteorological sub-data;
[0101] (102.3) Based on the multiple updated historical power load impact data subsequences corresponding to the multiple sub-geographical areas in each historical period, a sequence to be predicted in each historical period is obtained.
[0102] Among them, the next adjacent period can be a period after the current historical period. According to the sequence to be predicted in the historical period, the power load of the next adjacent period can be predicted. The next adjacent period can be a historical period or a period that finally needs to be predicted.
[0103] The predicted meteorological sub-data may be a dataset of expected meteorological conditions for each sub-geographical region used in predicting the next adjacent time period. The predicted meteorological sub-data may include predicted values of meteorological parameters such as temperature, humidity, wind speed, and precipitation. In some embodiments, when the predicted next adjacent time period is still a historical time period, the predicted meteorological sub-data is the historical meteorological sub-data corresponding to the next adjacent time period. When the next adjacent time period is the final time period to be predicted (no historical meteorological sub-data exists), the predicted meteorological sub-data is the predicted meteorological data. The predicted meteorological sub-data in this case may be obtained from the weather forecast.
[0104] The historical power load sub-data may be the actual power consumption recorded at multiple historical time points in a historical period, and is used to reflect the historical power consumption pattern of the corresponding sub-geographical area.
[0105] The historical meteorological sub-data may be the actual meteorological conditions at multiple historical time points in a historical period, which are used to enable the model to identify the influence of meteorological factors on power load.
[0106] Among them, the updated historical power load impact sub-data sequence can be a new sequence formed by adding the predicted meteorological sub-data to the original historical power load impact sub-data sequence, which contains richer information, that is, not only the past power load and meteorological conditions, but also the forecast of future meteorological conditions, thereby providing the target model with richer input features to better capture future power load changes.
[0107] For example, if there are sub-geographical areas A, B, and C, and the current historical period is from December 13, 2025 to December 15, 2025, and the next adjacent period is from December 16, 2025 to December 18, 2025, and the next adjacent period is a historical period that has already occurred, then the historical meteorological sub-data of sub-geographical areas A, B, and C from December 16, 2025 to December 18, 2025 can be directly used as the prediction. The meteorological sub-data are added to the historical power load impact sub-data sequences of sub-geographical area A, sub-geographical area B and sub-geographical area C from December 13, 2025 to December 15, 2025, respectively, to form multiple updated historical power load impact sub-data sequences corresponding to sub-geographical area A, sub-geographical area B and sub-geographical area C, respectively. Based on the multiple updated historical power load impact sub-data sequences, the sequence to be predicted with a historical period of December 13, 2025 to December 15, 2025 is obtained.
[0108] Further, assuming that the current historical period is from December 21, 2025 to December 23, 2025, if the next adjacent period is from December 24, 2025 to December 26, 2025, and this adjacent period is the future period that ultimately needs to be predicted, then the predicted meteorological data of sub-geographical area A, sub-geographical area B and sub-geographical area C from December 24, 2025 to December 26, 2025 can be obtained, and the corresponding predicted meteorological data can be added to the historical load impact sub-data sequences corresponding to sub-geographical area A, sub-geographical area B and sub-geographical area C respectively to form multiple updated historical power load impact sub-data sequences, and based on the multiple updated historical power load impact sub-data sequences, a sequence to be predicted with a historical period of December 21, 2025 to December 23, 2025 is formed.
[0109] By introducing predicted meteorological data, important estimated information on the impact on power load is provided for prediction, which not only improves the input quality of the model, but also enhances its ability to capture future changes in power load, so that subsequent models can achieve more accurate and practical prediction results.
[0110] Step 103 : For each sequence to be predicted corresponding to each historical period, the pre-trained target model is sequentially input.
[0111] In some embodiments, in order to utilize a pre-trained target model to process and predict power load, the sequence to be predicted for each historical period can be input into the model in sequence, which can ensure that the model gradually learns and accumulates data features from different periods, helps to maintain the consistency of the prediction, and enables the model to better adapt to the changes in power load over time.
[0112] Among them, the target model can be a pre-trained deep learning model specially designed for power load forecasting, which is used to capture complex patterns in long time series and interactions between multiple geographical regions, and predict power loads in all sub-geographical regions based on the captured information.
[0113] For example, assuming there are three historical periods, namely historical period 1 corresponding to March 18 to March 20, historical period 2 corresponding to March 21 to March 23, and historical period 3 corresponding to March 24 to March 26, then the sequence to be predicted corresponding to historical period 1 can be first input into the target model. After the target model makes a prediction based on the sequence to be predicted in historical period 1, the sequence to be predicted corresponding to historical period 2 is input into the target model. After the target model makes a prediction based on the sequence to be predicted in historical period 2, the sequence to be predicted corresponding to historical period 3 is input into the target model. In this way, the temporal consistency of the time series data can be maintained, so that the target model can learn the long-term dependency of the sequence, and thus make a more accurate power load forecast.
[0114] By sequentially inputting the pre-trained target model into the sequence to be predicted corresponding to each historical period, the target model's ability to learn time series characteristics can be enhanced, ensuring the consistency and reliability of the prediction results, which has a significant effect on subsequently improving the accuracy of power load forecasting.
[0115] In some embodiments, in order to construct a more comprehensive, detailed, and easy-to-process sequence to be predicted, the original data can be effectively encoded and necessary spatiotemporal features can be added to facilitate the target model's understanding of the input data while laying a solid foundation for achieving high-precision and high-robustness predictions. For example, before step 103, the following may also be included:
[0116] (A.1) encoding the historical power load impact sub-data contained in the sequence to be predicted to obtain a first encoding result;
[0117] (A.2) Obtaining location information corresponding to each sub-geographical region and time information corresponding to multiple historical time points within each historical period for each sub-geographical region, encoding the time information and location information, and embedding the encoded information into the first encoding result to obtain an encoded sequence to be predicted; wherein the time information includes holiday information and time interval information for each historical time point;
[0118] For each historical period corresponding to the sequence to be predicted, the pre-trained target model is input in sequence, including:
[0119] For each historical period, the encoded sequence to be predicted is sequentially input into the pre-trained target model.
[0120] Among them, the first encoding result can be to convert the original historical power load impact sub-data (including historical power load sub-data, historical meteorological sub-data and predicted meteorological sub-data) into a form that is more suitable for machine learning processing through a specific encoding algorithm or model, so that each historical power load impact sub-data is represented as a set of numerical feature vectors.
[0121] The location information may be information describing the specific geographical location of each sub-geographical area, which may be latitude and longitude coordinates, an administrative area code, or other information that can uniquely identify the geographical location.
[0122] Time information can include holiday information and time interval information. Holiday information indicates the holiday status at the corresponding historical time point. Because holidays often lead to significant changes in electricity usage patterns, holiday information is an important temporal feature. Time interval information can be the time interval between adjacent historical time points, which helps the target model understand the temporal continuity of the data and identify periodic and trend patterns.
[0123] In some implementations, the historical power load sub-data in the historical power load impact sub-data may be normalized, and the normalization formula is as follows:
[0124]
[0125] Among them, X is the original data, X max and X min are the minimum and maximum values in the same dimension data (such as the temperature dimension in the historical meteorological sub-data), respectively. ′ is the normalized data.
[0126] For example, the location information of each sub-geographical area can be encoded using one-hot encoding. Specifically, each sub-geographical area corresponds to a unique encoding vector whose length is equal to the number of all sites N. The i-th site can be represented by a vector of length N, where only the i-th element is 1 and the rest are 0. For example, if there are five sites, the first site can be encoded as [1, 0, 0, 0, 0].
[0127] For example, the time information may include holiday information, weekday / weekend information, quarterly information, weekly information, time interval information, etc. Different time information will be converted into a form understandable by the machine learning model through different encoding methods.
[0128] For example, holiday information can be encoded using a two-digit 0-1 code, with non-holidays encoded as [0,0] and holidays encoded as [0,1]; weekday / weekend information can be encoded using a two-digit 0-1 code, for example, weekdays are encoded as [0,0] and weekends are encoded as [1,0]; quarterly information can be encoded using a four-digit 0-1 code, and since there are four quarters in a year, it can be represented by four binary digits, i.e., the first quarter Q1 = [1,0,0,0], the second quarter Q2 = [0,1,0,0], the third quarter Q3 = [0,0,1,0], and the fourth quarter Q4 = [0,0,0,1].
[0129] Please refer to Figure 4 Furthermore, the week information can be encoded using sine and cosine functions. For the dth day of the week (from 0 = Monday to 6 = Sunday), the week encoding Week_Encoding can be defined as:
[0130]
[0131] Please refer to Figure 5 , time information (i.e. time interval information) can also be encoded using sine and cosine functions. For the t-th 15-minute interval in a day, the time encoding Day_Encoding is defined as:
[0132]
[0133] Furthermore, the site IDs corresponding to the sub-geographical regions, historical meteorological sub-data (including wind speed, temperature, rainfall, humidity, irradiance, etc.), and forecasted meteorological sub-data can all be encoded using one-hot encoding. For example, if there are five sites, then when site ID is 3, the corresponding encoded vector is [0, 0, 1, 0, 0].
[0134] Furthermore, after normalizing the historical power load sub-data and encoding the historical meteorological sub-data, a first encoding result can be obtained, and the time information and location information are correspondingly encoded according to the above encoding method and embedded in the first encoding result to obtain the encoded sequence to be predicted.
[0135] By encoding the relevant data, the encoded sequence to be predicted is obtained, which can enable the sequence to be predicted to fully reflect the spatial and temporal characteristics of the historical power load impact sub-data, provide high-quality input for the target model, and thus achieve more accurate and reliable power load forecasting.
[0136] In step 104, the time-dependent features between the multiple historical power load impact sub-data corresponding to the multiple historical time points included in the sequence to be predicted and the spatial-dependent features between the multiple sub-geographical areas are calculated through the time-dependent features and the spatial-dependent features, so as to predict the multiple power load sub-data of the multiple sub-geographical areas in the next adjacent time period based on the time-dependent features and the spatial-dependent features.
[0137] In some implementations, in order to achieve more accurate prediction, temporal attention mechanism and spatial attention mechanism can be used to mine deep structural information in the sequence to be predicted, so as to achieve efficient and accurate prediction results.
[0138] The temporal attention mechanism can be used to capture the relationships between each sub-geographic region at different time points in the forecast sequence. The temporal attention mechanism allows the target model to dynamically assign different weights to past historical time points, thereby focusing on the historical information that is most helpful for power load forecasting in the next adjacent period.
[0139] The spatial attention mechanism can be used to identify and quantify the spatial correlations between sub-geographic regions. Through the spatial attention mechanism, the target model can learn the sub-geographic regions with the most significant interactions, capture the complex connections between different sub-geographic regions, and thus better understand the cross-regional influencing factors.
[0140] Time-dependent features can be temporal patterns or trends that exist within each sub-geographical region over a long period of time. These patterns may span multiple historical time points, even days, weeks, or even longer. Time-dependent features can be used to reflect how electricity consumption behavior varies with factors such as seasons and holidays, helping to improve the accuracy of electricity demand forecasts for the next adjacent time period.
[0141] Among them, spatial dependence characteristics can be used to describe the mutual influence and association between different sub-geographical areas.
[0142] The power load sub-data may be predicted power load sub-data, that is, the power load sub-data of the next adjacent time period predicted by the sequence to be predicted corresponding to the historical time period.
[0143] Please refer to Figure 6 , Figure 6 This is the architecture diagram of the target model proposed in this application. In some embodiments, data can be encoded in the embedding layer of the target model to convert the input model data into a numerical feature vector. The encoding rules have been expanded above and will not be repeated here. Afterwards, the encoded sequence to be predicted can be initially transformed by the linear layer to adapt to the subsequent transformer layer processing.
[0144] Furthermore, the target model can include multiple Transformer layers, each of which consists of a temporal attention mechanism and a spatial attention mechanism. The temporal multi-head attention mechanism is used to calculate the dependencies between multiple historical time points corresponding to each sub-geographical region in the sequence to be predicted. Through this multi-head attention mechanism, the target model can capture the complex dependencies between different historical time points. The spatial multi-head attention mechanism can be used to calculate the spatial dependencies between multiple sub-geographical regions at the same historical time point. Through this multi-head attention mechanism, the target model can capture the complex spatial relationships between different sub-geographical regions.
[0145] Furthermore, residual connections are used in each Transformer layer to address the problems of vanishing and exploding gradients. Specifically, after the temporal and spatial attention mechanisms, the input and output are added together through residual connections, ensuring smooth information flow and avoiding gradient problems in deep networks.
[0146] Furthermore, after being processed by multiple Transformer layers, the final transformation is performed through the linear layer to output the predicted values of multiple power load sub-data for the next adjacent time period.
[0147] In some implementations, after completing the prediction for the sequence to be predicted corresponding to one historical period, the sequence to be predicted for the next historical period can be sequentially obtained and predicted until the next adjacent period predicted is the target prediction period to be predicted. At this point, prediction can be stopped and the power load sub-data for the target prediction period can be output. In this way, the target model can learn long-term dependent features rather than local features, thereby making more accurate predictions.
[0148] Please refer to Figure 7 In some embodiments, the temporal attention mechanism contained in each Transformer layer is described. Specifically, first, the input sequence to be predicted can be transposed from (batch, segment length, position dimension, feature dimension) to (batch, position dimension, segment length, feature dimension) to facilitate temporal attention calculation in the time dimension. Afterwards, the data can be reduced in dimension to (batch multiplied by position dimension, segment length, feature dimension) to reduce computational complexity. Furthermore, the temporal attention mechanism can be applied to the reduced-dimensional data to calculate the time-dependent features corresponding to each sub-geographical area, and the data can be restored to (batch multiplied by position dimension, segment length, feature dimension).
[0149] For example, suppose there is a seven-day historical series to be predicted, with each day's data including historical power load impact data for four sub-geographic regions. The input data has the following dimensions: batch 1, segment length 7, location dimension 4, and feature dimension 2. Using the temporal attention mechanism, the target model can capture the varying patterns in the impact of temperature changes on power load across different days.
[0150] Please refer to Figure 8 In some embodiments, the spatial attention mechanism contained in each Transformer layer is described. The spatial attention mechanism is mainly used to capture the spatial dependencies between different sub-geographical areas. Specifically, first, the time-dependent features output by the time attention mechanism can be upgraded to (batch, position dimension, segment length, feature dimension) to facilitate attention calculation in the spatial dimension. Afterwards, the data is transposed to (batch, segment length, position dimension, feature dimension) through the transposition layer, and then the data is reduced to (batch multiplied by segment length, position dimension, feature dimension). Furthermore, the spatial attention mechanism is applied to the reduced-dimensional data to calculate the spatial-dependent features. After the calculation is completed, the data can be upgraded back to (batch, segment length, position dimension, feature dimension). At this time, the data has integrated the time-dependent features and the spatial-dependent features.
[0151] For example, assuming that the sequence to be predicted includes historical power load impact sub-data of four sub-geographical regions, through the spatial attention mechanism, the target model can identify whether there is mutual influence between the power load changes between sub-geographical regions A and B, thereby improving the accuracy of power load forecasting.
[0152] Please refer to Figure 9In some embodiments, in order to enable the data to be predicted in the input layer to be effectively passed to the temporal attention mechanism and spatial attention mechanism in the transformer layer, a transposition layer can be added before the input and after the output of the temporal attention mechanism and the spatial attention mechanism. Specifically, in the temporal attention mechanism, the target model first converts the input data from (batch, segment length, position dimension, feature dimension) to (batch, position dimension, segment length, feature dimension) through a transposition operation to facilitate attention calculation in the temporal dimension. Then, the data is converted to (batch multiplied by position dimension, segment length, feature dimension) through a dimensionality reduction operation to reduce computational complexity. After the temporal attention mechanism is processed, the output data will enter the intermediate layer for further processing.
[0153] Furthermore, before the spatial attention mechanism, the intermediate layer converts the data from (batch multiplied by position dimension, segment length, feature dimension) back to (batch, segment length, position dimension, feature dimension) through dimensionality increase and transposition again, so as to facilitate attention calculation in the spatial dimension. Then, the data is converted to (batch multiplied by segment length, position dimension, feature dimension) through dimensionality reduction operation to prepare for the spatial attention mechanism.
[0154] Furthermore, after the spatial attention mechanism, in which the target model processes the spatially dependent features, the output data is fed back into the intermediate layer. The intermediate layer uses a dimensionality-increasing operation to convert the data from (batch multiplied by segment length, position dimension, feature dimension) back to (batch, segment length, position dimension, feature dimension) for processing by subsequent model layers.
[0155] When processing the sequence to be predicted containing time and space information, the intermediate layer performs multiple transposition and dimensionality increase / reduction operations, so that the target model can capture the dependency features in both the time dimension and the space dimension, and obtain a fusion feature that combines the time dependency features and the space dependency features, and make a more accurate prediction of future power load based on the fusion feature.
[0156] In some embodiments, when there is missing data in the sequence to be predicted, a mask matrix can be generated based on the missing data, and based on the mask matrix, the part corresponding to the missing data is given a very large negative value. After softmax, the attention weight of the position corresponding to the missing data is close to zero, so as to ensure that the target model does not allocate attention to the missing part, thereby avoiding invalid information consuming the prediction computing power of the target model and improving the efficiency and accuracy of the prediction.
[0157] The embodiment of the present application obtains historical power load impact data corresponding to each sub-geographical area within a target geographic area, the historical power load impact data including historical power load impact sub-data at multiple historical time points; sequentially extracts multiple historical power load impact data sub-sequences corresponding to multiple historical time periods from the historical power load impact data corresponding to each sub-geographical area according to a target sliding window, and obtains a sequence to be predicted for each historical time period based on the multiple historical power load impact data sub-sequences corresponding to each historical time period for the multiple sub-geographical areas; sequentially inputs the sequence to be predicted corresponding to each historical time period into a pre-trained target model; and calculates the temporal dependency features between the multiple historical power load impact sub-data corresponding to the multiple historical time points contained in the sequence to be predicted, as well as the spatial dependency features between the multiple sub-geographical areas, through the temporal and spatial dependency features in the target model, so as to predict the multiple power load sub-data of the multiple sub-geographical areas in the next adjacent time period based on the temporal and spatial dependency features. In this way, the target model obtains the historical power load impact data of each sub-geographical area within the target geographic area, which means that the present application can capture a wider range of spatial correlations through a global perspective, thereby providing a more comprehensive and accurate prediction. On this basis, the present application introduces a temporal attention mechanism and a spatial attention mechanism, which allows the target model to effectively identify and utilize the temporal and spatial factors that have a significant impact on the power load in the sequence to be predicted corresponding to each historical period, so that the target model can more comprehensively understand and predict the changes in the power load of the entire target geographical area. In addition, by predicting the sequence to be predicted in each historical period in sequence, the target model can effectively learn the long-term dependencies in the historical power load impact data, so that the target model can fully learn the changing patterns of the data and improve the accuracy of power load prediction. In summary, the present application can improve the accuracy of power load prediction.
[0158] In some embodiments, to ensure that the target model can make accurate predictions, the power load sub-data output from the to-be-predicted sequence that are not for the target prediction period can be masked to avoid obscuring the key prediction results that actually need to be predicted. For example, after predicting multiple power load sub-data for multiple sub-geographical regions in the next adjacent period based on the time-dependent features and the spatial-dependent features, the following steps may also be included:
[0159] (B.1) When the next adjacent period predicted in each historical period is not the target prediction period, masking is performed on the plurality of power load sub-data, and the masked results are output;
[0160] (B.2) When the next adjacent period predicted in each historical period is the target prediction period, a plurality of power load sub-data are output.
[0161] The target prediction period may be a specific time window in which a final prediction needs to be made.
[0162] The mask result may be a result obtained by processing the original data according to specific rules, and may be used to ignore unnecessary information to avoid confusing key prediction results in practical applications.
[0163] In some embodiments, since the target model needs to learn the long-term dependency of the historical power load impact data based on the sample sequence to be predicted corresponding to the historical period, the power load sub-data outputted in the prediction may correspond to the historical period when the prediction is performed in the early stage. For example, if the historical power load impact data of three historical periods is included, if the power load sub-data of the fourth period (i.e., the target prediction period) needs to be predicted based on the three historical periods, then, in the process of learning the long-term dependency relationship by the target model, the power load sub-data of the second historical period may be predicted by the sequence to be predicted corresponding to the first historical period, the power load sub-data of the third historical period may be predicted by the sequence to be predicted of the second historical period, and the power load sub-data of the fourth period may be predicted by the sequence to be predicted of the third historical period. Then, in this process, what really needs to be output is the power load sub-data of the fourth period (i.e., the target prediction period). Therefore, in the process of learning the dependency relationship and predicting the power load sub-data by the target model, the second historical period and the third historical period are not the target prediction period, and the power load sub-data of the second historical period and the power load sub-data of the third historical period may be masked and the masked result may be output. The fourth historical period is a target prediction period, and therefore, the predicted power load sub-data of each sub-geographical area at each time point in the fourth historical period may be output.
[0164] In some implementations, the power load sub-data predicted for each time period may be directly labeled and output without masking, so as to be distinguished from the power load sub-data for the target prediction time period.
[0165] Through the above methods, the target model can focus on the truly important prediction data.
[0166] In some embodiments, in order to build a target model that can efficiently and accurately predict power load, a preset model can be trained using sample power load impact data, and the parameters of the preset model can be continuously adjusted so that the model gradually has the ability to capture complex spatiotemporal dependencies using a spatiotemporal attention mechanism, thereby making accurate predictions of power load. For example, the target model can be trained in the following ways:
[0167] (C.1) obtaining sample power load impact data corresponding to each sample sub-geographical area within the sample target geographic area, the sample power load impact data including sample power load impact sub-data at multiple sample time points;
[0168] (C.2) sequentially extracting, according to the sample time step, a plurality of sample power load impact data subsequences corresponding to a plurality of sample time periods from the sample power load impact data corresponding to each sample sub-geographical area, and obtaining a sample sequence to be predicted for each sample time period based on the plurality of sample power load impact data subsequences corresponding to each sample time period for the plurality of sample sub-geographical areas;
[0169] (C.3) For each sample period, the sample sequence to be predicted is sequentially input into the preset model;
[0170] (C.4) calculating, using the temporal attention mechanism and spatial attention mechanism in the preset model, sample time dependency features between a plurality of sample power load impact sub-data corresponding to a plurality of sample time points included in the sample sequence to be predicted, and sample spatial dependency features between a plurality of sample sub-geographical regions, so as to predict a plurality of first power load sub-data for the plurality of sample sub-geographical regions in the next adjacent sample time period based on the sample time dependency features and the sample spatial dependency features;
[0171] (C.5) obtaining a plurality of second power load sub-data of the plurality of sample sub-geographical areas in a next sample adjacent time period;
[0172] (C.6) determining a target loss based on the differences between the plurality of first power load sub-data and the plurality of second power load sub-data predicted during the plurality of sample periods;
[0173] (C.7) Based on the target loss, adjust the parameters of the preset model to obtain the target model.
[0174] The sample target geographic area may be a specific geographic location range used to construct and evaluate a preset model during the training and validation phases, such as a province.
[0175] Among them, the sample sub-geographical area can be a more fine-grained division unit within the sample target geographical area. For example, if the sample target geographical area is a province, then each sample sub-geographical area can correspond to a city; if the sample target geographical area is a city, then each sample sub-geographical area can correspond to a district, and so on.
[0176] The sample power load impact data may include, but is not limited to, various information directly or indirectly related to power consumption over a period of time in the past, which is used to enable the preset model to learn long-term dependencies and output corresponding predicted first power load sub-data. The sample power load impact data may cover multiple dimensions, such as sample power load sub-data, meteorological parameters (temperature, humidity, wind speed, etc.), holiday schedules, special events (such as large-scale events), etc., so that the model can make accurate and comprehensive predictions based on the degree of influence of different factors in different geographical locations.
[0177] The sample time point can be a timestamp of a historical period, used to describe the data collection point during the sample period. The sample time point can be a time unit of minutes, hours, days, or even longer time spans.
[0178] Among them, the sample power load impact sub-data can be a group or multiple groups of related variable values collected for a specific sample sub-geographical area at each sample time point, which represents the status of various factors affecting the power load in the sample sub-geographical area at the sample time point.
[0179] Among them, the sample time step can be the time interval unit selected during the training process, which determines the data granularity processed and predicted by the preset model, and can be different scales such as minutes, hours, and days.
[0180] The sample period may be a time interval consisting of a series of continuous sample time points.
[0181] The sample power load impact data subsequence can be a continuous data segment extracted from the corresponding sample power load impact data within each sample sub-geographical area according to the sample time step. The sample power load impact data subsequence includes the sample power load and associated sample influencing factors (such as temperature, humidity, etc.) at each sample time point within the sample period for the sample sub-geographical area. Each sample sub-geographical area corresponds to a sample power load impact data subsequence within a sample period.
[0182] The sample sequence to be predicted can be a comprehensive input sequence formed by integrating the sample power load impact data subsequences of multiple sample sub-geographical regions within the same sample period. This sample sequence serves as input to the pre-set model, which calculates the spatiotemporal dependencies between all sample sub-geographical regions within the sample period and uses this to predict power load conditions for the next adjacent sample period.
[0183] Among them, the preset model can be an initialized deep learning model architecture, which includes a temporal attention mechanism and a spatial attention mechanism, aiming to capture complex patterns in the sample sequence to be predicted and the interactions between multiple sample sub-geographical regions.
[0184] Sample time-dependent features can be temporal patterns or trends that exist within each sample sub-geographic region over a long period of time. These temporal patterns may span multiple sample time points, or even days, weeks, or even longer. Sample time-dependent features can be used to reflect how electricity consumption behavior varies with factors such as seasons and holidays, helping to improve the accuracy of electricity demand forecasts for the next sample period.
[0185] Among them, the sample spatial dependence characteristics can be used to describe the mutual influence and correlation between different sample sub-geographical areas.
[0186] The next sample adjacent period may be a period immediately following the current known sample period. The first power load sub-data at each sample time point in the next sample adjacent period may be predicted through the sample prediction sequence corresponding to the current sample period.
[0187] The first power load sub-data may be predicted power load sub-data, that is, power load sub-data of the next sample adjacent time period predicted by the sample to be predicted sequence corresponding to the sample time period.
[0188] The second power load sub-data may be the actual recorded power load value in the next adjacent sample period, which is used to compare the accuracy of the prediction result of the preset model.
[0189] The target loss can be an indicator that measures the difference between the first power load sub-data predicted by the preset model and the actual second power load sub-data. By minimizing the target loss, the model parameters can be optimized and the prediction accuracy can be improved.
[0190] In some implementations, training of a preset model can be divided into a training phase, a fine-tuning phase, and a testing phase.
[0191] Next, the training process of the training phase is introduced.
[0192] The samples input into the preset model during the training phase are sample power load sub-data and sample meteorological sub-data, and the corresponding sample time information and sample location information are encoded and embedded to obtain the sample sequence to be predicted in the training phase; through the training phase, the preset model can learn the basic characteristics and patterns of time series data.
[0193] For example, during the training phase, sample power load impact data from seven consecutive days (or other time spans, depending on the actual situation) can be randomly selected to form the training samples for this batch. Afterwards, missing data can be checked, abnormal data can be identified, and random masking can be performed to simulate different types of missing data and improve the model's generalization ability.
[0194] Exemplarily, when simulating different types of missing data, the overall data loss of the entire sample sub-geographical area can be simulated. For example, the overall data loss of the sample sub-geographical area is simulated with a probability of 2% (which can be adjusted according to actual conditions), and a sample sub-geographical area is randomly selected, a starting time is randomly determined, and a masking length is randomly determined (the longest is 1 day, that is, 96 15-minute sampling points). The longer the masking length, the greater the probability of being selected.
[0195] Furthermore, we can simulate the absence of some variables in some time periods with a probability of 7%. Each variable has a 3% probability of being selected, and the variables (such as the temperature variable in the sample meteorological sub-data) are selected independently. For each selected variable, the starting time and masking length (the maximum is 1 day, that is, 96 15-minute sampling points) are randomly determined. Similarly, the longer the masking length, the greater the probability of being selected.
[0196] Furthermore, mixed-type data missing can be simulated with a probability of 1%. First, the operation is performed according to the method of overall data missing in the sample sub-geographical area, and then the data missing at the 8th time point on the 3rd day is performed according to the method of missing some variables and some time periods in the sample sub-geographical area.
[0197] Furthermore, the preset model can be trained using the sample power load impact data after simulated missing processing. During the training phase, the sample sequence to be predicted consisting of the sample power load sub-data and the sample meteorological sub-data can be first obtained, and the sample sequence to be predicted for each sample period can be embedded with the sample time information and sample location information and then input into the preset model. The preset model can output multiple first power load sub-data for the next sample adjacent period. In the process of processing multiple sample sequences to be predicted for all sample periods, the long-term dependency of the sequences can be learned, thereby making more accurate predictions.
[0198] Next, we introduce the training process of the fine-tuning stage.
[0199] Furthermore, during the fine-tuning phase, the pre-set model can be further adapted to specific scenarios in real-world applications, thereby improving its generalization and prediction accuracy. Therefore, during the fine-tuning phase, the predicted meteorological sub-data for the sample immediately adjacent to the sample moment can be added to create a more realistic and accurate sample sequence to be predicted. This helps the pre-set model better utilize this predicted data and improves prediction accuracy.
[0200] In some embodiments, the fine-tuning stage can first obtain a sample sequence to be predicted consisting of sample power load sub-data, sample meteorological sub-data, and sample predicted meteorological sub-data for the next sample adjacent time period, and embed the sample time information and sample location information into the sample sequence to be predicted for each sample time period and then input it into a preset model. The preset model can output multiple first power load sub-data for the next sample adjacent time period. In the process of processing multiple sample sequences to be predicted for all sample time periods, the long-term dependency of the sequences can be learned, thereby making more accurate predictions.
[0201] Through phased training, we can avoid overfitting of the preset model on complex data sets and ensure that the performance of the preset model on new data is more stable.
[0202] Please refer to Figure 10 , the overall training process of the preset model is introduced. Assume that a sample target geographical area is divided into multiple sample sub-geographical areas, and the goal is to enable the preset model to predict the power load of these sample sub-geographical areas in the future.
[0203] First, sample power load impact data can be obtained. Sample power load impact data can be collected for each sample sub-geographical area. The sample power load impact data includes sample power load sub-data and sample meteorological load sub-data at multiple sample time points.
[0204] Furthermore, sample period data can be intercepted from the sample power load impact data. Specifically, according to a certain sample time step (e.g., 1 day), a subsequence of sample power load impact data for multiple sample periods is intercepted from the sample power load impact data of each sample sub-geographical area. For example, for sample sub-geographical area A, the sample time step is 1, and the intercepted sample sliding window is 2 days. Then, in 4 days, three sample periods can be intercepted: 1 to 2 days, 2 to 3 days, and 3 to 4 days. Based on the sample power load impact data corresponding to each sample period, a subsequence of sample power load impact data corresponding to the sample sub-geographical area A in the corresponding sample period is constructed.
[0205] Furthermore, a sample sequence to be predicted can be constructed. Specifically, a sample sequence to be predicted can be constructed based on the data of each sample period, that is, the sample power load impact data subsequences of all sample sub-geographical areas in the same sample period are combined together.
[0206] Furthermore, the sample sequence to be predicted for each sample period is input into a preset model. The preset model can be a deep learning model, which uses the temporal attention mechanism and spatial attention mechanism in the preset model to calculate the sample time dependency features of the same sample sub-geographical region at different sample time points in the sample sequence to be predicted, and the sample spatial dependency features of different sample sub-geographical regions at the same sample time points.
[0207] Furthermore, the power load value of the next sample adjacent period can be predicted based on the calculated time-dependent characteristics and space-dependent characteristics. For example, when the sample period is from the 2nd to the 3rd day, the corresponding predicted next sample adjacent period is the 4th day. Then, the first sample power load impact data of the 4th day can be predicted based on the sample prediction sequence from the 2nd to the 3rd day.
[0208] Furthermore, in order to evaluate the accuracy of the prediction results, the second power load sub-data actually recorded in each sample sub-geographical area at each sample time point can be obtained, and the target loss of the preset model can be determined based on the gap between the first power load sub-data and the second power load sub-data, as well as the sum of the first power load of the sample target geographical area calculated from multiple first power load sub-data, and the sum of the second power load of the sample target geographical area calculated from multiple second power load sub-data.
[0209] Furthermore, based on the target loss, the model parameters of the preset model can be adjusted by the back propagation algorithm until the model convergence condition is reached, and the training can be stopped to obtain the target model. In some embodiments, the model convergence condition can be that the number of training times reaches a preset number of training times, for example, the preset number of training times is 100 times. When the preset model is trained for more than 100 times, the training can be stopped to obtain the target model. The specific value of the preset number of training times can be adjusted according to actual conditions, for example, it can be 200 times, 300 times, etc., and the embodiments of the present application do not impose specific restrictions on this.
[0210] Exemplarily, after completing the model training, the trained model can be evaluated using a pre-divided test set. Specifically, the data in the test set can be used to input into the trained model, and the prediction results can be generated through the model's time attention mechanism and spatial attention mechanism. Determine whether the prediction time range has been reached (for example, predicting the power load for the next week). If the prediction time range has not been reached, continue with the prediction of subsequent time periods; if the prediction time range has been reached, input the final prediction result and proceed to the next step. In the next step, the prediction result can be evaluated to check whether it meets the preset evaluation indicators (such as mean square error, accuracy, etc.). If the prediction result meets the requirements of the evaluation indicators, the test process is terminated and it is considered that the model has achieved the expected performance; conversely, if the prediction result fails to meet the requirements of the evaluation indicators, the model is fine-tuned and enters the fine-tuning stage to further optimize its performance.
[0211] Through the above method, a phased training strategy (pre-training, fine-tuning, and testing) can be used to ensure the adaptability and accuracy of the model in different scenarios. The pre-training stage enables the model to learn the basic characteristics of the time series, while the fine-tuning stage enables it to better adapt to specific situations in actual applications. In this way, the trained target model can have better generalization capabilities and achieve accurate prediction of power load.
[0212] In some embodiments, to enhance the robustness and generalization ability of the model, data missing conditions may be simulated during model training to ensure that the model can still provide accurate predictions when faced with data missing issues that may arise in actual operations. For example, (C.3) may include:
[0213] (C.3.1) For each sample sequence to be predicted corresponding to each sample period, determine the target sub-geographical area and target covering time point that the sample sequence to be predicted needs to cover;
[0214] (C.3.2) In the sample sequence to be predicted, mask the sample power load impact sub-data of the target sub-geographical area at the target masking time point to obtain the masked sample sequence to be predicted corresponding to each sample period;
[0215] (C.3.3) For each sample period, the masked sample sequence to be predicted is sequentially input into the preset model.
[0216] The target sub-geographical area may refer to a sample sub-geographical area that needs to be covered (ie, masked) within a specific sample period.
[0217] The target masking time point may be a sample time point within the corresponding sample period at which the data of the target sub-geographical area needs to be masked. The target masking time point may be a single sample time point or multiple consecutive sample time points. For example, the target masking time point may simulate the temporary loss of all data for the target sub-geographical area A at a certain hour of the day or at certain times over several days.
[0218] For example, if a preset model is used to predict daily power load for the next week, during the training phase, to improve the model's ability to handle unknown data, random masking can be performed on the data for any target sub-geographical area and any time period. For example, if the target sub-geographical area is Site B and the target masking time point is the fourth day, all data for Site B on the fourth day can be masked.
[0219] In some embodiments, random masking may be performed according to target variables (eg, sample meteorological sub-data such as temperature and humidity), or mixed masking may be performed according to target masking time points and target variables, and so on.
[0220] By randomly masking the sample sequence to be predicted, various data loss situations that may be encountered in actual applications are simulated, and the preset model's ability to process unknown data is improved. This not only improves the prediction accuracy of the preset model, but also enhances its adaptability and reliability in actual applications.
[0221] In some embodiments, since the sample to be predicted sequence of multiple sample time periods is predicted one by one, in order to maintain causality and avoid information leakage in the training stage, a mask mechanism can be used to ensure that when the preset model calculates the sample time-dependent features and the sample space-dependent features, only the values before the current position can be used, and the values after the current position cannot be seen.
[0222] In some embodiments, when missing data is not considered, for sample meteorological sub-data such as temperature, humidity, and irradiance, in order to use the sample meteorological sub-data of the historical period and the sample predicted meteorological sub-data of the next sample adjacent period, for the sample meteorological sub-data and sample predicted meteorological sub-data corresponding to each sample sub-geographical area, all sample meteorological sub-data or sample predicted meteorological sub-data intercepted from each sample sub-geographical area can be used. For each variable, an N×N mask matrix M can be generated, and then:
[0223]
[0224] Among them, M ijIndicates whether the i-th position can obtain the information of the j-th position. The mask matrix M can make the i-th position only obtain the information of the adjacent period of the next sample and the previous historical period. 0 means no mask setting, and -∞ means mask setting. Temperature, humidity, and irradiation are as follows Figure 11 In the masking method of the lower triangle shown, the value of the gray part is 0, and the values of the next sample adjacent period and the previous historical period are used, while the values after the next sample adjacent period cannot be seen.
[0225] For the sample power load sub-data, in order to predict the value of the next sample adjacent period, the values of the next sample adjacent period and the period after can be masked in the mask matrix, considering the sample power load sub-data of the historical period. For the N×N mask matrix F composed of all the sample power load sub-data intercepted from each sample sub-geographical area, we have:
[0226]
[0227] Among them, F ij Indicates whether the i-th position can obtain the information of the j-th position. The mask matrix F can prevent the i-th position from obtaining its own and subsequent values. The sample power load sub-data can also use the lower triangle mask method, but do not consider the diagonal, that is, Figure 11 In the mask method shown, the gray part has a value of 0, and the value before the current position is used, while the value after the current position cannot be seen.
[0228] In some implementations, when calculating the attention score, the mask matrices M and F can be applied to the dot product of the query and the key as follows:
[0229]
[0230] Among them, QK T represents the dot product of the transpose of the query matrix Q and the key matrix K, which is used to calculate the similarity between the query and the key; It is the square root of the key matrix dimension and is used to scale the dot product result. If the box value is too large, the gradient will disappear. The softmax function is used to convert the dot product result into a probability distribution, which represents the relevance of each sample time point to the current prediction.
[0231] In some embodiments, when missing data (i.e., outliers) are considered, the missing data can be set as a special mark. In this application, the mask value of the missing data is set to a very large negative number, so that when calculating the attention weight, the impact of the missing data on other points will be minimized. The principle of masking is as follows:
[0232] In order to handle outliers and utilize future data, a missing value mask matrix H is designed:
[0233]
[0234] When considering missing data, for the input part, when calculating the attention score, not only the mask matrices M and F mentioned above are applied to the dot product results of the query and key, but also the missing value mask matrix H generated based on the missing data is considered:
[0235]
[0236] By adding the mask matrices M, F, and H to QK T The masked positions will get a large negative value. After softmax, the attention weights of these positions are close to zero. Considering the mask diagram of data missing, Figure 12 In the self-attention calculation, the input mask ensures that the preset model does not allocate attention to the missing parts of the data, thereby preventing invalid information from interfering with the model's learning.
[0237] The masking method described above ensures that the attention calculation for each sample time step is based only on information prior to the sample time step. This maintains the causal relationship of generating the sample sequence to be predicted, prevents information leakage, and enables the preset model to correctly learn how to generate the sample sequence to be predicted. For all sample sequences to be predicted corresponding to all sample time steps, the query (Q), key (K), and value (V) vectors can be calculated in parallel. The dot product of the query vector Q and the key vector K is added to the mask matrices M, H, and F to calculate the attention scores for all positions in parallel. After applying softmax, the weighted attention score is obtained, which is then multiplied by the value vector V to calculate the weighted sum.
[0238] The above steps are performed in parallel on all sample time steps because the mask matrix has ensured the correctness of causality.
[0239] In some embodiments, the above-mentioned masking process is also applicable to the generation of the sequence to be predicted of the target model to ensure that the attention of the target model is allocated to important data. The specific steps are not described one by one, and the method of masking and calculating the missing data above can be referred to.
[0240] In some embodiments, the output of the preset model is consistent with the input dimension of the preset model. For the pre-training stage of the preset model, only the first power load sub-data of the next sample adjacent time period is output, and the future power load sub-data is shielded; for the fine-tuning stage of the preset model, only the first power load sub-data of the next sample adjacent time period is output, and the past power load sub-data is shielded.
[0241] By implementing this masking strategy, the robustness of the preset model (or target model) to missing or anomalous data can be enhanced. By minimizing the impact of these data points, the stability and accuracy of the preset model (or target model)'s predictions can be ensured. Secondly, the masking mechanism effectively maintains the causal relationships in the data, preventing information leakage and enabling the preset model (or target model) to accurately generate sequences based on information from previous time steps, thereby improving prediction accuracy.
[0242] In some embodiments, to enhance the robustness and forecasting performance of the model and ensure the consistency of the forecast results, a mean square error penalty term may be added to optimize and adjust the load forecast results of each layer of the preset model to ensure that the cumulative forecasts of the sample sub-geographical areas match the forecasts of the sample target geographical area, minimizing the total error between the sample target geographical area and each sample sub-geographical area. For example, (C.6) may include:
[0243] (C.6.1) For each sample time point in a plurality of next sample adjacent time periods predicted for each sample time period, obtain the first square of the first power load sub-data and the second square of the second power load sub-data corresponding to each sample sub-geographical area, and determine a first difference based on the difference between the second square and the first square;
[0244] (C.6.2) Obtaining a first sub-loss corresponding to each sample time point based on the sum of the multiple first differences corresponding to the multiple sample geographic areas;
[0245] (C.6.3) Obtain the first target sub-loss by summing the multiple first sub-losses predicted at multiple sample time points;
[0246] (C.6.4) For each sample time point in the multiple next sample adjacent time periods predicted for each sample period, obtain the sum of multiple first power load sub-data corresponding to the multiple sample geographic areas to obtain the first power load sum;
[0247] (C.6.5) obtaining a second power load sum for the sample target geographic area at each sample time point, and determining a second difference based on a difference between the second power load sum and the first power load sum;
[0248] (C.6.6) Obtaining a second target sub-loss by summing the multiple second differences corresponding to the multiple sample time points predicted by the preset model;
[0249] (C.6.7) Determine a target loss based on the first target sub-loss and the second target sub-loss.
[0250] The first square may be the square value of the first power load sub-data corresponding to each sample sub-geographical area in the next sample adjacent period predicted in each sample period. in It is the first power load sub-data predicted by the preset model.
[0251] The second square may be the square value of the second power load sub-data in each sample period. where y n,t It is the actual power load value detected during the sample period.
[0252] The first difference may be the difference between the second square and the first square, that is,
[0253] The first sub-loss may be the sum of multiple first differences of all sample geographical areas at corresponding sample time points.
[0254] The first target sub-loss may be used to measure the difference between each first power load sub-data and the corresponding second power load sub-data predicted by the preset model for each sample sub-geographical area at all predicted sample time points.
[0255] The first power load sum may be the sum of multiple first power load sub-data corresponding to the predicted multiple sample geographical areas obtained for each sample time point included in the predicted multiple adjacent time periods of the next samples.
[0256] The second power load sum may be the sum of multiple second power load sub-data obtained by actual measurement corresponding to multiple sample geographical areas at each sample time point included in the next sample adjacent period of each sample period.
[0257] The second difference may be a difference between the second power load sum and the corresponding first power load sum at each predicted sample time point.
[0258] Among them, the second target sub-loss can be used to measure the difference between the total first power load of the sample target geographical area predicted by the preset model at all sample time points and the total second power load obtained by actual measurement.
[0259] For example, when calculating the target loss of a batch of sample power load impact data, the target loss calculation formula is as follows:
[0260]
[0261] Where N represents the number of all sample sub-geographical areas in this training, T represents the total length of the sample sequence to be predicted corresponding to the sample power load impact data, including data at multiple sample time points, and P represents the sample time point at which prediction starts (i.e., prediction starts from the P+1th sample time point). is the first power load sub-data of the nth sample sub-geographical area at the sample time point t, y n,t is the actual second power load sub-data of the nth sample sub-geographical area at the sample time point t, y 0,t is the sum of multiple second power load sub-data corresponding to n sample sub-geographical areas, λ is the weight coefficient of the mean square error penalty term, and can be flexibly adjusted according to actual conditions.
[0262] In some embodiments, the difference between the first power load sub-data of all sample time points included in all sample time periods predicted by the preset model and the actual second power load sub-data of each sample sub-geographical area can be calculated, and these differences are squared and summed, and then divided by the total number of samples (that is, the product of the number of sample time points and the number of sample sub-geographical areas) to obtain the first target sub-loss.
[0263] In some embodiments, the second target sub-loss can be obtained by calculating the accumulation of the predicted first power load sub-data of all sample sub-geographical areas (ultimately obtaining the sum of the predicted first power loads of the sample target geographical area at each sample time point), and obtaining the actual sum of the second power loads of the sample target geographical area at each sample time point, and squaring the second difference between the second power load sum and the first power load sum, summing the squares, multiplying by the weight coefficient, and finally dividing by the total number of predicted multiple sample time points.
[0264] By determining the target loss, we can focus on the prediction accuracy of the preset model for each sample sub-geographical area, and also ensure the consistency of the accumulation of prediction results of multiple sample sub-geographical areas with the prediction results of the sample target geographical area. In this way, we can optimize and adjust the power load prediction results of each layer to minimize the total error of the power load prediction of the sample target geographical area and each sample sub-geographical area, thereby improving the aggregation consistency of the overall prediction.
[0265] Please refer to Figure 13 In some embodiments, combined Figure 13The overall embodiment of the power load forecasting method of the present application is introduced. Specifically, the historical power load impact data of each sub-geographical area in the target geographical area can be obtained through the power grid data of each sub-geographical area, and the historical power load impact data can be classified and selected, for example, divided into historical power load sub-data, historical meteorological sub-data, etc. (if directly obtained according to category, no division is required). Furthermore, the historical power load impact data of each sub-geographical area can be slid according to the target sliding window, and multiple historical power load impact data sub-sequences corresponding to each sub-geographical area in multiple historical time periods can be intercepted. After the sequence to be predicted is composed according to the multiple historical power load impact data sub-sequences, the sequence to be predicted can be encoded and the abnormal data can be calibrated and processed, so that the target model can effectively identify the data and reduce the attention allocated to the abnormal data.
[0266] Furthermore, after the sequence to be predicted is processed, it can be input into the target model. The target model calculates the corresponding time-dependent features through the time attention mechanism, and extracts the spatial-dependent features of the processed time-dependent features according to the spatial attention mechanism to obtain the spatial-dependent features between multiple sub-geographical areas. Finally, the fusion features obtained by fusing the time-dependent features with the spatial-dependent features are used for prediction to obtain the power load sub-data of the next adjacent time period. Furthermore, the target model can repeatedly process the multiple historical power load impact data sub-sequences corresponding to the next historical time period of multiple sub-geographical areas to obtain the next sequence to be predicted corresponding to the next historical time period, and predict the power load sub-data of the next adjacent time period based on the next sequence to be predicted, until the predicted next adjacent time period is the target prediction time period, and obtain multiple power load sub-data corresponding to the target prediction time period.
[0267] See also Figure 14 The present application also provides an electric load forecasting device that can implement the above-mentioned electric load forecasting method. The electric load forecasting device includes:
[0268] An acquisition module 141 is configured to acquire historical power load impact data corresponding to each sub-geographical area within a target geographical area, wherein the historical power load impact data includes historical power load impact sub-data at multiple historical time points;
[0269] The interception module 142 is configured to sequentially intercept, according to the target sliding window, multiple subsequences of historical power load impact data corresponding to multiple historical time periods from the historical power load impact data corresponding to each sub-geographical area, and obtain a sequence to be predicted for each historical time period based on the multiple subsequences of historical power load impact data corresponding to each historical time period for the multiple sub-geographical areas;
[0270] An input module 143 is used to sequentially input the pre-trained target model for the sequence to be predicted corresponding to each historical period;
[0271] The calculation module 144 is used to calculate the time dependence characteristics between multiple historical power load impact sub-data corresponding to multiple historical time points contained in the sequence to be predicted, as well as the spatial dependence characteristics between multiple sub-geographical areas through the time attention mechanism and the spatial attention mechanism in the target model, so as to predict multiple power load sub-data of multiple sub-geographical areas in the next adjacent time period based on the time dependence characteristics and the spatial dependence characteristics.
[0272] The specific implementation of the power load forecasting device is basically the same as the specific embodiment of the power load forecasting method described above, and will not be repeated here. Under the premise of meeting the requirements of the embodiment of this application, the power load forecasting device can also be provided with other functional modules to implement the power load forecasting method in the above embodiment.
[0273] The present application also provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-described power load forecasting method when executing the computer program. The computer device can be any intelligent terminal, including a tablet computer and an in-vehicle computer.
[0274] See also Figure 15 , Figure 15 The hardware structure of a computer device according to another embodiment is shown. The computer device includes:
[0275] The processor 151 may be implemented as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0276] The memory 152 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 152 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program codes are stored in the memory 152 and are called by the processor 151 to execute the power load forecasting method of the embodiments of this application.
[0277] Input / output interface 153, used to implement information input and output;
[0278] Communication interface 154, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.);
[0279] bus 155 , which transmits information between the various components of the device (e.g., processor 151 , memory 152 , input / output interface 153 , and communication interface 154 );
[0280] The processor 151 , the memory 152 , the input / output interface 153 and the communication interface 154 are connected to each other in communication within the device via the bus 155 .
[0281] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned power load forecasting method is implemented.
[0282] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0283] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0284] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0285] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0286] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0287] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0288] It should be understood that in this application, "at least one (item)" and "several" refer to one or more, and "plurality" refers to two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0289] In the several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the division of the above units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0290] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0291] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0292] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0293] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.
Claims
1. A method for predicting power load, characterized in that: The method comprises: Obtaining historical power load impact data corresponding to each sub-geographical area within the target geographical area, wherein the historical power load impact data includes historical power load impact sub-data at multiple historical time points; According to the target sliding window, sequentially extracting a plurality of historical power load impact data subsequences corresponding to a plurality of historical time periods from the historical power load impact data corresponding to each of the sub-geographical areas, and obtaining a sequence to be predicted for each of the historical time periods based on the plurality of historical power load impact data subsequences corresponding to the plurality of sub-geographical areas in each historical time period; For each historical period, the sequence to be predicted is sequentially input into the pre-trained target model; Through the time attention mechanism and the space attention mechanism in the target model, the time dependence characteristics between the multiple historical power load impact sub-data corresponding to the multiple historical time points contained in the sequence to be predicted, and the space dependence characteristics between the multiple sub-geographical areas are calculated, so as to predict the multiple power load sub-data of the multiple sub-geographical areas in the next adjacent time period based on the time dependence characteristics and the space dependence characteristics.
2. The power load forecasting method according to claim 1, characterized in that: The historical power load impact sub-data corresponding to each sub-geographical area includes historical power load sub-data and historical meteorological sub-data; obtaining the sequence to be predicted for each historical period based on the multiple sub-sequences of historical power load impact data corresponding to the multiple sub-geographical areas in each historical period includes: Obtaining the forecasted meteorological sub-data for each sub-geographical area for the next adjacent period corresponding to the forecast in each historical period; adding the predicted meteorological sub-data to a historical power load impact sub-data sequence corresponding to each of the sub-geographical regions, so as to generate an updated historical power load impact sub-data sequence corresponding to each of the sub-geographical regions based on the predicted meteorological sub-data, the historical power load sub-data, and the historical meteorological sub-data; Based on multiple updated historical power load impact data subsequences corresponding to multiple sub-geographical areas in each historical period, a sequence to be predicted in each historical period is obtained.
3. The power load forecasting method according to claim 1, characterized in that: After predicting the plurality of power load sub-data of the plurality of sub-geographical areas in the next adjacent time period according to the time-dependent feature and the space-dependent feature, the method further includes: When the next adjacent period predicted for each historical period is not the target prediction period, masking the plurality of power load sub-data and outputting the masked result; When the next adjacent period predicted in each historical period is the target prediction period, the plurality of power load sub-data are output.
4. The power load forecasting method according to claim 1, characterized in that: Before sequentially inputting the sequence to be predicted corresponding to each historical period into the pre-trained target model, the method further includes: Encoding the historical power load impact sub-data contained in the sequence to be predicted to obtain a first encoding result; Obtaining location information corresponding to each of the sub-geographical areas, and time information corresponding to each of the sub-geographical areas at multiple historical time points included in each historical period, encoding the time information and the location information, and embedding the encoded information into the first encoding result to obtain an encoded sequence to be predicted; wherein the time information includes holiday information for each historical time point and time interval information for the historical time point; Then, the sequence to be predicted corresponding to each historical period is sequentially input into the pre-trained target model, including: The encoded sequence to be predicted corresponding to each historical period is sequentially input into the pre-trained target model.
5. The power load forecasting method according to claim 1, characterized in that: The target model is trained in the following way: Obtaining sample power load impact data corresponding to each sample sub-geographical area within the sample target geographical area, wherein the sample power load impact data includes sample power load impact sub-data at multiple sample time points; sequentially extracting, according to the sample time step, a plurality of sample power load impact data subsequences corresponding to a plurality of sample time periods from the sample power load impact data corresponding to each sample sub-geographical area, and obtaining a sample sequence to be predicted for each sample time period based on the plurality of sample power load impact data subsequences corresponding to each sample time period for the plurality of sample sub-geographical areas; For each sample period, the sample sequence to be predicted is sequentially input into the preset model; By using the temporal attention mechanism and the spatial attention mechanism in the preset model, the sample time dependency features between the plurality of sample power load impact sub-data corresponding to the plurality of sample time points included in the sample sequence to be predicted, and the sample spatial dependency features between the plurality of sample sub-geographical areas are calculated, so as to predict the plurality of first power load sub-data of the plurality of sample sub-geographical areas in the next adjacent sample time period based on the sample time dependency features and the sample spatial dependency features; Acquire a plurality of second power load sub-data of the plurality of sample sub-geographical areas in a next sample adjacent time period; determining a target loss based on differences between the plurality of first power load sub-data and the plurality of second power load sub-data predicted in a plurality of sample time periods; Based on the target loss, the parameters of the preset model are adjusted to obtain a target model.
6. The power load forecasting method according to claim 5, characterized in that: The determining the target loss according to the differences between the plurality of first power load sub-data and the plurality of second power load sub-data predicted in the plurality of sample periods in sequence includes: For each sample time point in a plurality of next sample adjacent time periods predicted for each sample time period, obtaining a first square of the first power load sub-data and a second square of the second power load sub-data corresponding to each sample sub-geographical area, and determining a first difference based on a difference between the second square and the first square; Obtaining a first sub-loss corresponding to each sample time point according to a sum of multiple first differences corresponding to the multiple sample geographical areas; The first target sub-loss is obtained by summing the multiple first sub-losses predicted at multiple sample time points; For each sample time point in the plurality of next sample adjacent time periods predicted for each sample time period, obtaining a sum of the plurality of first power load sub-data corresponding to the plurality of sample geographical areas to obtain a first power load sum; Obtaining a second power load sum of the sample target geographical area at each sample time point, and determining a second difference based on a difference between the second power load sum and the first power load sum; Obtaining a second target sub-loss based on the sum of multiple second difference values corresponding to the multiple sample time points predicted by the preset model; A target loss is determined based on the first target sub-loss and the second target sub-loss.
7. The power load forecasting method according to claim 5, characterized in that: The sample sequence to be predicted corresponding to each sample period is sequentially input into a preset model, including: For the sample sequence to be predicted corresponding to each sample period, determining a target sub-geographical area and a target covering time point that the sample sequence to be predicted needs to cover; In the sample sequence to be predicted, masking is performed on the sample power load impact sub-data of the target sub-geographical area at the target covering time point to obtain a masked sample sequence to be predicted corresponding to each sample period; The masked sample sequence to be predicted corresponding to each sample period is sequentially input into the preset model.
8. A power load forecasting device, characterized in that: The device comprises: An acquisition module, configured to acquire historical power load impact data corresponding to each sub-geographical area within the target geographical area, wherein the historical power load impact data includes historical power load impact sub-data at multiple historical time points; an interception module, configured to sequentially intercept, according to a target sliding window, a plurality of historical power load impact data subsequences corresponding to a plurality of historical time periods from the historical power load impact data corresponding to each sub-geographical area, and obtain a sequence to be predicted for each historical time period based on the plurality of historical power load impact data subsequences corresponding to each historical time period for the plurality of sub-geographical areas; An input module, configured to sequentially input the pre-trained target model for the sequence to be predicted corresponding to each historical period; A calculation module is used to calculate the time dependence characteristics between multiple historical power load impact sub-data corresponding to multiple historical time points contained in the sequence to be predicted, as well as the spatial dependence characteristics between the multiple sub-geographical areas through the time attention mechanism and the spatial attention mechanism in the target model, so as to predict the multiple power load sub-data of the multiple sub-geographical areas in the next adjacent time period based on the time dependence characteristics and the spatial dependence characteristics.
9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the power load forecasting method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the power load forecasting method according to any one of claims 1 to 7 is implemented.