Photovoltaic power generation power prediction method based on state frequency memory network
Patent Information
- Application Number
- CN202411669999.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-02-28
Smart Images

Figure CN119537920A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of renewable energy power generation, and in particular to a photovoltaic power generation power prediction method based on a state frequency memory network. Background Art
[0002] With the rapid development of the global new energy industry, photovoltaic power generation has become an important part of renewable energy generation. However, due to the influence of multiple factors such as weather conditions, seasonal changes and geographical location, the output power of photovoltaic power generation systems shows significant volatility and uncertainty. Although traditional prediction methods, including those based on physical models, statistical models and machine learning models, can improve the accuracy of photovoltaic power prediction to a certain extent, their ability to handle complex time domain and frequency domain characteristics is still insufficient.
[0003] In recent years, deep learning models such as recurrent neural networks (RNN) and long short-term memory networks (LSTM) have been used in photovoltaic power generation prediction, but they still have obvious limitations in frequency domain feature modeling and uncertainty processing. Therefore, it is of great significance to propose a new prediction model that combines time domain and frequency domain information to improve the accuracy and reliability of prediction. Summary of the invention
[0004] The purpose of the present invention is to solve the defects of photovoltaic power prediction methods in the prior art in processing frequency domain characteristics and data uncertainty, and to provide a photovoltaic power prediction method based on a state frequency memory network to solve the above problems.
[0005] In order to achieve the above object, the technical solution of the present invention is as follows:
[0006] A photovoltaic power generation power prediction method based on a state frequency memory network comprises the following steps:
[0007] 11) Data collection and preprocessing: Obtain historical power generation data and meteorological data of photovoltaic power stations, and normalize the data;
[0008] 12) Constructing a state frequency memory network: Constructing a state frequency memory network by using tensor space dimension setting, matrix operation logic design, optimization algorithm selection, and loss function construction;
[0009] 13) Model training and parameter tuning: Use GPU to train the state frequency memory network, and optimize the model hyperparameters through random search method, using MAE, RMSE, MAPE and R² as evaluation indicators;
[0010] 14) Photovoltaic power generation prediction: The processed data is input into the trained state frequency memory network for short-term photovoltaic power generation prediction.
[0011] The construction of the state frequency memory network comprises the following steps:
[0012] 21) Determine the appropriate tensor space dimension based on the input data characteristics to capture time series and frequency domain features:
[0013] Assume that the input feature matrix is , where T represents the time step, F represents the number of features, and the feature dimension of the input data determines the shape of the tensor, ensuring that the model effectively stores and updates feature information of different frequencies. The feature dimensions include historical power generation, sunshine intensity, and temperature;
[0014] 22) Perform an outer product operation on the input feature matrix and the frequency feature matrix to capture the timing dependency and frequency domain dependency. The specific calculation process is as follows:
[0015] Joint forget gate calculation: The state forget gate and frequency forget gate control the retention of time domain and frequency domain information respectively. and frequency forget gate The calculation formula is as follows:
[0016] ;
[0017] in, is the activation function, , and , is the weight matrix, , is the bias term, through the outer product operation of the state forget gate and the frequency forget gate, the forget gate is combined to control the degree of forgetting and retention of time domain and frequency domain information;
[0018] State update formula: state frequency memory matrix The update formula is as follows:
[0019] ,
[0020] in, represents the element-wise product operation, is the retained information output by the joint forget gate, is the injected information output by the input gate, is an activation function used to map the input signal to a suitable range. , and are the weights and biases for state updates, respectively, ensuring that the state-frequency memory matrix contains the most relevant time-domain and frequency-domain information at each time step;
[0021] 23) Use of mathematical libraries and implementation tools: Use Pandas and Numpy to read and transform input data and process it into multi-sample, multi-feature input matrix cubes;
[0022] TensorFlow is used to build a state frequency memory network and perform matrix operations; the input data is in the form of multiple samples and multiple features , where N represents the number of samples, Pandas and Numpy construct the input matrix, TensorFlow is responsible for building and training the SFM network, and the Sys library is used to output the prediction results and set the model saving path;
[0023] 24) Set the optimization algorithm and loss function:
[0024] The Adam optimization algorithm is selected for gradient descent, and its update formula is as follows:
[0025]
[0026] in, represents the gradient, is the learning rate, and is the momentum parameter, is the first-order momentum of the gradient, that is, the moving average of the gradient, is the second-order momentum of the gradient, that is, the moving average of the squared gradient, and is the deviation correction value of momentum, is a small constant used to prevent division by zero errors;
[0027] Loss function and evaluation index: Define mean square error MSE as the loss function to optimize the prediction accuracy of the model:
[0028] ,
[0029] At the same time, the mean absolute percentage error MAPE is used as the accuracy evaluation indicator:
[0030]
[0031] in, Indicates the actual value, represents the predicted value of the model, is the number of samples, and the model prediction performance is optimized by minimizing the mean square error.
[0032] The model training and parameter tuning include the following steps:
[0033] 31) Perform data set cutting and preprocessing:
[0034] The photovoltaic power generation data set is cut and processed according to task requirements, and the target variable is converted into a vector form as a label set. , the target variable is the photovoltaic power data, and the meteorological and environmental parameter data are spliced into a feature matrix , meteorological and environmental parameters are sunshine intensity, temperature, humidity, wind speed, each of which Represents multi-feature input data at each time step;
[0035] Normalize the feature matrix:
[0036] ,
[0037] in, and are the minimum and maximum values of the feature respectively;
[0038] Then the label set and feature matrix are further divided into training set and test set;
[0039] 32) Model parameter initialization:
[0040] Input the training set into the model and read its dimensional features to initialize the model parameters, including the weight matrix, bias term, and the initial state of the state frequency memory matrix C;
[0041] Assume that the weight matrix W and the bias term b are initialized through a standard normal distribution as follows:
[0042]
[0043] This means that each element of the weight matrix W starts with a mean of 0 and a variance of Normal distribution The initial state frequency memory matrix C is usually initialized to a zero matrix to ensure that the model has no historical information at the beginning of training;
[0044] 33) Model training and iterative optimization:
[0045] Input the training set data into the model and set the number of training iterations n or the preset prediction error threshold. Stop training if the model meets any of the following conditions:
[0046] Reached the maximum number of iterations ;
[0047] The prediction error MSE reaches the set threshold:
[0048] ,
[0049] in, Indicates the actual value, represents the predicted value of the model, is the number of samples. The model prediction performance is optimized by minimizing the mean square error.
[0050] After training is completed, use the test set to test the prediction accuracy of the model;
[0051] If the accuracy does not meet the requirements, return 32) and use the cross-validation method to further train the model;
[0052] 34) Model saving and prediction result export:
[0053] After the model reaches the expected accuracy, save the parameters of the current model, including the weight matrix W, bias b, hyperparameters such as learning rate α, batch size, and then predict the feature data. Input the optimal model and output the prediction results:
[0054] ,
[0055] And export the prediction results to Excel.
[0056] Beneficial Effects
[0057] Compared with the prior art, the photovoltaic power generation prediction method based on the state frequency memory network of the present invention captures the complex characteristics of photovoltaic power generation by combining information in the time domain and the frequency domain to improve the prediction accuracy and the robustness of the system, thereby realizing accurate prediction of photovoltaic power generation.
[0058] This paper proposes a photovoltaic power prediction method based on the state frequency memory network (SFM). Combining wavelet transform and Fourier transform, the frequency characteristics in the data are extracted through the state frequency decoupling layer, which significantly improves the model's ability to capture periodic fluctuations and enhances the accuracy of photovoltaic power prediction. At the same time, the gating mechanism of the state update layer balances short-term and long-term dependencies, making the model more robust when dealing with the uncertainty of meteorological data, and effectively improving the anti-interference ability.
[0059] The SFM model of the present invention shows excellent prediction performance under different time scales and seasonal conditions, and is particularly suitable for photovoltaic power prediction under variable meteorological environments. This method not only improves the dispatching efficiency of photovoltaic power stations and optimizes the operation of power grids, but also provides more reliable support for the utilization of clean energy. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 is a method sequence diagram of the present invention;
[0061] Figure 2 It is a structural diagram of the SFM cycle network involved in the present invention;
[0062] Figure 3 is the GRA heat map involved in the present invention;
[0063] Figure 4 It is a radar chart of the prediction accuracy of the method described in the present invention and different models under four different evaluation indicators. DETAILED DESCRIPTION
[0064] In order to have a further understanding and recognition of the structural features and the effects achieved by the present invention, a preferred embodiment and accompanying drawings are used for detailed description as follows:
[0065] like Figure 1 As shown, the photovoltaic power generation power prediction method based on the state frequency memory network described in the present invention includes the following steps:
[0066] The first step is data collection and preprocessing: obtain the historical power generation data and meteorological data of the photovoltaic power station, and normalize the data. Obtain the historical data of photovoltaic power generation and related meteorological data, such as sunshine hours, temperature, wind speed and other variables. Normalize the data and standardize each data to the same range to reduce the impact of dimensional differences on model training. At the same time, use wavelet transform to denoise the data and extract the main component features in the data, thereby improving the data quality and the prediction accuracy of the model.
[0067] The second step is to build a state-frequency memory network: use the tensor space dimension setting, matrix operation logic design, optimization algorithm selection and loss function construction to build a state-frequency memory network.
[0068] like Figure 2 As shown in the figure, a state frequency memory network (SFM) model is constructed based on the preprocessed data. Specifically, the input layer inputs the processed time series data into the model in time steps; the state frequency decoupling layer extracts the frequency features in the data through Fourier transform to capture periodic changes; the state update layer adopts a gating mechanism to transfer frequency components and hidden states between different time steps to achieve a balance between short-term and long-term dependencies; the activation layer introduces nonlinearity to enhance the expressiveness of the model. Finally, the output layer maps the updated hidden state to the power prediction result to achieve dynamic prediction of short-term photovoltaic power generation.
[0069] The State Frequency Memory (SFM) model consists of the following network layers:
[0070] (1) Input layer: The input layer receives time series data, including features such as sunshine hours, global radiation intensity, solar altitude angle, direct radiation, and wind speed. These features are normalized and denoised before being input into the network to ensure data stability and reduce noise interference. Set the input feature data as , where is the input feature vector at time step, is the sequence length. The time series input format enables the model to read the data incrementally to capture temporal dependencies.
[0071] (2) State-frequency decoupling layer (core layer): The core of the SFM model is to perform state-frequency decomposition on the hidden state at each time step. Convert to state frequency matrix , thus realizing the mapping from time domain to frequency domain. State frequency matrix Represents the multi-frequency components in the hidden state. This matrix captures the contribution of the hidden state at different frequencies, enabling the model to extract the frequency characteristics of the input data. The formula is as follows:
[0072]
[0073] in Represents the Fourier transform operation, which can extract different frequency components.
[0074] (3) State update layer: The main function of the state update layer is to update the state of the The state frequency matrix is used to update the hidden state. Through the gating mechanism, the SFM model determines which frequency components will affect the state of the next time step. The gating mechanism consists of multiple control gates, including input gates and forget gates, which can flexibly selectively retain or discard certain frequency components, thereby achieving modeling of long-term and short-term dependencies.
[0075] Status update formula:
[0076]
[0077] in is the gating function, To control the parameter matrix, a gating mechanism allows the model to capture the dynamics of long-term and short-term dependencies.
[0078] (4) Activation layer: To enhance the nonlinear expression ability of the model, an activation function is usually applied after the state update layer. The SFM model uses a linear rectifier unit ( ) as an activation function can effectively introduce nonlinear factors and reduce the gradient vanishing problem.
[0079] ReLU formula:
[0080]
[0081] in, is the input vector. The activation function can ensure that positive outputs are retained in forward propagation, enhance the learning ability of the model, and adapt it to complex nonlinear time series data.
[0082] (5) Output layer (fully connected layer): In the fully connected layer, the frequency The decomposed hidden state matrix is mapped to the target output space to achieve the final prediction. The output layer is used to convert the high-dimensional feature space into specific prediction values, which is mainly used in the prediction tasks of power or other target variables.
[0083] Full connection formula:
[0084]
[0085] in, is the weight matrix of the output layer, is the bias term, is the final hidden state after multiple state updates. The fully connected layer aggregates features through weighting and biasing to output accurate power prediction results.
[0086] This model has the following advantages:
[0087] Enhance the ability to extract frequency features: By extracting the frequency components in the input data through the state frequency decoupling layer and Fourier transform, the SFM model can accurately capture the periodic changes in the data. The extraction of this frequency domain feature effectively improves the prediction accuracy of the model, and is particularly suitable for processing photovoltaic power data with periodic fluctuations; Strong robustness and adaptability to complex meteorological conditions: The state update layer of the SFM model uses a gating mechanism to dynamically adjust the frequency and state information, which can effectively balance short-term and long-term dependencies, so that the model can show excellent anti-interference ability when dealing with drastic fluctuations and uncertainties in meteorological data, ensuring the stability of the prediction results; Support multi-time scale and multi-scenario applications: The model is suitable for photovoltaic power prediction at different time scales such as hourly and daily levels, and shows good adaptability in different meteorological and geographical environments. The model is suitable for both short-term and seasonal predictions to meet diverse application needs.
[0088] Building a state frequency memory network (SFM) model includes the following steps:
[0089] (1) Determine the appropriate tensor space dimension based on the input data characteristics to capture time series and frequency domain features:
[0090] Assume that the input feature matrix is , where T represents the time step, F represents the number of features, and the feature dimension of the input data determines the shape of the tensor, ensuring that the model effectively stores and updates feature information of different frequencies. The feature dimensions include historical power generation, sunshine intensity, and temperature.
[0091] (2) Perform an outer product operation on the input feature matrix and the frequency feature matrix to capture the timing dependency and frequency domain dependency. The specific calculation process is as follows:
[0092] Joint forget gate calculation: The state forget gate and frequency forget gate control the retention of time domain and frequency domain information respectively. and frequency forget gate The calculation formula is as follows:
[0093]
[0094] in, is the activation function, , and , is the weight matrix, , is the bias term, which controls the degree of forgetting and retaining of time domain and frequency domain information through the outer product operation of state and frequency gates and the combined forget gate;
[0095] State update formula: state frequency memory matrix The update formula is as follows:
[0096] ,
[0097] in, represents the element-wise product operation, is the retained information output by the joint forget gate, is the injected information output by the input gate, is an activation function used to map the input signal to a suitable range. , and are the weights and biases for state updates, respectively, ensuring that the state-frequency memory matrix contains the most relevant time and frequency domain information at each time step.
[0098] (3) Use of mathematical libraries and implementation tools: Use Pandas and Numpy to read and convert input data and process it into multi-sample, multi-feature input matrix cubes;
[0099] TensorFlow is used to build a state frequency memory network and perform matrix operations; the input data is in the form of multiple samples and multiple features , where N represents the number of samples, Pandas and Numpy construct the input matrix, TensorFlow is responsible for building and training the SFM network, and the Sys library is used to predict the output results and set the model save path.
[0100] (4) Setting the optimization algorithm and loss function:
[0101] The Adam optimization algorithm is selected for gradient descent, and its update formula is as follows:
[0102]
[0103] in, represents the gradient, is the learning rate, and is the momentum parameter, is the first-order momentum of the gradient, that is, the moving average of the gradient, is the second-order momentum of the gradient, that is, the moving average of the squared gradient, and is the deviation correction value of momentum, is a small constant used to prevent division by zero errors;
[0104] Loss function and evaluation index: Define mean square error MSE as the loss function to optimize the prediction accuracy of the model:
[0105] ,
[0106] At the same time, the mean absolute percentage error MAPE is used as the accuracy evaluation indicator:
[0107]
[0108] in, Indicates the actual value, represents the predicted value of the model, is the number of samples, and the model prediction performance is optimized by minimizing the mean square error.
[0109] The third step is model training and parameter tuning: GPU is used to train the state frequency memory network, and the model hyperparameters are optimized through random search method, using MAE, RMSE, MAPE and R² as evaluation indicators.
[0110] (1) Data set cutting and preprocessing:
[0111] The photovoltaic power generation data set is cut and processed according to task requirements, and the target variable is converted into a vector form as a label set. , the target variable is the photovoltaic power data, and the meteorological and environmental parameter data are spliced into a feature matrix , meteorological and environmental parameters are sunshine intensity, temperature, humidity, wind speed, each of which Represents multi-feature input data at each time step;
[0112] Normalize the feature matrix:
[0113]
[0114] in, and are the minimum and maximum values of the feature respectively;
[0115] The label set and feature matrix are then further divided into training and testing sets.
[0116] (2) Model parameter initialization:
[0117] Input the training set into the model and read its dimensional features to initialize the model parameters, including the weight matrix, bias term, and the initial state of the state frequency memory matrix C;
[0118] Assume that the weight matrix W and the bias term b are initialized through a standard normal distribution as follows:
[0119]
[0120] This means that each element of the weight matrix W starts with a mean of 0 and a variance of Normal distribution The initial state frequency memory matrix C is usually initialized to a zero matrix to ensure that the model has no historical information in the early stage of training.
[0121] (3) Model training and iterative optimization:
[0122] Input the training set data into the model and set the number of training iterations n or the preset prediction error threshold. Stop training if the model meets any of the following conditions:
[0123] Reached the maximum number of iterations ;
[0124] The prediction error MSE reaches the set threshold:
[0125] ,
[0126] in, Indicates the actual value, represents the predicted value of the model, is the number of samples. The model prediction performance is optimized by minimizing the mean square error.
[0127] After training is completed, use the test set to test the prediction accuracy of the model;
[0128] If the accuracy does not meet the requirements, return to (2) and apply the cross-validation method to further train the model.
[0129] (4) Model saving and prediction result export:
[0130] After the model reaches the expected accuracy, save the parameters of the current model, including the weight matrix W, bias b, hyperparameters such as learning rate α, batch size, and then predict the feature data Input the optimal model and output the prediction results:
[0131] ,
[0132] The prediction results are exported to Excel for subsequent comparison and visual analysis with other models.
[0133] The fourth step is photovoltaic power generation prediction: the processed data is input into the trained state frequency memory network for short-term photovoltaic power generation prediction.
[0134] In practical applications, data set division is performed: the photovoltaic power generation historical data and meteorological data after feature selection are divided into training set, validation set and test set, with the ratio usually being 70%, 15% and 15%. The training set is used for model learning, the validation set is used for parameter adjustment, and the test set is used for the final model performance evaluation.
[0135] Model loss function definition: The mean square error (MSE) is used as the loss function to quantify the error between the model prediction value and the actual value. The formula of MSE is as follows:
[0136]
[0137] in, is the actual value, is the model prediction value, is the number of samples. Minimizing MSE can help the model improve its prediction accuracy.
[0138] Hyperparameter optimization: The key hyperparameters of the SFM model (such as learning rate , hidden layer dimension , batch size ) for optimization. Hyperparameter adjustment uses a random search method to speed up the convergence of the model and improve accuracy by selecting the best configuration from different parameter combinations. The specific optimization goals are as follows:
[0139]
[0140] in, represents the mean square error on the validation set. The optimal configuration of the hyperparameters is to make Minimum parameter combination
[0141] Training and validation: The Adam optimization algorithm is used to perform gradient descent to update model parameters. Adam is an optimization algorithm based on the estimation of the first and second order moments of the gradient. Its advantage is that it can dynamically adjust the learning rate, so as to effectively converge at different training stages. The update formula of the Adam optimization algorithm is:
[0142]
[0143] Model evaluation and preservation: After model training is completed, multiple evaluation indicators are used to comprehensively evaluate the model performance, including mean square error ( ), Root Mean Square Error ( ), mean absolute percentage error ( ) and the coefficient of determination ( ). Root mean square error ( ) is the square root of the mean square error, which can more intuitively reflect the error range. Mean absolute percentage error ( ) is used to evaluate the relative size of the prediction error, and the coefficient of determination ( ) is used to evaluate the model's ability to explain the data. The comprehensive application of these indicators can help optimize the model and, if necessary, fine-tune the model to improve prediction accuracy.
[0144]
[0145]
[0146]
[0147] The SFM model is used to predict power, and the prediction results are compared with the actual values. At the same time, in order to verify the superiority of the SFM model, other commonly used time series prediction models (such as LSTM, BiLSTM, Transformer) are selected as comparison benchmarks. The same data and experimental conditions are set. The prediction accuracy radar charts of different models under four different evaluation indicators are as follows: Figure 3 shown.
[0148] The experimental environment used in the present invention is as follows: All experiments in this study were performed using Nvidia GeForce GTX 4070 and implemented using PyTorch and Keras frameworks in Python 3.11. The experimental computer was equipped with an Intel Core (TM) i5-13600KF CPU and 48GB RAM. The training parameters are shown in Table 1:
[0149] The present invention uses a public data set. The experimental data comes from the historical data set of the National Renewable Energy Laboratory (NREL) of the United States. The specific details are shown in Table 1:
[0150] Table 1 Dataset composition
[0151] Dimension Days Days Annual 365 4463 Spring 90 1104 Summer 93 1133 Autumn 93 1140 Winter 89 1086
[0152] The present invention uses a random search method to efficiently explore the hyperparameter space of different models. The model parameter names and their corresponding optimal values are shown in Table 2:
[0153] Table 2 Model and parameter update table
[0154] Model Parameter Value Seq2Seq Embedding SizeHidden SizeNumber of LayersDropout Rate 25625620.2 LSTM ActivationBatch sizeLayer neurons Sigmoid3264, 128 SFM ActivationBatch sizeLayer neuronsKernel sizeFilters Sigmoid1664, 128(3,3)64, 128 Transformer ActivationBatch sizeKernel sizeFilters Sigmoid16(3,3)3 Bi-LSTM ActivationBatch sizeLayer neurons Sigmoid3264
[0155] like Figure 4 As shown in the figure, the proposed short-term photovoltaic power prediction model based on SFM recurrent network has the best prediction performance under multiple prediction time scales, and the prediction accuracy under four different evaluation indicators of MAE, MAPE, RMSE and R² is higher than that of other models. The second is the short-term photovoltaic power prediction model based on LSTM. The estimation accuracy of the short-term photovoltaic power prediction model based on BiLSTM or Transformer is similar. The prediction accuracy of the short-term photovoltaic power prediction model based on Seq2Seq model is the lowest.
[0156] The basic principle, main features and advantages of the present invention are described. Those skilled in the art should understand that the present invention is not limited by the above embodiments. The above embodiments and the specification only describe the principles of the present invention. The present invention may be subject to various changes and improvements without departing from the spirit and scope of the present invention. These changes and improvements fall within the scope of the present invention to be protected. The scope of protection claimed by the present invention is defined by the attached claims and their equivalents.
Claims
1. A photovoltaic power generation prediction method based on a state frequency memory network, characterized in that: The following steps are involved: 11) Data collection and preprocessing: Obtain historical power generation data and meteorological data of photovoltaic power stations, and normalize the data; 12) Constructing a state frequency memory network: Constructing a state frequency memory network by using tensor space dimension setting, matrix operation logic design, optimization algorithm selection, and loss function construction; 13) Model training and parameter tuning: Use GPU to train the state frequency memory network, and optimize the model hyperparameters through random search method, using MAE, RMSE, MAPE and R² as evaluation indicators; 14) Photovoltaic power generation prediction: The processed data is input into the trained state frequency memory network for short-term photovoltaic power generation prediction.
2. The photovoltaic power generation prediction method based on the state frequency memory network according to claim 1 is characterized in that: The construction of the state frequency memory network comprises the following steps: 21) Determine the appropriate tensor space dimension based on the input data characteristics to capture time series and frequency domain features: Assume that the input feature matrix is , where T represents the time step, F represents the number of features, and the feature dimension of the input data determines the shape of the tensor, ensuring that the model effectively stores and updates feature information of different frequencies. The feature dimensions include historical power generation, sunshine intensity, and temperature; 22) Perform an outer product operation on the input feature matrix and the frequency feature matrix to capture the timing dependency and frequency domain dependency. The specific calculation process is as follows: Joint forget gate calculation: The state forget gate and frequency forget gate control the retention of time domain and frequency domain information respectively. and frequency forget gate The calculation formula is as follows: , in, is the activation function, , and , is the weight matrix, , is the bias term, through the outer product operation of the state forget gate and the frequency forget gate, the forget gate is combined to control the degree of forgetting and retention of time domain and frequency domain information; State update formula: state frequency memory matrix The update formula is as follows: , in, represents the element-wise product operation, is the retained information output by the joint forget gate, is the injected information output by the input gate, is an activation function used to map the input signal to a suitable range. , and are the weights and biases for state updates, respectively, ensuring that the state-frequency memory matrix contains the most relevant time-domain and frequency-domain information at each time step; 23) Use of mathematical libraries and implementation tools: Use Pandas and Numpy to read and transform input data and process it into multi-sample, multi-feature input matrix cubes; TensorFlow is used to build a state frequency memory network and perform matrix operations; the input data is in the form of multiple samples and multiple features , where N represents the number of samples, Pandas and Numpy construct the input matrix, TensorFlow is responsible for building and training the SFM network, and the Sys library is used to output the prediction results and set the model saving path; 24) Set the optimization algorithm and loss function: The Adam optimization algorithm is selected for gradient descent, and its update formula is as follows: , in, represents the gradient, is the learning rate, and is the momentum parameter, is the first-order momentum of the gradient, that is, the moving average of the gradient, is the second-order momentum of the gradient, that is, the moving average of the squared gradient, and is the deviation correction value of momentum, is a small constant used to prevent division by zero errors; Loss function and evaluation index: Define mean square error MSE as the loss function to optimize the prediction accuracy of the model: , At the same time, the mean absolute percentage error MAPE is used as the accuracy evaluation indicator: , in, Indicates the actual value, represents the predicted value of the model, is the number of samples, and the model prediction performance is optimized by minimizing the mean square error.
3. The photovoltaic power generation prediction method based on state frequency memory network according to claim 1 is characterized in that: The model training and parameter tuning include the following steps: 31) Perform data set cutting and preprocessing: The photovoltaic power generation data set is cut and processed according to task requirements, and the target variable is converted into a vector form as a label set. , the target variable is the photovoltaic power data, and the meteorological and environmental parameter data are spliced into a feature matrix , meteorological and environmental parameters are sunshine intensity, temperature, humidity, wind speed, each of which Represents multi-feature input data at each time step; Normalize the feature matrix: , in, and are the minimum and maximum values of the feature respectively; Then the label set and feature matrix are further divided into training set and test set; 32) Model parameter initialization: Input the training set into the model and read its dimensional features to initialize the model parameters, including the weight matrix, bias term, and the initial state of the state frequency memory matrix C; Assume that the weight matrix W and the bias term b are initialized through a standard normal distribution as follows: , This means that each element of the weight matrix W starts with a mean of 0 and a variance of Normal distribution The initial state frequency memory matrix C is usually initialized to a zero matrix to ensure that the model has no historical information at the beginning of training; 33) Model training and iterative optimization: Input the training set data into the model and set the number of training iterations n or the preset prediction error threshold. Stop training if the model meets any of the following conditions: Reached the maximum number of iterations ; The prediction error MSE reaches the set threshold: , in, Indicates the actual value, represents the predicted value of the model, is the number of samples. The model prediction performance is optimized by minimizing the mean square error. After training, the prediction accuracy of the model is tested using the test set; If the accuracy does not meet the requirements, return 32) and use the cross-validation method to further train the model; 34) Model saving and prediction result export: After the model reaches the expected accuracy, save the parameters of the current model, including the weight matrix W, bias b, hyperparameters such as learning rate α, batch size, and then predict the feature data Input the optimal model and output the prediction results: , And export the prediction results to Excel.