Federal learning-based residential energy consumption short-term prediction method and system

Through the LSTM prediction model based on federated learning, combined with SSA and FedAvg algorithms, data integration and privacy protection problems in short-term residential energy consumption prediction are solved, and high-precision and privacy protection energy consumption prediction are achieved, improving the operating efficiency and scalability of the system.

CN120430652APending Publication Date: 2025-08-05XI'AN UNIVERSITY OF ARCHITECTURE AND TECHNOLOGY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510523336.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

Existing short-term residential energy consumption prediction methods pose many challenges in dealing with abnormal situations, capturing complex energy consumption patterns, avoiding overfitting and high computing costs, and integrating multi-source data, and it is difficult to achieve high-precision prediction while protecting privacy.

Method used

Using a federated learning-based method, the hyperparameters are optimized using LSTM prediction algorithm and SSA algorithm, and parameter fusion is combined with FedAvg algorithm to build a training data set through reasonable data sharing strategies to realize load data integration and model training of multiple residences, and protect privacy information.

Benefits of technology

It realizes that without sharing original data, it improves prediction accuracy and model generalization performance, protects private information, reduces computing costs, and improves the operating efficiency and scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120430652A_ABST
    Figure CN120430652A_ABST
Patent Text Reader

Abstract

The invention provides a residential energy consumption short-term prediction method and system based on federated learning, a federated learning model is applied to the field of residential energy consumption prediction, and the method comprises the following specific steps: obtaining load data of each residence; transmitting the load data of each residence to a residence energy consumption short-term prediction model based on federated learning, and predicting to obtain a short-term energy consumption condition of the corresponding residence; wherein the residence energy consumption short-term prediction model based on federated learning comprises a federated learning framework formed by a residence central prediction model and n residence prediction models, the residence central prediction model and the n residence prediction models all adopt an LSTM prediction algorithm, and hyper-parameters of the LSTM prediction algorithm are obtained through an SSA algorithm. According to the method, more reliable data support and theoretical support are provided for high-precision prediction of residential building energy consumption, and the method has important practical application value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of short-term prediction of residential energy consumption, and specifically relates to a method and system for short-term prediction of residential energy consumption based on federated learning. Background Art

[0002] Currently, buildings consume over 40% of the world's electricity and produce over 30% of global CO2 emissions, exacerbating global power shortages and environmental degradation. Therefore, improving the predictability of residential energy consumption is essential. There are three main approaches to predicting residential energy consumption: physical modeling, statistical analysis, and modern artificial intelligence models.

[0003] Initially, researchers primarily relied on physical modeling—using thermodynamic equations and empirical formulas to model building components, subsystems, and systems to predict the behavior of the entire building and its subsystems. However, obtaining detailed building and environmental information is difficult, making physical modeling cumbersome and difficult to understand. Furthermore, physical models often struggle to handle unusual conditions, and overly simplistic models may fail to capture complex energy consumption patterns.

[0004] With the development of statistics and computer technology, statistical analysis methods have gradually become an important means of forecasting building energy consumption. These methods can capture trends in data and deal with multiple influencing factors, which helps with classification and strategy formulation. However, since the relationship between building energy consumption data and other characteristic values is nonlinear and complex, the use of statistical analysis methods may affect the results and depend on the assumptions and initial conditions of the model. At the same time, statistical analysis methods often perform poorly when faced with problems such as non-independent and identically distributed data or partial missing data, and overly complex models may lead to overfitting and high computational costs. Therefore, statistical analysis methods generally do not appear alone and need to be combined with methods such as regularization and feature selection.

[0005] With the development of big data and artificial intelligence technologies, data-driven approaches have shown greater potential. Artificial intelligence models using traditional machine learning and deep learning techniques can automatically extract features from large amounts of historical data and establish complex nonlinear relationships. However, these models often fail to accurately predict large datasets, and parameter tuning (such as kernel functions and regularization parameters) is complex and sensitive to initial values and outliers. Furthermore, existing short-term residential energy consumption prediction models face challenges integrating data from diverse sources, as these data sources may have different formats and timescales, complicating data preprocessing and subsequent prediction. To address this issue, swarm intelligence optimization algorithms have been widely used to optimize the hyperparameters of LSTM models. However, since these algorithms only optimize the hyperparameters of the neural network model and cannot modify its internal parameters, they are unable to improve its performance and generalization when faced with non-IID data or partial data missingness. Therefore, they need to be combined with other algorithmic frameworks to improve the model's performance.

