Family house electricity consumption prediction method based on federated learning, medium and equipment

By adopting a combination of federated learning, singular spectrum analysis and LSTM neural network in the power consumption prediction of home residential housing, the problems of data privacy protection and heterogeneous data processing are solved, significantly improving the prediction accuracy and model robustness.

CN119476609APending Publication Date: 2025-02-18ZHEJIANG UNIV
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202411581422.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

There are personal privacy protection issues in the prediction of electricity consumption in households and residential areas. Traditional methods have challenges in data privacy protection and heterogeneous data processing, resulting in limited model learning ability and low prediction accuracy.

Method used

Using a federated learning-based approach, time series decomposition and parameter optimization are performed by creating and training models locally, combining singular spectrum analysis and LSTM neural networks, ensuring data privacy and security and improving prediction accuracy.

Benefits of technology

It effectively protects user privacy, improves the accuracy of household electricity consumption prediction and the robustness of the model. The experimental results show that MAE, RMSE and MAPE have improved by 65.21%, 68.98% and 36.86% respectively on the three evaluation indicators of MAE, RMSE and MAPE.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119476609A_ABST
    Figure CN119476609A_ABST
Patent Text Reader

Abstract

The invention discloses a family house electricity consumption prediction method based on federated learning, a medium and equipment. Aiming at the problem of knowledge confusion caused by different data characteristics in a multi-terminal environment, the invention provides a household electricity consumption prediction method fusing singular spectrum analysis and federated learning, which is the first method for simultaneously solving the problems of energy consumption prediction precision and data privacy under a federated learning framework. Various distributions of residential energy consumption data can be safely and effectively predicted. According to the method, the hierarchical features are extracted from the residential energy consumption data by using the singular spectrum analysis technology, so that the prediction model can better understand and distinguish the data characteristics of each terminal, and the cross-terminal learning effect and prediction accuracy are improved. Meanwhile, local data processing is carried out by adopting the bidirectional long-short-term memory neural network, and only processed model parameters or learning results are shared to the central server, so that direct interaction between data and a global model is avoided, and the training time and the risk of privacy disclosure are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of deep learning and electricity prediction, and in particular to a method, medium and device for predicting household residential electricity consumption based on federated learning. Background Art

[0002] As the feasibility and competitiveness of renewable energy generation continue to increase, it has become an inevitable trend for future development to accurately predict energy consumption (ECF), strengthen power regulation and resource allocation capabilities, and promote the transition to green and low-carbon energy. As an important part of total electricity demand, accurate prediction of residential electricity consumption is crucial to balancing the entire power grid and achieving carbon peak and carbon neutrality goals. However, residential electricity consumption patterns are extremely complex, with strong volatility, unpredictable sudden changes, and high uncertainty. Traditional energy consumption forecasting solutions usually rely on historical observation data and construct structured input-output pairs through sliding windows to predict energy consumption information for the next time period. The sliding window divides the original data into patches based on the time step, allowing the model to be trained on patches instead of the entire dataset. This process helps capture more fine-grained features in the time dimension.

[0003] Although traditional models can theoretically efficiently handle energy consumption prediction problems, these methods face many challenges in practical applications, especially in data privacy protection and heterogeneous data processing.

[0004] In the process of sharing data between different electricity suppliers and energy companies, protecting personal privacy becomes an important task. These energy consumption data may expose private information such as household occupancy, sleeping habits, and eating habits. In practical applications, researchers usually use Federated Learning (FL) to comply with privacy protection constraints, but this multi-terminal learning process often weakens the learning ability of the model. In addition, there are diverse electricity consumption behaviors between different devices and users, and the heterogeneity of data also continues to threaten the robustness of the model.

[0005] Therefore, reducing the constraints of data privacy protection on the learning ability of prediction models and improving the accuracy of models in capturing different inherent patterns and structures in raw data have become urgent issues to be solved. While protecting user privacy, balancing prediction accuracy and efficient computing is the focus of future research. Summary of the invention

[0006] The present invention aims to solve the problem of personal privacy protection in the prediction of residential energy consumption, and at the same time improve the prediction accuracy by using efficient feature extraction means, and reduce the negative impact of the terminal learning process on the model performance. To achieve the above purpose, the present invention provides a method, medium and device for predicting residential electricity consumption based on federated learning.

[0007] The method of the present invention ensures data privacy security by creating and training models locally and using a federated learning framework. Singular spectrum analysis is used to decompose time series and can capture trends and periodic changes in data; LSTM neural networks are used to process decomposed subsequences, further improving prediction accuracy. The federated learning framework optimizes the parameters of the distributed model through the FedAvg aggregation algorithm and ensures stable transmission of model parameters through a reliable TCP communication protocol.

