A short-term load forecasting method and system based on deep learning
By preprocessing and feature extraction of historical power load data based on deep learning, the problem of difficulty in processing nonlinear load data in the prior art is solved, and high-precision short-term load prediction and efficiency improvement are achieved.
Patent Information
- Application Number
- CN202411719804.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-11-28
Smart Images

Figure CN119228168B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power load forecasting, and in particular to a short-term load forecasting method and system based on deep learning. Background Art
[0002] Short-term power load forecasting is an important part of the stable operation of the new power system. It can provide a reliable decision-making basis for power system planning and operation, and contribute to the economic operation of the power system. At present, the increase of new energy sources and the increase of volatility have indirectly changed the power consumption behavior on the user side, increasing the uncertainty of the load and making it difficult to obtain accurate short-term load forecasting results. Therefore, short-term load forecasting has become a current research hotspot.
[0003] The current short-term load forecasting methods can be roughly divided into two types: mathematical statistical models and traditional machine learning methods. However, using these methods to achieve short-term load forecasting not only requires a large workload, but also often has difficulty in processing nonlinear and non-stationary power load data.
[0004] Therefore, it is urgent to propose a new short-term load forecasting method to achieve efficient and accurate prediction of power load data, thereby providing a strong guarantee for the efficient operation of the power system. Summary of the invention
[0005] The purpose of the present invention is to achieve efficient prediction of power load data. In order to achieve the above purpose, the present invention provides a short-term load forecasting method and system based on deep learning.
[0006] In a first aspect, an embodiment of the present invention provides a short-term load forecasting method based on deep learning, comprising:
[0007] Acquiring historical load data of a target power system to form an initial load data set, and preprocessing the initial load data set to obtain a target load data set;
[0008] Clustering the target load data set to obtain a plurality of load data subsets with different power consumption characteristics;
[0009] Position encoding is performed on the load data subset, and feature extraction is performed on the position-encoded load data subset through a multi-head self-attention mechanism to obtain a first output feature;
[0010] The first output feature is transformed into frequency domain through a channel attention mechanism to obtain a load frequency domain feature;
[0011] The load data subset and the load frequency domain feature are restored through a masked cross-attention mechanism, and short-term load prediction is performed on the obtained second output feature to obtain a prediction result.
[0012] Preferably, the preprocessing of the initial load data set to obtain the target load data set includes:
[0013] The initial load data set is processed for missing values and outliers to obtain a target load data set.
[0014] Preferably, clustering the target load data set to obtain a plurality of load data subsets with different power consumption characteristics includes:
[0015] The target load data is clustered using an improved DBSCAN algorithm to obtain a plurality of load data subsets with different power consumption characteristics; wherein the improved DBSCAN algorithm is designed to improve the setting rule of the neighborhood radius.
[0016] Preferably, the setting rule of improving the neighborhood radius includes:
[0017] The neighborhood radius is calculated using a preset formula; wherein the preset formula is as follows:
[0018]
[0019] in, represents the neighborhood radius, represents the number of samples, represents the sample dimension, Indicates the minimum number of points in the neighborhood required to become a core object, represents the Gamma function, express -Neighborhood.
[0020] Preferably, position encoding the load data subset and extracting features of the position-encoded load data subset through a multi-head self-attention mechanism to obtain a first output feature includes:
[0021] Using a gated recurrent unit to positionally encode the load data subset to obtain gated mechanism output data;
[0022] An encoder is used to extract features from the output data of the gating mechanism to obtain a first output feature; wherein the encoder includes a plurality of multi-head self-attention layers and a feedforward layer connected in sequence.
[0023] Preferably, the following formula is used to characterize the output characteristics of the current multi-head self-attention layer:
[0024]
[0025] in, represents the output features of the current multi-head self-attention layer, represents normalization processing, represents the input features of the current multi-head self-attention layer, Represents multi-head self-attention mechanism processing;
[0026] The first output feature is characterized by the following formula:
[0027]
[0028] in, represents the first output feature, represents the input features of the feed-forward layer, Represents feed-forward layer processing.
[0029] Preferably, the first output feature is transformed into a frequency domain through a channel attention mechanism to obtain a load frequency domain feature, including:
[0030] Performing feature mapping on the first output feature along the channel to obtain a first output feature vector for each channel;
[0031] Performing frequency domain transformation on the first output feature vector by using discrete cosine transform to obtain frequency domain components of each channel;
[0032] Performing a superposition operation on the frequency domain components to obtain an initial frequency domain feature of the first output feature;
[0033] The initial frequency domain features are optimized based on the attention mechanism to obtain the load frequency domain features.
[0034] Preferably, the load data subset and the load frequency domain feature are restored through a masked cross attention mechanism, and short-term load forecasting is performed on the obtained second output feature to obtain a forecast result, including:
[0035] A decoder is used to perform feature recovery on the load data subset and the load frequency domain feature to obtain a second output feature; wherein the decoder includes a plurality of mask cross attention layers and a feedforward layer connected in sequence;
[0036] Nonlinear mapping is performed on the second output feature to obtain a short-term load forecasting result.
[0037] Preferably, performing nonlinear mapping on the second output feature to obtain a short-term load forecast result includes:
[0038] A fully connected layer is used to perform nonlinear mapping on the second output feature to obtain a short-term load forecasting result; wherein the short-term load forecasting result is characterized by the following formula:
[0039]
[0040] in, represents the short-term load forecast result, represents the activation function of the fully connected layer, represents the weight matrix, represents the second output feature, Indicates deviation.
[0041] In a second aspect, an embodiment of the present invention provides a short-term load forecasting system based on deep learning, including:
[0042] A target data set acquisition module is used to acquire historical load data of a target power system to form an initial load data set, and preprocess the initial load data set to obtain a target load data set;
[0043] A clustering analysis module, used for clustering the target load data set to obtain multiple load data subsets with different power consumption characteristics;
[0044] A first output feature acquisition module is used to position encode the load data subset, and extract features of the position-encoded load data subset through a multi-head self-attention mechanism to obtain a first output feature;
[0045] A frequency domain feature acquisition module, used for performing frequency domain transformation on the first output feature through a channel attention mechanism to obtain a load frequency domain feature;
[0046] The prediction result acquisition module is used to restore the load data subset and the load frequency domain features through a masked cross-attention mechanism, and perform short-term load prediction on the obtained second output features to obtain a prediction result.
[0047] Compared with the prior art, the short-term load forecasting method and system based on deep learning in the embodiment of the present invention has the following beneficial effects: the DBSCAN clustering method is improved, and the load data with similar power consumption characteristics are classified into one category by this method, thereby improving the accuracy of subsequent load forecasting; the gated cyclic unit is used to extract the correlation between node load characteristics, remove irrelevant information, and aggregate the characteristics between nodes, which is conducive to improving the prediction accuracy; the discrete cosine transform with strong frequency domain information acquisition ability is used to convert the power load characteristics into frequency domain characteristics with clear physical meaning, which is helpful to reveal the frequency domain structure and characteristic information of the load; the channel attention mechanism is introduced to effectively capture the characteristic relationship of each channel in the frequency domain, enhance the expression ability of the characteristics, and extract more comprehensive load information from the frequency domain; the self-attention mechanism and the cross-attention mechanism are used to realize the efficient processing and prediction of time series data. In general, the present invention can realize high-precision short-term load forecasting under the new power system, and greatly improve the prediction efficiency under the condition of ensuring the prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a flowchart of a short-term load forecasting method based on deep learning according to an embodiment of the present invention;
[0049] Figure 2 is a schematic diagram of a process of obtaining a first output feature according to an embodiment of the present invention;
[0050] Figure 3 is a schematic diagram of the structure of a load forecasting model according to an embodiment of the present invention;
[0051] Figure 4 Schematic diagram of the workflow of the channel attention mechanism layer of an embodiment of the present invention;
[0052] Figure 5 is a schematic diagram of a flow chart of obtaining load frequency domain characteristics according to an embodiment of the present invention;
[0053] Figure 6 is a schematic diagram of a process for obtaining a prediction result according to an embodiment of the present invention;
[0054] Figure 7 It is a schematic diagram comparing the predicted load and actual load of the load forecasting model of the embodiment of the present invention and the Transformer model at different time points;
[0055] Figure 8 It is a structural schematic diagram of a short-term load forecasting system based on deep learning according to an embodiment of the present invention. DETAILED DESCRIPTION
[0056] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0057] In the description of the present invention, it should be understood that the terms "first" and "second" etc. are used in the present invention to distinguish different objects rather than to describe a specific order.
[0058] like Figure 1 As shown, an embodiment of the present invention provides a short-term load forecasting method based on deep learning, comprising the steps of:
[0059] S1. Acquire historical load data of a target power system to form an initial load data set, and preprocess the initial load data set to obtain a target load data set;
[0060] Specifically, the initial load data set is processed for missing values and outliers to obtain the target load data set.
[0061] This embodiment uses high-dimensional mapping to process missing values and outliers on the initial load data set. High-dimensional mapping is a technique for processing missing values and outliers in a data set, which usually involves mapping data from the original feature space to a higher-dimensional space so that it is easier to identify and process abnormalities and missing conditions in the data. Before high-dimensional mapping, the data is first cleaned, including removing irrelevant noise and standardizing data, and determining which features are important and which features may contain missing values or outliers. Then the selected high-dimensional mapping method is used to train the model to map the original data to a higher-dimensional space. In a high-dimensional space, outliers are usually far away from the main part of the data set, and these outliers can be identified by clustering or distance-based methods. For missing values, the model after high-dimensional mapping can be used to predict missing values. For identified outliers, different strategies can be adopted, such as deletion, replacement or correction. Once the missing values and outliers are processed, the data needs to be mapped back from the high-dimensional space to the original feature space to complete the processing of abnormal data.
[0062] S2. Clustering the target load data set to obtain multiple load data subsets with different power consumption characteristics;
[0063] Specifically, the improved DBSCAN algorithm is used to cluster the target load data to obtain multiple load data subsets with different power consumption characteristics.
[0064] The DBSCAN algorithm is a density-based clustering algorithm that can effectively identify clusters of any shape and can process noisy data. Specifically, the process of the DBSCAN algorithm is as follows:
[0065] 1) Initialization parameters:
[0066] : A positive number that defines the size of the neighborhood radius;
[0067] : An integer defining the minimum number of points in the neighborhood (including the point itself) that a point needs to have in order to become a core object.
[0068] 2) Find the core object:
[0069] For each point P in the data set, calculate its The number of points in the neighborhood (i.e., the distance from point P is less than If point P The number of points in the neighborhood is greater than or equal to , then point P is marked as a core object.
[0070] 3) Expand the cluster:
[0071] Initialize an empty cluster set. For each core object P, create a new cluster C and add P to C. Set up a queue Q to put all the P Points in the neighborhood (those points that have not yet been assigned to any cluster) are added to the queue Q.
[0072] When the queue Q is not empty, repeat the following steps:
[0073] i) Take a point Q_i from the queue Q;
[0074] ii) If Q_i has not been assigned to any cluster, add Q_i to cluster C;
[0075] iii) Change Q_i All points in the neighborhood that are not assigned to any cluster are added to queue Q (if they are not already in the queue).
[0076] 4) Mark noise points:
[0077] Points in the dataset that do not belong to any cluster are marked as noise points.
[0078] At this point, all points are classified into a cluster or marked as noise points.
[0079] The core of the DBSCAN algorithm is to set a neighborhood radius and minimum points , these two parameters set too large or too small will affect the clustering effect. Therefore, it is necessary to select appropriate and By understanding the distribution characteristics of the data set, we can reasonably choose the values of these two parameters to obtain better clustering effects.
[0080] A quantitative calculation method is used to determine the distance between the data and the local density. and The value of is as follows:
[0081]
[0082]
[0083]
[0084]
[0085] in, Represents two data points and The Euclidean distance between represents the cutoff distance, represents a binary function, if ,but , otherwise 0; Indicates the number of neighborhood objects of the i-th data point.
[0086] OK After that, we need to determine the neighborhood radius The DBSCAN algorithm uses a neighborhood radius calculation method to consider and the volume of the hypersphere surrounding all the data. Suppose an n-dimensional data set is , then its neighborhood radius As shown in the following formula:
[0087]
[0088] in, represents the volume of the hypersphere, Represents the radius of the sphere.
[0089] This method cleverly uses the concept of hypersphere, but it has some shortcomings. Although the hypersphere contains all data points, the spatial distribution is irregular, the data density is uneven, and the neighborhood radius determined by it is May be too large. Therefore, the present invention proposes an improved DBSCAN algorithm, which is designed to improve the setting rules of the neighborhood radius. Specifically, a preset formula is used to calculate the neighborhood radius. The preset formula is as follows:
[0090]
[0091] in, represents the neighborhood radius, represents the number of samples, represents the sample dimension, Indicates the minimum number of points in the neighborhood required to become a core object, represents the Gamma function, express -neighborhood. Further, As shown in the following formula:
[0092]
[0093] in, and Represents data points In the This ensures that the neighborhood radius It is not too large and can contain all the data, making calculations simpler.
[0094] The present invention improves the DBSCAN algorithm, and uses the improved DBSCAN algorithm to classify load data points with similar power consumption characteristics into one category, so as to improve the accuracy of subsequent load prediction.
[0095] S3, position-encoding the load data subset, and extracting features of the position-encoded load data subset through a multi-head self-attention mechanism to obtain a first output feature;
[0096] Specifically, Figure 2 As shown, step S3 includes:
[0097] S301, using a gated recurrent unit to position encode a load data subset to obtain gated mechanism output data;
[0098] The Gate Recurrent Unit (GRU) is used to process temporal information. It retains useful information and removes irrelevant information. In the GRU, there are two gates, a reset gate and an update gate. The reset gate determines how to combine new input information with previous memory, and the update gate defines how much of the previous memory is saved to the current time step. These two gating mechanisms can preserve information in long-term sequences without being cleared over time or removed because it is not relevant to the prediction.
[0099] The update gate helps the model decide how much past information to pass into the future, or how much information from the previous time step and the current time step needs to be passed on. The update gate adds these two pieces of information and feeds them into the Sigmoid activation function to compress the activation result to between 0 and 1. This function can reduce the risk of gradient vanishing. Specifically, the update gate outputs The formula is as follows:
[0100]
[0101] in, represents the Sigmoid activation function, represents the input vector at the t-th time step, that is, the t-th component of the input sequence X, and Both represent weight matrices, Represents the information of the previous time step t-1.
[0102] The expression of the reset gate is the same as that of the update gate, except that the parameters and usage of the weight matrix are different. Specifically, the reset gate outputs The formula is as follows:
[0103]
[0104] Furthermore, the calculation and The Hadamard product of and Because the update gate calculated earlier is a vector consisting of 0 to 1, it measures the size of the gate opening. The new memory content will use the reset gate to store the past related information, and the new information The calculation is performed using the following formula:
[0105]
[0106] Among them, W and U both represent weight matrices, Represents the Hadamard product operation.
[0107] Final calculation , which will retain the information of the current unit and pass it to the next unit to achieve the location encoding of the information. Use the update gate to determine the current memory content and the previous time step Specifically, the following formula is used to calculate the information of the current time step t: :
[0108]
[0109] in, The activation result of the update gate is the update gate output, which controls the inflow of information in the form of gating. and The Hadamard product represents the information retained to the final memory in the previous time step. This information plus the information retained to the final memory in the current memory is equal to the output content of the final gated recurrent unit, that is, the output data of the gating mechanism.
[0110] S302: Use an encoder to extract features from the output data of the gating mechanism to obtain a first output feature.
[0111] Specifically, the encoder is designed as an encoder architecture based on the Transformer network, which includes multiple multi-head self-attention layers connected in sequence and a feed-forward layer, see Figure 3 Among them, the output of each layer is connected to the next layer through residual connection and normalization.
[0112] Furthermore, the following formula is used to characterize the output characteristics of the current multi-head self-attention layer:
[0113]
[0114] in, represents the output features of the current multi-head self-attention layer, represents normalization processing, represents the input features of the current multi-head self-attention layer, Represents multi-head self-attention mechanism processing.
[0115] Furthermore, the following formula is used to characterize the first output feature:
[0116]
[0117] in, represents the first output feature, represents the input features of the feed-forward layer, Represents feed-forward layer processing.
[0118] Reference Figure 3 , the encoder of this embodiment includes three multi-head self-attention layers and a feedforward layer connected in sequence, and each multi-head self-attention layer includes 8 self-attention heads. It can be understood that the encoder receives the output data of the gating mechanism as input. Assuming that the output data of the gating mechanism is represented by h vectors, these vectors represent the load data of h time points, where each vector contains the load data of each user at the corresponding time point. The encoder processes the output data of the gating mechanism through the multi-head self-attention mechanism to capture the long-distance dependencies in the time series data.
[0119] S4, transforming the first output feature into frequency domain through the channel attention mechanism to obtain load frequency domain features;
[0120] It should be noted that step S4 is actually Figure 3 The processing of the mid-channel attention mechanism layer. Further, Figure 4 Schematic diagram of the workflow of the channel attention mechanism layer.
[0121] Specifically, Figure 5 As shown, step S4 includes:
[0122] S401, performing feature mapping on the first output feature along the channel to obtain a first output feature vector of each channel;
[0123] Reference Figure 4 , first along the channel, map the first output feature into , which is the first output feature vector of each channel.
[0124] S402, performing frequency domain transformation on the first output feature vector by using discrete cosine transform to obtain frequency domain components of each channel;
[0125] Discrete Fourier Transform (DFT) is a classic frequency domain transformation method, but when using discrete Fourier transform, due to the conjugate symmetry of the real signal Fourier transform, half of the data in the frequency domain after DFT is redundant. Compared with DFT, discrete cosine transform (DCT) can reduce more than half of the calculation amount and can perform frequency domain transformation more efficiently. Specifically, this embodiment adopts a one-dimensional DCT transform.
[0126] Reference Figure 4 , use discrete cosine transform to transform the first output eigenvector of each channel into frequency domain, and obtain the frequency domain component of each channel .
[0127] S403, performing a superposition operation on the frequency domain components to obtain an initial frequency domain feature of the first output feature;
[0128] Reference Figure 4 , perform superposition operation on all frequency domain components to obtain the initial frequency domain features .
[0129] S404. Optimize the initial frequency domain features based on the attention mechanism to obtain the load frequency domain features.
[0130] Reference Figure 4 After obtaining the frequency domain information, the SE module will be used for learning to obtain the load frequency domain features. Among them, the SE module is a convolutional neural network based on the attention mechanism.
[0131] Specifically, this embodiment uses the following formula to characterize the load frequency domain characteristics:
[0132]
[0133] in, represents the load frequency domain characteristics, represents the Sigmoid function, represents the ReLU function, , represents the weight matrix, represents discrete cosine transform, represents the first output feature.
[0134] By introducing the channel attention mechanism (frequency domain enhanced attention mechanism), the present invention can effectively capture the characteristic relationship of each channel in the frequency domain. This mechanism enhances the expressiveness of features and extracts more comprehensive load information from the frequency domain. In the context of deep learning load forecasting, this multi-dimensional feature extraction strategy significantly improves the diversity of features used. When performing load forecasting, the trend and pattern of load changes can be captured more accurately, thereby greatly improving the accuracy of deep learning models in load forecasting tasks.
[0135] S5. The load data subset and the load frequency domain features are restored through the masked cross-attention mechanism, and the short-term load forecast is performed on the obtained second output features to obtain the forecast result.
[0136] Specifically, Figure 6 As shown, step S5 includes:
[0137] S501, using a decoder to perform feature recovery on a load data subset and a load frequency domain feature to obtain a second output feature;
[0138] Specifically, the decoder is designed as a decoder architecture based on the Transformer network, which includes multiple masked cross-attention layers connected in sequence and a feed-forward layer, see Figure 3 Compared with the encoder, the decoder has an additional masking operation before inputting the data. The masking operation is to avoid leaking subsequent load information during the load forecasting process and ensure the authenticity of the forecast. The decoder merges the updated query vector Q, key vector K and value vector V and outputs them to obtain the second output feature.
[0139] Reference Figure 3 , the decoder of this embodiment includes three masked cross-attention layers and a feedforward layer connected in sequence. In addition to 8 self-attention heads, each masked cross-attention layer is additionally configured with 8 masked cross-attention heads to achieve accurate decoding of the encoder output. It can be understood that the decoder receives a load data subset and a load frequency domain feature as input. Assuming that the load data subset and the load frequency domain feature are represented by nh vectors, these vectors represent the load data at nh time points, and the task of the decoder is to predict the load at these time points. In addition, the input load data subset of the decoder is first processed by a linear layer, and the input data is mapped to a dimension suitable for the decoder processing through a linear transformation of the weight matrix.
[0140] S502: Perform nonlinear mapping on the second output feature to obtain a short-term load forecasting result.
[0141] Specifically, refer to Figure 3 , a fully connected layer is used to perform nonlinear mapping on the second output feature to obtain the short-term load forecasting result.
[0142] Furthermore, the following formula is used to characterize the short-term load forecasting results:
[0143]
[0144] in, represents the short-term load forecast result, represents the activation function of the fully connected layer, represents the weight matrix, represents the second output feature, Indicates deviation. is the Sigmoid activation function.
[0145] It should be noted that, refer to Figure 3 , which is a schematic diagram of the structure of the load forecasting model of the present invention. The load forecasting model of the present invention specifically introduces a channel attention mechanism (frequency domain enhanced attention mechanism) between the encoder and the decoder. This innovative design enables the model to more comprehensively capture the time domain characteristics and frequency domain characteristics of the load data, thereby improving the accuracy of the prediction. Through this carefully designed model architecture, the present invention can effectively predict the load data with high accuracy and generalization ability.
[0146] In order to verify the effectiveness of the above-mentioned short-term load forecasting method based on deep learning, this embodiment calculates the forecast evaluation index for the above-mentioned forecast results, thereby evaluating the results. Specifically, the mean square error (MSE) and the mean absolute error (MAE) are used as the evaluation indexes of the forecast results.
[0147] The mean square error is represented by the following formula:
[0148]
[0149] The mean absolute error is represented by the following formula:
[0150]
[0151] in, represents the length of the load sequence to be predicted, Indicates the true load value, Indicates the predicted load value.
[0152] Furthermore, in a specific embodiment, the prediction results are evaluated, and four control models, namely, the autoregressive moving average model (ARIMA), the long short-term memory recursive neural network (LSTM), the PatchTST model, and the Transformer model, are selected to conduct load forecasting experiments using the same data set as the load forecasting model proposed in the present invention. Specifically, the prediction errors are calculated as the mean absolute error (MAE) and the mean square error (MSE), and the results are shown in Table 1.
[0153] Table 1 Power load forecast results
[0154]
[0155] It can be seen from Table 1 that the prediction performance of the present invention is significantly better than that of the four control models: ARIMA, LSTM, PatchTST and Transformer.
[0156] Furthermore, in a specific embodiment, the comparison between the predicted load and the actual load of the present invention and Transformer at different time points is as follows: Figure 7 As shown in the figure, the horizontal axis represents the time point and the vertical axis represents the load value. Figure 7 It can be seen that the predicted value of the present invention is obviously closer to the true value.
[0157] The embodiment of the present invention is a short-term load forecasting method based on deep learning, which improves the DBSCAN clustering method and uses this method to classify load data with similar power consumption characteristics into one category, thereby improving the accuracy of subsequent load forecasting; a gated cyclic unit is used to extract the correlation between node load characteristics, remove irrelevant information, and aggregate the characteristics between nodes, which is conducive to improving the prediction accuracy; a discrete cosine transform with a strong ability to obtain frequency domain information is used to convert the power load characteristics into frequency domain characteristics with clear physical meanings, which helps to reveal the frequency domain structure and characteristic information of the load; a channel attention mechanism is introduced to effectively capture the characteristic relationship of each channel in the frequency domain, enhance the expression ability of the characteristics, and extract more comprehensive load information from the frequency domain; a self-attention mechanism and a cross-attention mechanism are used to achieve efficient processing and prediction of time series data. In general, the present invention can achieve high-precision short-term load forecasting under a new power system, and greatly improve the prediction efficiency while ensuring the prediction accuracy.
[0158] Based on the above short-term load forecasting methods, such as Figure 8 As shown, an embodiment of the present invention provides a short-term load forecasting system based on deep learning, including:
[0159] The target data set acquisition module 1 is used to acquire the historical load data of the target power system to form an initial load data set, and pre-process the initial load data set to obtain a target load data set;
[0160] Cluster analysis module 2, used to cluster the target load data set to obtain multiple load data subsets with different power consumption characteristics;
[0161] A first output feature acquisition module 3 is used to position encode the load data subset, and extract features of the position-encoded load data subset through a multi-head self-attention mechanism to obtain a first output feature;
[0162] The frequency domain feature acquisition module 4 is used to perform frequency domain transformation on the first output feature through a channel attention mechanism to obtain a load frequency domain feature;
[0163] The prediction result acquisition module 5 is used to restore the load data subset and the load frequency domain features through the masked cross attention mechanism, and perform short-term load prediction on the obtained second output features to obtain the prediction results.
[0164] It should be noted that each module in the above-mentioned short-term load forecasting system based on deep learning can be fully or partially implemented by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules. For the specific definition of a short-term load forecasting system based on deep learning, please refer to the definition of a short-term load forecasting method based on deep learning above. The two have the same functions and effects, which will not be repeated here.
[0165] In summary, the embodiment of the present invention is a short-term load forecasting method and system based on deep learning, which improves the DBSCAN clustering method, and uses this method to classify load data with similar power consumption characteristics into one category, thereby improving the accuracy of subsequent load forecasting; the gated cyclic unit is used to extract the correlation between node load characteristics, remove irrelevant information, and aggregate the characteristics between nodes, which is conducive to improving the prediction accuracy; the discrete cosine transform with strong frequency domain information acquisition ability is used to convert the power load characteristics into frequency domain characteristics with clear physical meaning, which helps to reveal the frequency domain structure and characteristic information of the load; the channel attention mechanism is introduced to effectively capture the characteristic relationship of each channel in the frequency domain, enhance the expression ability of the characteristics, and extract more comprehensive load information from the frequency domain; the self-attention mechanism and the cross-attention mechanism are used to realize efficient processing and prediction of time series data. In general, the present invention can realize high-precision short-term load forecasting under the new power system, and greatly improve the prediction efficiency under the condition of ensuring the prediction accuracy.
[0166] Each embodiment in this specification is described in a progressive manner, and the same or similar parts of each embodiment can be directly referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. It should be noted that the technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0167] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and substitutions can be made without departing from the technical principles of the present invention. These improvements and substitutions should also be regarded as the scope of protection of the present invention.
Claims
1. A short-term load forecasting method based on deep learning, characterized in that: include: Acquiring historical load data of a target power system to form an initial load data set, and preprocessing the initial load data set to obtain a target load data set; Clustering the target load data set to obtain a plurality of load data subsets with different power consumption characteristics; Position encoding is performed on the load data subset, and feature extraction is performed on the position-encoded load data subset through a multi-head self-attention mechanism to obtain a first output feature; The first output feature is transformed into frequency domain through a channel attention mechanism to obtain a load frequency domain feature; The load data subset and the load frequency domain feature are restored through a masked cross attention mechanism, and short-term load forecasting is performed on the obtained second output feature to obtain a forecast result; The first output feature is transformed into a frequency domain through a channel attention mechanism to obtain a load frequency domain feature, including: Performing feature mapping on the first output feature along the channel to obtain a first output feature vector for each channel; Performing frequency domain transformation on the first output feature vector by using discrete cosine transform to obtain frequency domain components of each channel; Performing a superposition operation on the frequency domain components to obtain an initial frequency domain feature of the first output feature; The initial frequency domain features are optimized based on the attention mechanism to obtain load frequency domain features; The load data subset and the load frequency domain feature are restored through a masked cross attention mechanism, and short-term load forecasting is performed on the obtained second output feature to obtain a forecast result, including: A decoder is used to perform feature recovery on the load data subset and the load frequency domain feature to obtain a second output feature; wherein the decoder includes a plurality of mask cross attention layers and a feedforward layer connected in sequence; Nonlinear mapping is performed on the second output feature to obtain a short-term load forecasting result.
2. The short-term load forecasting method according to claim 1, characterized in that: The preprocessing of the initial load data set to obtain a target load data set includes: The initial load data set is processed for missing values and outliers to obtain a target load data set.
3. The short-term load forecasting method according to claim 1, characterized in that: The clustering of the target load data set to obtain a plurality of load data subsets with different power consumption characteristics includes: The target load data is clustered using an improved DBSCAN algorithm to obtain a plurality of load data subsets with different power consumption characteristics; wherein the improved DBSCAN algorithm is designed to improve the setting rule of the neighborhood radius.
4. The short-term load forecasting method according to claim 3, characterized in that: The setting rule of improving the neighborhood radius includes: The neighborhood radius is calculated using a preset formula; wherein the preset formula is as follows: in, represents the neighborhood radius, represents the number of samples, represents the sample dimension, Indicates the minimum number of points in the neighborhood required to become a core object, represents the Gamma function, express -Neighborhood.
5. The short-term load forecasting method according to claim 1, characterized in that: The position encoding of the load data subset and feature extraction of the position-encoded load data subset through a multi-head self-attention mechanism to obtain a first output feature include: Using a gated recurrent unit to positionally encode the load data subset to obtain gated mechanism output data; An encoder is used to extract features from the output data of the gating mechanism to obtain a first output feature; wherein the encoder includes a plurality of multi-head self-attention layers and a feedforward layer connected in sequence.
6. The short-term load forecasting method according to claim 5, characterized in that: The following formula is used to characterize the output characteristics of the current multi-head self-attention layer: in, represents the output features of the current multi-head self-attention layer, represents normalization processing, represents the input features of the current multi-head self-attention layer, Represents multi-head self-attention mechanism processing; The first output feature is characterized by the following formula: in, represents the first output feature, represents the input features of the feed-forward layer, Represents feed-forward layer processing.
7. The short-term load forecasting method according to claim 1, characterized in that: The performing nonlinear mapping on the second output feature to obtain a short-term load forecast result includes: A fully connected layer is used to perform nonlinear mapping on the second output feature to obtain a short-term load forecasting result; wherein the short-term load forecasting result is characterized by the following formula: in, represents the short-term load forecast result, represents the activation function of the fully connected layer, represents the weight matrix, represents the second output feature, Indicates deviation.
8. A short-term load forecasting system based on deep learning, characterized in that: include: A target data set acquisition module is used to acquire historical load data of a target power system to form an initial load data set, and preprocess the initial load data set to obtain a target load data set; A clustering analysis module, used for clustering the target load data set to obtain multiple load data subsets with different power consumption characteristics; A first output feature acquisition module is used to position encode the load data subset, and extract features of the position-encoded load data subset through a multi-head self-attention mechanism to obtain a first output feature; A frequency domain feature acquisition module, used for performing frequency domain transformation on the first output feature through a channel attention mechanism to obtain a load frequency domain feature; A prediction result acquisition module, used for recovering the load data subset and the load frequency domain feature through a masked cross attention mechanism, and performing short-term load prediction on the obtained second output feature to obtain a prediction result; The first output feature is transformed into a frequency domain through a channel attention mechanism to obtain a load frequency domain feature, including: Performing feature mapping on the first output feature along the channel to obtain a first output feature vector for each channel; Performing frequency domain transformation on the first output feature vector by using discrete cosine transform to obtain frequency domain components of each channel; Performing a superposition operation on the frequency domain components to obtain an initial frequency domain feature of the first output feature; The initial frequency domain features are optimized based on the attention mechanism to obtain load frequency domain features; The load data subset and the load frequency domain feature are restored through a masked cross attention mechanism, and short-term load forecasting is performed on the obtained second output feature to obtain a forecast result, including: A decoder is used to perform feature recovery on the load data subset and the load frequency domain feature to obtain a second output feature; wherein the decoder includes a plurality of mask cross attention layers and a feedforward layer connected in sequence; Nonlinear mapping is performed on the second output feature to obtain a short-term load forecasting result.
Citation Information
Patent Citations
Power system short-term load prediction method, system and device and medium
CN112215442A
Image recognition method based on neural network frequency domain attention mechanism
CN113011444A