Power load prediction method, device, equipment, storage medium and program product
Through the multi-head attention mechanism and Fourier feature extraction model, combined with correlation and trend characteristics, power load forecasting is performed, which solves the problem that neural network models are difficult to capture long-term relationships and achieves long-term accuracy and stability of power load forecasting.
Patent Information
- Application Number
- CN202410294770.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-14
- Publication Date
- 2025-09-16
AI Technical Summary
Existing power load forecasting technology based on neural networks has difficulty in capturing longer time relationships, resulting in inaccurate long-term power load forecasts, and is unable to accurately capture the development trends and internal laws of power load data, resulting in large forecast deviations.
A Fourier feature extraction model based on a multi-head attention mechanism and a multi-layer perceptron is used to extract the correlation features and trend features of historical time series data respectively. Predictions are made through linear and nonlinear combinations, and the correlation features and trend features are fused together to achieve long-term accurate predictions.
It improves the accuracy of power load forecasting, can better capture the long-term dependencies and trend characteristics of power load data, reduce forecasting errors, and enhance the guiding significance of energy management and planning in the power industry.
Smart Images

Figure CN120653952A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of power load forecasting, and in particular to a power load forecasting method, apparatus, device, storage medium and program product. Background Art
[0002] Power load forecasting is a key aspect of energy management and planning in the power industry. On the one hand, user-side power demand is dynamic. Since electricity is generated and consumed immediately, the dynamic balance of supply and demand requires the support of load forecasting to ensure the stable and efficient operation of the entire power system. On the other hand, the country has proposed the goal of building a new power system based on renewable energy. In the future, renewable energy (wind, solar, etc.) will become a key component of the power grid system. However, the uncertainty of renewable energy power supply necessitates accurate load forecasting to ensure the stable operation of the power grid and formulate reasonable power generation plans.
[0003] Related technologies use deep neural network technology to train a prediction model. By adjusting the training method and process, the hope is that the neural network can learn the development trends and inherent patterns of load data, ultimately achieving relatively accurate power load forecast results. However, due to the limitations of the neural network model structure, these prediction methods have difficulty capturing long-term relationships, thus failing to guarantee the accuracy of long-term power load forecasts. They also cannot accurately capture the development trends and inherent patterns of power load data, resulting in significant deviations in power load forecasts. Summary of the Invention
[0004] The main purpose of this application is to provide a power load forecasting method, device, equipment, storage medium and program product, which can not only capture the longer-term dependencies of power load data, but also determine the trend characteristics of load data, so that this application can not only accurately predict power load, but also make long-term predictions.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides a method for predicting power load, the method comprising:
[0007] Obtain the historical time series data corresponding to the power load of the forecast object within the historical time period;
[0008] Respectively extracting correlation features and trend features from the historical time series data to obtain correlation features and trend features;
[0009] Based on the correlation feature, a first prediction process is performed on the power load of the prediction object in the time period to be measured to obtain first time series prediction data;
[0010] Based on the trend characteristics, a second prediction process is performed on the power load in the time period to be measured to obtain second time series prediction data;
[0011] The first time series prediction data and the second time series prediction data are fused to obtain time series prediction data corresponding to the power load of the prediction object during the time period to be measured.
[0012] According to the above technical means, by extracting correlation features of historical time series data, it is possible to capture longer dependencies of power load data and contextual information in the sequence, and by predicting through correlation features, it is possible to achieve accurate prediction of power load over a longer period of time; by extracting trend features of historical time series data, it is also possible to determine the trend features of load data and achieve accurate load trend prediction. This application combines load quantity prediction and load trend prediction, which can improve the accuracy of power load prediction and has important guiding significance for energy management and planning in the power industry.
[0013] In the above scheme, correlation features are extracted from the historical time series data to obtain correlation features, including: segmenting the historical time series data to obtain multiple non-overlapping historical time series sub-data and the corresponding position information of each historical time series sub-data in the historical time series data; performing dimensionality transformation on the multiple historical time series sub-data to obtain multiple historical time series sub-vectors with the same dimension; performing association processing on the multiple historical time series sub-vectors with the same dimension and the corresponding position information of each historical time series sub-data to obtain multiple associated sub-vectors; based on the multi-head attention mechanism, performing correlation feature extraction between the multiple associated sub-vectors to obtain the multi-head attention features corresponding to the historical time series data; and performing feature fusion on the multi-head attention features to obtain the correlation features.
[0014] According to the above technical means, a multi-head attention mechanism is used to simultaneously focus on different aspects and information at different positions of historical time series data. More attention heads can capture longer dependencies and obtain the correlation characteristics of historical time series data. Based on the correlation characteristics, long-term predictions can be made, and the error can be guaranteed to be within a certain small range.
[0015] In the above scheme, the multi-head attention mechanism is based on which correlation features are extracted between the multiple associated sub-vectors to obtain multi-head attention features corresponding to the historical time series data, including: based on multiple attention heads, multiple correlation features are extracted between the multiple associated sub-vectors to obtain multiple attention features; wherein the number of the multiple attention heads is equal to the number of the multiple associated sub-data; the multiple attention features are spliced to obtain spliced features; and the spliced features are linearly transformed to obtain the multi-head attention features.
[0016] Based on the above technical means, the multi-head attention mechanism enables the present application to simultaneously focus on different aspects and information at different locations of historical time series data. More attention heads can capture longer dependencies, eliminating the need to process sequence data through time expansion or fixed windows. This enables the present application to better capture contextual information in the sequence, reducing the problem of gradient propagation over time, thereby improving prediction stability.
[0017] In the above scheme, based on multiple attention heads, multiple correlation feature extractions are performed on the multiple associated sub-vectors to obtain multiple attention features, including: performing correlation calculations on each associated sub-vector and other associated sub-vectors in the multiple associated sub-vectors to obtain attention weights between each associated sub-vector and other associated sub-vectors; normalizing the attention weights corresponding to each associated sub-vector to obtain weight coefficients between each associated sub-vector and other associated sub-vectors; and performing weighted calculations on each associated sub-vector based on the weight coefficients between each associated sub-vector and other associated sub-vectors to obtain multiple attention features corresponding to multiple associated sub-vectors.
[0018] In the above scheme, based on the correlation characteristics, the first prediction processing is performed on the power load of the prediction object during the time period to be measured to obtain the first time series prediction data, including: based on the linear prediction head, the correlation characteristics are linearly mapped to obtain the first time series prediction data corresponding to the power load of the prediction object during the time period to be measured.
[0019] Based on the above technical approach, a multi-head attention mechanism is used to capture long-term dependencies in the input sequence, without the need for time expansion or fixed window processing of sequence data. This enables the application to better capture contextual information in the sequence, reduces the problem of gradient propagation over time, and thus improves the predictive stability of the model.
[0020] In the above scheme, trend features are extracted from the historical time series data to obtain trend features, including: based on Fourier series and multiple different time periods, constructing multiple different trend prediction functions for performing trend predictions on each time period respectively; wherein, one time period corresponds to one trend prediction function; based on the multiple different time periods, determining the time nodes corresponding to the historical time periods corresponding to the historical time series data in different time periods; based on the time nodes corresponding to the historical time series data in different time periods and the trend prediction functions corresponding to different time periods, determining multiple period trend features of the historical time series data in different time periods; and performing feature fusion on the multiple period trend features to obtain the trend features.
[0021] The above-mentioned technical approach considers different time dimensions, using time as the independent variable and fitting the Fourier function to the trend of power load data over time. This allows for accurate prediction of daily power load peaks and troughs, ensuring that the predicted curve closely matches the actual power load curve. Within the weekly range, the trend of high power load on weekdays and low power load on weekends can also be perfectly predicted.
[0022] In the above scheme, based on the trend characteristics, a second prediction processing is performed on the power load in the time period to be measured to obtain second time series prediction data, including: based on a multi-layer perceptron, a regression analysis is performed on the trend characteristics to obtain the second time series prediction data corresponding to the power load of the prediction object in the time period to be measured.
[0023] Based on the above technical means, the complex seasonality in the historical coincidence sequence can be effectively captured, thereby significantly improving the prediction accuracy.
[0024] In the above scheme, the historical time period includes multiple time points, and the historical time series data at least includes the power load data corresponding to the multiple time points respectively; the method also includes: performing mean and variance calculation on the power load data corresponding to the multiple time points respectively to obtain the power load mean and variance corresponding to the time series prediction data; based on the power load mean and the variance, performing data normalization processing on the multiple power load data to obtain multiple normalized data; based on the multiple normalized data, generating normalized time series data corresponding to the historical time series data; correspondingly, performing correlation feature extraction and trend feature extraction on the historical time series data respectively to obtain correlation features and the trend features, including: performing correlation feature extraction and trend feature extraction on the normalized time series data respectively to obtain the correlation features and the trend features.
[0025] According to the above technical means, correlation features and trend features are extracted from the normalized data to obtain correlation features and trend features, and power load forecasting is performed based on the correlation features and trend features, thereby improving the forecasting speed and accuracy.
[0026] In a second aspect, an embodiment of the present application provides an electric load forecasting device, which includes: an acquisition module for acquiring historical time series data corresponding to the electric load of the forecast object within a historical time period; a feature extraction module for performing correlation feature extraction and trend feature extraction on the historical time series data, respectively, to obtain correlation features and trend features; a first prediction module for performing a first prediction processing on the electric load of the forecast object within a time period to be measured based on the correlation features, to obtain first time series forecast data; a second prediction module for performing a second prediction processing on the electric load of the time period to be measured based on the trend features, to obtain second time series forecast data; a fusion module for performing a fusion processing on the first time series forecast data and the second time series forecast data, to obtain time series forecast data corresponding to the electric load of the forecast object within the time period to be measured.
[0027] In a third aspect, an embodiment of the present application provides a computer device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the steps in the above-mentioned power load forecasting method are implemented.
[0028] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above-mentioned power load forecasting method when executed by a processor.
[0029] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps in the above-mentioned power load forecasting method.
[0030] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings herein are incorporated into and constitute a part of this specification. These drawings illustrate embodiments consistent with the present application and, together with the specification, serve to illustrate the technical solutions of the present application. Obviously, the drawings described below are merely some embodiments of the present application. Those skilled in the art can, without inventive effort, derive other drawings from these drawings.
[0032] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.
[0033] Figure 1 This is a flow diagram of an optional power load forecasting method provided in an embodiment of the present application. Figure 1 ;
[0034] Figure 2 This is a flow chart of an optional power load forecasting method provided by the embodiment of the present application. Figure 2 ;
[0035] Figure 3 This is a flow chart of an optional power load forecasting method provided by the embodiment of the present application. Figure 3 ;
[0036] Figure 4 This is a flow chart of an optional power load forecasting method provided by the embodiment of the present application. Figure 4 ;
[0037] Figure 5 This is a flow chart of an optional power load forecasting method provided by the embodiment of the present application. Figure 5 ;
[0038] Figure 6 This is a schematic diagram of the structure of the Transformer model provided in the embodiment of the present application;
[0039] Figure 7 A schematic diagram of the structure of a power load forecasting device provided in an embodiment of the present application;
[0040] Figure 8 A schematic diagram of a hardware entity of a computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0041] To make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the specific technical solutions of the present application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application but are not intended to limit the scope of the present application.
[0042] Unless otherwise defined, all technical and scientific terms used in this application have the same meaning as commonly understood by those skilled in the art to which this application belongs. The terms used in this application are only for the purpose of describing this embodiment and are not intended to limit this application.
[0043] In the following description, references to “some embodiments,” “this embodiment,” “this embodiment,” and examples, etc., describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
[0044] If similar descriptions of "first / second" appear in the application documents, the following explanation is added. In the following description, the terms "first\second\third" are merely used to distinguish similar objects and do not represent a specific order of the objects. It can be understood that "first\second\third" can be interchanged with the specific order or sequence where permitted, so that the embodiment described herein can be implemented in an order other than that illustrated or described herein.
[0045] In the embodiment of the present application, the term "and / or" is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, object A and / or object B may represent three situations: object A exists alone, object A and object B exist at the same time, and object B exists alone.
[0046] Currently, power load forecasting is a key aspect of energy management and planning in the power industry. It involves predicting future power demand, or load, on the power grid in a specific region. Accurate load forecasting is crucial for ensuring reliable and efficient operation of the power system, optimizing resource allocation, and making decisions regarding power generation, transmission, and distribution. Furthermore, load forecasting helps power companies optimize the allocation and management of energy resources. By understanding the changing trends and peak-valley variations in load demand, power companies can rationally schedule the commissioning and shutdown of power generation equipment, adjust energy supply strategies, and improve energy efficiency and cost-effectiveness.
[0047] In some embodiments, both residential and business electricity usage has regular patterns. For example, residents need to charge the batteries of new energy vehicles and electric vehicles at night, and residents use a lot of electricity at night. Businesses use more electricity on weekdays, and less on weekends and holidays. To rationally plan power generation, transmission, and distribution, it is currently urgent to provide a power forecasting method that can accurately predict power usage trends and power consumption.
[0048] Related technologies use deep neural network technology and collected relevant historical data to train a black box model. By adjusting the method and process of training the model, it is expected that the neural network can learn the development trend and internal laws of historical load data, and ultimately obtain more accurate power load forecast results.
[0049] However, the difficulty of the power load forecasting task lies in the fact that it is affected by many external factors. For example, industrial parks consume more electricity during the week and less on weekends; weather factors and market factors can also cause fluctuations in the short-term or ultra-short-term load of the region. For example, heavy snow or heavy rain will prevent employees from coming to work, and the power consumption of the industrial park will be reduced in a short period of time; government policy factors and residents' income factors will have an impact on long-term and medium-term loads, that is, the trend of electricity consumption.
[0050] Therefore, existing neural network-based power load forecasting technology still has the following limitations: First, due to the limitations of the neural network model structure, it is difficult for the neural network model to capture long-term relationships, thus failing to guarantee the accuracy of long-term power load forecasts. Second, the neural network model cannot accurately capture the development trends and inherent laws of power load data, resulting in large deviations in power load forecasts.
[0051] Based on the above technical problems, the applicant believes that a multi-head attention mechanism can be used to simultaneously focus on different aspects and information at different positions of the input sequence. More attention heads can capture longer dependencies in historical data, better capture contextual information in the sequence, and achieve long-term accurate predictions. It can also be based on the Fourier (MLP-Fourier) feature extraction model of the multi-layer perceptron, take time as the independent variable, and use the Fourier function to fit the trend of power load data and time, thereby accurately predicting the trend of power load data.
[0052] Based on the above-mentioned inventive concept, an embodiment of the present application provides a method for predicting electric load. By obtaining historical time series data corresponding to the electric load of the prediction object in a historical time period, correlation feature extraction and trend feature extraction are performed on the historical time series data respectively to obtain correlation features and trend features. Based on the correlation features, a first prediction processing is performed on the electric load of the prediction object in the time period to be measured to obtain first time series prediction data. Based on the trend features, a second prediction processing is performed on the electric load in the time period to be measured to obtain second time series prediction data. The first time series prediction data and the second time series prediction data are fused to obtain time series prediction data corresponding to the electric load of the prediction object in the time period to be measured.
[0053] In this way, the power load forecasting method provided in the embodiment of the present application can capture the longer dependency relationship and context information in the sequence of power load data by extracting correlation features of historical time series data. Prediction through correlation features can achieve accurate prediction of power load over a longer period of time; by extracting trend features of historical time series data, it can also determine the trend features of load data and achieve accurate load trend prediction. This application combines load quantity prediction and load trend prediction to improve the accuracy of power load prediction, which has important guiding significance for energy management and planning in the power industry.
[0054] In some embodiments, new energy batteries are not only used in energy storage power supply systems such as hydropower, thermal power, wind power and solar power stations, but are also widely used in electric vehicles such as electric bicycles, electric motorcycles, electric cars, and aerospace and other fields. With the continuous expansion of the application field of power batteries, the market demand is also constantly expanding. In the embodiment of the present application, the battery involved may be a battery cell. A battery cell refers to a basic unit that can realize the mutual conversion of chemical energy and electrical energy, which can be used to make a battery module or a battery pack, thereby being used to supply power to an electrical device. A battery cell may be a secondary battery, which refers to a battery cell that can continue to be used by activating the active material by charging after the battery cell is discharged. The battery cell may be a lithium-ion battery, a sodium-ion battery, a sodium-lithium-ion battery, a lithium metal battery, a sodium metal battery, a lithium-sulfur battery, a magnesium-ion battery, a nickel-hydrogen battery, a nickel-cadmium battery, a lead-acid battery, etc., and the embodiment of the present application is not limited to this.
[0055] In an embodiment of the present application, the battery may also be a single physical module including one or more battery cells to provide higher voltage and capacity. When there are multiple battery cells, the multiple battery cells are connected in series, in parallel or in mixed connection through a busbar component. The battery can be used as an electrical device for power supply, and the electrical device may be, but is not limited to, a mobile phone, a tablet, a laptop computer, an electric toy, an electric tool, an electric vehicle, an electric car, a ship, a spacecraft, and the like. Among them, electric toys may include fixed or mobile electric toys, for example, game consoles, electric car toys, electric ship toys, and electric airplane toys, and the like, and spacecraft may include airplanes, rockets, space shuttles, and spacecraft, and the like.
[0056] The power load forecasting method provided in the embodiments of the present application can be executed by electronic devices such as computer devices, wherein the electronic devices can be various types of terminals such as laptop computers, tablet computers, desktop computers, set-top boxes, mobile devices (for example, mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), etc., and can also be implemented as servers. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0057] Below, an exemplary application when the computer device is implemented as a server will be explained, and the technical method in the embodiment of the present application will be clearly and completely described in conjunction with the drawings in the embodiment of the present application.
[0058] See also Figure 1 , Figure 1 This is a flow diagram of an optional power load forecasting method provided in an embodiment of the present application. Figure 1 The power load forecasting method is implemented through steps S101 to S105:
[0059] Step S101: Obtain historical time series data corresponding to the power load of the prediction object within a historical time period.
[0060] In this embodiment of the present application, the prediction object can be a city or a region. The historical time period refers to a certain time period in the past of the city or region. The data in the historical time period is used to predict future power load data. Here, the length of the historical time period is set according to the needs and can be one day, one month, or one year.
[0061] Historical time series data can be a sequence of data such as the power load value at each time point within a historical period. The time interval between two adjacent time points is the same. The interval between two adjacent time points can be set as needed, such as a power load value every minute, every hour, every day, every week, or every X days.
[0062] In some embodiments, historical time series data may have data in multiple dimensions, such as time points, power load values corresponding to each time point, weather and time characteristics corresponding to the time point (such as weekdays or holidays, etc.).
[0063] In an embodiment of the present application, if it is necessary to predict the electricity consumption of an industrial park in a certain city for the next month, the power load sequence of the industrial park in the past year or the past month can be obtained, and the power load forecast for the next month can be made based on the sequence.
[0064] Step S102: extract correlation features and trend features from the historical time series data to obtain correlation features and trend features.
[0065] In some embodiments, historical time series data is time series data, and it is necessary to determine the association between data at different positions (i.e., different time points) of the time series data, that is, the correlation between different positions of the historical time series data, that is, the global long-distance dependency of the historical time series data, so as to better make predictions. Therefore, the embodiments of the present application can extract correlation features of information between different time points in the historical time series data to extract correlation features between different positions in the historical time series data.
[0066] Here, the correlation feature can be the connection between different locations in historical time series data, or the correlation between power load data and weather, etc.
[0067] Here, we can use neural network models based on the attention mechanism (Attention Mechanism) such as Transformer to extract correlation features. We can also use models such as the Long Short-Term Memory (LSTM) network and the Seasonal Autoregressive Integrated Moving Average (SARIMA) model to extract correlation features.
[0068] In some embodiments, power load data generally exhibits periodicity and trend. For example, the annual periodicity of power load forecasting is manifested in higher power load in summer and winter and lower power load in spring and autumn; the weekly periodicity is manifested in higher power load on weekdays (for industrial parks) and lower power load on weekends. Here, the embodiment of the present application can use time as an independent variable to fit the trend of power load data and time through Fourier function, thereby obtaining the trend characteristics of time series data. The periodicity of power load data can also be extracted through other trend extraction neural networks.
[0069] Step S103: Based on the correlation characteristics, a first prediction process is performed on the power load of the prediction object within the time period to be measured to obtain first time series prediction data.
[0070] In some embodiments, the time period to be measured refers to the time period for which power load prediction is required, such as the next month. The length of the time period to be measured can be the same as or different from the length of the historical time period. For example, the historical time period is yesterday and the time period to be measured is tomorrow, that is, tomorrow's power load is predicted based on yesterday's data. Alternatively, the historical time period can be yesterday and the time period to be measured is the next month. In this case, tomorrow's power load can be predicted based on yesterday's data, and yesterday's data can be used to predict the data for the day after tomorrow. The prediction process can be iterated until data for the next month is obtained.
[0071] In some embodiments, after obtaining the correlation features of the historical time series data, a linear prediction head can be used to linearly transform the correlation features of the historical time series data, perform a first prediction process on the power load of the prediction object during the test time period, and obtain first time series prediction data. Here, the linear transformation can be a fully connected layer, and the weights of the fully connected layer can be learned during the training process to achieve accurate prediction.
[0072] Step S104: Based on the trend characteristics, perform a second prediction process on the power load in the time period to be measured to obtain second time series prediction data.
[0073] In an embodiment of the present application, the second prediction processing can perform linear and nonlinear combinations on trend features, and ultimately achieve prediction based on the trend of time series data to obtain second time series prediction data.
[0074] Step S105: performing fusion processing on the first time series prediction data and the second time series prediction data to obtain the time series prediction data corresponding to the power load of the prediction object in the time period to be measured.
[0075] Here, the fusion processing can be a weighted calculation, and the weight coefficient can be set according to demand. For example, if the importance of correlation and trend is the same, the weight coefficients are 0.5 and 0.5; if the trend is more important, the weight coefficient of the second time series prediction data is greater than the weight coefficient of the first time series prediction data, such as 0.7 and 0.3.
[0076] The embodiment of the present application performs a weighted sum calculation on the first time series prediction data obtained by predicting based on the correlation characteristics of historical time series data and the second time series data predicted based on the trend characteristics, so as to obtain the power load of the time period to be measured, thereby realizing power production planning.
[0077] The embodiments of the present application can capture longer-term dependencies of power load data and contextual information in the sequence by extracting correlation features from historical time series data, and can achieve accurate prediction of power load over a longer period of time by predicting through correlation features; by extracting trend features from historical time series data, it can also determine the trend features of load data and achieve accurate load trend prediction. This application combines load quantity prediction and load trend prediction to improve the accuracy of power load prediction, which has important guiding significance for energy management and planning in the power industry.
[0078] In some embodiments of the present application, Figure 2 This is a flow chart of an optional power load forecasting method provided by the embodiment of the present application. Figure 2 ,like Figure 2 As shown, step S102 extracts correlation features from historical time series data to obtain correlation features, which can be achieved through steps S201 to S205:
[0079] Step S201 : Segment the historical time series data to obtain a plurality of non-overlapping historical time series sub-data and corresponding position information of each historical time series sub-data in the historical time series data.
[0080] In some embodiments, to improve computing speed, longer historical time series data can be segmented to obtain multiple historical time series sub-data, with no overlapping data between adjacent historical time series sub-data to avoid errors in the prediction results. In this case, each historical time series sub-data contains information about a period of historical time series data.
[0081] In some embodiments, assuming that the length of the historical time series data is P, segmenting the historical time series data will generate N historical time series sub-data of length L. The number N of historical time series sub-data can be expressed by formula (1):
[0082]
[0083] Here, the length L can be set by technicians based on the amount of calculation and prediction accuracy. Since the complexity of attention calculation during prediction will increase quadratically with the length of the historical time series sub-data, the splitting operation can significantly reduce the calculation complexity and more effectively extract the information of the historical time series data, thereby improving the prediction performance.
[0084] In some embodiments, when L is set to a larger value, the inference and prediction speed is faster, but the prediction accuracy is reduced; when L is set to a smaller value, the inference and prediction speed is slower, but the prediction accuracy is higher.
[0085] In some embodiments, after the segmentation process, it is necessary to encode the corresponding position information of each historical time series sub-data in the historical time series data, and associate the encoded position information with each historical time series sub-data, so that during feature extraction, the correlation features between different positions can be better extracted.
[0086] Here, the historical time series data has a time sequence, and the position information corresponding to each historical time series sub-data in the historical time series data may refer to the time sequence of each historical time series sub-data in the historical time series data.
[0087] In some embodiments, a learnable position matrix can be used as the position encoding of each historical time series sub-data, or it can be a sine-cosine position encoding, or it can be represented by continuous numbers, or other identifiers that can represent the order can be used to mark the position information. The embodiments of this application do not limit the marking method.
[0088] Step S202: Perform dimension transformation processing on the multiple historical time series sub-data to obtain multiple historical time series sub-vectors with the same dimension.
[0089] Here, dimensionality transformation processing can refer to aligning the dimensions of each historical time series sub-data and projecting multiple historical time series sub-data into D dimensions. The value of D can be set. By transforming the original dimensions of the historical time series sub-data into D dimensions, the features of the historical time series sub-data can be transformed to allow interaction between features.
[0090] Here, these historical time series sub-data can be projected into the D-dimensional latent space through a projection layer W, that is, W∈R D×P , and obtain N multiple historical time series sub-vectors with the same dimension.
[0091] Step S203 : performing association processing on the multiple historical time series sub-vectors with the same dimension and the position information corresponding to each historical time series sub-data to obtain multiple associated sub-vectors.
[0092] In some embodiments, in order to distinguish the temporal order of each historical time series sub-vector, a position code is added to the projection of each historical time series sub-vector, as shown in formula (2):
[0093] X=Y+PE(pos)(2);
[0094] Among them, Y is the historical time series subvector, PE(pos) is the position information, X is the associated subvector, X=[x1,x2,…,x N ].
[0095] Step S204: Based on the multi-head attention mechanism, correlation features are extracted between the multiple associated sub-vectors to obtain multi-head attention features corresponding to the historical time series data.
[0096] In some embodiments, each associated sub-vector contains information about a period of historical time series data. In order to integrate the information of each associated sub-vector, the embodiment of the present application can use a multi-head self-attention mechanism to interact between multiple associated sub-vectors, calculate the correlation between each two associated sub-vectors, that is, the dependence and similarity between each two associated sub-vectors, thereby obtaining the correlation between each associated sub-vector and the other N-1 associated sub-vectors, that is, the weight coefficient, normalize the N-1 weight coefficients, and then perform a weighted sum calculation based on the normalized weight coefficients and the associated sub-vectors corresponding to each weight coefficient to obtain the attention feature corresponding to each associated sub-vector, and then splice the multiple attention features, and then perform a linear transformation through a preset matrix to obtain the multi-head attention feature F corresponding to the historical time series data = [f1, f2,…, f N ].
[0097] In some embodiments, step S204 may be implemented through steps S2041 to S2043:
[0098] Step S2041: Based on multiple attention heads, multiple correlation feature extractions are performed between the multiple associated sub-vectors to obtain multiple attention features; wherein the number of the multiple attention heads is equal to the number of the multiple associated sub-data.
[0099] In some embodiments, step S2041 may be implemented by steps S1 to S3:
[0100] Step S1: perform correlation calculations on each associated sub-vector and other associated sub-vectors in the plurality of associated sub-vectors to obtain attention weights between each associated sub-vector and other associated sub-vectors.
[0101] In some embodiments, two associated subvectors x i and x j The correlation between them can be calculated using formula (3):
[0102]
[0103] Among them, Q i =W Q x i , K j =W k x j , W Q and Wk are two matrices obtained by optimizing the loss function for randomly initialized matrices; D is the dimension of the associated subvector.
[0104] Formula (3) can be used to obtain the correlation between each associated sub-vector and the other N-1 associated sub-vectors, that is, the attention weight.
[0105] Step S2: normalize the attention weights corresponding to each associated sub-vector to obtain the weight coefficients between each associated sub-vector and other associated sub-vectors.
[0106] In some embodiments, the N-1 weight coefficients corresponding to each correlation sub-coefficient may be normalized using a softmax function to obtain weight coefficients between each correlation sub-vector and other correlation sub-vectors, wherein the sum of the N-1 weight coefficients is equal to 1.
[0107] Step S3: Based on the weight coefficients between each associated sub-vector and other associated sub-vectors, weighted calculation is performed on each associated sub-vector to obtain multiple attention features corresponding to the multiple associated sub-vectors.
[0108] In the embodiment of the present application, a weighted sum calculation can be performed based on the normalized weight coefficient and the associated sub-vector corresponding to each weight coefficient to obtain the attention feature corresponding to each associated sub-vector, that is, the output of each attention head, as shown in formula (4):
[0109]
[0110] Among them, V can also be the weight matrix obtained through training.
[0111] Repeat the above steps for each associated sub-vector to obtain multiple attention features corresponding to multiple associated sub-vectors.
[0112] Step S2042: perform splicing processing on the multiple attention features to obtain a spliced feature.
[0113] In the embodiment of the present application, multiple attention features corresponding to multiple associated sub-vectors are concatenated to obtain a concatenated feature, as shown in formula (5):
[0114] Concat(head1,head2,...,head N ) (5);
[0115] Step S2043: perform linear transformation on the splicing feature to obtain the multi-head attention feature.
[0116] In some embodiments, the weight matrix W can be pre-trained O, perform linear transformation on the concatenated features to obtain the multi-head attention feature MultiHead(Q,K,V), as shown in formula (6):
[0117] MultiHead(Q,K,V)=Concat(head1,head2,...,head N )W O (6);
[0118] The embodiments of this application utilize a multi-head attention mechanism, enabling the application to simultaneously focus on different aspects and locations of historical time series data. More attention heads can capture longer dependencies, eliminating the need to process sequence data through time expansion or fixed windows. This allows the application to better capture contextual information in the sequence, reducing the problem of gradient propagation over time, thereby improving prediction stability.
[0119] Step S205: perform feature fusion on the multi-head attention features to obtain the correlation features.
[0120] In some embodiments, since multi-head attention simply splices the output of each attention head together, it is necessary to fuse the information of different attention heads, and the operation of self-attention is essentially linear weighting, and its representation ability is limited, so the representation ability needs to be enhanced. In order to solve the above problems, the embodiment of the present application introduces a feedforward neural network (Feed Forward Network) to increase the nonlinearity of the features. The feedforward neural network (Feed Forward Network) is a two-layer multi-layer perceptron. Assume that the output of the multi-head attention is F = [f1, f2, ..., f N ], then the correlation feature P is as shown in formula (7):
[0121] P=FFN(F)=max(0,FW1+b1)W2+b2 (7);
[0122] Where P = [p1, p2, ..., p N ], W1, b1, W2, b2 are the weights and biases of the first and second layers of the feedforward neural network respectively; max(0,) is the ReLU activation function. The introduction of the ReLU activation function adds nonlinear components to the calculation process and enhances the learning ability.
[0123] The embodiment of the present application utilizes a multi-head attention mechanism to simultaneously focus on different aspects and information at different positions of historical time series data. More attention heads can capture longer dependencies and obtain the correlation characteristics of historical time series data. Based on the correlation characteristics, long-term predictions can be made, and the error can be guaranteed to be within a certain small range.
[0124] Based on the above embodiment, the first prediction processing of the power load of the prediction object in the test time period can be performed based on the correlation between different time points in the historical time series data. Therefore, step S103 can be implemented by step S1031:
[0125] Step S1031: Based on a linear prediction head, linear mapping is performed on the correlation feature to obtain first time series prediction data corresponding to the power load of the prediction object in the time period to be measured.
[0126] In some embodiments, linear mapping, ie, linear regression, may be performed on the correlation features based on a linear prediction head to obtain first time series prediction data corresponding to the power load of the prediction object during the time period to be measured.
[0127] However, features cannot be used directly as input for linear regression, and feature aggregation is required to transform the features into a one-dimensional vector. In the embodiment of the present application, feature aggregation can be performed by the flatten function. Flatten flattens all features and puts them together, which can maintain the information of all associated sub-vectors. Feature aggregation can also be performed by mean pooling and max pooling. Mean pooling averages the features of all patches, and max pooling takes the maximum value of each feature.
[0128] After feature aggregation, the first time series prediction data S obtained based on the linear prediction head prediction can be expressed by formula (8):
[0129] S=[s t+1 ,s t+2 ,...,s t+L ]=LinearHead(Flatten([p1,p2,...,p N ])) (8);
[0130] The present embodiment uses a multi-head attention mechanism to capture long-term dependencies in the input sequence, without the need for time expansion or fixed window processing of sequence data. This enables the present application to better capture contextual information in the sequence, reduces the problem of gradient propagation over time, and thus improves the prediction stability of the model.
[0131] In some embodiments of the present application, Figure 3 This is a flow chart of an optional power load forecasting method provided by the embodiment of the present application. Figure 3 ,like Figure 3As shown, the trend feature extraction of historical time series data in step S102 to obtain trend features can be achieved through steps S301 to S304:
[0132] Step S301: Based on the Fourier series and multiple different time periods, construct multiple different trend prediction functions for performing trend prediction on each time period respectively; wherein one time period corresponds to one trend prediction function.
[0133] In some embodiments, the Fourier series is as shown in formula (9):
[0134]
[0135] Among them, a0, a n and b n is the Fourier coefficient, T is the period, and n represents the Fourier order, which is the number of sine and cosine functions to use. Here, the sine and cosine functions are both periodic functions. By simply selecting the Fourier coefficients appropriately, we can accurately fit periodic functions.
[0136] In some embodiments, different time periods may refer to daily periodicity (T=1), weekly periodicity (T=7), and monthly periodicity (T=30). Power load data typically exhibits periodicity and trends. For example, the annual periodicity of power load forecasts is characterized by higher power loads in the summer and winter, and lower power loads in the spring and autumn. Weekly periodicity is characterized by higher power loads on weekdays (for industrial parks) and lower power loads on weekends.
[0137] Based on the Fourier series and different time periods, daily, weekly, and monthly trend prediction functions can be established to fit the daily, weekly, and monthly trends of power load data. The daily, weekly, and monthly trend prediction functions are shown in formulas (10), (11), and (12), respectively:
[0138]
[0139]
[0140]
[0141] Step S302: Based on the multiple different time periods, determine the time nodes corresponding to the historical time periods corresponding to the historical time series data in the different time periods.
[0142] Here, the historical time series data can be the power load data on February 22, 2024, and the historical time series data is the fourth day of the fourth week in the second month of 2024. Therefore, the time node of the daily periodicity is the fourth day of the week, and for formula (10), t=4; the time node of the weekly periodicity is the fourth week of the second month, and for formula (11), t=4; the time node of the monthly periodicity is the second month, and for formula (12), t=2.
[0143] Step S303: Based on the time nodes corresponding to the historical time series data in different time periods and the trend prediction functions corresponding to the different time periods, determine multiple period trend features of the historical time series data in different time periods.
[0144] In an embodiment of the present application, by bringing the time nodes corresponding to different time periods into the corresponding trend prediction function, the periodic trend characteristics of the historical time series data in different time periods can be obtained.
[0145] Step S304: performing feature fusion on the multiple periodic trend features to obtain the trend feature.
[0146] Here, the periodic trend features of daily periodicity, weekly periodicity and monthly periodicity can be integrated, either by adding or combining them, to obtain the trend features of the historical time series data.
[0147] This embodiment of the application considers different time dimensions, using time as the independent variable and fitting the power load data with a Fourier function to accurately predict the trend of power load data over time. This allows for accurate prediction of daily power load peaks and troughs, ensuring that the predicted curve and the actual power load curve remain essentially aligned. Within the weekly range, the trend of high power load on weekdays and low power load on weekends can also be perfectly predicted.
[0148] Based on the above embodiment, the second prediction processing of the power load of the prediction object in the test time period can be performed based on the data trend in the historical time series data. Therefore, step S104 can be implemented by step S1041:
[0149] Step S1041: Based on a multi-layer perceptron, a regression analysis is performed on the trend feature to obtain second time series prediction data corresponding to the power load of the prediction object during the time period to be measured.
[0150] In the embodiment of the present application, in order to capture the complex periodicity of the power load data, a multi-layer perceptron (MLP) can be used to regress the trend characteristics, as shown in formula (13):
[0151] F(t) = MLP(f(t)) (13);
[0152] Compared with related technologies that usually use linear regression of Fourier features to fit the seasonality of the sequence, which is limited by the fitting ability of linear regression and the order of Fourier features and cannot fit complex seasonal patterns, the method proposed in the embodiment of the present application can effectively capture the complex seasonality in the historical coincidence sequence, thereby significantly improving the prediction accuracy.
[0153] In some embodiments of the present application, Figure 4 This is a flow chart of an optional power load forecasting method provided by the embodiment of the present application. Figure 4 ,like Figure 4 As shown, step S105 can be implemented through steps S401 to S402:
[0154] Step S401: Obtain a first weight coefficient corresponding to the first time series prediction data and a second weight coefficient corresponding to the second time series prediction data.
[0155] In some embodiments, the first weight coefficient corresponding to the first time series prediction data and the second weight coefficient corresponding to the second time series prediction data can be set according to needs. For example, if the importance of correlation and trend is the same, the first weight coefficient and the second weight coefficient can be 0.5 and 0.5; if the trend is more important, the second weight coefficient is greater than the first weight coefficient.
[0156] Step S402: Perform weighted calculation on the first time series prediction data and the second time series prediction data according to the first weight coefficient and the second weight coefficient to obtain the time series prediction data corresponding to the power load of the prediction object in the time period to be measured.
[0157] Here, the weighted processing may be a weighted addition processing to obtain the time series prediction data corresponding to the power load of the prediction object during the time period to be measured.
[0158] The embodiments of the present application combine load quantity prediction and load trend prediction, which can improve the accuracy of power load prediction and has important guiding significance for energy management and planning in the power industry.
[0159] In some embodiments, the historical time period includes multiple time points, and the historical time series data includes at least power load data corresponding to the multiple time points respectively; the power load forecasting method provided in the embodiment of the present application may further include steps S10 to S30:
[0160] Step S10: Calculate the mean and variance of the power load data corresponding to the multiple time points to obtain the mean and variance of the power load corresponding to the time series prediction data.
[0161] Step S20: Based on the power load mean and the variance, perform data normalization processing on the plurality of power load data to obtain a plurality of normalized data.
[0162] In some embodiments, performing data normalization on each power load data in the historical time series data may refer to performing normalization on each power load data. The normalization formula is shown in (14):
[0163]
[0164] Among them, x i The data corresponding to each time in the time series data; is the mean of the time series data; σ is the variance of the time series data.
[0165] Here, the normalized data has a mean of 0 and a variance of 1 for each dimension. Normalizing time series data can improve prediction speed and accuracy. It effectively increases the efficiency of backpropagation and also has the effect of parameter regularization, allowing the use of higher learning rates. It can also effectively reduce gradient spread and simplify the selection of learning rates.
[0166] Step S30: Generate standard time series data corresponding to the historical time series data based on the multiple standard data.
[0167] In an embodiment of the present application, the normalized standard data is determined as the standard time series data corresponding to the historical time series data.
[0168] Correspondingly, step S102 can be implemented through step S1021:
[0169] Step S1021 : performing correlation feature extraction and trend feature extraction on the standard time series data respectively to obtain the correlation feature and the trend feature.
[0170] The embodiment of the present application performs correlation feature extraction and trend feature extraction on the normalized data to obtain correlation features and trend features, and performs power load forecasting based on the correlation features and trend features, thereby improving forecasting speed and accuracy.
[0171] Next, we provide an application of a power load forecasting method in a practical scenario.
[0172] In order to solve the problem that the power load forecasting method in the related art cannot accurately predict the trend of data and cannot make long-term forecasts, the embodiment of the present application not only establishes a Transformer model, but also uses the multi-head attention mechanism in the Transformer model to enable the model to simultaneously focus on the feature information of the input sequence (i.e., historical time series data) in different aspects and different positions. More attention heads can capture longer dependencies. A Fourier (MLP-Fourier) feature extraction model based on a multi-layer perceptron is also established. This module takes time as an independent variable and uses the Fourier function to fit the trend of power load data and time. In order to better extract the trend of power load data, the outer layer is wrapped with a multi-layer perceptron model. The prediction method provided by the embodiment of the present application can maintain a long-term prediction effect for one month. Given some historical data, it can predict the power load for the next month, and the error can be guaranteed to be within a small range. At the same time, it can accurately predict the trend of power load data, accurately predict the daily power load peak and trough, so that the predicted curve and the actual power load curve remain basically consistent. Within the scope of the week, the trend of high power load on weekdays and low power load on weekends can also be accurately predicted.
[0173] Figure 5 This is a flow chart of an optional power load forecasting method provided by the embodiment of the present application. Figure 5 ,like Figure 5 As shown, the prediction process is mainly divided into data normalization, the Transformer model captures longer dependencies, the MLP-Fourier model extracts trend features, and then integrates and outputs the power load prediction results. The power load prediction method can be implemented through steps S501 to S504:
[0174] Step S501: normalize the time series data to obtain normalized data.
[0175] In some embodiments, normalizing the time series data may refer to normalizing the sequence data. The normalization formula is shown in (15):
[0176]
[0177] Among them, x i The data corresponding to each time in the time series data; is the mean of the time series data; σ is the variance of the time series data.
[0178] Here, the normalized data has a mean of 0 and a variance of 1 for each dimension. Normalizing time series data can speed up training, improve model accuracy, and accelerate model convergence. It effectively improves backpropagation efficiency and regularizes parameters, allowing for higher learning rates. It can also effectively reduce gradient vanishing and simplify learning rate selection.
[0179] Step S502: Perform a first prediction on the normalized data to obtain first predicted data.
[0180] In some embodiments, the first prediction can be implemented through a Transformer model to capture longer dependencies in time series data.
[0181] In some embodiments, Figure 6 is a schematic diagram of the structure of the Transformer model provided in the embodiment of the present application, such as Figure 6 As shown, the Transformer model 60 may include a time block division layer 601, a mapping and position encoding layer 602, an encoding layer 603, a feature aggregation layer 604, and a linear mapping layer 605. The encoding layer 603 may include position and data embedding, a multi-head attention layer, layer normalization, residual connection, and a forward feedback layer.
[0182] First, the input time series data is divided into multiple non-overlapping time period sequences (patches) based on the time block partitioning layer 601. Assuming that the length of each patch after division is P, the time series data will generate N patches. N can be achieved by formula (16):
[0183]
[0184] Where L is the length of the time series data.
[0185] In some embodiments, because the computational complexity of the Transformer model's attention increases quadratically with the length of the input time series data, patching can significantly reduce the computational complexity by reducing the upper length of the time series data input to the Transformer from L to N. Patching can more effectively extract historical sequence information, thereby improving prediction performance by increasing the length of the input sequence.
[0186] The second step is to pre-process the multiple time segment sequences (patches) obtained by the division based on the mapping and position encoding layer 602 (Projection+Position Embedding). Here, these patches can be projected into the D-dimensional latent space W∈R through a projection layer W.D×P , get multiple time period sequences Y after projection, Y includes y1 to y N .
[0187] Here, in order to distinguish the temporal order of each patch, a positional encoding is added to the projection of each patch. Here, a learnable position matrix can be used as the positional encoding to embed into each time segment sequence. The multiple time segment sequences X after the mapping and positional encoding layer processing can be expressed by formula (17):
[0188] X=Y+PE(pos) (17);
[0189] Where X includes x1 to x N ; PE(pos) is the position information of each time period sequence.
[0190] In some embodiments, each time period sequence may be assigned a unique code to indicate the absolute position of the position in the sequence; each time period sequence may be assigned a code relative to other time period sequences to indicate the relative position between the time period sequence and other time period sequences; and sine and cosine functions may be used to encode position information so that the model can capture periodic patterns in the sequence.
[0191] The second step is to calculate the correlation between every two time period sequences based on the coding layer 603 .
[0192] After the above steps, we can get the N time period sequence [x1, x2, ..., x N ], where each time period sequence contains information about a period of the input historical load sequence. In order to integrate the information of each time period sequence, the transformer uses a multi-head self-attention layer to interact between patches. Consider two time period sequences x i and x j , self-attention calculates the correlation between two patches through formula (18):
[0193]
[0194] Among them, Q i =W Q x i , K j =W k x j , D is the dimension of the patch. Q and W k These are two matrices that can be obtained through model training.
[0195] Through the above steps, the attention weight between each two patches can be obtained, and then the weight is normalized using softmax. Finally, each patch is weighted and summed to obtain the output head of the patch after softmax, as shown in formula (19):
[0196]
[0197] Here, head is a d-dimensional vector, V = W V x i , W V With W Q and W k The same can be obtained through model training.
[0198] In the embodiment of the present application, in order to extract different aspects of information between patches, the transformer model uses multiple self-attention modules to project each patch into multiple subspaces, and obtains the correlation representation in different subspaces between patches to form the multi-head attention feature MultiHead(Q, K, V) corresponding to the time series data, as shown in formula (20):
[0199] MultiHead(Q,K,V)=Concat(head1,head2,...,head N )W O (20);
[0200] Among them, concat is the splicing operation, W O It can be obtained through model training.
[0201] Based on the above formula (20), we get the multi-head attention feature F = [f1,f2,...,f N ].
[0202] Here, multi-head attention simply concatenates the outputs of each attention head, so information from different attention heads needs to be fused. Secondly, the self-attention operation is essentially linear weighting, and its representational capabilities are limited, so this representational capability needs to be enhanced. To achieve these two goals, this application introduces a real-time feedforward network to increase the nonlinearity of the multi-head attention features.
[0203] In the embodiment of the present application, the feedforward layer (FeedForward Network) is a two-layer multilayer perceptron, W1 and W2 are the weights of the first layer and the second layer respectively, b1 and b2 are the biases of the first layer and the second layer respectively, and the output P of the feedforward layer, that is, the feature corresponding to each patch, is obtained as shown in formula (21):
[0204] P=FFN(F)=max(0,FW1+b1)W2+b2 (21);
[0205] Among them, max(0,·) is the ReLU activation function; P=[p1,p2,...,p N ].
[0206] Here, after obtaining the features corresponding to each patch, it is necessary to use these features to predict future power load. However, the features cannot be used directly as input for linear regression and need to be transformed into a one-dimensional vector through feature aggregation. Therefore, the embodiment of the present application aggregates the features corresponding to each patch based on the feature aggregation layer 604.
[0207] In the embodiment of the present application, feature aggregation can be performed through the flatten function. Flatten flattens all features and puts them together, which can maintain the information of all patches. The aggregated features are shown in formula (22).
[0208] Flatten([p1,p2,...,p N ]) (twenty two);
[0209] Feature aggregation can also be performed through mean pooling and max pooling. Mean pooling averages the features of all patches, and max pooling takes the maximum value of each feature.
[0210] Next, the load amount of the future time step is predicted through the linear mapping layer 605, that is, the first prediction data, as shown in formula (23):
[0211] [x t+1 ,x t+2 ,...,x t+L ]=LinearHead(Flatten([p1,p2,...,p N ])) (twenty three);
[0212] Step S503: Perform a second prediction on the normalized data to obtain second predicted data.
[0213] In some embodiments, the second prediction may refer to extracting trend features of time series data through an MLP-Fourier model and predicting the power load based on the trend features.
[0214] In some embodiments, the Fourier series is as shown in formula (24):
[0215]
[0216] Among them, a0, a n and b n is the Fourier coefficient, T is the period, and n represents the Fourier order, which is the number of sine and cosine functions to use. Here, the sine and cosine functions are both periodic functions. By simply selecting the Fourier coefficients appropriately, we can accurately fit periodic functions.
[0217] Based on the above formula (24), models of daily periodicity (T = 1), weekly periodicity (T = 7), and monthly periodicity (T = 30) are established to fit the trend of power load data. The models of daily periodicity, weekly periodicity, and monthly periodicity are shown in formulas (25), (26), and (27):
[0218]
[0219]
[0220]
[0221] Based on the above model, daily, weekly, and monthly periodic features can be obtained. By splicing and fusing them, the Fourier feature f(t) can be obtained, that is, the power load trend in the time period to be predicted. The Fourier feature is regressed through a multi-layer perceptron (MLP) to obtain the second prediction result F(t) to capture the complex periodicity of the power load data. This process is implemented by formula (28):
[0222] F(t) = MLP(f(t)) (28);
[0223] Compared with related technologies that usually use linear regression of Fourier features to fit the seasonality of the sequence, which is limited by the fitting ability of linear regression and the order of Fourier features and cannot fit complex seasonal patterns, the method proposed in the embodiment of the present application can effectively capture the complex seasonality in the historical coincidence sequence, thereby significantly improving the prediction accuracy.
[0224] Step S504: fusing the first prediction data and the second prediction data to obtain a power prediction result.
[0225] Here, the fusion processing may be to add or weighted add the first prediction data and the second prediction data to obtain the power prediction result for the time period to be measured.
[0226] The prediction method provided by the embodiments of the present application can maintain a long-term prediction effect for one month. Given some historical data, it can predict the power load for the next month with a small error range. At the same time, it can accurately predict the trend of power load data and accurately predict the daily power load peaks and troughs, so that the predicted curve and the actual power load curve remain basically consistent. Within the scope of the week, the trend of high power load on weekdays and low power load on weekends can also be accurately predicted.
[0227] Based on the foregoing embodiments, an embodiment of the present application provides a power load forecasting device, which includes the various units included and the various modules included in each unit, and can be implemented by a processor in a computer device; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), etc.
[0228] Figure 7 A schematic diagram of the structure of a power load forecasting device provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the power load prediction device 700 includes: an acquisition module 710, a feature extraction module 720, a first prediction module 730, a second prediction module 740 and a fusion module 750, wherein:
[0229] An acquisition module 710 is used to acquire historical time series data corresponding to the power load of the prediction object within a historical time period; a feature extraction module 720 is used to perform correlation feature extraction and trend feature extraction on the historical time series data respectively to obtain correlation features and trend features; a first prediction module 730 is used to perform a first prediction processing on the power load of the prediction object within a time period to be measured based on the correlation features to obtain first time series prediction data; a second prediction module 740 is used to perform a second prediction processing on the power load of the time period to be measured based on the trend features to obtain second time series prediction data; a fusion module 750 is used to perform a fusion processing on the first time series prediction data and the second time series prediction data to obtain time series prediction data corresponding to the power load of the prediction object within the time period to be measured.
[0230] In some embodiments, the feature extraction module 720 is also used to segment the historical time series data to obtain multiple non-overlapping historical time series sub-data and the corresponding position information of each historical time series sub-data in the historical time series data; perform dimensionality transformation on the multiple historical time series sub-data to obtain multiple historical time series sub-vectors with the same dimension; perform association processing on the multiple historical time series sub-vectors with the same dimension and the corresponding position information of each historical time series sub-data to obtain multiple associated sub-vectors; based on the multi-head attention mechanism, perform correlation feature extraction between the multiple associated sub-vectors to obtain the multi-head attention feature corresponding to the historical time series data; perform feature fusion on the multi-head attention feature to obtain the correlation feature.
[0231] In some embodiments, the feature extraction module 720 is also used to perform multiple correlation feature extractions between the multiple associated sub-vectors based on multiple attention heads to obtain multiple attention features; wherein the number of the multiple attention heads is equal to the number of the multiple associated sub-data; the multiple attention features are spliced to obtain spliced features; and the spliced features are linearly transformed to obtain the multi-head attention features.
[0232] In some embodiments, the feature extraction module 720 is also used to perform correlation calculations on each associated sub-vector and other associated sub-vectors in the multiple associated sub-vectors to obtain attention weights between each associated sub-vector and other associated sub-vectors; normalize the attention weights corresponding to each associated sub-vector to obtain weight coefficients between each associated sub-vector and other associated sub-vectors; and perform weighted calculations on each associated sub-vector based on the weight coefficients between each associated sub-vector and other associated sub-vectors to obtain multiple attention features corresponding to multiple associated sub-vectors.
[0233] In some embodiments, the first prediction module 730 is further configured to perform linear mapping on the correlation feature based on a linear prediction head to obtain first time series prediction data corresponding to the power load of the prediction object during the time period to be measured.
[0234] In some embodiments, the feature extraction module 720 is also used to construct multiple different trend prediction functions for performing trend predictions on each time period based on the Fourier series and multiple different time periods; wherein one time period corresponds to one trend prediction function; based on the multiple different time periods, determine the time nodes corresponding to the historical time periods corresponding to the historical time series data in different time periods; based on the time nodes corresponding to the historical time series data in different time periods and the trend prediction functions corresponding to different time periods, determine multiple periodic trend features of the historical time series data in different time periods; perform feature fusion on the multiple periodic trend features to obtain the trend features.
[0235] In some embodiments, the second prediction module 740 is further configured to perform regression analysis on the trend characteristics based on a multi-layer perceptron to obtain second time series prediction data corresponding to the power load of the prediction object during the time period to be measured.
[0236] In some embodiments, the fusion module 750 is also used to obtain a first weight coefficient corresponding to the first time series prediction data and a second weight coefficient corresponding to the second time series prediction data; based on the first weight coefficient and the second weight coefficient, the first time series prediction data and the second time series prediction data are weightedly calculated to obtain the time series prediction data corresponding to the power load of the prediction object during the time period to be measured.
[0237] In some embodiments, the historical time period includes multiple time points, and the historical time series data includes at least the power load data corresponding to the multiple time points respectively; the device also includes: a calculation module, which is used to calculate the mean and variance of the power load data corresponding to the multiple time points respectively, and obtain the power load mean and variance corresponding to the time series prediction data; a data standardization module, which is used to perform data standardization processing on the multiple power load data based on the power load mean and the variance, and obtain multiple standard data; a generation module, which is used to generate standard time series data corresponding to the historical time series data based on the multiple standard data; correspondingly, the feature extraction module 720 is also used to perform correlation feature extraction and trend feature extraction on the standard time series data respectively, and obtain the correlation feature and the trend feature.
[0238] The description of the above device embodiment is similar to the description of the above method embodiment and has similar beneficial effects as the method embodiment. In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to perform the methods described in the above method embodiments. For technical details not disclosed in the device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0239] It should be noted that, in the embodiment of the present application, if the above-mentioned power load forecasting method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific hardware, software or firmware, or any combination of hardware, software and firmware.
[0240] An embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, some or all of the steps in the above method are implemented.
[0241] The present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements some or all of the steps in the above method. The computer-readable storage medium may be transient or non-transient.
[0242] An embodiment of the present application provides a computer program, including computer-readable code. When the computer-readable code is run in a computer device, a processor in the computer device executes some or all of the steps for implementing the above method.
[0243] An embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, implements some or all of the steps in the above method. The computer program product can be implemented specifically by hardware, software, or a combination thereof. In some embodiments, the computer program product is embodied as a computer storage medium. In other embodiments, the computer program product is embodied as a software product, such as a software development kit (SDK), etc.
[0244] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between the various embodiments, and their similarities or similarities can be referenced to each other. The descriptions of the above device, storage medium, computer program, and computer program product embodiments are similar to the descriptions of the above method embodiments and have similar beneficial effects as the method embodiments. For technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of this application, please refer to the description of the method embodiments of this application for understanding.
[0245] It should be noted that Figure 8 A schematic diagram of a hardware entity of a computer device in an embodiment of the present application is shown in FIG. Figure 8 As shown, the hardware entity of the computer device 800 includes: a processor 801, a communication interface 802 and a memory 803, wherein:
[0246] Processor 801 generally controls the overall operation of computer device 800 .
[0247] The communication interface 802 enables the computer device to communicate with other terminals or servers through a network.
[0248] The memory 803 is configured to store instructions and applications executable by the processor 801. It can also cache data to be processed or processed by the processor 801 and various modules in the computer device 800 (for example, image data, audio data, voice communication data, and video communication data). This can be implemented using flash memory (FLASH) or random access memory (RAM). Data can be transmitted between the processor 801, the communication interface 802, and the memory 803 via a bus 804.
[0249] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned steps / processes does not mean the order of execution, and the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The above-mentioned serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.
[0250] This application uses descriptions of directions or positional relationships such as "up", "down", "top", "bottom", "front", "back", "inside" and "outside" to facilitate the description of this application, and does not indicate or imply that the device referred to must have a specific direction, be constructed and operated in a specific direction. Therefore, it should not be understood as limiting the scope of protection of this application.
[0251] It should also be noted that, in the description of this application, unless otherwise specified or limited, the terms "installed," "connected," and "connected" should be understood broadly. For example, they can refer to fixed connections, detachable connections, or integral connections; they can refer to direct connections or indirect connections through an intermediary. Those skilled in the art will understand the specific meanings of these terms in this application based on the specific circumstances.
[0252] It should be noted that, in this application, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0253] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of 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 can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0254] The units described above as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, the functional units in the various embodiments of the present application may all be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0255] The above are only implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or replacements that can be easily thought of by any technician familiar with this technical field within the technical scope disclosed in this application should be covered by the protection scope of the present application.
Claims
1. A method for predicting power load, characterized in that: The power load forecasting method comprises: Obtain the historical time series data corresponding to the power load of the forecast object within the historical time period; Respectively extracting correlation features and trend features from the historical time series data to obtain correlation features and trend features; Based on the correlation feature, a first prediction process is performed on the power load of the prediction object in the time period to be measured to obtain first time series prediction data; Based on the trend characteristics, a second prediction process is performed on the power load in the time period to be measured to obtain second time series prediction data; The first time series prediction data and the second time series prediction data are fused to obtain time series prediction data corresponding to the power load of the prediction object during the time period to be measured.
2. The power load forecasting method according to claim 1, characterized in that: Correlation features are extracted from the historical time series data to obtain correlation features, including: Segmenting the historical time series data to obtain a plurality of non-overlapping historical time series sub-data and corresponding position information of each historical time series sub-data in the historical time series data; Performing dimension transformation processing on the multiple historical time series sub-data to obtain multiple historical time series sub-vectors with the same dimension; performing association processing on the multiple historical time series sub-vectors having the same dimension and the position information corresponding to each historical time series sub-data to obtain multiple associated sub-vectors; Based on the multi-head attention mechanism, correlation features are extracted between the multiple associated sub-vectors to obtain multi-head attention features corresponding to the historical time series data; The multi-head attention features are subjected to feature fusion to obtain the correlation features.
3. The power load forecasting method according to claim 2, characterized in that: The multi-head attention mechanism is used to extract correlation features between the multiple associated sub-vectors to obtain multi-head attention features corresponding to the historical time series data, including: Based on the multiple attention heads, multiple correlation feature extractions are performed on the multiple associated sub-vectors to obtain multiple attention features; wherein the number of the multiple attention heads is equal to the number of the multiple associated sub-data; Performing splicing processing on the multiple attention features to obtain a spliced feature; Perform a linear transformation on the splicing features to obtain the multi-head attention features.
4. The power load forecasting method according to claim 3, characterized in that: Based on the multiple attention heads, multiple correlation feature extractions are performed between the multiple associated sub-vectors to obtain multiple attention features, including: performing correlation calculations on each associated sub-vector and other associated sub-vectors in the plurality of associated sub-vectors to obtain attention weights between each associated sub-vector and other associated sub-vectors; Normalize the attention weights corresponding to each associated sub-vector to obtain the weight coefficients between each associated sub-vector and other associated sub-vectors; Based on the weight coefficients between each associated sub-vector and other associated sub-vectors, a weighted calculation is performed on each associated sub-vector to obtain multiple attention features corresponding to the multiple associated sub-vectors.
5. The power load forecasting method according to any one of claims 1 to 4, characterized in that: The step of performing a first prediction process on the power load of the prediction object within the time period to be measured based on the correlation feature to obtain first time series prediction data includes: Based on the linear prediction head, the correlation features are linearly mapped to obtain first time series prediction data corresponding to the power load of the prediction object in the time period to be measured.
6. The power load forecasting method according to any one of claims 1 to 5, characterized in that: Extract trend features from the historical time series data to obtain trend features, including: Based on the Fourier series and multiple different time periods, multiple different trend prediction functions are constructed to respectively predict the trend of each time period; wherein one time period corresponds to one trend prediction function; Based on the multiple different time periods, determining time nodes corresponding to the historical time periods corresponding to the historical time series data in the different time periods; Determine multiple periodic trend features of the historical time series data in different time periods based on the time nodes corresponding to the historical time series data in different time periods and the trend prediction functions corresponding to the different time periods; Feature fusion is performed on the multiple periodic trend features to obtain the trend feature.
7. The power load forecasting method according to any one of claims 1 to 6, characterized in that: Based on the trend characteristics, a second prediction process is performed on the power load in the time period to be measured to obtain second time series prediction data, including: Based on a multi-layer perceptron, regression analysis is performed on the trend characteristics to obtain second time series prediction data corresponding to the power load of the prediction object during the time period to be measured.
8. The power load forecasting method according to any one of claims 1 to 7, characterized in that: The first time series prediction data and the second time series prediction data are fused to obtain time series prediction data corresponding to the power load of the prediction object in the time period to be measured, including: Obtaining a first weight coefficient corresponding to the first time series prediction data and a second weight coefficient corresponding to the second time series prediction data; The first time series prediction data and the second time series prediction data are weightedly calculated according to the first weight coefficient and the second weight coefficient to obtain the time series prediction data corresponding to the power load of the prediction object in the time period to be measured.
9. The power load forecasting method according to any one of claims 1 to 8, characterized in that: The historical time period includes multiple time points, and the historical time series data includes at least power load data corresponding to the multiple time points respectively; The method further comprises: Calculating the mean and variance of the power load data corresponding to the multiple time points to obtain the mean and variance of the power load corresponding to the time series prediction data; Based on the power load mean and the variance, performing data normalization processing on the plurality of power load data to obtain a plurality of normalized data; Based on the plurality of standard data, generating standard time series data corresponding to the historical time series data; Correspondingly, the extracting correlation features and trend features from the historical time series data respectively to obtain the correlation features and the trend features includes: Correlation feature extraction and trend feature extraction are performed on the standard time series data respectively to obtain the correlation feature and the trend feature.
10. A power load forecasting device, characterized in that: The power load prediction device includes: An acquisition module is used to obtain historical time series data corresponding to the power load of the prediction object within a historical time period; A feature extraction module is used to extract correlation features and trend features from the historical time series data to obtain correlation features and trend features; A first prediction module is configured to perform a first prediction process on the power load of the prediction object within the time period to be measured based on the correlation feature to obtain first time series prediction data; A second prediction module is used to perform a second prediction process on the power load in the time period to be measured based on the trend characteristics to obtain second time series prediction data; A fusion module is used to fuse the first time series prediction data and the second time series prediction data to obtain the time series prediction data corresponding to the power load of the prediction object during the time period to be measured.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the program, the steps of the power load forecasting method according to claims 1 to 9 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the power load forecasting method according to claims 1 to 9 are implemented.
13. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps in the power load forecasting method according to any one of claims 1 to 9 are implemented.