[0008] In order to achieve the above-mentioned invention object, the present invention specifically adopts the following technical solutions:

[0009] In a first aspect, the present invention provides a method for predicting household residential electricity consumption based on federated learning, which comprises the following steps:

[0010] S1. Obtain an original data set of residential energy consumption, and perform data preprocessing on the original data set to obtain a preprocessed data set consisting of preprocessed time series data;

[0011] S2. Construct the preprocessed time series data into a trajectory matrix, and decompose the constructed trajectory matrix using the singular spectrum decomposition algorithm. Each preprocessed time series data corresponds to a plurality of decomposed subsequences, and each subsequence represents a specific component or attribute in the time series data.

[0012] S3, input the decomposed subsequences into the prediction model built based on the federated learning network framework for local training;

[0013] S4. When the local training completes an iteration, the prediction model parameters obtained by the iteration are uploaded to the central server through Socket communication.

[0014] S5. After receiving the prediction model parameters uploaded by multiple local nodes, the central server aggregates the received prediction model parameters using the FedAvg aggregation algorithm, and then sends the aggregated prediction model parameters to each local node through Socket communication;

[0015] S6. After each local node receives the aggregated prediction model parameters sent by the central server, the local node performs the next iteration round of training and updates the prediction model parameters using the aggregated prediction model parameters;

[0016] S7, continuously iterate the training until the prediction model converges to form a unified model that can be used for predicting residential energy consumption;

[0017] S8. Input the residential energy consumption data to be tested into the unified model, output the residential electricity consumption prediction result, and realize the residential electricity consumption prediction based on federated learning.

[0018] Based on the above scheme, each step can be implemented in the following preferred specific manner.

[0019] Preferably, in step S1, the data preprocessing of the original data set specifically includes data cleaning and normalization operations on the original data set.

[0020] Preferably, the specific process in step S2 is as follows:

[0021] S21. Construct the trajectory matrix H according to the following formula:

[0022]

[0023] s<ψ

[0024] m=ψ+s-1

[0025] Among them, ψ represents the total number of time-lag vectors obtained by segmentation; m represents the total number of data points in the original time series after data cleaning; s represents the width of the window; Y1,...,Y ψ Respectively represent the data normalization results of the 1st, ..., ψth time-delay vectors; y s ,y s+1 ,y ψ ,y ψ+1 ,y m They represent the sth, s+1, ψ, ψ+1, and mth data points in the original time series after data cleaning;

[0026] S22. Perform singular value decomposition on the trajectory matrix H:

[0027] H=U∑V T

[0028] Where U is the left singular vector matrix; ∑ is a diagonal matrix; V is the right singular vector matrix; T represents the matrix transpose;

[0029] S23. Represent the trajectory matrix as the sum of multiple matrices of rank 1:

[0030]

[0031] Where d is the number of positive singular values ​​of the trajectory matrix; denote the 1st, 2nd, ..., dth rank-1 matrices respectively, and each rank-1 matrix corresponds to a positive singular value of the trajectory matrix;

[0032] S24. According to the size of the singular values, all matrices with rank 1 are grouped non-overlappingly, and a reconstruction matrix corresponding to each group is generated from all matrices with rank 1 in each group, and the sum of the reconstruction matrices of all groups is the trajectory matrix;

[0033] S25. Taking the reconstruction matrix of each group as a unit, diagonally average each diagonal line in the reconstruction matrix of each group to obtain the average value of the diagonal line, traverse the diagonal lines in the reconstruction matrix of each group in order from the lower left corner to the upper right corner, and form a decomposed subsequence corresponding to the average value of the diagonal line.

[0034] As a preference, in S23, when the t-th singular value σ of the trajectory matrix t When greater than 0, the t-th rank 1 matrix By the tth singular value σ t and the corresponding left singular vector u t , right singular vector v t Together they constitute:

[0035]

[0036] Among them, u t is a left singular vector, corresponding to the tth column of the left singular vector matrix U; v t is a right singular vector, corresponding to the tth column of the right singular vector matrix V.

[0037] As a preference, in S24, all matrices of rank 1 are divided into 4 groups, and the reconstructed matrix H of the j∈{1,2,3,4}th group is j The specific form is as follows:

[0038]

[0039] in, They represent the 1st, 2nd, …, kth rank-1 matrices in the j∈{1,2,3,4}th group respectively.