[0006] In summary, existing short-term residential energy consumption forecasting methods still face many challenges in handling abnormal situations, capturing complex energy consumption patterns, avoiding overfitting and high computational costs, and integrating multi-source data. Therefore, it is particularly important to develop a short-term residential energy consumption forecasting model that can comprehensively consider these factors and improve prediction accuracy and generalization performance. Summary of the Invention

[0007] The present invention provides a short-term residential energy consumption prediction method based on federated learning, and applies the federated learning model to the field of residential energy consumption prediction to solve the problems of existing short-term residential energy consumption prediction models, such as imperfect handling of abnormal situations, overly simple models that may not capture complex energy consumption patterns, overly complex models that cause overfitting and high computational costs, and the need to integrate data from different sources, which may have different formats and time strengths, increasing the difficulty of data preprocessing and subsequent prediction.

[0008] To achieve the above objectives, the present invention provides the following technical solution: a method for short-term residential energy consumption prediction based on federated learning, which includes the following specific steps:

[0009] Obtain load data for each residence;

[0010] The load data of each residence is transmitted to the short-term residential energy consumption prediction model based on federated learning to predict the short-term energy consumption of the corresponding residence;

[0011] Among them, the short-term residential energy consumption prediction model based on federated learning includes a federated learning framework composed of a residential central prediction model and n residential prediction models. The residential central prediction model and the n residential prediction models both adopt the LSTM prediction algorithm, and the hyperparameters of the LSTM prediction algorithm are obtained through the SSA algorithm.

[0012] Furthermore, the acquired load data of each residence is transmitted to the residential central prediction model, and the optimal hyperparameters of the LSTM prediction algorithm are obtained through the SSA algorithm to establish the initial global model;

[0013] Obtain the load data of each residence and construct a training dataset for the n-residence prediction model based on the data sharing strategy;

[0014] The initial global model is used as the local model of the residential prediction model, and the training data sets of n residential prediction models are used to train the local models respectively to obtain n residential prediction models.

[0015] Furthermore, the initial global model is described as follows:

[0016]

[0017] Where K represents the total number of participants; n k represents the amount of data of the kth party; B k represents local batch data; L represents the loss function.

[0018] Furthermore, in the step of obtaining the load data of each residence and constructing a training data set for the n-residence prediction model based on a data sharing strategy, the data sharing strategy is specifically as follows:

[0019] The sum of the load data for n houses is expressed as: Among them, m k represents the data volume of the kth residence, β is the ratio of the sum of the load data of n residences to the sum of the load data of a single residence;

[0020] The data that can be shared in the total load data of n residences is expressed as α·D, where α is the proportion of data that can be shared in the total load data of n residences.

[0021] Furthermore, the initial global model is used as the local model of the residential prediction model, and the training data sets of n residential prediction models are used to train the local models respectively to obtain n residential prediction models:

[0022] The updated model parameters are transmitted to the residential central prediction model, which uses the FedAvg algorithm to perform parameter fusion to obtain the global model parameters.

[0023] n residential prediction models are trained using global model parameters;

[0024] Repeat the above steps until n different residential prediction models that meet the requirements are obtained.

[0025] The present invention also provides a short-term residential energy consumption prediction system based on federated learning, comprising:

[0026] A data acquisition module is used to obtain load data of each residence;

[0027] The short-term energy consumption prediction module is used to transmit the load data of each residence to the short-term residential energy consumption prediction model based on federated learning to predict the short-term energy consumption of the corresponding residence;

[0028] Among them, the short-term residential energy consumption prediction model based on federated learning includes a federated learning framework composed of a residential central prediction model and n residential prediction models. The residential central prediction model and the n residential prediction models both adopt the LSTM prediction algorithm, and the hyperparameters of the LSTM prediction algorithm are obtained through the SSA algorithm.

[0029] Furthermore, the n residential prediction model training is specifically as follows:

[0030] Obtain the load data of each residence and construct a training dataset for the n-residence prediction model based on the data sharing strategy;

[0031] The initial global model is used as the local model of the residential prediction model. The training data sets of n residential prediction models are used to train the local models respectively. The updated model parameters are transferred to the residential central prediction model. The residential central prediction model uses the FedAvg algorithm to perform parameter fusion to obtain the global model parameters.

[0032] n residential prediction models are trained using global model parameters;

[0033] Repeat the above steps until n different residential prediction models that meet the requirements are obtained;

[0034] The data sharing strategy is as follows:

