Federal learning photovoltaic power generation prediction method and system for enhancing privacy protection
Through the internal product function encryption and threshold update strategy, the problems of low data privacy and communication efficiency in existing energy predictions are solved, and efficient and secure photovoltaic power generation prediction in the smart grid are achieved, which improves prediction accuracy and system security.
Patent Information
- Application Number
- CN202410967103.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-12-24
AI Technical Summary
Existing energy forecasting methods have flaws in data privacy protection and communication efficiency. Centralized data processing may lead to privacy leakage and increased communication complexity, especially in the prediction of photovoltaic power generation, which affects the accuracy and reliability of forecasts. sex.
Data transmission is protected by internal product function encryption technology, and by encrypting terminal model parameters during federated learning training, and using threshold-based parameter update strategy to transmit only parameters with a change of more than the threshold, reducing communication bandwidth and improving efficiency.
It realizes efficient and secure data aggregation and communication in the smart grid, protects user privacy, improves the accuracy of photovoltaic power generation prediction and system efficiency, and reduces the potential risk of data leakage.
Smart Images

Figure CN119180358A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of smart grid technology, and in particular to a method and system for predicting photovoltaic power generation through federated learning with enhanced privacy protection. Background Art
[0002] With the continuous growth of global energy demand and the widespread deployment of renewable energy, smart grid, as a cutting-edge technology of power system, plays a vital role in the efficiency and safety of energy management. In this context, energy forecasting technology has become an indispensable part of smart grid, which plays a core role in the rational planning of infrastructure, effective dispatch of electricity, reduction of power outages and prevention of equipment failures.
[0003] However, most existing energy forecasting methods use a centralized data processing model. Although this method is effective in some cases, it also exposes a series of problems. First, centralized data processing has the potential risk of data privacy leakage, which poses a challenge to protecting user data security. Second, since a large amount of data needs to be frequently transmitted between different nodes, this not only increases the complexity and cost of communication, but also reduces the response speed and efficiency of the system.
[0004] Especially in the prediction of renewable energy generation on the user side, such as solar photovoltaic power generation, existing methods often fail to fully consider key influencing factors such as solar radiation, which directly affects the accuracy and reliability of the prediction. In addition, the centralized model training process requires the processing and transmission of a large amount of data, which not only imposes a heavy burden on the communication network, but also makes the system more vulnerable to cyber attacks and data leakage. Summary of the invention
[0005] In view of the problems in the above-mentioned prior art that the public transmission of model parameters in federated learning can still launch attacks through member inference and model inversion, resulting in privacy leakage, and low communication efficiency between the central server and the terminal, the present invention is proposed.
[0006] Therefore, the technical problem solved by the present invention is to design an effective inner product function encryption to achieve secure data aggregation, protect privacy by encrypting the model parameters of the terminal during federated learning training, and adopt a threshold-based parameter update strategy method to update the parameters of the local model to solve the problem of low communication efficiency.
[0007] To solve the above technical problems, the present invention provides the following technical solutions: a method for predicting photovoltaic power generation with federated learning and enhanced privacy protection, comprising: collecting and preprocessing multi-source data of photovoltaic power stations; constructing an ANN-LSTM prediction model, and designing the structure and hyperparameters of the ANN-LSTM prediction model; deploying the ANN-LSTM prediction model to a central server and each terminal, each terminal training the ANN-LSTM prediction model according to its own data, the central server updating the ANN-LSTM prediction model, and each terminal updating the weight parameters of the ANN-LSTM prediction model; using an inner product function to encrypt and protect data transmission between the central server and each terminal; adopting a parameter update strategy based on threshold comparison, so that the ANN-LSTM prediction model parameters with a change greater than the threshold are transmitted to the central server, so that data can be transmitted efficiently and the communication bandwidth can be reduced.
[0008] As a preferred solution of the privacy-enhanced federated learning photovoltaic power generation prediction method of the present invention, wherein: constructing the ANN-LSTM prediction model includes constructing an ANN part, constructing an LSTM part, and combining the ANN part and the LSTM part into an ANN-LSTM prediction model; constructing the ANN part includes defining the input layer as x=[x 1 ,x 2 ...x n ], the forward propagation of the hidden layer is z [l] =w [l] ·h [l-1] +b [l] , hidden layer h with Dropout [l] h [l] =D [l] ⊙σ(z [l] ), the input layer is y = w [L] ·h [L-1] +b [L] , set the ANN network parameters; build the LSTM part, including setting the basic unit of LSTM, the basic unit of LSTM includes forget gate, input gate and output gate, and define the input and output expressions of LSTM unit; combine ANN and LSTM into ANN-LSTM prediction model, including using ANN to fuse multi-source data, and using LSTM to process time series and make predictions.
[0009] As a preferred solution of the privacy-enhanced federated learning photovoltaic power generation prediction method of the present invention, the input and output expressions of the LSTM unit are as follows:
[0010]
[0011] Among them, f t , I t , O t , ct ,h t and t Respectively represent the forget gate output, input gate output, output gate output, cell state output, hidden state output and predicted power value output in the LSTM cell, σ g represents the Sigmoid activation function, W f , W i , W o and W c Represents the forget gate, input gate, output gate and LSTM cell input x at the current time step t The weight, U f , U i , U o and U c Represent the forget gate, input gate, output gate and LSTM cell for the previous time step hidden state h t-1 The weight of b f 、b i 、b o and b c Represent the forget gate, input gate, output gate and LSTM cell input x respectively. t and h t-1 The bias, c t-1 represents the output of the previous LSTM cell state, σ h represents the hyperbolic tangent activation function.
[0012] As a preferred solution of the privacy-enhanced federated learning photovoltaic power generation prediction method of the present invention, the method comprises: using inner product function encryption to protect the data transmission between the central server and each terminal, including designing the data encryption and decryption process using inner product function encryption technology; in the initialization stage, the key management center generates public parameters and keys, generates different encryption keys for each terminal, and generates keys for aggregation and decryption; in the encryption stage, after the terminal trains the model locally, it uses the private key to encrypt and update the ANN-LSTM prediction model parameters; in the aggregation and decryption stage, the central server receives the ciphertexts of all terminals, uses its own key to aggregate the local model parameters of each terminal, and obtains the final aggregation result through calculation.
[0013] As a preferred solution of the privacy-enhanced federated learning photovoltaic power generation prediction method of the present invention, the initialization phase includes: the parameter generation algorithm receives a security parameter λ as input, generates public parameters and a master key, and the execution process of the parameter generation algorithm is as follows: select two cyclic additive groups {G 1 ,G 2} and a multiplicative group G T , and at the same time, select a bilinear pairing e = G 1 ×G 2→G T ; From G 1 and G 2 In the above equation, we select generators P and Q respectively, satisfying P∈G 1 , Q∈G 2 ; The selected bilinear line satisfies for any a, b∈Z q , both have e(aP,bQ)=e(P,Q) ab ; Compute the finite field Z of prime order Q q Three reversible n×n matrices (B,N 1 ,N 2 ); Output (G 1 ,G 2 ,G T ,q,e,p,Q) as common parameters, (B,N 1 ,N 2 ) as the master key; the terminal key generation algorithm receives the master key as input and generates a i , output Δ i , and the key used for encryption In each round of federated learning training, the key management center provides each terminal C i Assign different Δ i , the execution process of the terminal key generation algorithm is as follows: For each terminal C i , the terminal key generation algorithm generates an n-dimensional vector Δ i , vector Δ i Over a finite field of prime order q, compute for each terminal C i Key The calculation formula is Among them B i ' and B i " are two randomly selected n×n matrices such that B i '+B i =B -1 ; Each terminal C i Receive its corresponding Δ from the key management center i and Used to protect its local model parameters during federated learning.
[0014] As a preferred solution of the method for predicting photovoltaic power generation with federated learning with enhanced privacy protection of the present invention, the encryption stage includes: the encryption algorithm input terminal C i The two confidential information masking vectors Δ i and key and the n-dimensional vector X of the terminal local model parameters i , generate ciphertext CT i , ciphertext CT i The calculation formula is as follows:
[0015]
[0016] Among them, CT i represents the ciphertext of the i-th terminal, Represents X i With the masking vector Δ i of and, and Represents the matrix N of size n×n respectively 1 and N 2 The inverse matrix, B i ′ and B i ″ denotes a randomly selected n×n matrix.
[0017] As a preferred solution of the privacy-enhanced federated learning photovoltaic power generation prediction method of the present invention, the aggregation and decryption phase includes: the aggregation decryption algorithm receives two secret information SK of the central server U and Δ, and a set of ciphertexts corresponding to the parameters of the local ANN-LSTM prediction model of the participating terminals {CT 1 ,CT 2 ...,CT K}, output an n-dimensional vector X, the calculation steps of X include: summing up the ciphertexts of all terminals to obtain the following formula:
[0018]
[0019] Using the properties of bilinear pairing and the central server's key SK U The following formula is obtained:
[0020]
[0021] According to B i '+B i =B -1 , simplify the formula to get:
[0022]
[0023] According to e(ΔP,Q)=e(P,Q) Δ as well as get:
[0024]
[0025] Among them, CT represents the ciphertext set, K represents the total number of terminals, i represents the i-th terminal, and CT i represents the ciphertext of the i-th terminal, CT(1) represents CT(2) means Represents X i With the masking vector Δ i of and, and The size of each matrix N is n×n 1 and N 2 The inverse matrix of , e represents a bilinear pairing function, and P represents the additive group G 1 The elements in Q represent the additive group G 2 The elements in B i ′ and B i ″ denotes a randomly selected n×n matrix, and B denotes a finite field Z q The reversible n×n matrix on , Δ represents the masking vector Δ i By calculating G T The discrete logarithm in , according to e(P,Q) X Calculate X
[0026] Another object of the present invention is to provide a federated learning photovoltaic power generation prediction system with enhanced privacy protection, including: a data acquisition module for collecting and preprocessing multi-source data of photovoltaic power stations; a model construction module for constructing an ANN-LSTM prediction model and designing the structure and hyperparameters of the ANN-LSTM prediction model; an updating module for deploying the ANN-LSTM prediction model to a central server and each terminal, each terminal training the ANN-LSTM prediction model according to its own data, the central server updating the ANN-LSTM prediction model, and each terminal updating the weight parameters of the ANN-LSTM prediction model; an encryption protection module for encrypting and protecting data transmission between the central server and each terminal using an inner product function; a transmission module for adopting a parameter update strategy based on threshold comparison to transmit the ANN-LSTM prediction model parameters with a change greater than the threshold to the central server, so that data can be transmitted efficiently and the communication bandwidth can be reduced.
[0027] A computer device includes a memory and a processor, wherein the memory stores a computer program, and is characterized in that when the processor executes the computer program, the steps of the above-mentioned federated learning photovoltaic power generation prediction method with enhanced privacy protection are implemented.
[0028] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the above-mentioned federated learning photovoltaic power generation prediction method with enhanced privacy protection are implemented.
[0029] Beneficial effects of the present invention: A method and system for predicting photovoltaic power generation through federated learning with enhanced privacy protection is proposed to accurately predict future power generation, an effective inner product function encryption is designed to achieve secure data aggregation, and the privacy of the terminal is protected by encrypting the model parameters during federated learning training. In order to solve the problem of low communication efficiency, a threshold-based parameter update strategy method is adopted to update the parameters of the local model, in which only parameters with sufficient changes are updated. This innovative method provides strong technical support for energy management of smart grids, is expected to promote further development in the field of renewable energy, and will play a more important role in future energy forecasting and management. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0031] Figure 1 It is a schematic diagram of the overall design of the present invention.
[0032] Figure 2 Schematic diagram of multi-source data fusion based on ANN.
[0033] Figure 3 Schematic diagram of time series prediction based on LSTM.
[0034] Figure 4 Schematic diagram of the pre-training process based on ANN-LSTM. DETAILED DESCRIPTION
[0035] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0036] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0037] Example 1
[0038] Reference Figure 1 to Figure 4, an embodiment of the present invention provides a method for predicting photovoltaic power generation through federated learning with enhanced privacy protection, comprising the following steps:
[0039] S1: Collect and preprocess multi-source data of PV power plants.
[0040] Specifically, collect multi-source data of photovoltaic power plants, including but not limited to photovoltaic panel power output, solar radiation intensity, ambient temperature, humidity, and timestamp, etc. Clean the data and remove outliers and fill in missing values.
[0041] Furthermore, data preprocessing was to remove outliers using the 3σ principle and replace missing values with the mean before and after; the data were standardized to ensure that different features had consistent dimensions.
[0042] S2: Build an ANN-LSTM prediction model and design the structure and hyperparameters of the ANN-LSTM prediction model.
[0043] Specifically, ANN with Dropout is used for multi-source data fusion, and LSTM is used to process time series data and make predictions. The network parameters of ANN are: 3 neurons in the input layer, 1 neuron in the output layer, 3 hidden layers containing 64 neurons, and the random dropout concept of the hidden layer is p = 0.4.
[0044] Furthermore, if Figure 2 to Figure 4 As shown, building the ANN-LSTM prediction model includes the following steps:
[0045] S2.1: Collect multi-source data of the photovoltaic power station, including but not limited to the power output of the photovoltaic panels, solar radiation intensity, ambient temperature, humidity, and timestamp, etc.
[0046] S2.2: Clean the data to remove outliers and fill missing values. Use the 3σ principle to remove outliers and replace missing values with the mean before and after. Standardize the data to ensure that different features have consistent dimensions.
[0047] S2.3: Divide the preprocessed data into training and testing sets to evaluate model performance.
[0048] S2.4 builds a prediction model architecture that includes an artificial neural network (ANN) and a long short-term memory network (LSTM). ANN is used to fuse multi-source data, and LSTM is used to process time series data and make predictions.
[0049] ANN consists of an input layer, a hidden layer, and an output layer. ANN with Dropout will apply Dropout to the output of some neurons during the forward propagation process. Dropout is a regularization technique used to prevent neural networks from overfitting. Dropout is achieved by randomly "discarding" some neurons in the network during the training process.
[0050] The multi-data fusion process of ANN is as follows:
[0051] Define the input layer as x=[x 1 ,x 2 ...x n ]; define the forward propagation of the hidden layer as z [l] =w [l] ·h [l-1] +b [l] Among them, z [l] is the linear output of the lth layer, w [l] is the weight matrix, h [l-1] is the activation output of layer l-1, b [l] is the bias vector of the lth layer.
[0052] Hidden layer h with Dropout [l] h [l] =D [l] ⊙σ(z [l] ), where D [l] is a binary matrix whose elements are randomly set to values between [0, 1] during training, σ(·) is the ReLU activation function, ⊙ represents element-wise multiplication, and z [l] is the linear output of the lth layer.
[0053] The output layer is y=w [L] ·h [L-1] +b [L] ; where y is the final output of the network and L is the number of layers in the network. During testing or inference, Dropout is not applied, but the outputs of all neurons are used.
[0054] The dropout probability p is a hyperparameter that needs to be tuned for the specific problem. Dropout layers are typically used only during training and are disabled or replaced with a simple scaling factor when evaluating or testing the network.
[0055] The network parameters of ANN are 3 neurons in the input layer, 1 neuron in the output layer, 3 hidden layers with 64 neurons, and the random dropout concept of the hidden layer is p = 0.4.
[0056] LSTM is a recurrent neural network that can process time series data well. The basic units of LSTM neural network are as follows: Figure 3 As shown. Each unit in the LSTM module has three gates: forget gate f t , Input Gate I t and output gate O t The input gate is responsible for controlling the amount of new information incorporated into the cell state, the forget gate is responsible for regulating the extent to which the previous cell state is discarded, and finally, the output gate is responsible for regulating the amount of cell state sent to subsequent layers. The input and output expressions of each cell of LSTM are:
[0057]
[0058] Among them, f t , I t , O t , c t ,h t and t Respectively represent the forget gate output, input gate output, output gate output, cell state output, hidden state output and predicted power value output in the LSTM cell, σ g represents the Sigmoid activation function, W f , W i , W o and W c Represents the forget gate, input gate, output gate and LSTM cell input x at the current time step t The weight, U f , U i , U o and U c Represent the forget gate, input gate, output gate and LSTM cell for the previous time step hidden state h t-1 The weight of b f , b i , b o and b c Represent the forget gate, input gate, output gate and LSTM cell input x respectively. t and h t-1 The bias, c t-1 represents the output of the previous LSTM cell state, σ h represents the hyperbolic tangent activation function.
[0059] S2.5: Use the training set data to train the model, adjust hyperparameters such as learning rate, batch size, number of network layers, etc., and use the back-propagation algorithm to optimize the model weight size.
[0060] S2.6: Evaluate and optimize the model based on the test set using the root mean square error Where N is the number of test samples, r i and The actual and predicted values, respectively) and the mean absolute error Evaluate the prediction accuracy of the model. Optimize the model based on the evaluation results, including adjusting the network structure or retraining.
[0061] S3: The ANN-LSTM prediction model is deployed to the central server and each terminal. Each terminal trains the ANN-LSTM prediction model based on its own data. The central server updates the ANN-LSTM prediction model, and each terminal updates the weight parameters of the ANN-LSTM prediction model.
[0062] Specifically, the ANN-LSTM prediction model is deployed to the central server and each terminal; each terminal trains the ANN-LSTM prediction model based on its own data, and encrypts the trained ANN-LSTM prediction model weight parameters and sends them to the central server. After receiving the encrypted parameters from each terminal, the central server decrypts and aggregates them to update the ANN-LSTM prediction model of the central server. Then, the global model parameters are encrypted and distributed to the ANN-LSTM prediction model of each terminal to update the weight parameters.
[0063] S4: Use inner product function to encrypt and protect the data transmission between the central server and each terminal.
[0064] Furthermore, the encryption and decryption process of data communication is designed using inner product function encryption technology, which realizes the calculation of the inner product of data without exposing the original data. The scheme first generates public and private keys in the system initialization phase, and then the user uses the private key to encrypt the local data to obtain the ciphertext. During the training process of federated learning, the user sends these ciphertexts to the server, and the server uses the public key for secure aggregation and updates the global model without knowing the specific data of any user. This process not only ensures the privacy and security of the data, but also effectively resists potential data leakage risks such as member inference attacks and model inversion attacks, thereby providing a communication-efficient and privacy-preserving energy prediction method in sensitive areas such as smart grids.
[0065] S5: A parameter update strategy based on threshold comparison is adopted to transmit the ANN-LSTM prediction model parameters with changes greater than the threshold to the central server, so that data can be transmitted efficiently and the communication bandwidth can be reduced.
[0066] Specifically, the threshold-based parameter update strategy, that is, the model parameters are only transmitted when the change exceeds the preset threshold. This strategy significantly reduces the amount and frequency of data transmission during the federated learning process, and reduces the security risks that may be caused by data transmission.
[0067] Furthermore, in the case of multiple terminals, it is unsafe to provide the same key to multiple terminals, so different keys are provided for each terminal. For encryption, each terminal uses its own encryption algorithm to generate ciphertext. For decryption, after aggregating the ciphertexts of different terminals, a ciphertext decrypted by the decryption algorithm is obtained. The process consists of three main stages, including initialization, encryption, aggregation, and decryption.
[0068] Furthermore, during the initialization phase, the key management center runs the following algorithm to generate public parameters and keys for the central server and the terminal, respectively.
[0069] Furthermore, the parameter generation algorithm receives a security parameter λ as input and generates a public parameter PP and a master key MSK. The execution flow of the algorithm is as follows:
[0070] The parameter generation algorithm receives a security parameter λ as input and generates a public parameter PP and a master key MSK. The execution flow of the parameter generation algorithm is as follows:
[0071] Choose two cycles of additive group {G 1 ,G 2} and a multiplicative group G T , and at the same time, select a bilinear pairing e = G 1 ×G 2 →G T ; From G 1 and G 2 In the above equation, we select generators P and Q respectively, satisfying P∈G 1 , Q∈G 2 ; The selected bilinear line satisfies for any a, b∈Z q , both have e(aP,bQ)=e(P,Q) ab , Z q refers to a finite field of prime order Q.
[0072] Furthermore, we calculate the finite field Z of prime order Q q Three reversible n×n matrices (B,N 1 ,N 2 ); Output (G 1 ,G 2 ,G T ,q,e,p,Q) as common parameters, (B,N 1 ,N 2 ) as the master key; the terminal key generation algorithm receives the master key MSK as input, and for each terminal C i , output Δ i , and the encryption key SK Ci .
[0073] Furthermore, in each round of federated learning training, the key management center is a key management center for each terminal C i Assign different Δ i , the execution process of the terminal key generation algorithm is as follows:
[0074] For each terminal C i , the terminal key generation algorithm generates an n-dimensional vector Δ i , vector Δ i Over a finite field of prime order q.
[0075] Calculate each terminal C i Key The calculation formula is Among them B i ' and B i " are two randomly selected n×n matrices such that B′ i +B” i =B -1 , B' i and B" i The choice of ensures that they are inverses of the B matrix -1 The sum is equal to the identity matrix, thus ensuring the security and validity of the key.
[0076] Each terminal C i Receive its corresponding Δ from the key management center i and Used to protect its local model parameters during federated learning.
[0077] Preferably, through this algorithm, the privacy protection of terminal data can be achieved in the federated learning environment, while ensuring that only authorized terminals can participate in the training of the model. This method helps to build a secure and flexible federated learning system, allowing multiple participants to jointly train models while protecting the privacy of their respective data.
[0078] Furthermore, in order to enable the key management center to assign keys to each terminal, public key cryptography is used. Specifically, each entity, including the key management center, central server and terminal, has a pair of unique public and private keys. i Generate a unique key pair After that, the key management center uses terminal C i The public key of the terminal C is used to encrypt the key pair and send the encrypted key pair to the terminal C. i . Terminal C i After receiving the encrypted key pair, use your own private key to decrypt it to obtain the key that can be used to encrypt and mask the local model parameters and the n-dimensional vector Δ used for these encryption operations iIn this way, terminal C i You can safely receive and use your own private key without having to worry about the key being intercepted or tampered with during transmission.
[0079] Furthermore, in the federated learning architecture, the central server plays a key role in aggregating the model parameters of each terminal. To this end, the key management center executes a specific key generation algorithm that generates the central server's key SK based on the master key MSK. U , and an n-dimensional vector Δ for subsequent unmasking operations. SK U is generated by calculating SK U =(BN 1 ,BN 2 ), and Δ is obtained by i Δ i Perform summation Here K represents the total number of terminals participating in federated learning. In each round of training, the central server will first report to the key management center the list of terminals that have submitted model parameters. The key management center will then provide the corresponding Δ vector based on this list to ensure that the central server can correctly demask and aggregate these encrypted model parameters. This process ensures that only the parameters of the terminals participating in the current round of federated learning are used for aggregation, thereby maintaining the security and efficiency of the system.
[0080] Furthermore, in the encryption phase, after each terminal has trained the model locally based on its private data, it runs the following encryption algorithm to shield and encrypt the updated model parameters.
[0081] Furthermore, the encryption algorithm is input into terminal C i Two confidential information of: masking vector Δ i and key and the n-dimensional vector X of the terminal local model parameters i The goal of this algorithm is to generate a ciphertext CT i , ensuring that even if it is intercepted during transmission, it cannot be interpreted by unauthorized third parties.
[0082] Specifically, the algorithm passes X i With the masking vector Δ i Add to generate the masked model parameters Right now This step effectively hides the values of the original model parameters. i Key The matrix in and And the randomly selected matrix B i ' and B i", combined with the central server's public key Q, to calculate the ciphertext CT i , the calculated ciphertext CT i It consists of two parts, each of which is obtained by calculating the masked model parameters with the corresponding matrix and public key. In this way, even if the ciphertext is intercepted during transmission, the original model parameters cannot be decrypted without the corresponding private key, thus ensuring the security and privacy of customer data.
[0083] Furthermore, the encryption algorithm is input into terminal C i The two confidential information masking vectors Δ i and key And the n-dimensional vector Xi of the terminal local model parameters, generate the ciphertext CT i , ciphertext CT i The calculation formula is as follows:
[0084]
[0085] Among them, CT i represents the ciphertext of the i-th terminal, Represents X i With the masking vector Δ i of and, and Represents the matrix N of size n×n respectively 1 and N 2 The inverse matrix, B i ′ and B i ″ denotes a randomly selected n×n matrix. Further, in the aggregation and decryption stage, after receiving the ciphertext from all terminals participating in the federated learning, the central server runs the following aggregation decryption algorithm to aggregate and decrypt the local model parameters of each terminal.
[0086] Furthermore, the aggregate decryption algorithm receives two secret information SK from the central server. U and Δ, and a set of ciphertexts corresponding to the parameters of the local ANN-LSTM prediction model of the participating terminals {CT 1 ,CT 2 ...,CT K}, output an n-dimensional vector X, the calculation steps of X include:
[0087] The sum of the ciphertexts of all terminals is obtained as follows:
[0088]
[0089] Using the properties of bilinear pairing and the central server's key SK U The following formula is obtained:
[0090]
[0091] According to B i '+B i =B -1 , simplify the formula to get:
[0092]
[0093] According to e(ΔP,Q)=e(P,Q) Δ as well as get:
[0094]
[0095] Among them, CT represents the ciphertext set, K represents the total number of terminals, i represents the i-th terminal, and CT i represents the ciphertext of the i-th terminal, CT(1) represents CT(2) means Represents X i With the masking vector Δ i of and, and Represents the matrix N of size n×n respectively 1 and N 2 The inverse matrix of , e represents a bilinear pairing function, and P represents the additive group G 1 The elements in Q represent the additive group G 2 The elements in B i ′ and B i ″ represent randomly selected n×n matrices, B represents the finite field Z q The reversible n×n matrix on , Δ represents the masking vector Δ i By calculating G T The discrete logarithm in can be obtained from e(P,Q) X Calculate X. If the elements of X are small values, X can be calculated efficiently using the small-step big-step algorithm.
[0096] Furthermore, in the field of federated learning, the optimization of communication efficiency is crucial and will directly affect the performance and response speed of the entire system. This paper proposes a parameter update strategy based on threshold comparison to optimize data communication. The core idea of this method is to transmit only when the change in model parameters exceeds a preset threshold through intelligent screening, thereby significantly reducing unnecessary data flow.
[0097] Furthermore, the change is defined as an absolute percentage, as follows:
[0098]
[0099] Among them, x i represents the model parameters of the ith time, x i-1 represents the model parameter of the i-1th time, and α represents the threshold. Thus, the number and frequency of transmissions are reduced, and the communication efficiency of data transmission is improved.
[0100] Furthermore, after each training cycle of federated learning, the terminal will calculate the difference between the new and old model parameters. Only when the parameter change is significant, that is, exceeding the set threshold, will the terminal send these key parameter updates to the central server. This strategy not only effectively reduces the total amount of data transmission, but also avoids frequent communication activities that may affect network performance.
[0101] Furthermore, the central server plays the role of an aggregator in this process, responsible for receiving parameter updates from various terminals, enabling the central server to ensure that the iteration and optimization of the model are both fast and efficient while maintaining the consistency and stability of the model.
[0102] Furthermore, the implementation of the threshold-based parameter update strategy method can also improve data security. Since the amount of data transmitted is reduced, the risk of potential data leakage is also reduced. By reducing the transmission of sensitive information, the threshold-based parameter update strategy method provides an additional layer of security for data processing in federated learning.
[0103] Example 2
[0104] Reference Figure 1 to Figure 4 , which is an embodiment of the present invention, provides a federated learning photovoltaic power generation prediction system with enhanced privacy protection, including:
[0105] For the specific limitations of the federated learning photovoltaic power generation prediction system with enhanced privacy protection, please refer to the limitations of the federated learning photovoltaic power generation prediction method with enhanced privacy protection above, which will not be repeated here. Each module in the above-mentioned federated learning photovoltaic power generation prediction system with enhanced privacy protection can be implemented in whole or in part through 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.
[0106] Example 3
[0107] Reference Figure 1 to Figure 4, which is the second embodiment of the present invention, based on the first two embodiments, the embodiment of the present invention provides a computer device, which may be a server, and includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium.
[0108] The database of the computer device is used to store action detection data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in any of the above-mentioned sparse tensor operation acceleration method embodiments are implemented.
[0109] In one embodiment, an embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in any of the above-mentioned sparse tensor operation acceleration method embodiments are implemented.
[0110] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0111] Example 4
[0112] Reference Figure 1 to Figure 4 , which is an embodiment of the present invention, provides a federated learning photovoltaic power generation prediction method and system with enhanced privacy protection. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through simulation.
[0113] Table 1 Performance comparison of different photovoltaic power generation prediction models
[0114] Prediction Model RMSE MAE ANN 0.618 0.368 LSTM 0.623 0.342 ANN-LSTM (present invention) 0.573 0.317
[0115] Table 1 compares the performance of the ANN-LSTM prediction model designed by the present invention with other machine learning-based predictors in terms of RMSE and MAE. It can be clearly seen from Table 2 that the ANN-LSTM-based prediction model proposed by the present invention has better performance than the ANN-based or LSTM-based prediction models. This is because it can combine the advantages of ANN and LSTM. The ANN module integrates multiple data and extracts features, while the LSTM module associates the extracted features at different time steps for prediction.
[0116] Table 2 Comparison of basic federated learning and federated learning with different thresholds proposed in this patent
[0117] Prediction Model RMSE MAE Communication bandwidth saving BFL 0.694 0.374 0 PFL1 0.718 0.358 81.46% PFL2 0.735 0.375 85.54% PFL3 0.821 0.582 91.23%
[0118] Table 2 gives a comparison of basic federated learning (BFL) and federated learning with different threshold data updates proposed in this patent. Three threshold methods, namely PFL1 (α = 2%), PFL2 (α = 4%) and PFL3 (α = 10%), were tested. The RMSE, MAE and communication bandwidth savings after each round of training were compared. It can be observed from the table that the performance of the predictor based on PFL1 is slightly lower than that of the predictor based on BFL. However, compared with the prediction model trained using the BFL method, the prediction model based on PFL1 saves more than 80% of the communication bandwidth. In addition, the higher the threshold, the higher the communication bandwidth savings and the lower the prediction model performance. In summary, selecting a threshold of 4% can achieve a balance between prediction model performance and communication bandwidth.
[0119] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for predicting photovoltaic power generation with federated learning and enhanced privacy protection, characterized in that: include: Collect and pre-process multi-source data of photovoltaic power plants; Build an ANN-LSTM prediction model and design the structure and hyperparameters of the ANN-LSTM prediction model; The ANN-LSTM prediction model is deployed to the central server and each terminal. Each terminal trains the ANN-LSTM prediction model based on its own data. The central server updates the ANN-LSTM prediction model, and each terminal updates the weight parameters of the ANN-LSTM prediction model. The inner product function is used to encrypt and protect the data transmission between the central server and each terminal; A parameter updating strategy based on threshold comparison is adopted to transmit the ANN-LSTM prediction model parameters with changes greater than the threshold to the central server, which enables data to be transmitted efficiently and reduces the communication bandwidth.
2. The method for predicting photovoltaic power generation with federated learning and enhanced privacy protection as claimed in claim 1, characterized in that: The construction of the ANN-LSTM prediction model includes: Build the ANN part, build the LSTM part, and combine the ANN part and the LSTM part into an ANN-LSTM prediction model; The ANN construction part includes defining the input layer as x=[x1,x2...x n ], the forward propagation of the hidden layer is z [l] =w [l] ·h [l-1] +b [l] , hidden layer h with Dropout [l] h [l] =D [l] ⊙σ(z [l] ), the input layer is y = w [L] ·h [L-1] +b [L] , set ANN network parameters; The LSTM construction part includes setting the basic unit of LSTM, the basic unit of LSTM includes a forget gate, an input gate and an output gate, and defining the input and output expressions of the LSTM unit; The combination of ANN and LSTM into an ANN-LSTM prediction model includes using ANN to fuse multi-source data and using LSTM to process time series and make predictions.
3. The method for predicting photovoltaic power generation with federated learning and enhanced privacy protection as claimed in claim 2, characterized in that: The input and output expressions of the LSTM unit are as follows: Among them, f t , I t , O t , c t ,h t and t Respectively represent the forget gate output, input gate output, output gate output, cell state output, hidden state output and predicted power value output in the LSTM cell, σ g represents the Sigmoid activation function, W f , W i , W o and W c Represents the forget gate, input gate, output gate and LSTM cell input x at the current time step t The weight, U f , U i , U o and U c Represent the forget gate, input gate, output gate and LSTM cell for the previous time step hidden state h t-1 The weight of b f , b i , b o and b c Represent the forget gate, input gate, output gate and LSTM cell input x respectively. t and h t-1 The bias, c t-1 represents the output of the previous LSTM cell state, σ h represents the hyperbolic tangent activation function.
4. The method for predicting photovoltaic power generation with enhanced privacy protection through federated learning according to claim 3, characterized in that: The use of inner product function to encrypt and protect the data transmission between the central server and each terminal includes: Design the data encryption and decryption process using inner product function encryption technology; In the initialization phase, the key management center generates public parameters and keys, generates different encryption keys for each terminal, and generates keys for aggregation and decryption; In the encryption phase, after training the model locally, the terminal uses the private key to encrypt and update the ANN-LSTM prediction model parameters; In the aggregation and decryption stage, the central server receives the ciphertext from all terminals, uses its own key to aggregate the local model parameters of each terminal, and obtains the final aggregation result through calculation.
5. The method for predicting photovoltaic power generation with federated learning and enhanced privacy protection as claimed in claim 4, characterized in that: The initialization phase includes: The parameter generation algorithm receives a security parameter λ as input and generates public parameters and a master key. The execution flow of the parameter generation algorithm is as follows: Choose two cycles of additive group {G1, G2} and a multiplicative group G with prime order q T , and at the same time, select a bilinear pairing e = G1 × G2 → G T ; Select generators P and Q from G1 and G2 respectively, satisfying P∈G1, Q∈G2; The selected bilinear line satisfies that for any a, b∈Z q , both have e(aP,bQ)=e(P,Q) ab ; Compute the finite field Z of prime order Q q Three reversible n×n matrices (B, N1, N2) on ; Output (G1, G2, G T ,q,e,p,Q) as public parameters and (B,N1,N2) as master key; The terminal key generation algorithm receives the master key as input and generates a i , output Δ i , and the key used for encryption In each round of federated learning training, the key management center provides each terminal C i Assign different Δ i , the execution process of the terminal key generation algorithm is as follows: For each terminal C i , the terminal key generation algorithm generates an n-dimensional vector Δ i , vector Δ i Over a finite field of prime order q, Calculate each terminal C i Key The calculation formula is Among them B i ' and B i " are two randomly selected n×n matrices such that B′ i +B″ i =B -1 ; Each terminal C i Receive its corresponding Δ from the key management center i and Used to protect its local model parameters during federated learning.
6. The method for predicting photovoltaic power generation with enhanced privacy protection through federated learning according to claim 5, characterized in that: The encryption stage includes: Encryption algorithm input terminal C i The two confidential information masking vectors Δ i and key and the n-dimensional vector X of the terminal local model parameters i , generate ciphertext CT i , ciphertext CT i The calculation formula is as follows: Among them, CT i represents the ciphertext of the i-th terminal, Represents X i With the masking vector Δ i of and, and Respectively represent the inverse matrices of the n×n matrices N1 and N2, B i ′ and B i ″ denotes a randomly selected n×n matrix.
7. The method for predicting photovoltaic power generation with federated learning and enhanced privacy protection as claimed in claim 6, characterized in that: The aggregation and decryption phase includes, The aggregate decryption algorithm receives two secret information SK from the central server U and Δ, and a set of ciphertexts corresponding to the parameters of the local ANN-LSTM prediction model of the participating terminals {CT1, CT2..., CT K }, output an n-dimensional vector X, the calculation steps of X include: The sum of the ciphertexts of all terminals is obtained as follows: Using the properties of bilinear pairing and the central server's key SK U The following formula is obtained: According to B i '+B i =B -1 , simplify the formula to get: According to e(ΔP,Q)=e(P,Q) Δ as well as get: Among them, CT represents the ciphertext set, K represents the total number of terminals, i represents the i-th terminal, and CT i represents the ciphertext of the i-th terminal, CT(1) represents CT(2) means Represents X i With the masking vector Δ i of and, and The inverse matrices of matrices N1 and N2 of size n×n, e represents a bilinear pairing function, P represents an element in the additive group G1, Q represents an element in the additive group G2, B i ′ and B i ″ denotes a randomly selected n×n matrix, and B denotes a finite field Z q The reversible n×n matrix on , Δ represents the masking vector Δ i of and; By calculating G T The discrete logarithm in , according to e(P,Q) X Calculate X.
8. A system using the privacy-enhanced federated learning photovoltaic power generation prediction method as claimed in any one of claims 1 to 7, characterized in that: include: Data acquisition module, used to collect and pre-process multi-source data of photovoltaic power plants; Model building module, used to build ANN-LSTM prediction model and design the structure and hyperparameters of ANN-LSTM prediction model; The updating module is used to deploy the ANN-LSTM prediction model to the central server and each terminal. Each terminal trains the ANN-LSTM prediction model according to its own data. The central server updates the ANN-LSTM prediction model, and each terminal updates the weight parameters of the ANN-LSTM prediction model. An encryption protection module is used to encrypt and protect the data transmission between the central server and each terminal using the inner product function; The transmission module is used to adopt a parameter update strategy based on threshold comparison, so that the ANN-LSTM prediction model parameters with a change greater than the threshold are transmitted to the central server, so that data can be transmitted efficiently and the communication bandwidth can be reduced.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for predicting photovoltaic power generation with federated learning and enhanced privacy protection according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for predicting photovoltaic power generation with federated learning and enhanced privacy protection according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Anning service supply and demand resource prediction method, device and equipment
CN120671889A
Dynamic data desensitization method for sensitive field identification
CN120996146A
Distributed photovoltaic station short-term power generation prediction method based on federated learning
CN121417182A