[0040] Preferably, in step S3, the prediction model adopts a bidirectional long short-term memory neural network.

[0041] Preferably, in step S3, when the prediction model is trained locally, an adaptive momentum estimation optimization algorithm is used to update the prediction model parameters.

[0042] Preferably, the TCP protocol is used for parameter transmission when uploading the prediction model parameters of the local node to the central server and when the central server sends the aggregated prediction model parameters to each local node to ensure the reliability and sequentiality of data transmission.

[0043] In a second aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for predicting household residential electricity consumption based on federated learning as described in any of the schemes of the first aspect above is implemented.

[0044] In a third aspect, the present invention provides a computer electronic device comprising a memory and a processor;

[0045] The memory is used to store computer programs;

[0046] The processor is used to implement the method for predicting household residential electricity consumption based on federated learning as described in any of the schemes of the first aspect above when executing the computer program.

[0047] Compared with the prior art, the present invention has the following beneficial effects:

[0048] The present invention protects user privacy data by combining local calculation and global model optimization. In addition, by adding a singular spectrum decomposition algorithm to decompose the data, the prediction model can capture data trend characteristics from multiple dimensions, and perform parameter training based on the LSTM model, significantly improving the energy consumption prediction accuracy across multiple residential terminals. Experimental results show that the method of the present invention improves the three evaluation indicators of prediction accuracy (MAE, RMSE and MAPE) by 65.21%, 68.98% and 36.86% respectively. In addition, through continuous parameter optimization and model iteration, the present invention can also achieve rapid adaptation of the model in different application scenarios and enhance the generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 is a flow chart of the steps of the method of the present invention;

[0050] Figure 2 Flowchart for predicting electricity consumption for a traditional residential home;

[0051] Figure 3 It is the overall framework flow chart of the method of the present invention;

[0052] Figure 4 It is a schematic diagram of the singular value decomposition and prediction model structure of the present invention. DETAILED DESCRIPTION

[0053] In order to make the above-mentioned purpose, features and advantages of the present invention more obvious and easy to understand, the specific implementation mode of the present invention is described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. The technical features in each embodiment of the present invention can be combined accordingly without conflicting with each other.

[0054] In the description of the present invention, it should be understood that the terms "first" and "second" are only used for the purpose of distinguishing descriptions, and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features.

[0055] As the feasibility and competitiveness of renewable energy generation gradually increase, accurate energy consumption forecasting is essential to enhance the regulation capacity of the power system and optimize resource allocation, thereby supporting the transition to a sustainable low-carbon energy system. In this context, household electricity demand forecasting, as a key part of total electricity demand, plays a core role in balancing the power grid, achieving carbon emission peaks and carbon neutrality goals. However, the extremely high complexity, significant volatility, sudden changes and uncertainty of household electricity consumption patterns pose significant challenges to accurate forecasting.

[0056] like Figure 1 As shown, in a preferred implementation of the present invention, the above-mentioned method for predicting household residential electricity consumption based on federated learning includes the following steps S1 to S8 to solve the problem of personal privacy protection in household residential energy consumption prediction, while improving the prediction accuracy and reducing the negative impact of the terminal learning process on the model performance. The specific implementation process is described below.

[0057] S1. Obtain an original data set of residential energy consumption, and perform data preprocessing on the original data set to obtain a preprocessed data set consisting of preprocessed time series data.

[0058] It should be noted that in step S1 of the present invention, the original data set of public household residential energy consumption is obtained, and data cleaning and normalization operations are performed to complete data preprocessing. Among them, the data cleaning process includes outlier detection and missing data filling. In this embodiment, the normalization method used in the data preprocessing stage is minimum-maximum normalization, which is used to scale the numerical features to between 0 and 1. Normalization unifies the data magnitude, and the original data falls within a comparable scale range, thereby ensuring the stability of the prediction model. At the same time, normalizing the original data improves the convergence speed of the method of the present invention. In addition, the minimum-maximum normalization method has excellent performance in achieving more accurate predictions and better model generalization capabilities.

[0059] The specific method of normalization is as follows:

[0060]

[0061] Among them, Y i represents the data normalization result of the i-th time lag vector, that is, the preprocessed time series data; Represents the original time series Y after data cleaning time ={y1,y2,…,y m}The i∈[1,ψ]th time-delay vector obtained by segmentation, y1,y2,…,y m They represent the 1st, 2nd, …, mth data points in the original time series after data cleaning, and m represents the total number of data points; and They represent the maximum energy consumption and the minimum energy consumption in the original data after data cleaning.