[0035] The sum of the load data for n houses is expressed as: , where m k represents the data volume of the kth residence, β is the ratio of the sum of the load data of n residences to the sum of the load data of a single residence;

[0036] The data that can be shared in the total load data of n residences is expressed as α·D, where α is the proportion of data that can be shared in the total load data of n residences.

[0037] The present invention also provides a terminal device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, the steps of the above-mentioned method for short-term residential energy consumption prediction based on federated learning are implemented.

[0038] The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the above-mentioned method for short-term residential energy consumption prediction based on federated learning.

[0039] The present invention also provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for short-term prediction of residential energy consumption based on federated learning.

[0040] Compared with the prior art, the present invention has at least the following beneficial effects:

[0041] This paper provides a short-term residential energy consumption forecasting method based on federated learning. By integrating load data from multiple residences, model training is performed without sharing the original data, effectively protecting the privacy of each residence. The model uses the LSTM prediction algorithm and the sparrow search algorithm (SSA) to search for hyperparameters of the LSTM prediction algorithm, significantly improving prediction accuracy and model performance.

[0042] First, as a special type of recurrent neural network, LSTM networks are capable of capturing long-term dependencies in time series data. For data with distinct temporal characteristics, such as residential energy consumption, LSTM networks can more accurately model and predict it. However, the performance of LSTM networks depends heavily on the settings of their hyperparameters, such as the learning rate, number of iterations, and number of hidden layers. Traditional hyperparameter optimization methods are often time-consuming and ineffective.

[0043] This paper introduces the Sparrow Search Algorithm (SSA) to optimize the hyperparameters of the LSTM network. SSA is an optimization algorithm based on swarm intelligence that searches for the optimal solution by simulating the foraging behavior of sparrows. Compared to other optimization algorithms, SSA has stronger global search capabilities and faster convergence speed. The LSTM network optimized by SSA can find the optimal hyperparameter combination in a shorter time, thereby improving the model's prediction accuracy and training efficiency.

[0044] Furthermore, the federated learning framework enables the model to fully utilize load data from multiple residences for training, eliminating the need to centrally store the data. This not only protects the privacy of each residence but also enables the model to learn richer data features, improving its generalization performance. Therefore, the proposed federated learning-based short-term residential energy consumption prediction model, through the LSTM optimization algorithm, achieves the advantages of high prediction accuracy, good privacy protection, and strong generalization performance.

[0045] The present invention adopts a data sharing strategy to construct a training dataset for the n-residential prediction model. This method not only fully utilizes the load data of each residential building, but also improves data utilization and model training results through a reasonable sharing mechanism.

[0046] Specifically, the present invention first calculates the sum of load data for n residences and uses a proportionality factor β to express the ratio of this sum to the sum of load data for each residence. This proportionality factor β reflects the relative size of the data for each residence and provides a basis for subsequent data sharing.

[0047] The present invention then defines a shared data ratio, α, which represents the proportion of data that can be shared within the total load data of n residences. By adjusting the value of α, the amount of shared data can be controlled, thereby fully utilizing the shared data to improve model training while protecting the privacy of each residence.

[0048] Based on the aforementioned data sharing strategy, the present invention constructs a training dataset for each residential prediction model. These training datasets not only contain the local data for each residential unit but also incorporate partial data from other residential units based on the sharing strategy. This dataset construction approach enables each residential prediction model to learn richer data features, improving the model's prediction accuracy and generalization performance.

[0049] Furthermore, through a rational data sharing strategy, this invention addresses the problem of low prediction accuracy when data is partially missing or when the training and test sets are not independently and identically distributed. Because shared data can compensate for the shortcomings of individual residential data, the model can access more comprehensive data features during training, thereby improving model robustness and prediction accuracy.

[0050] The present invention uses the FedAvg algorithm for parameter fusion during the training of n residential prediction models. The FedAvg algorithm is a parameter aggregation method commonly used in federated learning. It fuses the parameters of each local model into a global model parameter through weighted averaging.

[0051] Specifically, in each training round, each residential prediction model is first trained using local data to obtain updated model parameters. These updated model parameters are then uploaded to the residential central prediction model. The residential central prediction model uses the FedAvg algorithm to perform a weighted average of these parameters to obtain the global model parameters. Finally, the global model parameters are distributed back to each residential prediction model for use in the next round of training.

[0052] The advantage of the FedAvg algorithm is that it can fully utilize the learning results of each local model and obtain a more optimized global model through weighted averaging. At the same time, because the FedAvg algorithm only transmits model parameters and not the original data, it can effectively protect the privacy information of each residence.

