A prediction method and device based on multi-household power consumption prediction model
The Fed_BiLSTM model, which combines federated learning and BiLSTM, solves the problems of long training time and insufficient privacy protection in household electricity consumption prediction. It generates a general model that achieves efficient and accurate prediction of electricity consumption for multiple households while protecting user privacy.
Patent Information
- Application Number
- CN202111301260.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-04
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2041-11-04
AI Technical Summary
Existing technologies for predicting household electricity consumption suffer from problems such as long model training times and insufficient data privacy protection. Especially with large amounts of data, traditional methods require retraining the model, while deep learning models require a large amount of user data, resulting in low efficiency and a high risk of privacy leaks.
The Fed_BiLSTM model, which combines federated learning and BiLSTM, collects electricity consumption data from multiple electricity users, samples and preprocesses the data, and divides it into training and test sets. The model parameters are then fused using a central server for iterative training to generate a general model, reducing data uploads. Training and updates are performed only in the local model, and the Adam optimizer and a specific loss function are used to optimize the model.
While ensuring prediction accuracy and data privacy, the model training time was reduced, prediction efficiency and generalization ability were improved, user privacy was protected, and accurate prediction of electricity consumption for multiple households was achieved.
Smart Images

Figure CN114118530B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a prediction method and device based on a multi-household electricity consumption prediction model. Background Art
[0002] Accurately predicting highly volatile household electricity consumption (HEC) plays an important role in contemporary society. It enables the government to respond to demand in a timely manner and formulate more reasonable sustainable development strategies. In addition, it is also conducive to the development of smart grids, which can transmit electricity without delay to meet user needs. However, there are also some obstacles in the research of household electricity consumption prediction.
[0003] First, the traditional HEC prediction research method shows that we need to use one model to predict a set of data, which requires different models to be used for training different data. When training a set of data, the previous model will be discarded, the next model needs to be initialized, and then the training will start again. The trained model loses its usability after completing the current prediction task. In practical applications, when the amount of data or the model scale is very large, it takes a lot of time to train the model.
[0004] Secondly, the development of technology has improved the ability to analyze user data. People have the ability to infer user information from user behavior data. If the user's behavior data flows into the hands of illegal persons, it will cause a lot of trouble to the user. Therefore, in recent years, people have paid more and more attention to the protection of personal privacy. However, the currently popular deep learning models require a large amount of data to achieve better performance. The collection of massive user data has become an obstacle to the further development of deep learning.
[0005] Therefore, it is of great significance to use the model to make accurate predictions on multiple HEC datasets while ensuring data privacy. Reducing the training time of the model and protecting data privacy are the two most important issues in current research. Summary of the invention
[0006] The purpose of the embodiments of the present application is to provide a prediction method and device based on a multi-household electricity consumption prediction model, so as to reduce model training time and protect data privacy.
[0007] In a first aspect, an embodiment of the present application provides a prediction method based on a multi-household power consumption prediction model, the method comprising:
[0008] Collecting power consumption data of multiple power users, wherein the power consumption data is data of each time period recorded in chronological order;
[0009] Sampling the power consumption data, preprocessing the sampled data, and determining a training set and a test set based on the preprocessed data;
[0010] Based on the training set and the test set, training the power consumption prediction model to obtain a general model;
[0011] The power consumption of the user to be predicted is predicted by using the general model.
[0012] In some embodiments, based on the training set and the test set, training the power consumption prediction model to obtain a general model includes:
[0013] Based on the training set and the test set, the power consumption prediction model of each power user is trained, and the trained model parameters are transmitted to the central server;
[0014] The central server fuses the model parameters and sends the fused data to each of the power consumption prediction models for cyclic training until a general model is generated.
[0015] In some embodiments, determining a training set and a test set based on the preprocessed data includes:
[0016] The preprocessed data is divided into 87% training set and 13% test set.
[0017] In some embodiments, based on the training set and the test set, training the power consumption prediction model of each power consumer includes:
[0018] The power consumption prediction model is a model combining federated learning and BiLSTM, namely, a Fed_BiLSTM model, which includes five parallel task modules and one central module, wherein each task module is composed of a BiLSTM neural network layer and a fully connected layer;
[0019] After the server in the central module establishes a connection with the client through the TCP protocol, the power consumption prediction model of each power user is trained through the task module based on the training set and the test set.
[0020] In some embodiments, sending the fused data to each of the power consumption prediction models for cyclic training until a general model is generated includes:
[0021] The fused data is sent to each of the power consumption prediction models, and the loss function of the power consumption prediction model is used. And the loss function of the general model Do circuit training;
[0022] By minimizing the mean absolute error Mean absolute percentage error and RMS error Evaluate and optimize the model after each training until a general model is generated;
[0023] Among them, m represents the quantitative feature, y={y1,y2,…,y N} represents the predicted value, Indicates actual value.
[0024] In some embodiments, preprocessing the sampled data includes:
[0025] The data set of the electricity user is uploaded to each node, exception processing is performed, and the power consumption data is scaled using the Z-Score to obtain the pre-processed power consumption data with an average value of 0 and a standard deviation of 1.
[0026] In a second aspect, an embodiment of the present application provides a device based on a multi-household power consumption prediction model, the device comprising:
[0027] A collection module, used to collect power consumption data to be predicted, wherein the power consumption data is data of each time period recorded in chronological order;
[0028] An analysis module, used for performing abnormal processing and preprocessing on the power consumption data;
[0029] A confirmation module is used to determine the training set and the test set based on the preprocessed data;
[0030] A training module, used for training the initial power consumption prediction model based on a training set and a test set to obtain a general model;
[0031] The prediction module is used to predict the electricity consumption of the electricity user to be predicted through a trained general model.
[0032] In some embodiments, the training module further includes:
[0033] The training module trains the power consumption prediction model of each power user based on the training set and the test set, and transmits the trained model parameters to the central server;
[0034] The training module fuses the model parameters through a central server, and sends the fused data to each of the power consumption prediction models for cyclic training until a general model is generated.
[0035] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein a computer program is stored on the memory, and when the computer program is executed by the processor, the prediction method based on the multi-household power consumption prediction model described in the first aspect is implemented.
[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the prediction method based on the multi-household electricity consumption prediction model described in the first aspect is implemented.
[0037] Compared with the related art, the present application provides a prediction method and device based on a multi-household electricity consumption prediction model. Collect electricity consumption sequence data of multiple electricity users; sample the electricity consumption data, and determine a training set and a test set based on the sampled data; based on the training set and the test set, locally train the electricity consumption prediction model of each electricity user, and pass the trained parameters to the central server; the central server fuses the received model parameters and then distributes them to each local model; after receiving the parameters, the local model performs a local update, and repeats the above operation until the optimal general model is generated. Reduce data processing and training time, and the data is trained synchronously on a distributed computer system. Under the premise of ensuring prediction accuracy and data privacy, the present invention can realize the prediction of various household energy consumption data with only one general model, and has strong generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 is a block diagram of an example electronic device;
[0040] Figure 2 is a flowchart of the steps of a prediction method based on a multi-household power consumption prediction model according to an embodiment of the present application;
[0041] Figure 3 It is a flow chart of passing parameters to the central server;
[0042] Figure 4 It is a schematic diagram of the overall algorithm framework;
[0043] Figure 5 It is a schematic diagram of a bidirectional long short-term memory neural network model;
[0044] Figure 6 It is a schematic diagram of the fitting of five universal models for predicting household electricity consumption;
[0045] Figure 7 It is a structural block diagram of a device based on a multi-household electricity consumption prediction model according to an embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be described below in conjunction with the drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments.
[0047] The present application embodiment provides an electronic device, Figure 1 is a block diagram of an example electronic device, such as Figure 1 As shown, the electronic device 100 includes one or more processing devices 102, one or more storage devices 104, an input device 106, and an output device 108, which are interconnected via a bus system 112 and / or other forms of connection mechanisms (not shown). It should be noted that Figure 1 The components and structures of the electronic device 100 shown are merely exemplary and non-limiting. The electronic device may also have other components and structures as required.
[0048] The processing device 102 may be a central processing unit (CPU), a graphics processing unit (GPU), or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 100 to perform desired functions.
[0049] The storage device 104 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on a computer-readable storage medium, and the processing device 102 may run the program instructions to implement the client functions (implemented by the processor) and / or other desired functions in the embodiments of the present invention described below. Various applications and various data, such as various data used and / or generated by the application, may also be stored in the computer-readable storage medium.
[0050] The input device 106 may be a device used by a user to input instructions, and may include one or more of a keyboard, a mouse, a microphone, a touch screen, and the like.
[0051] The output device 108 may output various information (eg, images or sounds) to the outside (eg, a user), and may include one or more of a display, a speaker, and the like.
[0052] Exemplarily, the example electronic device for implementing the power consumption prediction model training method according to the embodiment of the present invention may be implemented on a mobile terminal such as a smart phone, a tablet computer, or the like.
[0053] The general model training method for multi-household electricity consumption prediction will be introduced in detail below in conjunction with a specific embodiment.
[0054] The present application embodiment provides a prediction method based on a multi-household electricity consumption prediction model. Figure 2 is a flowchart of the steps of a prediction method based on a multi-household power consumption prediction model according to an embodiment of the present application, such as Figure 2 As shown, the method comprises the following steps:
[0055] Step S210, collecting power consumption data of multiple power users, where the power consumption data is data for each time period recorded in chronological order;
[0056] Specifically, the power consumption data of 5 different households can be collected according to the collection points, and the data of each time period can be recorded in chronological order.
[0057] Step S220, sampling the power consumption data, preprocessing the sampled data, and determining a training set and a test set based on the preprocessed data;
[0058] Specifically, 6 seconds is set as a step, time series data is generated respectively, invalid data is removed, and then the generated time series data set is standardized using Z-Score to have a mean value of 0 and a standard deviation of 1. The collection point may refer to the electricity user.
[0059] The sliding time window method can be used to expand the subsequence from a single-dimensional time series data to multi-dimensional data. The sliding time window length can be set to 8. The data of the first eight points can be used to predict the power consumption of the ninth point, and the single-dimensional sample data can be expanded into multi-dimensional sample data. Based on this prediction method, the original single-dimensional time series sample data is expanded into multi-dimensional sample data, that is, each predicted target value and its corresponding historical data set.
[0060] Step S230, training the power consumption prediction model based on the training set and the test set to obtain a general model;
[0061] Step S240: predicting the power consumption of the user to be predicted by using a general model.
[0062] Through steps S210 to S240 in the embodiment of the present application, the problems of low training efficiency and easy data leakage of the power consumption prediction model are solved. Under the premise of ensuring prediction accuracy and data privacy, only one general model can be used to predict various household power data, which has strong generalization ability.
[0063] In some embodiments, step S230, training the power consumption prediction model based on the training set and the test set to obtain a general model includes:
[0064] Based on the training set and the test set, the power consumption prediction model of each power user is trained, and the trained model parameters are transmitted to the central server;
[0065] Figure 3 is a flow chart of passing parameters to the central server, such as Figure 3 As shown in the figure, the trained parameters will be transmitted to the central server through the TCP protocol. TCP is an efficient, reliable, stable, connection-oriented communication protocol. The TCP protocol is used to establish a connection between the server and the client. When the client establishes communication with the server through TCP, it sends a communication request to the server. After the two parties have a three-way handshake, full-duplex communication is established between the client and the server. When the two parties wave their hands four times, the connection will be disconnected. Through the TCP protocol, the client can upload or download updated parameters to achieve interaction between the server and the client.
[0066] The central server fuses the model parameters and sends the fused data to each power consumption prediction model for cyclic training until a general model is generated.
[0067] Specifically, Figure 4 It is a schematic diagram of the overall algorithm framework, such as Figure 4 As shown in the figure, by introducing federated learning into the traditional prediction method, a single general model can be used to predict multiple databases. The present invention reduces the workload of data collectors and the workload of data collection. In addition, the data only flows in the local model and will not be uploaded to the server. The server aggregates all local models and generates a general model to predict multiple different data sets.
[0068] Each database is deployed on a local model, and each client updates the local model with a unique gradient. After the local model training is completed, the local parameters are uploaded to the server. The server fuses the received model parameters according to the parameter fusion mechanism and then distributes them to each local model. TCP communication is designed to transmit parameters between the server and the client. After receiving the parameters, the local model is locally updated, and the above operations are repeated until the optimal general model is generated.
[0069] In order to make the model more generalizable, SGD was not used to optimize the model, but Adam was used. HEC data has the characteristics of large fluctuations and obvious mutations. The Adam optimizer adds a first-order momentum m based on SGD. i and the second-order momentum v i , which updates the network weights w more efficiently than SGD i+1 , get the gradient of the objective function under the current parameters Better prediction results can be obtained.
[0070] m i Determined based on the following formula:
[0071]
[0072] v i Determined based on the following formula:
[0073]
[0074] w i+1 Determined based on the following formula:
[0075]
[0076] Determined based on the following formula:
[0077]
[0078] Where β1 and β2 are hyperparameters that control momentum.
[0079] The loss function of each local power consumption prediction model is J h (w), the loss function of the general model is The design and optimization are carried out with the goal of minimizing the mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE).
[0080] In some embodiments, step S220, preprocessing the sampled data includes:
[0081] The data set of the electricity user is uploaded to each node, exception processing is performed, and the power consumption data is scaled using the Z-Score to obtain the pre-processed power consumption data with an average value of 0 and a standard deviation of 1.
[0082] In some embodiments, step S220, determining the training set and the test set based on the preprocessed data includes:
[0083] The preprocessed data is divided into 87% training set and 13% test set.
[0084] In some embodiments, training the power consumption prediction model of each power consumer based on the training set and the test set includes:
[0085] The power consumption prediction model is a model that combines federated learning and BiLSTM, namely the Fed_BiLSTM model. The model that combines federated learning and BiLSTM includes five parallel task modules and one central module, where each task module consists of a BiLSTM neural network layer and a fully connected layer;
[0086] Specifically, Figure 5 It is a schematic diagram of a bidirectional long short-term memory neural network model, such as Figure 5 As shown in the figure, the five local models are all trained using BiLSTM, which has a four-layer structure. The four layers are: input layer, forward layer, backward layer, and output layer. The forward layer and the backward layer do not interfere with each other, and the dependency relationship is clear. Each layer has a corresponding weight, and the weight of each layer is reused in each time step. The final result is the sum of the elements of the forward layer output and the backward layer output.
[0087] After the server in the central module establishes a connection with the client through the TCP protocol, the power consumption prediction model of each electricity user is trained through the task module based on the training set and the test set.
[0088] Each of the task modules consists of a BiLSTM neural network layer and a fully connected layer;
[0089] BiLSTM includes two layers of LSTM, and LSTM has three gates: forget gate F t , input gate I t and C′ t , output gate O t . F t A sigmoid layer is implemented to determine which information in the output of the previous LSTM layer and the input of the current LSTM layer will be discarded. t Using the sigmoid layer, C′ t Using a tanh layer, determine the new information to store in the cell state. t Determines what information will be output to the next layer of LSTM. In addition, the cell state C t It plays a role of long-term storage in LSTM and is updated according to the selected unit. Finally, the output is h t By output gate O t and the current cell state C t Decide.
[0090] The forget gate Ft is determined based on the following formula:
[0091] Ft =σ(W F ·[h t-1 ,x t ]+b F )
[0092] Input Gate I t Determined based on the following formula:
[0093] I t =σ(W I ·[h t-1 ,x t ]+b I )
[0094] Input gate C′ t Determined based on the following formula:
[0095] C′ t =tanh(W C ·[h t-1 ,x t ]+b C )
[0096] Cell State C t Determined based on the following formula:
[0097] C t =F t ⊙C t-1 +I t ⊙C′ t
[0098] Output Gate O t Determined based on the following formula:
[0099] O t =σ(W o ·[h t-1 ,x t ]+b o )
[0100] Finally, the output h t Determined based on the following formula:
[0101] h t =O t ⊙tanh(C t )
[0102] In the above formula, w and b represent the corresponding weights and biases. [,] represents the connection of two matrices, and ⊙ represents the hadamard result.
[0103] In some embodiments, the fused data is sent to each power consumption prediction model for cyclic training until a general model is generated, including:
[0104] The fused data is sent to each power consumption prediction model, and the loss function J of the power consumption prediction model is used to calculate the power consumption prediction model. h (w), and the loss function of the general model Do circuit training;
[0105] By minimizing the mean absolute error Mean absolute percentage error and RMS error Evaluate and optimize the model after each training until a general model is generated;
[0106] Among them, m represents the quantitative feature, y={y1,y2,…,y N} represents the predicted value, Represents the actual value. MAE, RMSE, and MAPE are used to evaluate the effectiveness and generalization of the proposed prediction method.
[0107] Specifically, the above evaluation indexes can be used to quantify the prediction effect and evaluate the accuracy and performance of the prediction method. Table 1 is the experimental prediction results of several prediction methods to further demonstrate the versatility of the present invention in the prediction of household electricity consumption time series. Using the same evaluation index, the prediction error and fitting effect of different methods for predicting each household electricity consumption variable are calculated and compared. Different family structures have different electricity consumption habits, which poses a challenge to the versatility of the prediction method.
[0108] The machine learning models on which these prediction methods are based include LSTM, BiLSTM, Fed_LSTM with federated learning, and Fed_BiLSTM with federated learning (this prediction method). As can be seen from the table, the prediction results of BiLSTM are not better than those of LSTM. It shows that in household electricity prediction data, bidirectional LSTM is not necessarily better than unidirectional LSTM at learning data trends. The prediction performance of BiLSTM after the introduction of federated learning is significantly better than that of LSTM after the introduction of federated learning, which shows that the operation of the fusion model in federated learning greatly improves the learning ability of BiLSTM. In addition, the evaluation values of various aspects of the model proposed by the present invention also show that it is superior to a single model. The general model trained by Fed_BiLSTM has achieved higher prediction accuracy on 5 data with different distributions. Therefore, the advantages of Fed_BiLSTM are not only reflected in the improvement of prediction accuracy, but also in the high versatility of the model.
[0109] Table 1
[0110]
[0111] Figure 6 Figure 2 is a schematic diagram of the fitting of five universal models for predicting household electricity consumption. Figure 6 As shown in the figure, Real Value is the real value of the electricity consumption data, and Predicted Value is the predicted value of the electricity consumption data. Due to the family's own reasons, the data distribution of these five families is significantly different. In the same period, the electricity consumption of households 1, 2, and 4 fluctuated greatly, and the electricity consumption data of households 3 and 5 fluctuated greatly. In this case, it is a challenging task to use a general model to predict different data sets with such large waveform differences. By observing the fluctuating data, it can be found that the peak electricity consumption of different households is in different positions, with large fluctuations and obvious mutations. It is difficult for ordinary neural networks to predict sudden changes and irregular data.
[0112] Due to the long training time, the traditional model is only applicable to the current single data set. When entering the next scene, the model needs to be retrained. In practical applications, the process cost of waiting for model training is very high, and it is unrealistic to spend a lot of time training a model at one time. Establishing a model that can accurately predict multiple households is an inevitable trend in time series prediction research. From the prediction results, the present invention is consistent with the expected value and accurately predicts the energy consumption trend.
[0113] The local model in the prediction method consists of five parallel bidirectional memory neural network (PLSTM) layers and one fully connected (dense) layer. BiLSTM can capture the bidirectional long-term dependency of data from front to back and from back to front. The forward layer and the backward layer do not interfere with each other, and the dependency relationship is clear. Each layer has a corresponding weight, and the weight of each layer is reused in each time step. The bidirectional structure of BiLSTM enables it to inherit the advantages of LSTM and make up for the shortcomings of LSTM.
[0114] Through the method for predicting the time series of electricity consumption of multiple households based on the bidirectional long short-term memory neural network model of federated learning in the embodiment of the present application, the distributed structure effectively reduces the training time of the model. Fed_LSTM model data only flows in the local model, protecting the privacy of users. The server receives the gradient information uploaded from the local model, and then sends the fusion parameters to each local model through a secure aggregation mechanism. The above operation is repeated until a general model with high prediction accuracy is obtained. The structure of the forward LSTM and the reverse LSTM also enables the model to better capture the long-term dependency of the data and improve the final prediction accuracy. The proposed invention is superior to the existing multiple models for predicting household electricity consumption. The deep learning model predicts that the evaluation indicators of five different households in multiple scenarios are better than multiple single models and combined models. It can be effectively applied to the prediction of electricity consumption data in protecting data privacy and reducing training time, and can effectively solve the problems of low prediction accuracy, poor generalization, prediction lag, data privacy leakage, etc. in the current electricity consumption prediction model, and has good robustness and generalization.
[0115] The embodiment of the present application provides a device based on a multi-household electricity consumption prediction model, Figure 7 is a block diagram of a device structure based on a multi-household power consumption prediction model according to an embodiment of the present application, such as Figure 7 As shown, the device comprises:
[0116] The collection module 701 is used to collect the power consumption data to be predicted, where the power consumption data is data of each time period recorded in chronological order;
[0117] An analysis module 702, for performing abnormal processing and preprocessing on power consumption data;
[0118] A confirmation module 703 is used to determine a training set and a test set based on the preprocessed data;
[0119] A training module 704 is used to train the initial power consumption prediction model based on the training set and the test set to obtain a general model;
[0120] The prediction module 705 is used to predict the electricity consumption of the electricity user to be predicted by using a trained general model.
[0121] Through the collection module 701, analysis module 702, confirmation module 703, training module 704 and prediction module 705 in the embodiment of the present application, the problems of low training efficiency and easy data leakage of the power consumption prediction model are solved. Under the premise of ensuring prediction accuracy and data privacy, only one general model can be used to realize the prediction of various household power data, which has strong generalization ability.
[0122] In some embodiments, the training module 704 further includes:
[0123] The training module 704 trains the power consumption prediction model of each power user based on the training set and the test set, and transmits the trained model parameters to the central server;
[0124] The training module 704 fuses the model parameters through the central server and sends the fused data to each power consumption prediction model for cyclic training until a general model is generated.
[0125] The implementation principle and technical effects of the device provided in the embodiments of the present application are the same as those of the aforementioned method embodiments. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiments.
[0126] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0127] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0128] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0129] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0130] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this 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. The computer software product 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 methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0131] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A prediction method based on a multi-household electricity consumption prediction model, characterized in that: The method comprises: Collecting power consumption data of multiple power users, wherein the power consumption data is data of each time period recorded in chronological order; Sampling the power consumption data, preprocessing the sampled data, and determining a training set and a test set based on the preprocessed data; Based on the training set and the test set, the power consumption prediction model of each power user is trained, and the trained model parameters are transmitted to the central server, wherein the power consumption prediction model is a model combining federated learning and BiLSTM, i.e., a Fed_BiLSTM model, and the model combining federated learning and BiLSTM includes five parallel task modules and one central module, wherein each of the task modules is composed of a BiLSTM neural network layer and a fully connected layer; The central server fuses the model parameters, sends the fused data to each of the power consumption prediction models for cyclic training, and uses the Adam optimizer to update the network weights to obtain the gradient of the objective function under the current parameters until a general model is generated; The power consumption of the user to be predicted is predicted by using the general model.
2. The method according to claim 1, characterized in that Determining the training set and test set based on the preprocessed data includes: The preprocessed data is divided into 87% training set and 13% test set.
3. The method according to claim 1, characterized in that Based on the training set and the test set, training the power consumption prediction model of each power user includes: After the server in the central module establishes a connection with the client through the TCP protocol, the power consumption prediction model of each power user is trained through the task module based on the training set and the test set.
4. The method according to claim 1, characterized in that Sending the fused data to each of the power consumption prediction models for cyclic training until a general model is generated includes: The fused data is sent to each of the power consumption prediction models, and the loss function of the power consumption prediction model is used. And the loss function of the general model Do circuit training; By minimizing the mean absolute error Mean absolute percentage error and RMS error Evaluate and optimize the model after each training until a general model is generated; Among them, m represents the quantitative feature, y={y1,y2,…,y N } represents the predicted value, Indicates actual value.
5. The method according to claim 1, characterized in that The preprocessing of the sampled data includes: The data set of the electricity user is uploaded to each node, exception processing is performed, and the power consumption data is scaled using the Z-Score to obtain the pre-processed power consumption data with an average value of 0 and a standard deviation of 1.
6. A device based on a multi-household electricity consumption prediction model, characterized in that: The device comprises: A collection module, used to collect power consumption data to be predicted, wherein the power consumption data is data of each time period recorded in chronological order; An analysis module, used for performing abnormal processing and preprocessing on the power consumption data; A confirmation module is used to determine the training set and the test set based on the preprocessed data; A training module is used to train the power consumption prediction model of each power user based on the training set and the test set, and transmit the trained model parameters to the central server; the model parameters are integrated by the central server, and the integrated data is sent to each of the power consumption prediction models for cyclic training, and the network weights are updated using the Adam optimizer to obtain the gradient of the objective function under the current parameters until a general model is generated, wherein the power consumption prediction model is a model combining federated learning and BiLSTM, that is, a Fed_BiLSTM model, and the model combining federated learning and BiLSTM includes five parallel task modules and a central module, wherein each of the task modules is composed of a BiLSTM neural network layer and a fully connected layer; The prediction module is used to predict the electricity consumption of the electricity user to be predicted through a trained general model.
7. An electronic device comprising a processor and a memory, wherein a computer program is stored in the memory, wherein: When the computer program is executed by the processor, the prediction method based on the multi-household electricity consumption prediction model according to any one of claims 1 to 5 is performed.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the prediction method based on a multi-household electricity consumption prediction model as described in any one of claims 1 to 5 is executed.
Citation Information
Patent Citations
Network safety risk prediction method and device, storage medium and computer equipment
CN112906903A
Electric quantity demand prediction method and system based on federal ensemble learning
CN113139341A