[0062] S2. The preprocessed time series data is constructed into a trajectory matrix, and the constructed trajectory matrix is ​​decomposed using the singular spectrum decomposition algorithm. Each preprocessed time series data corresponds to multiple decomposed subsequences, and each subsequence represents a specific component or attribute in the time series data.

[0063] It should be noted that in step S2 of the present invention, signal decomposition is performed based on the singular spectrum decomposition algorithm. The preprocessed time series data is constructed into a trajectory matrix and input into a signal decomposition module based on the singular spectrum decomposition algorithm. Unlike traditional data decomposition methods, the singular spectrum decomposition algorithm (SSA) can effectively extract the main components, changing trends, seasonal patterns and periodic changes from the preprocessed time series data, significantly enhancing the prediction accuracy of the prediction model, and providing an enhanced solution for improving prediction accuracy while maintaining data privacy security and training efficiency. After processing, each preprocessed time series data is output by the signal decomposition module as four decomposed subsequences, each subsequence representing a specific component or attribute in the time series data, and these subsequences are subsequently used for training the prediction model.

[0064] Several key steps in step S2 are described in detail below.

[0065] 1) Trajectory matrix construction

[0066] S21. Construct the trajectory matrix H, also called the Henkel matrix, according to the following formula:

[0067]

[0068] Among them, ψ represents the total number of time-lag vectors obtained by segmentation; m represents the total number of data points in the original time series after data cleaning; s represents the width of the window; Y1,...,Y ψ Respectively represent the data normalization results of the 1st, ..., ψth time-delay vectors; y s ,y s+1 ,y ψ ,y ψ+1 ,y m They represent the s, s+1, ψ, ψ+1, and m data points in the original time series after data cleaning.

[0069] It should also be noted that ψ, m, and s need to satisfy the following conditions at the same time:

[0070]

[0071] s<ψ

[0072] m=ψ+s-1

[0073] 2) Singular Value Decomposition

[0074] S22. Perform singular value decomposition (SVD) on the trajectory matrix H to extract the key features of the data. SVD decomposes the trajectory matrix H into the product of three matrices:

[0075] H=U∑V T

[0076] Where U is the left singular vector matrix, represented by HH T The column vectors of the left singular vector matrix U are called left singular vectors; ∑ is a diagonal matrix containing the s singular values ​​σ1, σ2, ..., σ of the trajectory matrix H. s and arranged in descending order; V is the right singular vector matrix, composed of H T The eigenvectors of H constitute the column vectors of the right singular vector matrix V, and T represents the matrix transpose.

[0077] Take the tth singular value σ of the trajectory matrix t For example, the corresponding eigenvalue λ t The square root of Where t∈{1,2,…,s} represents the singular value index.

[0078] S23. Represent the trajectory matrix as the sum of multiple matrices of rank 1:

[0079]

[0080] Where d is the number of positive singular values ​​of the trajectory matrix; They represent the 1st, 2nd,…,dth rank-1 matrices respectively, and each rank-1 matrix corresponds to a positive singular value of the trajectory matrix.

[0081] Furthermore, in S23, when the t-th singular value σ of the trajectory matrix t When greater than 0, the t-th rank 1 matrix By the tth singular value σ t and the corresponding left singular vector u t , right singular vector v t Together they constitute:

[0082]

[0083] Among them, u t is a left singular vector, corresponding to the tth column of the left singular vector matrix U; v t is a right singular vector, corresponding to the tth column of the right singular vector matrix V.

[0084] 3) Sequence grouping

[0085] S24. According to the size of the singular values, all matrices with rank 1 are grouped non-overlappingly, and a reconstruction matrix corresponding to each group is generated from all the matrices with rank 1 in each group, and the sum of the reconstruction matrices of all groups is the trajectory matrix.

[0086] It should be noted that in step S24 of the present invention, considering the analysis requirements, it is necessary to transform the matrix with rank 1 in the previous step into Divide into several groups so that the matrices in each group are different. Here, the purpose of grouping is to distinguish different types of components (such as trend, seasonality, noise, etc.) to facilitate the reconstruction of specific components.

[0087] In this embodiment, the matrix with rank 1 is Divided into 4 groups, the reconstruction matrix of the j∈{1,2,3,4}th group The specific form is as follows:

[0088]

[0089] in, They represent the 1st, 2nd, …, kth rank-1 matrices in the j∈{1,2,3,4}th group respectively.

[0090] Therefore, the trajectory matrix can also be written as follows:

[0091] H=H1+H2+H3+H4