[0053] In this paper, by using the FedAvg algorithm for parameter fusion over multiple iterations, each residential prediction model can gradually learn global data characteristics, improving the model's prediction accuracy and generalization performance. Furthermore, the simplicity and efficiency of the FedAvg algorithm make the method of this invention more feasible and efficient in practical applications.

[0054] In summary, the present invention achieves the advantages of high prediction accuracy, good privacy protection, stable operation, and strong generalization performance through a federated learning-based short-term residential energy consumption prediction model, reasonable training dataset construction, and effective use of the FedAvg algorithm.

[0055] The residential energy consumption short-term prediction system based on federated learning provided by the present invention integrates multiple functional modules such as data acquisition and short-term energy consumption prediction, realizing accurate prediction and efficient management of residential energy consumption.

[0056] First, the system's data acquisition module enables real-time and accurate acquisition of residential load data. This data forms the foundation of the prediction model, and its accuracy and real-time performance directly impact the reliability of the forecast results. Therefore, the efficient operation of the data acquisition module provides solid data support for the entire system.

[0057] Secondly, the short-term energy consumption forecasting module is the core component of the system. It utilizes a federated learning-based residential short-term energy consumption forecasting model. By integrating load data from multiple residences for training, it achieves accurate forecasts without sharing the original data. This forecasting approach not only protects the privacy of each residence but also improves the model's generalization performance and prediction accuracy. Furthermore, the use of the LSTM optimization algorithm and the FedAvg algorithm enables the forecasting model to converge to the optimal solution more quickly during training, improving system efficiency.

[0058] Furthermore, the system is highly scalable and flexible. As the number of residences increases or the amount of data changes, the system can automatically adjust model parameters and training strategies to adapt to the new data environment. This adaptive capability makes the system more flexible and reliable in practical applications.

[0059] In summary, the federated learning-based short-term residential energy consumption prediction system provided by the present invention achieves accurate prediction and efficient management of residential energy consumption by integrating multiple functional modules and adopting advanced prediction algorithms and optimization strategies. It is highly practical, scalable, and flexible. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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 paying any creative work.

[0061] Figure 1 It is a flowchart of the method of the present invention;

[0062] Figure 2 It is the structural diagram of the SSA mechanism model;

[0063] Figure 3 A diagram of the basic horizontal federated learning used in this invention;

[0064] Figure 4 This is the LSTM neural network structure diagram;

[0065] Figure 5 Flowchart of the loss-based adaptive boosting federated learning algorithm;

[0066] Figures 6-8 1 is a comparison chart of the predicted values and true values of several control group models in the examples. DETAILED DESCRIPTION

[0067] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0068] The present invention provides a short-term prediction method for residential energy consumption based on federated learning. The main idea of the method is to use the quartile method to select outliers and replace them with sample means, perform the Min-Max scaling method, and use the sparrow search algorithm to optimize the central server hyperparameters (such as the number of iterations, learning rate, packet loss rate, etc.). After the optimization is completed, the central server obtains the optimal hyperparameters and distributes the hyperparameters to each local server. The central server distributes model parameters to the local servers. The local servers use their respective data sets to train the models and obtain their respective model parameters, which are then uploaded to the central server for model aggregation. The above steps are repeated many times and after reaching the maximum number of iterations, the optimal global model parameters are obtained and verified using a test set.

[0069] See also Figure 1 The present invention provides a short-term residential energy consumption prediction method based on federated learning. Based on available data from multiple houses, a LoAdaBoost-SSA-LSTM prediction model is established to solve the problem of partial data missing or non-independent and identically distributed training and test sets and to improve the generalization ability of the model. The prediction model of the present invention is implemented by the following technical solutions: a short-term residential energy consumption prediction method based on improved federated learning. The method is based on the LoAdaBoost horizontal federated learning framework and the SSA-LSTM neural network model to achieve short-term residential energy consumption prediction under data privacy security, wherein, as Figure 3 As shown, the data and model parameters are placed in the local server of each end user and the central power grid server to which the residence belongs, respectively. Before the entire federated learning framework starts running, the complete data of a household is first placed in the SSA-LSTM model to obtain the optimal model hyperparameters. After that, the central server delegates the model hyperparameters and parameters to each local server, so that the local server can obtain predicted data faster and more accurately; the improved LoAdaBoost horizontal federated learning algorithm is used in the central server to aggregate the model parameters uploaded by all local servers and perform weighted processing. At the same time, the LoAdaBoost horizontal federated learning algorithm used in the present invention adds a retraining mechanism and shares a small part of the data set with the local server compared to the ordinary federated learning algorithm, thereby ensuring decentralization and improving model accuracy, while achieving accurate short-term prediction of residential energy consumption without compromising user data privacy.

