A method for predicting the amount of power generation data
Through the periodic processing, fragment processing and feature combination module of the LSMPF model, the problem of difficulty in dealing with multi-periodic and multi-scale characteristics in power generation data is solved, and more accurate and stable power generation prediction is achieved.
Patent Information
- Application Number
- CN202411131697.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-08-19
AI Technical Summary
Traditional time series prediction methods are difficult to process multi-periodic and multi-scale features in power generation data simultaneously, resulting in insufficient accuracy of prediction results. The model often fails to capture long-periodic features when processing long-term series, which adds over-conception. risk of cooperation.
The LSMPF model is proposed, including a periodic processing module, a fragment processing module and a feature combination module. Through discrete Fourier transform, multi-stage downsampling, improved position coding and dual attention calculation, the Multi-period mode improves the prediction flexibility and comprehensiveness of the model and reduces prediction errors.
It significantly improves the accuracy and stability of the prediction of power generation data, enhances the model's ability to capture complex periodic signals, reduces the risk of overfitting, and improves the comprehensiveness and accuracy of the prediction results.
Smart Images

Figure CN118659368B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of machine learning, and in particular relates to a method for predicting the amount of electric power generation data. Background Art
[0002] Multi-periodicity and multi-scale characteristics are common in power generation data. Power generation demand is affected by various cyclical factors, such as daytime peak and trough electricity consumption, differences in electricity consumption patterns between weekends and weekdays, and fluctuations in electricity consumption caused by seasonal changes. These factors make the power generation data show obvious multi-periodicity and multi-scale characteristics. Traditional time series prediction methods often find it difficult to handle these complex characteristics simultaneously, and only focus on data patterns at a single scale, resulting in insufficient accuracy in the prediction results.
[0003] The accuracy of power generation data forecasts usually relies on the analysis of long-term historical data. This is because power consumption patterns are not only affected by short-term factors, but may also be affected by long-term trends or abnormal events (such as holidays, special weather, etc.). When processing long time series, traditional models are often unable to capture these long-term characteristics due to the short input window, which limits the model's predictive ability and accuracy.
[0004] The complexity of power generation data is reflected in the multi-dimensionality and variability of the data. Different electricity user groups (such as households, industry, and commerce) and external environmental factors (such as temperature and humidity) will affect the overall power generation data volume. This complexity increases the risk of model overfitting, that is, the model may overfit the noise and specific patterns in the training data, resulting in poor performance in practical applications. To solve this problem, it is necessary to adopt models and methods that can effectively handle data complexity and prevent overfitting, so as to better capture the key patterns and features in the data. Summary of the Invention
[0005] The present invention provides a method for predicting the amount of electric power generation data, aiming to propose an LSMPF model, which consists of a period processing module, a fragment processing module and a feature combination module. The period processing module decomposes and decouples different periodic patterns in the electric power generation data to enhance the interpretability of the model. The fragment processing module processes and analyzes the decomposed electric power generation data of different periodic components to improve the flexibility of model prediction. The feature combination module independently predicts the outputs of different features and fuses the various prediction results to improve the comprehensiveness of the model prediction results and reduce the prediction error.
[0006] The present invention proposes a power generation data volume prediction model, which specifically includes the following steps:
[0007] S1. Collect data related to power generation, including features and target variables, and preprocess the collected data;
[0008] S2. Normalize the preprocessed data using layer normalization and divide the data set;
[0009] S3. Construct a periodicity processing module to process multi-periodicity patterns in power generation data. The specific steps are as follows:
[0010] S31. Perform global periodicity analysis, use discrete Fourier transform to convert power generation data from time domain to frequency domain, and select the previous frequencies and their corresponding period lengths;
[0011] S32, introduce multi-stage downsampling, use the period information obtained in step S31 to guide the sampling rate The power generation data is downsampled multiple times to obtain the downsampled sequence ;
[0012] S33, perform local periodicity analysis on each downsampled sequence Perform short-time Fourier transform and sequence decomposition, and average pool the decomposed periodic components to obtain the decomposed periodic quantity of power generation data. ;
[0013] S4. Construct a fragment processing module to process the complex information in the power generation data. The specific steps are as follows:
[0014] S41, for each period Use the period length as the embedded phase size and fold it into a two-dimensional matrix ;
[0015] S42, introduce an improved position coding enhancement strategy to add position coding to each phase and cycle stage , and perform linear mapping to obtain the embedded representation of phase and period and ;
[0016] S43, perform dual attention calculation, first, use the first-order attention to model the embedded representation of phase and period to obtain the dependency and , then, the second-order attention is used to integrate the dependencies within and between cycles to obtain the relationship term and , and fused to get the encoding ;
[0017] S5, build feature combination module, for each encoding Make a separate prediction through the fully connected layer and use the strip interpolation method to calculate each prediction result. Interpolation is performed to expand the full prediction sequence length Finally, the predicted value of power generation data is obtained by weighted combination .
[0018] Preferably, in step S1, the power generation related data includes historical power generation data, temperature data, humidity data, sunshine duration data, rainfall data, and winter and summer power consumption difference data. The collected power generation data is denoised using an exponentially weighted moving average. The specific formula is as follows:
[0019] ;
[0020] Where, is the smoothing coefficient, ranging from 0 to 1. For the moment The raw power generation data, For the moment The denoised electric power generation data.
[0021] Preferably, in step S2, the pre-processed power generation data is normalized using batch normalization, and the data set is divided proportionally. The specific formula is as follows:
[0022] ;
[0023] Where, is the scaling parameter, The input power generation data Sample feature values, is the mean of the current batch data, is the variance of the current batch data, is a positive number to prevent division by zero. is the translation parameter.
[0024] Preferably, in steps S3 and S31, global periodicity analysis is performed, and discrete Fourier transform is used to convert the power generation data from the time domain to the frequency domain. The specific formula is as follows:
[0025] ;
[0026] Where, For power generation data complex-valued frequency components, The first Sample values, is the length of the power generation data, is a complex exponential function, is the frequency index, calculates the amplitude of the frequency domain component, and determines the significant frequency. The specific formula is:
[0027] ;
[0028] Where, for The real part of for The imaginary part of the first frequency , calculate the corresponding period length , the specific formula is:
[0029] ;
[0030] Where, For the frequencies, For the The period length of a frequency.
[0031] Preferably, the discrete Fourier transform is used to convert the power generation data from the time domain to the frequency domain, and the first several main frequencies and their corresponding period lengths are selected. The discrete Fourier transform can capture the significant periodic characteristics in the power generation data, thereby effectively separating the global periodic components in the power generation data, improving the decomposition and understanding of complex periodic signals, enabling the model to more accurately capture long-period characteristics, providing a basis for subsequent downsampling operations, and enhancing the model's ability to interpret the periodic characteristics of the data, thereby improving the accuracy and stability of the prediction.
[0032] Preferably, in the steps S3 and S32, multi-level downsampling is introduced to perform multi-level downsampling on the original power generation data, using different downsampling rates each time. , and use the cycle information obtained in step S31 to guide, specifically, for a given cycle , downsampling rate It is necessary to ensure that at least one complete cycle of this period is retained in the downsampled sequence, that is,
[0033] , select multiple downsampling rates , each downsampling rate corresponds to one or more major period lengths Sampling requirements, and the selected downsampling rate satisfy , where the maximum downsampling rate The specific formula is:
[0034] ;
[0035] Where, is the maximum downsampling rate, is the main period length identified in the global multi-periodicity analysis, indicating the The length of the significant period is then calculated to calculate the power generation sequence after downsampling. , the specific formula is:
[0036] ;
[0037] Where, is the original power generation data, is the length of the power generation sequence after downsampling, is the downsampling rate.
[0038] Preferably, a multi-level downsampling strategy is introduced to guide the selection of the downsampling rate according to the results of the periodic analysis, and the power generation data is downsampled multiple times. This multi-level downsampling can ensure that one or more complete cycles are retained in the sequence after each downsampling, simplifying the power generation data structure so that the model can more easily handle periodic features of different scales, reducing the computational complexity while retaining the key information of the data, and thus effectively capturing periodic features of different scales, so that the model can significantly improve efficiency when processing long time series, while maintaining sensitivity to multi-periodic features, thereby enhancing the flexibility and accuracy of prediction.
[0039] Preferably, in the steps S3 and S33, local periodicity analysis is performed to analyze the sequence after each level of downsampling. Perform short-time Fourier transform, the specific formula is:
[0040] ;
[0041] Where, is the index of the time frame, is the power generation sequence after downsampling, is the frequency, and then the sequence is decomposed. The specific formula is:
[0042] ;
[0043] Where, For a new round of seasonal ingredients, It is a new round of trend components. and is the sliding window size and step size, For the downsampled power generation series, the periodic components after sequence decomposition, including seasonal components and trend components, are averaged and pooled to obtain the decomposition periodicity of the power generation data. The specific formula is:
[0044] ;
[0045] ;
[0046] Where, is the average pooling operation, is the size of the pooling window, is the size of the pooling step, For each round of seasonal components, It is the trend component of the last round.
[0047] Preferably, short-time Fourier transform and sequence decomposition are performed on each downsampled sequence, and the decomposed periodic components are average pooled. Combining local frequency domain analysis with time series decomposition, the model can capture short-term periodic changes within the local time window through short-time Fourier transform, thereby improving the ability to identify seasonal and trend components, and smoothing fluctuations through pooling operations to reduce the impact of noise, significantly enhancing the model's ability to capture local cycles and trends, reducing the impact of noise in predictions, and making the model more accurate in dealing with short-term and local periodic changes.
[0048] Preferably, the decomposition cycle quantity of each power generation data in steps S4 and S41 is , use the The length of the cycle As the size of the embedded phase, it is folded into a two-dimensional matrix, dividing the sequence into multiple cycles. Each phase in each cycle corresponds to a row of the matrix. The specific formula is:
[0049] ;
[0050] Where, For folding operation, To align sequence operations, For the The seasonal quantity sequence after average pooling, is the magnitude of the embedded phase, is the sliding window size, is the step length.
[0051] Preferably, the cycle length is used as the embedded phase size for the decomposed periodic quantity, and the sequence is folded into a two-dimensional matrix, which converts complex time series data into a two-dimensional representation, so that the model can better capture the phase relationship within and between cycles, and enables the model to capture detailed information within the cycle while retaining the global relationship between cycles, providing richer input features for the subsequent attention mechanism. Moreover, through phase embedding, the model performs well in processing periodic data and can better distinguish subtle changes in different cycles, thereby improving the accuracy of prediction.
[0052] Preferably, the improved position coding enhancement strategy is introduced in steps S4 and S42, using a learnable weight coefficient and scaling factor Control the scale of encoding and the importance of each scale. The specific formula is:
[0053] ;
[0054] ;
[0055] ;
[0056] Where, is the position parameter, which is the position index of the phase in the sequence. is the index into the embedding vector, is the dimension of the embedding vector, which is the dimension of the vector space into which each phase is embedded, is the frequency scaling factor, is the learnable weight coefficient, For the The scaling factor of the scale, Enhancement strategy for sinusoidal position encoding Sum and cosine position encoding enhancement strategy The weighted combination of The position encoding of the time step of power generation data is used to obtain the embedded representation of phase and period through linear mapping and improved position encoding enhancement strategy. The specific formula is:
[0057] ;
[0058] ;
[0059] Where, and is the embedded representation of phase and period after linear mapping and position encoding, is the two-dimensional matrix obtained after the folding operation, is the transposed matrix obtained after the folding operation, and is the position information encoding matrix of phase and period, and is the mapping matrix for each phase and each cycle, where is the dimension of the embedding vector, For the The total length of the periodic sequence, is the magnitude of the embedded phase, For the The position encoding of each time step of the power generation data.
[0060] Preferably, an improved position encoding strategy is introduced, and learnable weight coefficients and scaling factors are used to control the scale of encoding and the importance of each scale, thereby enhancing the model's sensitivity to different position information and adjusting the influence of different scales by learning weights. The improved position encoding strategy can better capture the position information within the phase and period, enhance the expressiveness of features, and improve the discrimination between different time steps, significantly improving the model's ability to process complex periodic signals, especially in the extraction of multi-scale features, so that the model can perform well at different time scales.
[0061] Preferably, dual attention calculation is performed in steps S4 and S43. In the initial stage, a multi-head attention mechanism is used to perform first-order attention calculation, the embedded representation of the phase and period is modeled, and a nonlinear transformation is performed through a multi-layer perceptron to obtain the dependencies of the phase and period. The specific formula is:
[0062] ;
[0063] ;
[0064] Where, It is a multi-layer perceptron, which is used to perform further nonlinear transformation on the output of multi-head attention. Multi-head attention mechanism to model the embedded representation of phase and period in first-order attention, 、 、 are the query, key, and value matrices represented by the phase embedding, 、 、 The query, key, and value matrices represented by the period embedding are then used to perform second-order attention calculations using a multi-head cross-attention mechanism to integrate the dependencies between phase and period. The nonlinear transformation is then performed using a multi-layer perceptron to obtain the relationship between phase and period. The specific formula is:
[0065] ;
[0066] ;
[0067] Where, and It is a multi-layer perceptron, which is used to further perform nonlinear transformation on the output of multi-head cross-attention and A multi-head cross-attention mechanism for integrating phase and period dependencies in second-order attention, 、 、 are the query, key, and value matrices of the phase dependencies, 、 、 The output of the second-order attention is and Fusion, get the final code, the specific formula is:
[0068] ;
[0069] Where, is the phase relation term, is a periodic relation.
[0070] Preferably, the first-order attention is used to model the embedded representation of the phase and period, and the second-order attention is used to integrate the dependencies within and between periods. The dual attention mechanism can handle dependencies at different levels separately and improve the overall feature expression ability through integration. It can more accurately model the relationship between different time steps and perform nonlinear transformation on the output through a multi-layer perceptron, thereby enhancing the complexity of the feature representation and improving the model's ability to handle complex time series, especially in capturing long-term and short-term dependencies, making the model more robust and accurate in dealing with multi-period and multi-time scale features.
[0071] Preferably, in step S5, a feature combination module is constructed. First, for each code A separate prediction is made through the fully connected layer. The specific formula is:
[0072] ;
[0073] Where, For the The output of the second-order attention and Fusion is encoded, For the The fully connected prediction layer of the code is then used to interpolate the prediction results Expanded to the full prediction sequence length, the specific formula is:
[0074] ;
[0075] Where, It is a strip interpolation method used to expand the power generation data prediction results to the target length , For the The prediction results of the fully connected prediction layer are finally obtained by weighted combination of the prediction results. The specific formula is:
[0076] ;
[0077] Where, The number of different period lengths identified for the model, is the complete prediction sequence after strip interpolation, This is the final power generation data prediction result.
[0078] Preferably, each code is predicted separately through a fully connected layer, and the prediction result is expanded to the complete prediction sequence length using the strip interpolation method. By combining the prediction results of multiple layers, the outputs of different features can be better integrated and the prediction error can be reduced. The model can process different features independently and realize the comprehensive prediction of power generation through weighted combination, ensuring the comprehensiveness and accuracy of the prediction results, while reducing the errors caused by insufficient processing of a single feature, making the final prediction result more stable and accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] Figure 1 A step diagram of a method for predicting the amount of power generation data.
[0080] Figure 2 This is the structure diagram of the LSMPF prediction model.
[0081] Figure 3 This is the structural diagram of the cycle processing module.
[0082] Figure 4 This is the structure diagram of the fragment processing module.
[0083] Figure 5 The LSMPF prediction model is used to implement the power generation data prediction fitting effect diagram. DETAILED DESCRIPTION
[0084] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0085] See also Figure 1-Figure 5The present invention provides a technical solution: a method for predicting the amount of power generation data, which can decompose and decouple different periodic patterns in the power generation data by constructing a periodic processing module to enhance the interpretability of the model; the fragment processing module can process and analyze the power generation data of different periodic components after decomposition to improve the flexibility of model prediction; the feature combination module independently predicts the output of different features and fuses the various prediction results to improve the comprehensiveness of the model prediction results and reduce the prediction error. The specific steps are as follows: Figure 1 shown.
[0086] Construct the LSMPF prediction model, whose structure is as follows Figure 2 The specific steps are as follows:
[0087] S1. Collect data related to power generation, including features and target variables, and preprocess the collected data.
[0088] Furthermore, the power generation related data includes historical power generation data, temperature data, humidity data, sunshine duration data, rainfall data, and winter and summer electricity consumption difference data. The exponentially weighted moving average is used to denoise the collected power generation data. The specific formula is as follows:
[0089] ;
[0090] Where, is the smoothing coefficient, ranging from 0 to 1. For the moment The raw power generation data, For the moment The denoised electric power generation data.
[0091] S2. Use layer normalization to normalize the preprocessed data and divide the data set.
[0092] Furthermore, batch normalization is used to normalize the preprocessed power generation data and the data set is divided proportionally. The specific formula is as follows:
[0093] ;
[0094] Where, is the scaling parameter, The input power generation data Sample feature values, is the mean of the current batch data, is the variance of the current batch data, is a positive number to prevent division by zero. is the translation parameter.
[0095] S31, construct a cycle processing module, its structure is as follows Figure 3 As shown in the figure, a global periodicity analysis is performed, the power generation data is converted from the time domain to the frequency domain using discrete Fourier transform, and the front frequencies and their corresponding period lengths.
[0096] Furthermore, a global periodicity analysis is performed and the power generation data is converted from the time domain to the frequency domain using discrete Fourier transform. The specific formula is as follows:
[0097] ;
[0098] Where, For power generation data complex-valued frequency components, The first Sample values, is the length of the power generation data, is a complex exponential function, is the frequency index, calculates the amplitude of the frequency domain component, and determines the significant frequency. The specific formula is:
[0099] ;
[0100] Where, for The real part of for The imaginary part of the first frequency , calculate the corresponding period length , the specific formula is:
[0101] ;
[0102] Where, For the frequencies, For the The period length of a frequency.
[0103] S32, introduce multi-stage downsampling, use the period information obtained in step S31 to guide the sampling rate The power generation data is downsampled multiple times to obtain the downsampled sequence .
[0104] Furthermore, multi-level downsampling is introduced to perform multi-level downsampling on the original power generation data, using different downsampling rates each time. , and use the cycle information obtained in step S31 to guide, specifically, for a given cycle , downsampling rate It is necessary to ensure that at least one complete cycle of this period is retained in the downsampled sequence, that is,
[0105] , select multiple downsampling rates , each downsampling rate corresponds to one or more major period lengths Sampling requirements, and the selected downsampling rate satisfy , where the maximum downsampling rate The specific formula is:
[0106] ;
[0107] Where, is the maximum downsampling rate, is the main period length identified in the global multi-periodicity analysis, indicating the The length of the significant period is then calculated to calculate the power generation sequence after downsampling. , the specific formula is:
[0108] ;
[0109] Where, is the original power generation data, is the length of the power generation sequence after downsampling, is the downsampling rate.
[0110] S33, perform local periodicity analysis on each downsampled sequence Perform short-time Fourier transform and sequence decomposition, and average pool the decomposed periodic components to obtain the decomposed periodic quantity of power generation data. .
[0111] Furthermore, a local periodicity analysis is performed on the sequence after each level of downsampling. Perform short-time Fourier transform, the specific formula is:
[0112] ;
[0113] Where, is the index of the time frame, is the power generation sequence after downsampling, is the frequency, and then the sequence is decomposed. The specific formula is:
[0114] ;
[0115] Where, For a new round of seasonal ingredients, It is a new round of trend components. and is the sliding window size and step size, For the downsampled power generation series, the periodic components after sequence decomposition, including seasonal components and trend components, are averaged and pooled to obtain the decomposition periodicity of the power generation data. The specific formula is:
[0116] ;
[0117] ;
[0118] Where, is the average pooling operation, is the size of the pooling window, is the size of the pooling step, For each round of seasonal components, It is the trend component of the last round.
[0119] S41, construct a fragment processing module, its structure is as follows Figure 4 As shown, for each cycle Use the period length as the embedded phase size and fold it into a two-dimensional matrix .
[0120] Furthermore, the decomposition cycle quantity of each power generation data , use the The length of the cycle As the size of the embedded phase, it is folded into a two-dimensional matrix, dividing the sequence into multiple cycles. Each phase in each cycle corresponds to a row of the matrix. The specific formula is:
[0121] ;
[0122] Where, For folding operation, To align sequence operations, For the The seasonal quantity sequence after average pooling, is the magnitude of the embedded phase, is the sliding window size, is the step length.
[0123] S42, introduce an improved position coding enhancement strategy to add position coding to each phase and cycle stage , and perform linear mapping to obtain the embedded representation of phase and period and .
[0124] Furthermore, an improved position encoding enhancement strategy is introduced, using learnable weight coefficients and scaling factor Control the scale of encoding and the importance of each scale. The specific formula is:
[0125] ;
[0126] ;
[0127] ;
[0128] Where, is the position parameter, which is the position index of the phase in the sequence. is the index into the embedding vector, is the dimension of the embedding vector, which is the dimension of the vector space into which each phase is embedded, is the frequency scaling factor, is the learnable weight coefficient, For the The scaling factor of the scale, Enhancement strategy for sinusoidal position encoding Sum and cosine position encoding enhancement strategy The weighted combination of The position encoding of the time step of power generation data is used to obtain the embedded representation of phase and period through linear mapping and improved position encoding enhancement strategy. The specific formula is:
[0129] ;
[0130] ;
[0131] Where, and is the embedded representation of phase and period after linear mapping and position encoding, is the two-dimensional matrix obtained after the folding operation, is the transposed matrix obtained after the folding operation, and is the position information encoding matrix of phase and period, and is the mapping matrix for each phase and each cycle, where is the dimension of the embedding vector, For the The total length of the periodic sequence, is the magnitude of the embedded phase, For the The position encoding of each time step of the power generation data.
[0132] S43, perform dual attention calculation, first, use the first-order attention to model the embedded representation of phase and period to obtain the dependency and , then, the second-order attention is used to integrate the dependencies within and between cycles to obtain the relationship term and , and fused to get the encoding .
[0133] Furthermore, dual attention calculation is performed. In the initial stage, a multi-head attention mechanism is used to perform first-order attention calculation, model the embedded representation of phase and period, and perform nonlinear transformation through a multi-layer perceptron to obtain the dependencies of phase and period. The specific formula is:
[0134] ;
[0135] ;
[0136] Where, It is a multi-layer perceptron, which is used to perform further nonlinear transformation on the output of multi-head attention. Multi-head attention mechanism to model the embedded representation of phase and period in first-order attention, 、 、 are the query, key, and value matrices represented by the phase embedding, 、 、 The query, key, and value matrices represented by the period embedding are then used to perform second-order attention calculations using a multi-head cross-attention mechanism to integrate the dependencies between phase and period. The nonlinear transformation is then performed using a multi-layer perceptron to obtain the relationship between phase and period. The specific formula is:
[0137] ;
[0138] ;
[0139] Where, and It is a multi-layer perceptron, which is used to further perform nonlinear transformation on the output of multi-head cross-attention and A multi-head cross-attention mechanism for integrating phase and period dependencies in second-order attention, 、 、 are the query, key, and value matrices of the phase dependencies, 、 、 The output of the second-order attention is and Fusion, get the final code, the specific formula is:
[0140] ;
[0141] Where, is the phase relation term, is a periodic relation.
[0142] S5, build feature combination module, for each encoding Make a separate prediction through the fully connected layer and use the strip interpolation method to calculate each prediction result. Interpolation is performed to expand the full prediction sequence length Finally, the predicted value of power generation data is obtained by weighted combination .
[0143] Furthermore, we construct a feature combination module. First, we encode each A separate prediction is made through the fully connected layer. The specific formula is:
[0144] ;
[0145] Where, For the The output of the second-order attention and Fusion is encoded, For the The fully connected prediction layer of the code is then used to interpolate the prediction results Expanded to the full prediction sequence length, the specific formula is:
[0146] ;
[0147] Where, It is a strip interpolation method used to expand the power generation data prediction results to the target length , For the The prediction results of the fully connected prediction layer are finally obtained by weighted combination of the prediction results. The specific formula is:
[0148] ;
[0149] Where, The number of different period lengths identified for the model, is the complete prediction sequence after strip interpolation, This is the final power generation data prediction result.
[0150] Furthermore, the LSMPF prediction model is written in Python and implemented using the PyTorch framework. It is trained on an NVIDIA 4080TI GPU using a dataset of one full year of electricity generation data. The model input length is set to 1680 and the prediction length is set to for , after normalization, input into LSMPF prediction model, set the training batch to 128, use As an optimizer, the learning rate is set to .
[0151] Furthermore, Figure 5 The figure shows the fitting effect of the power generation data prediction of the LSMPF prediction model. The horizontal axis represents the month (January to December), and the vertical axis represents the power generation (unit: MWh). The black triangles in the figure represent the actual data, and the gray cross symbols represent the predicted data. It can be seen from the figure that the fit between the predicted value and the actual value is high, indicating that the model performs well in the power generation prediction. In each month from January to December, the trend of the predicted data is basically consistent with the actual data. In particular, in the months with relatively slow changes in power generation, such as January to May, the predicted value of the model almost coincides with the actual value, indicating that the model is good at capturing the overall trend of power generation. In terms of potential, the model performs well. In months with large fluctuations in power generation, such as June to August, although there are some deviations between the actual data and the predicted data, the overall trend is still consistent, indicating that the model has strong predictive ability in dealing with seasonal changes. At the same time, the figure shows that the predicted data closely follows the actual data in terms of overall trend, indicating that the model has good stability and robustness. When facing power generation fluctuations in different seasons, the model can still maintain a high prediction accuracy, especially in July and August, the predicted data well captures the peak value of power generation. The above analysis shows that the LSMPF prediction model performs well in practical applications.
Claims
1. A method for predicting the amount of power generation data, It is characterized in that The following steps are involved: S1. Collect data related to power generation. Preprocessing of collected data including features and target variables; S2, normalizing the preprocessed data using layer normalization method and dividing the data set; S3. Construct a periodic processing module for processing multi-periodic patterns in power generation data. The specific steps are as follows: S31, perform global periodicity analysis, use discrete Fourier transform to convert power generation data from time domain to frequency domain, and select the previous frequencies and their corresponding period lengths; S32, introduce multi-stage downsampling, use the period information obtained in step S31 to guide the sampling rate The power generation data is downsampled multiple times to obtain the downsampled sequence ; S33, perform local periodicity analysis on each downsampled sequence Perform short-time Fourier transform and sequence decomposition, and average pool the decomposed periodic components to obtain the decomposed periodic quantity of power generation data ; S4. Construct a fragment processing module to process complex information in the power generation data. The specific steps are as follows: S41, for each cycle Use the period length as the embedded phase size and fold into a two-dimensional matrix ; S42, introduce an improved position coding enhancement strategy to add position coding to each phase and cycle stage , and perform linear mapping to obtain the embedded representation of phase and period and ; S43, perform dual attention calculation. First, use the first-order attention to model the embedding representation and obtain the dependency and , then, the dependency is integrated using the second-order attention to obtain the relationship term and , and merge them to get the encoding ; S5. Construct a feature combination module for each encoding A separate prediction is made through the fully connected layer, and each prediction result is processed using the strip interpolation method. Finally, the predicted value of the power generation data is obtained through weighted combination. .
2. A method for predicting the amount of electric power generation data according to claim 1, It is characterized in that In the steps S3 and S31, global periodicity analysis is performed, and the power generation data is converted from the time domain to the frequency domain using discrete Fourier transform. The specific formula is as follows: ; In the formula, For power generation data complex-valued frequency components, The power generation data Sample values, is the length of the electric power generation data, is a complex exponential function, is the frequency index, calculates the amplitude of the frequency domain component, and determines the significant frequency. The specific formula is: ; In the formula, for The real part of for The imaginary part of the Frequency , calculate the corresponding period length , the specific formula is: ; In the formula, For the frequency, For the The period length of a frequency.
3. A method for predicting the amount of electric power generation data according to claim 2, It is characterized in that In the steps S3 and S32, multi-level downsampling is introduced to perform multi-level downsampling on the original power generation data, and different downsampling rates are used each time. , and use the cycle information obtained in step S31 to guide, specifically, for a given cycle , downsampling rate It is necessary to ensure that at least one complete cycle of this period is retained in the downsampled sequence, that is, , select multiple downsampling rates , each downsampling rate corresponds to one or more major period lengths The sampling requirements and the selected downsampling rate satisfy , where the maximum downsampling rate The specific formula is: ; In the formula, is the maximum downsampling rate, is the main period length identified in the global multi-periodicity analysis, indicating The length of the significant period is then used to calculate the downsampled power generation sequence. , the specific formula is: ; In the formula, is the original power generation data, is the length of the power generation sequence after downsampling, is the downsampling rate.
4. A method for predicting the amount of electric power generation data according to claim 3, It is characterized in that In the steps S3 and S33, local periodicity analysis is performed to analyze the sequence after each level of downsampling. Perform short-time Fourier transform, the specific formula is: ; In the formula, is the index of the time frame, is the down-sampled power generation sequence, is the frequency, and then the sequence is decomposed. The specific formula is: ; In the formula, For a new round of seasonal ingredients, It is a new round of trend components. and is the sliding window size and step size, For the downsampled power generation series, the periodic components after sequence decomposition, including seasonal components and trend components, are averaged and pooled to obtain the decomposed periodic quantity of power generation data. The specific formula is: ; ; In the formula, is the average pooling operation, is the size of the pooling window, is the size of the pooling step, For each round of seasonal components, It is the trend component of the last round.
5. A method for predicting the amount of electric power generation data according to claim 4, It is characterized in that In the steps S4 and S41, the decomposition cycle quantity of each electric power generation amount data is , use The cycle length of the cycle As the size of the embedded phase, it is folded into a two-dimensional matrix, and the sequence is divided into multiple periods. Each phase in each period corresponds to a row of the matrix. The specific formula is: ; In the formula, For folding operation, To align sequence operations, For the The seasonal quantity sequence after average pooling, is the magnitude of the embedded phase, is the sliding window size, is the step length.
6. A method for predicting the amount of electric power generation data according to claim 5, It is characterized in that The improved position encoding enhancement strategy is introduced in steps S4 and S42, using a learnable weight coefficient and scaling factor Control the scale of encoding and the importance of each scale. The specific formula is: ; ; ; In the formula, is the position parameter, which is the position index of the phase in the sequence. is the index into the embedding vector, is the dimension of the embedding vector, which is the dimension of the vector space into which each phase is embedded, is the frequency scaling factor, is the learnable weight coefficient, For the The scaling factor of the scale, Enhancement strategy for sinusoidal position encoding Sum and cosine position encoding enhancement strategy The weighted combination of The position encoding of the time step of the power generation data is used to obtain the embedded representation of the phase and period through linear mapping and improved position encoding enhancement strategy. The specific formula is: ; ; In the formula, and is the embedded representation of phase and period after linear mapping and position encoding, is the two-dimensional matrix obtained after the folding operation, is the transposed matrix obtained after the folding operation, and is the position information encoding matrix of phase and period, and is the mapping matrix for each phase and each cycle, where is the dimension of the embedding vector, For the The total length of the periodic sequence, is the magnitude of the embedded phase, For the The position encoding of each time step of the electric power generation data.
7. A method for predicting the amount of electric power generation data according to claim 6, It is characterized in that In the steps S4 and S43, dual attention calculation is performed. In the initial stage, a multi-head attention mechanism is used to perform first-order attention calculation, the embedded representation of the phase and period is modeled, and a nonlinear transformation is performed through a multi-layer perceptron to obtain the dependencies of the phase and period. The specific formula is: ; ; In the formula, is a multi-layer perceptron, which is used to perform further nonlinear transformation on the output of multi-head attention. Multi-head attention mechanism to model the embedded representation of phase and period in first-order attention, , , are the query, key, and value matrices represented by the phase embedding, , , The query, key, and value matrices are represented by the period embedding. After that, the multi-head cross-attention mechanism is used to perform second-order attention calculation, integrate the dependencies of phase and period, and perform nonlinear transformation through the multi-layer perceptron to obtain the relationship between phase and period. The specific formula is: ; ; In the formula, and It is a multi-layer perceptron, which is used to further nonlinearly transform the output of multi-head cross-attention. and A multi-head cross-attention mechanism for integrating phase and period dependencies in second-order attention, , , are the query, key, and value matrices of the phase dependencies, , , The output of the second-order attention is and Fusion, get the final code, the specific formula is: ; In the formula, is the phase relation term, is a periodic relation.
8. A method for predicting the amount of electric power generation data according to claim 7, It is characterized in that In step S5, a feature combination module is constructed. First, for each encoding A separate prediction is performed through the fully connected layer. The specific formula is: ; In the formula, For the The output of the second-order attention and Fusion is encoded, For the The fully connected prediction layer of the code is then used to interpolate the prediction results Expanded to the complete prediction sequence length, the specific formula is: ; In the formula, It is a strip interpolation method used to expand the power generation data prediction results to the target length , For the The prediction results of the fully connected prediction layer are finally obtained by weighted combination of the prediction results. The specific formula is: ; In the formula, The number of different period lengths identified for the model, is the complete prediction sequence after strip interpolation, The final power generation data prediction results.
Citation Information
Patent Citations
Power transaction data prediction and verification method and system based on DFT-KNNI-KMEANS algorithm
CN115828124A
Ship motion long-time forecasting method and system integrated with time-frequency analysis
CN117932273A
Power load prediction method and device and medium
CN118199054A
Short-term wind power prediction method based on multi-feature fusion period enhancement
CN118472943A
Wind power prediction method and system for optimizing deep transformer network
US20220197233A1