[0092] 4) Refactoring

[0093] S25. Taking the reconstruction matrix of each group as a unit, diagonally average each diagonal line in the reconstruction matrix of each group to obtain the average value of the diagonal line, traverse the diagonal lines in the reconstruction matrix of each group in order from the lower left corner to the upper right corner, and form a decomposed subsequence corresponding to the average value of the diagonal line.

[0094] It should be noted that in step S25 of the present invention, the reconstruction matrix H obtained in the previous step is j Perform diagonal averaging and reconstruct the matrix H j Each diagonal element of corresponds to a reconstruction element. For the reconstruction matrix H j The qth diagonal line in the equation is averaged to get the average value of the qth diagonal line. Finally, the reconstructed matrix H j The average of all diagonals in forms a decomposed subsequence They represent the 1st, 2nd, …, mth elements in the decomposed subsequence respectively.

[0095] Furthermore, by repeating the above process, the corresponding decomposed subsequence can be obtained for the reconstructed matrix of each group.

[0096] S3. Input the decomposed subsequences into the prediction model built based on the federated learning network framework for local training.

[0097] It should be noted that in step S3 of the present invention, after completing the signal decomposition, the decomposed subsequences are then input into the prediction model for training and processing the decomposed subsequences to capture the long-term dependency features (relationships) in the time series data.

[0098] In this embodiment, energy consumption data is inherently variable and uncertain, which makes it challenging to model these nonlinear and complex relationships. In order to simultaneously capture both forward and backward long-term dependencies in the past time domain, the method of the present invention uses a bidirectional long short-term memory neural network (BiLSTM) to learn the hidden irregularities in time series data.

[0099] The structure of BiLSTM is as follows Figure 2 As shown, it contains a forward layer and a backward layer, which output the hidden state h at time t. t and h′ t , the two combine to form the hidden state of the final output to the forward layer at time t That is, bidirectional hidden state splicing.

[0100] Taking the forward layer as an example, the core components of BiLSTM are three gate units implemented by the Sigmoid activation function: the forget gate f t , input gate i t and the output gate O of the forward layer t The Sigmoid activation function ensures that the output of each gate is between 0 and 1, where 0 means ignoring information and 1 means accepting information. Specifically, the forget gate f t Used to decide whether to forget the unit state C at time t-1 in the previous layer t-1 ; Input gate i t For the input x at time t t and the hidden state h output to the previous layer at time t-1 t-1 The proportion of new information provided, updating the unit state C at time t in the forward layer t ; Output gate 0 t According to the unit state C of the forward layer at time t t Determine the hidden state h output to the front layer at time t t .

[0101] In BiLSTM, in order to distinguish the state variables of the forward layer and the backward layer, the symbol of the backward layer is represented by a prime (′), which is specifically defined as follows:

[0102] i t =σ(W i ·[h t-1 , x t ]+b i )

[0103] f t =σ(W f ·[h t-1 , x t ]+b f )

[0104] O t =σ(W o ·[h t-1 , x t ]+b o )

[0105] C t =f t ⊙C t-1 +i t ⊙C′ t

[0106] C′ t =tanh(W c ·[h t-1 , x t ]+b c )

[0107] h t =O t ⊙tanh(C t )

[0108] h′ t =O′ t ⊙tanh(C′ t )

[0109] Among them, f t represents the forget gate; i t represents the input gate; O t represents the output gate; σ represents the sigmoid activation function; W f , W i , W o , W c Both represent weight coefficients; b f 、b i 、b o 、b c All represent bias values; x t represents the input at time t; [h t-1 , x t ] means h t-1 and x t Series calculation of h t-1 represents the hidden state output to the previous layer at time t-1; C t represents the unit state at the forward layer at time t; C t-1 Represents the unit state at the forward layer t-1 time; C′ trepresents the unit state at the backward layer at time t; tanh represents the hyperbolic tangent activation function; h t represents the hidden state output to the front layer at time t; h′ t represents the hidden state output to the back layer at time t; ⊙ represents the Hadamard product; O t Represents the output gate of the forward layer; O′ t Represents the output gate of the backward layer.

[0110] It should be noted that in step S3 of the present invention, due to the need for multi-terminal interactive training, the prediction model uses an adaptive momentum estimation (Adam) optimization algorithm to update the prediction model parameters when it is trained locally, and the learning rate is adjusted dynamically based on the gradient to accelerate the convergence speed of the prediction model, rather than stochastic gradient descent (SGD). Adam dynamically adjusts the learning rate of each parameter based on the average value of past gradients and the average value of past square gradients. By tracking the first-order momentum and second-order momentum of the gradient, Adam shows better performance in the ECF task and accelerates the convergence speed.