[0070] Furthermore, the short-term residential energy consumption prediction method based on improved federated learning includes the following steps:

[0071] S1. Collect and pre-process the original data, and classify the original data set according to the characteristics of cooling load data of large public buildings;

[0072] Preprocess the existing data set, including missing and abnormal data processing and data normalization:

[0073] Missing and abnormal data processing: Outliers are processed by using the quartile method to select them and process them into the average of the entire data set to reduce errors. Missing values are also processed by using the average of the valid surrounding values of the current value to fill the missing value. The span of the neighboring points represents the range extending upward and downward from the location of the missing value. The valid values within this range will be used to calculate the average. This avoids over-reliance on the value of a single neighboring point and avoids excessive consideration of irrelevant data.

[0074] Data normalization: To avoid errors caused by different magnitudes, this paper uses the maximum and minimum normalization method, also known as the deviation normalization method, to normalize the data to between [0, 1]. The formula is as follows:

[0075]

[0076] Where X is the original data value, X min is the minimum value in the data set, X max is the maximum value in the data set, X a is the scaled data value.

[0077] S2, using the Sparrow Search Algorithm (SSA) to optimize the central server hyperparameters;

[0078] After preprocessing the experimental data, the most complete dataset was selected and divided into a training set and a validation set. This was then fed into a central server, where the SSA algorithm was used to optimize the LSTM. After defining the optimization objective and parameter space, initializing the sparrow population, performing fitness assessment and role division, iterative optimization, dynamic adjustment, and termination judgment, the optimal LSTM hyperparameters were obtained. The central server then distributed the optimal hyperparameters for subsequent short-term residential energy consumption forecasting.

[0079] like Figure 2 、 Figure 4 As shown, the SSA-LSTM neural network is used for training, which includes the following steps:

[0080] S21. First, determine the LSTM prediction error (MSE) on the validation set as the fitness function, minimize the error value, and select the LSTM hyperparameters to be optimized (number of hidden layers, learning rate, dropout rate, number of iterations), and define the search range of each parameter;

[0081] S22, set the population size N, randomly generate the initial sparrow position X i =[X i1 ,Xi2 ,...,X im ], where m is the hyperparameter dimension, and each sparrow position X i Corresponding to a set of LSTM hyperparameter combinations (such as X i1 represents the number of hidden layers, X i2 represents the learning rate);

[0082] S23. For each sparrow individual, try to train the LSTM model with its hyperparameter combination, and calculate the error on the validation set as the fitness value f(X i ). Roles are assigned simultaneously. In the sparrow search algorithm, there are three types of individuals: foragers, followers, and scouts. The finders are the top 20% of individuals with the best fitness, responsible for global exploration; the followers are the remaining individuals, following the finders for local development; and the scouts are the randomly selected 10% to 20% of individuals, who perform vigilance behaviors to escape the local optimum.

[0083] S24. The discoverer updates its location using the following formula:

[0084]

[0085] Where r represents the current number of iterations, T represents the maximum number of iterations, α is a local random number in the range of (0, 1), R2 represents the warning value, R2∈[0, 1], ST represents the safety value, ST∈[0.5, 1], represents the position of the i-th sparrow in the m-th dimension at the r-th iteration. D is a random number that follows a normal distribution, and L is the step size matrix, which is defined as:

[0086]

[0087] Among them, randn(D) is a random number that obeys the normal distribution, is the current global optimal position;

[0088] S25. Followers update their positions using the following formula:

[0089]

[0090] in, represents the worst position of the sparrow in the current dimension at the rth iteration, represents the optimal position of the sparrow in the current dimension at the r+1th iteration, and A represents a 1-row and m-column matrix with elements of 1 or -1;

[0091] S26, Scout is updated with the following positions:

[0092]

[0093] Among them, β is a normally distributed random number with mean 0 and variance 1, which represents the step size control parameter; K is a random number between [-1, 1], f i represents the fitness of the i-th sparrow, f g 、f w Represent the optimal fitness and the worst fitness of the current sparrow population respectively. And γ is a very small constant to avoid f i =f g When the denominator is 0;

[0094] S27. After the above steps, the individual with the highest fitness is retained in each generation to prevent the loss of excellent solutions. When the maximum number of iterations T is reached or the fitness change rate is lower than the threshold δ, the search is terminated.

[0095] S28. After obtaining the optimal hyperparameter combination, it is distributed to each local server of the federated learning. Each local server initializes the local LSTM model with the unified hyperparameters and performs subsequent short-term residential energy consumption prediction.

[0096] S3, such as Figure 5 As shown in the figure, a prediction model based on an improved federated learning architecture is used to make short-term predictions of residential energy consumption, including the following steps:

[0097] S31. Decentralize the optimal LSTM model hyperparameters and model parameters obtained in step S2 above to each local server, and define a global objective function. The global objective function formula is as follows:

[0098]

[0099] Where K represents the total number of participants; n k represents the amount of data of the kth party; B k represents local batch data; L represents the loss function.

[0100] S32. The central server distributes the initial global model and initial median loss to all participants, and a data sharing strategy is proposed. The essence of this strategy is to share a small dataset in each participant's training set. This small dataset is different from any other participant's training set and is sent to each participant when the FedAvg algorithm is initialized.

[0101] This data sharing strategy involves two parameters, α and β. α represents the portion of the server dataset that will be shared with each participant. Assuming the server dataset is D, then α·D of the server dataset will be shared with each participant. β, on the other hand, refers to the ratio of the server dataset size to the sum of all participant datasets, i.e.:

[0102]

[0103] Among them, m k Indicates the data volume of the kth participant.

[0104] S33. Each participant uses local data and shared data to train the LSTM model and execute the FedAvg algorithm. The algorithm formula is as follows:

[0105]

[0106] Among them, η represents the learning rate, Represents global parameters, Represents the local parameters of the next round;

[0107] After completing E local updates in each round, the median loss is obtained. If the obtained median loss is greater than the median loss distributed by the central server, training continues until the maximum number of iterations is reached or the median loss is less than the median loss distributed by the central server. The parameters and median loss are uploaded.

[0108] S34. Each participant encrypts and uploads the updated parameters to the central server, and uses weighted averaging to perform parameter fusion. The formula is as follows:

[0109]

[0110] in, Ensure that participants with large amounts of data contribute more.

[0111] At the same time, the uploaded median losses are averaged to obtain the median loss of the new round.

[0112] S35, the central server will get the new parameters The median loss of the new round is sent to each participant, and step S33 is repeated. The training is terminated after the preset maximum number of training rounds is reached.

[0113] S36. Output the optimized federated LSTM model, and each participant uses the obtained optimal LSTM model to perform short-term prediction of local residential energy consumption.

[0114] This paper uses a large dataset from the Low Carbon London project, which collects hourly residential loads generated by four groups of households from November 1, 2011, to December 31, 2011. The data in this dataset includes visibility, wind speed, temperature, dew point, air pressure, current temperature, wind speed, and humidity.

[0115] To better simulate the dataset, the present invention uses the following measures to process it. First, outliers are processed by using the quartile method to identify them and convert them into the average value of the entire dataset to reduce errors. Second, all variables are scaled using Min-Max to have the same range. These readjustments are necessary to accelerate the learning process of federated learning. Finally, the dataset is split into training and test sets, and the training and test sets are randomly divided into 80% and 20% respectively.

[0116] In order to quantitatively analyze the experimental prediction results, the evaluation indicators selected are mean absolute error (MAE), root mean square error (RMSE) and determination coefficient (R 2 ). The above evaluation indicators are defined as:

[0117]

[0118] Where: N is the number of residential energy consumption prediction test set data; is the predicted value of the i-th predicted data; y i is the true value of the corresponding data in the test set; is the average value of the test set data.

[0119] After determining the input features and completing the aforementioned data preprocessing, we first need to study the impact of different neural networks and swarm intelligence algorithms on prediction accuracy. To ensure a fair comparative analysis, we first compare the LSTM model with a multi-layer feedforward neural network (BP), a univariate neural network (GRU), and an enhanced decision tree neural network (XGBOOST) trained using the same dataset and test environment (federated learning framework). This verifies the advantages of the LSTM neural network under the same parameters and experimental conditions.

[0120] The prediction results of BP, LSTM, GRU, and XGBOOST models are as follows Figure 6 The performance evaluation indicators are shown in Table 1. As can be seen, LSTM, as a commonly used prediction model for building energy consumption, can demonstrate relatively good performance evaluation indicators and has better accuracy than BP, GRU, and XGBOOST. In the following, FL refers to the LoAdaBoost federated learning algorithm.