[0111] S4. After the local training completes an iteration, the prediction model parameters obtained from the iteration are uploaded to the central server through Socket communication.

[0112] It should be noted that in step S4 of the present invention, after all four subsequences are trained, each local client (node) establishes a connection with the central server via Socket communication and sends the prediction model parameters obtained through local training to the central server.

[0113] S5. After the central server receives the prediction model parameters uploaded by multiple local nodes, it aggregates the received prediction model parameters using the FedAvg aggregation algorithm, and then the central server sends the aggregated prediction model parameters to each local node through Socket communication.

[0114] It should be noted that in step S5 of the present invention, after receiving the prediction model parameters sent by all local nodes, the central server aggregates these prediction model parameters, and then the central server sends the aggregated prediction model parameters to each local node through Socket communication.

[0115] S6. After each local node receives the aggregated prediction model parameters sent by the central server, the local node performs the next iteration round of training and updates the prediction model parameters using the aggregated prediction model parameters.

[0116] It should be noted that in step S6 of the present invention, the central server sends the aggregated prediction model parameters to each local node, and each local node receives the aggregated prediction model parameters and uses the aggregated prediction model parameters to update the prediction model parameters.

[0117] It should be noted that the TCP protocol is used for parameter transmission when uploading the prediction model parameters of the local node to the central server and the central server sends the aggregated prediction model parameters to each local node to ensure the reliability and sequentiality of data transmission.

[0118] S7. Continuously iterate the training until the prediction model converges to form a unified model that can be used to predict residential energy consumption.

[0119] It should be noted that in step S7 of the present invention, steps S4-S6 are continuously repeated to perform local training, parameter transmission and updating until the prediction model converges and the training is completed, forming a unified model that can be used for household residential energy consumption prediction.

[0120] S8. Input the residential energy consumption data to be tested into the unified model, output the residential electricity consumption prediction result, and realize the residential electricity consumption prediction based on federated learning.

[0121] In general, the present invention uses a decentralized approach to model training, which protects the privacy of sensitive data and reduces communication costs. In addition, in order to address the problem of limited prediction capabilities caused by multi-terminal learning, the present invention designs a feature extractor based on the singular spectrum decomposition algorithm to identify hidden trends, fluctuations, and noise components in the original data. By combining a bidirectional long short-term memory neural network, the prediction can capture forward and backward dependencies, thereby achieving efficient and accurate ECF prediction.

[0122] The present invention will now use a specific example to demonstrate the application effect of the household residential electricity consumption prediction method based on federated learning described in the above embodiments S1 to S8 on a specific data set, so as to facilitate understanding of the essence of the present invention.

[0123] Example

[0124] The specific implementation process of the method for predicting household residential electricity consumption based on federated learning adopted in this embodiment is as described above and will not be repeated here.

[0125] This embodiment uses an actual energy consumption dataset called UK-Dale for verification. This widely used dataset records the energy consumption information of five households in the UK from November 9, 2012 to April 26, 2017, with a time resolution of six seconds. The original dataset contains multiple entries, which are then converted into a dataset with a time interval of five minutes. In addition, as part of urban energy use, household energy consumption data is not affected by factors such as industry, commerce or public infrastructure, so there is no need to consider many influencing variables, and a univariate dataset can be used. For each household, 10,000 samples were selected and divided into a training set (70%), a validation set (10%), and a test set (20%).

[0126] This example was performed on a desktop workstation equipped with an AMD Ryzen 9 5900HX CPU and an NVIDIA GeForce RTX 3080 GPU. The workstation runs the Windows 11 operating system and is implemented using the Python 3.8.18 programming language. The deep learning model was developed using the Pytorch 1.7.1 framework. Socket is used to establish communication between the local host and the central server. The results of the example were visualized using Matplotlib 3.3.1 and Microsoft Visio Professional 2021.

[0127] Details of the parameters used in this example: The sliding time window is set to 10, and the epoch and learning rate are set to 16 and 0.05 respectively. The mean square error (MSE) is used as the loss function to measure the difference between the true value and the predicted value, aiming to minimize the error when training the prediction model.

[0128] The method FLSL of the present invention and other multiple energy consumption prediction models were experimented on the same data set. The experimental results are shown in Tables 1-3. The prediction results of the household energy consumption information by the method of the present invention are significantly better than the existing comparison models. Under different energy consumption scenarios, the three evaluation indicators are improved by an average of 65.21%, 68.98% and 36.86%.

[0129] Table 1. Comparison of MAE performance of different residential energy consumption prediction models

[0130]

[0131]

[0132] Table 2. RMSE performance comparison of different residential energy consumption prediction models

[0133] RMSE Family 1 Family 2 Family 3 Family 4 Family 5 DT 0.032054 0.032988 0.044715 0.032129 0.034265 RF 0.022610 0.024256 0.031787 0.023034 0.025602 SVR 0.023081 0.024994 0.032343 0.021890 0.029499 MLP 0.022753 0.025758 0.031354 0.022829 0.028130 GRU 0.042769 0.023344 0.032209 0.021614 0.025518 LSTM 0.022611 0.023263 0.032336 0.021465 0.02462 SLTSM 0.043437 0.023397 0.032138 0.021538 0.024225 BiLSTM 0.042738 0.023042 0.031716 0.02136 0.023591 EMD_LSTM 0.034121 0.017329 0.024039 0.016218 0.019368 EWT_BiLSTM 0.044198 0.023269 0.030170 0.021955 0.024892 Fed_LSTM 0.023828 0.025773 0.036922 0.023355 0.024142 Fed_BiLSTM 0.023696 0.025626 0.035545 0.022758 0.023041 FLSL 0.005034 0.00876 0.0096 0.008726 0.007905

[0134] Table 3. Comparison of MAPE performance of different residential energy consumption prediction models

[0135]

[0136]

[0137] As can be seen from Tables 1-3, the method of the present invention performs very well in predicting household energy consumption information. The federated learning strategy aims to achieve privacy protection and training efficiency through local training data. The method of the present invention uses singular value decomposition to extract trends, fluctuations, and noise to enhance its learning and prediction capabilities. Bidirectional long-term and short-term feature extraction is used to adapt to interactive training in federated learning. Therefore, the method of the present invention achieves faster and more accurate predictions in multi-family predictions than other state-of-the-art models.

[0138] In addition, the prediction results also show that the prediction trend is often slightly higher than the actual value, which not only ensures sufficient power supply, but also minimizes resource waste, thereby improving overall cost efficiency. In addition, the method of the present invention not only has a strong overall fitting ability, but also has an accurate fitting ability during peak hours, and can actively adjust the power supply strategy to ensure the stability of power supply.

[0139] It is understandable that the household residential electricity consumption prediction method based on federated learning described in S1 to S8 above can be implemented by computer programs. Therefore, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer electronic device corresponding to the household residential electricity consumption prediction method based on federated learning provided in the above embodiment, which includes a memory and a processor;

[0140] The memory is used to store computer programs;

[0141] The processor is used to implement the household residential electricity consumption prediction method based on federated learning in the above embodiment when executing the computer program.

[0142] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.

[0143] Therefore, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer-readable storage medium corresponding to the method for predicting household residential electricity consumption based on federated learning provided in the above embodiment, and a computer program is stored on the storage medium. When the computer program is executed by the processor, it can implement the method for predicting household residential electricity consumption based on federated learning in the above embodiment.

[0144] It is understandable that the above storage medium may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. The storage medium may also be a U disk, a mobile hard disk, a magnetic disk or an optical disk, etc., which can store program codes.

[0145] It is understandable that the above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0146] The above-described embodiment is only a preferred solution of the present invention, but it is not intended to limit the present invention. A person skilled in the relevant technical field may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, any technical solution obtained by equivalent replacement or equivalent transformation falls within the protection scope of the present invention.

Claims

1. A method for predicting household electricity consumption based on federated learning, characterized in that: The following steps are involved: S1. Obtain an original data set of residential energy consumption, and perform data preprocessing on the original data set to obtain a preprocessed data set consisting of preprocessed time series data; S2, constructing the preprocessed time series data into a trajectory matrix, and decomposing the constructed trajectory matrix using the singular spectrum decomposition algorithm, each preprocessed time series data corresponds to a plurality of decomposed subsequences, each subsequence represents a specific component or attribute in the time series data; S3, input the decomposed subsequences into the prediction model built based on the federated learning network framework for local training; S4. When the local training completes an iteration, the prediction model parameters obtained by the iteration are uploaded to the central server through Socket communication. S5. After receiving the prediction model parameters uploaded by multiple local nodes, the central server aggregates the received prediction model parameters using the FedAvg aggregation algorithm, and then sends the aggregated prediction model parameters to each local node through Socket communication; S6. After each local node receives the aggregated prediction model parameters sent by the central server, the local node performs the next iteration round of training and updates the prediction model parameters using the aggregated prediction model parameters; S7, continuously iterate the training until the prediction model converges to form a unified model that can be used for predicting residential energy consumption; S8. Input the residential energy consumption data to be tested into the unified model, output the residential electricity consumption prediction result, and realize the residential electricity consumption prediction based on federated learning.