[0121] Table 1 Performance evaluation results of FL framework models with different neural networks

[0122]

[0123] In order to verify that SSA can better optimize the hyperparameters of the LSTM model and make the prediction effect of LSTM better, in the same experimental environment, the same data set and the same federated framework, this paper selected the other three swarm intelligence algorithms for comparison, including the sparrow search algorithm (SSA), the particle swarm optimization algorithm (PSO), the gray wolf optimization algorithm (GWO) and the whale optimization algorithm (WOA). After optimizing LSTM with different swarm intelligence optimization algorithms, the energy consumption prediction was performed using the optimal hyperparameter model. The evaluation index results are shown in Table 2. The prediction results are shown in Table 2. Figure 7 As shown in the figure, the FL-SSA-LSTM model outperforms the other comparison models based on the results of the above three performance evaluation indicators. Therefore, the present invention selects SSA as the optimization algorithm for LSTM.

[0124] Table 2 Model performance evaluation results of different optimization algorithms

[0125]

[0126] In the case of missing some eigenvalues in the dataset, using FL can improve the generalization of the prediction model and achieve better prediction results. In order to verify the superiority of the prediction accuracy of the model of the present invention, the dates with some missing eigenvalues in the dataset were selected as the test days, and the sparrow search optimized LSTM model, the LSTM model under the federated learning framework and the ordinary LSTM were selected for comparison. Figure 8 As can be seen from the figure, the FL-SSA-LSTM model has a better fit and a smaller prediction error. It can be seen that even when some data is missing, the model of the present invention can still show good performance evaluation indicators and high prediction accuracy, demonstrating the high generalization of the model.

[0127] The following are device embodiments of the present invention, which can be used to perform the method embodiments of the present invention. For details not disclosed in the device embodiments, please refer to the method embodiments of the present invention.

[0128] In yet another embodiment of the present invention, a short-term residential energy consumption prediction system based on federated learning is provided, comprising:

[0129] A data acquisition module is used to obtain load data of each residence;

[0130] The short-term energy consumption prediction module is used to transmit the load data of each residence to the short-term residential energy consumption prediction model based on federated learning to predict the short-term energy consumption of the corresponding residence;

[0131] Among them, the short-term residential energy consumption prediction model based on federated learning includes a federated learning framework composed of a residential central prediction model and n residential prediction models. The residential central prediction model and the n residential prediction models both adopt the LSTM prediction algorithm, and the hyperparameters of the LSTM prediction algorithm are obtained through the SSA algorithm.

[0132] Furthermore, the n residential prediction model training is specifically as follows:

[0133] Obtain the load data of each residence and construct a training dataset for the n-residence prediction model based on the data sharing strategy;

[0134] The initial global model is used as the local model of the residential prediction model. The training data sets of n residential prediction models are used to train the local models respectively. The updated model parameters are transferred to the residential central prediction model. The residential central prediction model uses the FedAvg algorithm to perform parameter fusion to obtain the global model parameters.

[0135] n residential prediction models are trained using global model parameters;

[0136] Repeat the above steps until n different residential prediction models that meet the requirements are obtained;

[0137] The data sharing strategy is as follows:

[0138] The sum of the load data for n houses is expressed as: , where m k represents the data volume of the kth residence, β is the ratio of the sum of the load data of n residences to the sum of the load data of a single residence;

[0139] The data that can be shared in the total load data of n residences is expressed as α·D, where α is the proportion of data that can be shared in the total load data of n residences.

[0140] In another embodiment of the present invention, a terminal device is provided, comprising a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used to implement a method for short-term prediction of residential energy consumption based on federated learning.

[0141] In another embodiment of the present invention, the present invention further provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a terminal device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the terminal device and, of course, extended storage media supported by the terminal device. The computer-readable storage medium provides a storage space that stores the terminal's operating system. In addition, the storage space also stores one or more instructions suitable for being loaded and executed by the processor. These instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the above-mentioned embodiment regarding a method for short-term residential energy consumption prediction based on federated learning.

[0142] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0143] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0144] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0145] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.

[0146] In summary, the model proposed in this paper better addresses the aforementioned issues and improves the accuracy and reliability of residential energy consumption predictions. By sharing a small portion of the dataset with all local servers before training and retraining servers whose training losses exceed the median loss of all local servers during training, the model increases its generalizability and prediction accuracy. This provides more reliable data and theoretical support for high-precision predictions of residential energy consumption, and has important practical application value.

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the scope of protection of the claims of the present invention.