2. A method for predicting household residential electricity consumption based on federated learning as claimed in claim 1, characterized in that: In step S1, data preprocessing is performed on the original data set, specifically, data cleaning and normalization operations are performed on the original data set.

3. A method for predicting household electricity consumption based on federated learning as claimed in claim 1, characterized in that: The specific process in step S2 is as follows: S21. Construct the trajectory matrix H according to the following formula: s<ψ m=ψ+s-1 Among them, ψ represents the total number of time-lag vectors obtained by segmentation; m represents the total number of data points in the original time series after data cleaning; s represents the width of the window; Y1,...,Y ψ Respectively represent the data normalization results of the 1st, ..., ψth time-delay vectors; y s ,y s+1 ,y ψ ,y ψ+1 ,y m They represent the sth, s+1, ψ, ψ+1, and mth data points in the original time series after data cleaning; S22. Perform singular value decomposition on the trajectory matrix H: H=U∑V T Where U is the left singular vector matrix; ∑ is a diagonal matrix; V is the right singular vector matrix; T represents the matrix transpose; S23. Represent the trajectory matrix as the sum of multiple matrices of rank 1: Where d is the number of positive singular values ​​of the trajectory matrix; denote the 1st, 2nd, ..., dth rank-1 matrices respectively, and each rank-1 matrix corresponds to a positive singular value of the trajectory matrix; S24. According to the size of the singular values, all matrices with rank 1 are grouped non-overlappingly, and a reconstruction matrix corresponding to each group is generated from all matrices with rank 1 in each group, and the sum of the reconstruction matrices of all groups is the trajectory matrix; S25. Taking the reconstruction matrix of each group as a unit, diagonally average each diagonal line in the reconstruction matrix of each group to obtain the average value of the diagonal line, traverse the diagonal lines in the reconstruction matrix of each group in order from the lower left corner to the upper right corner, and form a decomposed subsequence corresponding to the average value of the diagonal line.

4. A method for predicting household electricity consumption based on federated learning as claimed in claim 3, characterized in that: In S23, when the tth singular value σ of the trajectory matrix t When greater than 0, the t-th rank 1 matrix By the tth singular value σ t and the corresponding left singular vector u t , right singular vector v t Together they constitute: Among them, u t is a left singular vector, corresponding to the tth column of the left singular vector matrix U; v t is a right singular vector, corresponding to the tth column of the right singular vector matrix V.

5. A method for predicting household electricity consumption based on federated learning as claimed in claim 3, characterized in that: In S24, all matrices with rank 1 are divided into 4 groups, and the reconstruction matrix H of the j∈{1,2,3,4}th group is j The specific form is as follows: k∈{1,2,…,d} in, They represent the 1st, 2nd, …, kth rank-1 matrices in the j∈{1,2,3,4}th group respectively.

6. A method for predicting household electricity consumption based on federated learning as claimed in claim 1, characterized in that: In step S3, the prediction model adopts a bidirectional long short-term memory neural network.

7. A method for predicting household electricity consumption based on federated learning as claimed in claim 1, characterized in that: In step S3, when the prediction model is trained locally, an adaptive momentum estimation optimization algorithm is used to update the prediction model parameters.

8. A method for predicting household electricity consumption based on federated learning as claimed in claim 1, characterized in that: The TCP protocol is used to transmit the prediction model parameters of the local node to the central server and the central server sends the aggregated prediction model parameters to each local node to ensure the reliability and sequence of data transmission.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the method for predicting household residential electricity consumption based on federated learning as described in any one of claims 1 to 8 is implemented.

10. A computer electronic device, characterized in that: including memory and processor; The memory is used to store computer programs; The processor is used to implement the method for predicting household residential electricity consumption based on federated learning as described in any one of claims 1 to 8 when executing the computer program.

Citation Information

Patent Citations

  • Wind speed prediction method and related device

    CN108960511A

  • Medium-term electric quantity prediction method based on sequence component decomposition and neural network

    CN110298475A

  • Federal learning-based model training method and device, and federal learning system

    CN112862011A

  • Short-term wind power generation power prediction method

    CN115169742A

  • Residential energy consumption prediction method for protecting data privacy of residents

    CN115759387A