Claims

1. A short-term residential energy consumption prediction method based on federated learning, characterized in that: The specific steps are as follows: Obtain load data for each residence; The load data of each residence is transmitted to the short-term residential energy consumption prediction model based on federated learning to predict the short-term energy consumption of the corresponding residence; Among them, the short-term residential energy consumption prediction model based on federated learning includes a federated learning framework composed of a residential central prediction model and n residential prediction models. The residential central prediction model and the n residential prediction models both adopt the LSTM prediction algorithm, and the hyperparameters of the LSTM prediction algorithm are obtained through the SSA algorithm.

2. A method for short-term residential energy consumption prediction based on federated learning according to claim 1, characterized in that: The load data of each residence is transmitted to the central residential prediction model, and the optimal hyperparameters of the LSTM prediction algorithm are obtained through the SSA algorithm to establish the initial global model. Obtain the load data of each residence and construct a training dataset for the n-residence prediction model based on the data sharing strategy; The initial global model is used as the local model of the residential prediction model, and the training data sets of n residential prediction models are used to train the local models respectively to obtain n residential prediction models.

3. A method for short-term residential energy consumption prediction based on federated learning according to claim 2, characterized in that: The initial global model is described as follows: Where K represents the total number of participants; n k represents the amount of data of the kth party; B k represents local batch data; L represents the loss function.

4. The method for short-term residential energy consumption prediction based on federated learning according to claim 2, characterized in that: In the step of obtaining the load data of each residence and constructing a training data set for the n-residence prediction model based on a data sharing strategy, the data sharing strategy is specifically as follows: The sum of the load data of n houses is expressed as: Among them, m k represents the data volume of the kth residence, β is the ratio of the sum of the load data of n residences to the sum of the load data of a single residence; The data that can be shared in the total load data of n residences is expressed as α·D, where α is the proportion of data that can be shared in the total load data of n residences.

5. The method for short-term residential energy consumption prediction based on federated learning according to claim 2, characterized in that: Taking the initial global model as the local model of the residential prediction model, the local models are trained respectively using the training data sets of n residential prediction models to obtain the steps of n residential prediction models: The updated model parameters are transmitted to the residential central prediction model, which uses the FedAvg algorithm to perform parameter fusion to obtain the global model parameters. n residential prediction models are trained using global model parameters; Repeat the above steps until n different residential prediction models that meet the requirements are obtained.

6. A short-term residential energy consumption prediction system based on federated learning, characterized in that: include: A data acquisition module is used to obtain load data of each residence; The short-term energy consumption prediction module is used to transmit the load data of each residence to the short-term residential energy consumption prediction model based on federated learning to predict the short-term energy consumption of the corresponding residence; Among them, the short-term residential energy consumption prediction model based on federated learning includes a federated learning framework composed of a residential central prediction model and n residential prediction models. The residential central prediction model and the n residential prediction models both adopt the LSTM prediction algorithm, and the hyperparameters of the LSTM prediction algorithm are obtained through the SSA algorithm.

7. A short-term residential energy consumption prediction system based on federated learning according to claim 6, characterized in that: The n residential prediction model training is specifically as follows: Obtain the load data of each residence and construct a training dataset for the n-residence prediction model based on the data sharing strategy; The initial global model is used as the local model of the residential prediction model. The training data sets of n residential prediction models are used to train the local models respectively. The updated model parameters are transferred to the residential central prediction model. The residential central prediction model uses the FedAvg algorithm to perform parameter fusion to obtain the global model parameters. n residential prediction models are trained using global model parameters; Repeat the above steps until n different residential prediction models that meet the requirements are obtained; The data sharing strategy is as follows: The sum of the load data of n houses is expressed as: Among them, m k represents the data volume of the kth residence, β is the ratio of the sum of the load data of n residences to the sum of the load data of a single residence; The data that can be shared in the total load data of n residences is expressed as α·D, where α is the proportion of data that can be shared in the total load data of n residences.

8. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the processor implements the steps of a method for short-term residential energy consumption prediction based on federated learning as described in any one of claims 1 to 5.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of a method for short-term residential energy consumption prediction based on federated learning as described in any one of claims 1 to 5 are implemented.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of a method for short-term residential energy consumption prediction based on federated learning as described in any one of claims 1 to 5 are implemented.

Citation Information

Cited By

  • Building energy consumption prediction method and device integrating parameter optimization and multi-model integration

    CN121481000A