A personalized electricity load forecasting method based on aggregate function

By establishing a personalized federated learning framework and a ensemble function model on edge nodes, combined with a multi-head attention mechanism, the personalized problem of power load prediction in the existing technology is solved, and accurate prediction of the power consumption mode of users in different regions is achieved, and prediction accuracy and service quality are improved.

CN118798320BActive Publication Date: 2025-08-19ELECTRIC POWER RES INST CHINA SOUTHERN POWER GRID CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410778077.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2025-08-19
Estimated Expiration
2044-06-17

AI Technical Summary

Technical Problem

The existing methods fail to effectively comprehensively analyze the comprehensive power load under a single station area or user in power load prediction, making it difficult to achieve personalized prediction, and cannot adapt to the differences in power consumption patterns of users in different regions, resulting in insufficient prediction accuracy.

Method used

Using a personalized federated learning framework, the raw data of power load is obtained through edge nodes, input the global model and local personalized model respectively, and iteratively updates are performed. Combining the set function and the multi-head attention mechanism, the timing dependence of irregularly sampled power time series is captured, and a personalized power load prediction model is established.

Benefits of technology

It realizes accurate prediction of the power consumption mode of users in different regions, improves prediction accuracy and service quality, adapts to the differences in power consumption modes in different regions, is suitable for irregular sampling of power time series, and has good scalability and practicality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118798320B_ABST
    Figure CN118798320B_ABST
Patent Text Reader

Abstract

The present invention provides a method for personalized electricity load forecasting based on a set function, comprising: an edge node obtaining raw electricity load data from each metering point within its region; inputting the raw electricity load data into a global model and a local personalized model, respectively, to obtain a global model prediction value and a local personalized model prediction value; wherein the edge node iteratively updates the model parameters of the global model and the local personalized model using the raw electricity load data, updates the local personalized model based on the updated model parameters, and sends the updated model parameters of the global model to the cloud, so that the cloud updates the global model based on the updated model parameters sent by each edge node. In response to the problem of differences in the distribution of electricity consumption patterns of users in different regions, the present invention proposes establishing a personalized model for each region based on a personalized federated learning framework to adapt to the differentiated electricity consumption patterns of different regions and achieve accurate electricity load forecasting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of electricity load forecasting, and in particular relates to a method for predicting personalized electricity load based on a set function. Background Art

[0002] With the increasing adoption of smart grids and the establishment of advanced metering systems, massive amounts of electricity consumption data are generated. This data can effectively help power companies forecast grid load. Accurate and secure load forecasting is crucial for power generation, transmission, and maintenance. Building deep learning models is currently a popular forecasting method. Power load data is inherently a time series. Existing methods, such as recurrent neural networks and Transformers, can effectively model the temporal dependencies in power load data, effectively mining the potential power consumption patterns of various electrical devices and achieving accurate load forecasting. To reduce data transmission costs and protect user privacy, federated learning strategies based on cloud-edge-device architectures have emerged, encompassing applications in power data collection, processing, and intelligent analysis. Typically, several edge nodes (edges) are deployed between a central cloud platform (cloud) and user terminals (ends) to receive user-side data from their respective distribution areas. Federated learning strategies are then employed across these edge nodes to achieve distributed training of a global model. Specifically, each edge node uses its own local data to adjust the global model and sends updated model weights to the central cloud server. The central server then averages the weight updates sent by all edge nodes to update the global model. As a new type of distributed machine learning technology, federated learning only sends model parameters and does not share original data, ensuring the efficiency and security of model training.

[0003] In general, existing methods use deep learning models to model the timing dependencies in power time series data, and use cloud-edge collaboration solutions and federated learning strategies to solve the efficiency and security issues that arise during model training in actual application scenarios.

[0004] However, when predicting user power load, existing methods primarily target individual users or individual devices within a user, focusing solely on mining the power usage patterns of a particular user or device. These methods fail to effectively analyze the overall power load forecast for a single substation or user, hindering the analysis of collective substation or user behavior patterns, group classification, and behavioral data mining, making personalized predictions difficult. Due to geographic and demographic differences between substations, as well as differences in user electricity usage habits, achieving aggregated personalized predictions can further improve prediction accuracy, enhance service quality, and enhance user experience. Summary of the Invention

[0005] In view of this, the present invention aims to provide a personalized electricity load forecasting method and related devices based on set functions, which are used to address the problem of differences in the distribution of electricity consumption patterns of users in different regions. It proposes to establish a personalized model for each region based on a personalized federated learning framework to adapt to the differentiated electricity consumption patterns in different regions and achieve accurate electricity load forecasting.

[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0007] In a first aspect, the present invention provides a method for predicting personalized electricity load based on a set function, comprising the following steps:

[0008] The edge node obtains the original data of power load at each metering point in the area to which it belongs;

[0009] Inputting the original data of power load into the global model and the local personalized model respectively to obtain the global model prediction value and the local personalized model prediction value;

[0010] Among them, the edge node generates a local personalized model based on the global model initialization obtained from the cloud, and uses the original power load data to iteratively update the model parameters of the global model and the local personalized model, updates the local personalized model based on the updated model parameters, and sends the model parameter update amount of the global model to the cloud, so that the cloud can update the global model according to the model parameter update amount sent by each edge node. The global model and the local personalized model are both power load prediction models.

[0011] Furthermore, the updating of the global model and the local personalized model at the edge node includes the following steps:

[0012] The edge node inputs the data of the local historical window into the global model and obtains updated global model parameters based on the difference between the data output by the global model and the data of the prediction window. The data of the local historical window and the prediction window are obtained by dividing the original power load data into a sliding window in chronological order.

[0013] Inputting data from the local history window into the local personalized model, and obtaining updated local personalized model parameters based on the difference between the data output by the local personalized model and the data from the prediction window;

[0014] Obtaining an update amount of the global model parameters based on the updated global model parameters, and sending the update amount to the cloud, so that the cloud updates the global model according to the update amount sent by each edge node;

[0015] The local personalized model is updated based on the updated local personalized model parameters.

[0016] Furthermore, the power load forecasting model is a power load forecasting model based on a set function, and the input of the power load forecasting model based on a set function is a triplet of s j =(t j ,z j ,m j ), where s j is the jth power load sampling point, t j is the sampling time of the jth power load sampling point, z j is the power load value of the jth power load sampling point, m j is the terminal type of the source of the jth power load sampling point. The power load forecasting model based on the aggregate function adapts to the original power load data of the irregularly sampled power time series through the input data in the form of triples.

[0017] Furthermore, the training steps of the power load forecasting model based on the aggregate function include:

[0018] Extract sample data for model training from the original electricity load data;

[0019] Preprocess the sample data in triple form;

[0020] The pre-processed sample data is input into the power load forecasting model based on the feedforward neural network to obtain the power load forecast value;

[0021] According to the difference between the power load prediction value and the actual power load value, the model parameters of the power load prediction model based on the feedforward neural network are updated to obtain an updated power load prediction model;

[0022] Among them, the multi-head attention mechanism method is used in the power load forecasting model based on the feedforward neural network to capture the potential temporal dependencies in the irregularly sampled power time series corresponding to the sample data, and to mine the user's power consumption characteristics.

[0023] Furthermore, before preprocessing the sample data in triple form, the following steps are also included:

[0024] According to the set historical window length and the window length to be predicted, pairs of historical window data and prediction window data are extracted from the sample data;

[0025] The historical window data is used as input data for the power load forecasting model based on the feedforward neural network to obtain the power load forecast value; the forecast window data is used as the actual power load value to update the power load forecasting model based on the feedforward neural network.

[0026] Furthermore, the sample data in triple form is preprocessed, including:

[0027] The sampling time t of each sampling point triplet j The continuous sine and cosine time coding method is used to encode it into a τ-dimensional vector, and we get:

[0028]

[0029] Where, e t is the sampling time t j The corresponding τ-dimensional vector, x 2k (t j ) and x 2k+1 (t j ) represent the even and odd bits of the τ-dimensional vector, k∈{0,...,τ / 2}, represents a vector of dimension τ;

[0030] For each sampling point triplet terminal type m j The pre-trained language model BERT is used to encode the text semantic representation vector, and then the feedforward neural network FFN is used to map the text semantic representation vector into a τ-dimensional vector to obtain:

[0031]

[0032] Where, e m For terminal type m j The corresponding τ-dimensional vector, U m , W m , b m is the parameter matrix of the feedforward neural network, and tanh is the hyperbolic tangent activation function.

[0033] The power load value z of each sampling point triplet j Use feedforward neural network FFN to map it into a τ-dimensional vector and get:

[0034]

[0035] Where, e z is the power load value z j The corresponding τ-dimensional vector, U z , W z , b z is the parameter matrix of the feedforward neural network.

[0036] Furthermore, a multi-head attention mechanism is used to capture the potential temporal dependencies in the irregularly sampled power time series corresponding to the sample data, including:

[0037] Using dot product attention with h attention heads, for the i-th head, respectively, by learning the matrix and bond matrix Any observation point s in the historical window datax The encoding vector h(s x ) is mapped to the d-dimensional Query vector and Key vector, that is:

[0038]

[0039] Where, and Represent the Query vector and Key vector respectively, represents a vector of dimension τ×d, represents a vector of dimension d;

[0040] Then calculate any two observation points s x and s y The attention score between the i-th head

[0041]

[0042] Where exp() represents the exponential operation with the natural logarithm e as the base, and any observation point s can be obtained by weighted summing all other M observation points through the attention score x The output vector of the i-th head

[0043]

[0044] Where, is the observation point s x and s j The attention score between the i-th head.

[0045] Furthermore, the triple s j The encoding vector h(s j ) is as follows:

[0046]

[0047] Furthermore, based on the output vectors obtained by the h attention heads, the expression of the user's electricity consumption characteristics is obtained through the feedforward neural network FFN as follows:

[0048] u i =FFN(o i )

[0049]

[0050] Where, superscript i is the number of h attention heads, subscript i is the user number, u i is the feature representation of the i-th user, o i is the output vector of the i-th attention head, o iis the output vector aggregation matrix of the i-th user, and |H| represents the number of observation points in the historical window.

[0051] Furthermore, the expression of the power load forecast value is as follows:

[0052]

[0053] Where, represents user i's m pred Equipment in t pred The power load forecast value at the moment, || represents the concatenation of vectors.

[0054] In a second aspect, the present invention further provides a personalized electricity load forecasting system based on a set function, comprising: a smart metering device, an edge node, and a central cloud server;

[0055] The edge node is used to obtain the original data of power load of each metering point in the area through the smart metering device;

[0056] The edge node inputs the original power load data into the global model and the local personalized model respectively to obtain the global model prediction value and the local personalized model prediction value;

[0057] Among them, the edge node generates a local personalized model based on the global model initialization obtained from the central cloud server, and uses the original power load data to iteratively update the model parameters of the global model and the local personalized model, updates the local personalized model based on the updated model parameters, and sends the model parameter update amount of the global model to the central cloud server, so that the central cloud server updates the global model according to the model parameter update amount sent by each edge node. The global model and the local personalized model are both power load prediction models.

[0058] Accordingly, the present invention further provides a computer device, comprising a processor and a memory:

[0059] The memory is used to store computer programs and send instructions of the computer programs to the processor;

[0060] The processor executes the first aspect of the personalized electricity load forecasting method based on a set function according to the instructions of the computer program.

[0061] Correspondingly, the present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for predicting personalized electricity load based on a set function as described in the first aspect is implemented.

[0062] In summary, the present invention provides a method for personalized electricity load prediction based on a set function, including an edge node obtaining the original electricity load data of each metering point in the region to which it belongs; inputting the original electricity load data into a global model and a local personalized model respectively to obtain a global model prediction value and a local personalized model prediction value; wherein, the edge node generates a local personalized model based on the global model initialization obtained from the cloud, and iteratively updates the model parameters of the global model and the local personalized model using the original electricity load data, updates the local personalized model based on the updated model parameters, and sends the model parameter update amount of the global model to the cloud so that the cloud updates the global model based on the model parameter update amount sent by each edge node. Both the global model and the local personalized model are electricity load prediction models. In response to the problem of differences in the distribution of electricity consumption patterns of users in different regions, the present invention proposes to establish a personalized model for each region based on a personalized federated learning framework to adapt to the differentiated electricity consumption patterns of different regions and achieve accurate electricity load prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] 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.

[0064] Figure 1 The overall framework diagram of the personalized electricity load forecasting method based on the set function provided by the embodiment of the present invention;

[0065] Figure 2 A structural diagram of a user electricity load forecasting model based on a set function provided in an embodiment of the present invention;

[0066] Figure 3 A structural diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0067] In order to make the purposes, features, and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0068] This embodiment provides a method for predicting personalized electricity load based on a set function, including the following steps:

[0069] S1: The edge node obtains the original data of power load at each metering point in the area.

[0070] S2: Input the original power load data into the global model and the local personalized model respectively to obtain the global model prediction value and the local personalized model prediction value;

[0071] Among them, the edge node generates a local personalized model based on the global model initialization obtained from the cloud, and uses the original power load data to iteratively update the model parameters of the global model and the local personalized model, updates the local personalized model based on the updated model parameters, and sends the model parameter update amount of the global model to the cloud, so that the cloud can update the global model according to the model parameter update amount sent by each edge node. The global model and the local personalized model are both power load prediction models.

[0072] It should be noted that in cloud-edge-device collaboration solutions, edge devices can be individual user electricity metering devices, such as new meters with edge computing capabilities, or terminals with edge computing capabilities at user substations. Data from different users or substations will exhibit different data distributions. Existing federated learning strategies, which simply weighted average the parameter updates generated by training a global model using data from different regions, are too coarse-grained. This makes the resulting integrated global model ineffective in expressing the fine-grained characteristics of power time series data. Specifically, it cannot accurately capture the personalized electricity consumption patterns unique to different users or substations. This results in the model's predicted values lacking regional characteristics and resulting in poor prediction performance.

[0073] In this embodiment, a local personalized model is deployed at the edge node. This model is initialized and generated by the edge node based on the global model provided by the cloud. The edge node uses the raw load data for its region as a data foundation to continuously update the model parameters of the local personalized model. This generates a load forecast model that is tailored to the user's electricity usage characteristics within the region. Using this local personalized model for forecasting accurately captures the unique electricity usage patterns of different users or substations, providing regionally specific prediction values and achieving superior personalized forecasting results.

[0074] In addition, the edge nodes also use the original data of power load to train the global model to obtain the model parameters of the global model that take into account the power consumption patterns of users in the area. During the iterative training of the global model by all edge nodes, the updated model parameter update amount after each update is sent to the cloud. The cloud can then update the global model based on the model update amount information provided by all edge nodes.

[0075] It can be seen that compared with the federated learning strategy in the prior art, the local personalized model trained in this embodiment is suitable for personalized prediction of user electricity consumption in the area to which it belongs, while the trained global model can take into account the electricity consumption patterns of users in all areas. After the personalized power load prediction model is deployed, it can accurately predict the power load of users in different areas. The predicted value after the global model is deployed can provide a reference for global power allocation, thereby solving the problem that there are differences in the distribution of user electricity consumption patterns in different regions and accurate prediction cannot be achieved.

[0076] This embodiment provides a personalized electricity load forecasting method based on a set function. This method establishes a model for a sequence of sampling points consisting of electricity load metering points for all smart devices in a single user or a single substation, enabling personalized electricity consumption pattern mining and power load forecasting. This is beneficial for improving prediction accuracy, achieving efficient resource allocation, and thus improving service quality. In response to the differentiated electricity consumption models of users in different regions, this patent incorporates a personalized federated learning strategy based on the cloud-edge federated learning structure, customizing a personalized power load model for each region, further increasing prediction accuracy.

[0077] In a preferred embodiment of the present invention, updating the global model and the local personalized model at the edge node includes the following steps:

[0078] S21: The edge node inputs the data of the local historical window into the global model, and obtains updated global model parameters based on the difference between the data output by the global model and the data of the prediction window. The data of the local historical window and the data of the prediction window are the data obtained by dividing the original power load data in chronological order through a sliding window.

[0079] S22: Inputting the data of the local history window into the local personalized model, and obtaining updated local personalized model parameters based on the difference between the data output by the local personalized model and the data of the prediction window;

[0080] S23: Obtaining an update amount of the global model parameters based on the updated global model parameters, and sending the update amount to the cloud, so that the cloud updates the global model according to the update amount sent by each edge node;

[0081] S24: Update the local personalized model based on the updated local personalized model parameters.

[0082] It should be noted that edge nodes can iteratively update global model parameters and local personalized model parameters through the back gradient propagation algorithm.

[0083] Please refer to the figure Figure 1In a specific implementation of this embodiment, the overall process of the personalized electricity load forecasting method based on the aggregate function is implemented based on the update method of the global model and the local personalized model at the edge node. Figure 1 As shown. The following combination Figure 1 The overall process of this method is introduced, which includes the following steps:

[0084] Step S31: Each smart metering device regularly reports the original data of the electricity load of the metering point (including user ID, electricity address, metering point ID, user category), and transmits the data to the nearest edge node (meter or terminal).

[0085] Step S32: The cloud center server randomly initializes a global power load forecasting model based on a collective function (the detailed design scheme of the model will be described later) and transmits its parameter w to each edge node.

[0086] Step S33: Each edge device uses the model parameter w received from the cloud center server to initialize the local personalized model to adapt to the differentiated power consumption patterns in different regions and achieve accurate power load prediction. For the kth edge node, the initialization parameter of its personalized model is v k , where 1≤k≤K, K is the total number of edge nodes, and the original user data in the local area in step S1 is divided into a historical window and a prediction window in chronological order through a sliding window.

[0087] Step S34: Each edge device inputs the data of the local historical window into the latest global model w received from the cloud center server to obtain the predicted output. Then, the mean square error between the predicted output and the actual sample value of the prediction window is calculated as the global model optimization objective function, and the global model parameters are iteratively updated through the back gradient propagation algorithm:

[0088]

[0089] In the above formula, w k Represents the updated parameters of the global model trained at the kth edge node region, η g is a pre-set learning rate, Represents the objective function F k For the model parameter w k The obtained gradient, the model iteratively updates r rounds, initially, w k =w.

[0090] Step S35: Each edge device inputs the data of the historical window into the local personalized model of its own area to obtain the predicted output. It then calculates the mean square error between the predicted output and the actual sampled value of the prediction window as the local model optimization objective function, and updates the local personalized model parameters using the back gradient propagation algorithm:

[0091]

[0092] In the above formula, v k represents the personalized model parameters of the kth edge node, η1 represents the pre-set learning rate, represents the gradient of the objective function with respect to the local personalized model parameters, and w is the parameter of the global model before iterative update in step S4. is a regularization term, and λ is a pre-set hyperparameter that adjusts the proportion of global and local personalized models. In particular, when λ→+∞, Can be regarded as 0, then only v k When λ is -w, the minimum value is achieved, and the results of the local personalized model approximate those of the global model. When λ→0, the local model is trained independently using local data. In practical applications, the setting of λ is flexible and can be adjusted according to the degree of regional electricity consumption to achieve a balance between personalized and global considerations.

[0093] Step S36: Each edge node calculates its own update amount for the global model parameters:

[0094] Δ k =w k -w

[0095] And send this updated amount to the cloud center server.

[0096] Step S37: The cloud center server aggregates the global model parameter update amounts sent by each edge node to update the global model parameters:

[0097]

[0098] Step S38: The cloud center server sends the updated parameter weight w back to each edge node.

[0099] Step S39: Repeat steps S34-S38 until the maximum number of iterations T is reached, and finally obtain the personalized power load forecasting model of each regional edge node (the corresponding parameter set is {v k} k∈[K] ) and a global model in a cloud center (the corresponding parameter is w). After the personalized power load forecasting model is deployed, it can accurately predict the power load of users in different regions. The predicted value after the global model is deployed can provide a reference for global power allocation.

[0100] Furthermore, if the power load of each load-monitorable electrical device is considered a variable, the sampling series of all devices owned by a user constitute a multivariate time series. If the power load of each user in a substation is considered a variable, the sampling series of all users in a substation constitute a multivariate time series. Existing techniques for analyzing multivariate power time series typically require a predetermined number of sampling devices, while also ensuring uniform sampling intervals and aligned sampling times across devices. However, in real-world power load scenarios, user-side sampling devices are diverse, such as private charging stations, air conditioners, and lighting. Furthermore, the number of electrical devices is increasing, leading to fluctuations in the number of devices over time. This makes it difficult to determine the sampling number in advance, and coupling the model design with the number of sampling devices makes the model difficult to scale. The sampling intervals between devices vary, and these can also be caused by communication failures, device malfunctions, and other factors. Furthermore, clock synchronization issues between devices can affect sampling time alignment. These practical problems result in the fact that the time series of power load data actually obtained for a single user or a single substation presents irregular sampling characteristics (uneven sampling intervals and non-uniform sampling times), and most power time series prediction technologies cannot be directly applied to scenarios with irregular power time series.

[0101] Aiming at the problem that the user's power load data has the characteristics of irregular sampling and the existing power time series analysis model cannot be directly applied to this scenario, a user power load forecasting model based on aggregate function is proposed. The structure of the model is as follows Figure 2 As shown, the following combination Figure 2 The user power load forecasting model based on aggregate function is introduced.

[0102] In a preferred embodiment of the present invention, the input of the model is a triplet of s j =(t j ,z j ,m j ), where s j is the jth power load sampling point, t j is the sampling time of the jth power load sampling point, z j is the power load value of the jth power load sampling point, m j is the terminal type of the source of the jth power load sampling point. The power load forecasting model based on the aggregate function adapts to the original power load data of the irregularly sampled power time series through the input data in the form of triples.

[0103] Specifically, the cloud master station establishes the topological relationship of all smart devices under each user or users under each substation, including user ID, electricity address, user type, metering point ID field or substation ID, user ID, electricity address, and user type, and obtains the sampling sequence of all devices under each user (such as different types of users such as private charging piles, shops, or air conditioners, lighting, etc. near the address under a certain user) or users under each substation.

[0104] The time series of the power load sampling of the user's irregular sampling can be expressed as a set of observation points, using S i ={s1,s2,…,s M} represents the set of all power load sampling points of all smart terminals under the i-th user, with a size of M, where any sampling point s j It can be expressed as a triple, namely s j =(t j ,z j ,m j ), where t j represents the sampling time of the observation point, z j Represents the collected power load value, m j A string representing the terminal type of the sampling point. For example, if a user's charging pile samples a power load value of 7 kW at 01:00 on April 1, 2024, the sampling point is represented as (20240401010000,7,"charging pile"). This triple representation method can represent the sampling point of any device at any time, without having to meet the constraints of uniform sampling intervals for the same device and consistent sampling rates for different devices.

[0105] In a preferred embodiment of the present invention, a method for training an electricity load forecasting model based on a set function is proposed, comprising the following steps:

[0106] S41: extracting sample data for model training from the original power load data;

[0107] S42: Preprocessing the sample data in triple form;

[0108] S43: inputting the preprocessed sample data into a power load forecasting model based on a feedforward neural network to obtain a power load forecast value;

[0109] S44: updating the model parameters of the power load prediction model based on the feedforward neural network according to the difference between the power load prediction value and the actual power load value, and obtaining an updated power load prediction model;

[0110] Among them, the multi-head attention mechanism method is used in the power load forecasting model based on the feedforward neural network to capture the potential temporal dependencies in the irregularly sampled power time series corresponding to the sample data, and to mine the user's power consumption characteristics.

[0111] The multi-head attention mechanism is a neural network-based attention mechanism. By introducing multiple attention heads, it can simultaneously focus on multiple different feature subspaces, thereby more comprehensively capturing the associations and patterns in multivariate time series data. The multi-head attention mechanism plays a vital role in time series analysis, helping us better understand the interactions between different variables, thereby improving the model's representational and generalization capabilities.

[0112] In this embodiment, the multi-head attention mechanism is used to capture the potential temporal dependencies in irregularly sampled power time series. At the same time, this embodiment uses a feedforward neural network to build a power load forecasting model.

[0113] In a preferred embodiment of the present invention, before step S42, it also includes: extracting paired historical window data and prediction window data from the sample data according to the set historical window length and the window length to be predicted; the historical window data is used as input data of the power load prediction model based on the feedforward neural network to obtain the power load prediction value; the prediction window data is used as the actual power load value to update the power load prediction model based on the feedforward neural network.

[0114] Specifically, the length of the historical window and the length of the window to be predicted are selected according to actual needs, and paired historical windows H are extracted from the original sampling point set by the sliding window method in chronological order. i and prediction window P i , where 1≤i≤N (N is the number of windows), constitutes the historical window set and the prediction window set. The historical window set will serve as the input of the model, and the prediction window set will serve as the actual result of the corresponding input, which is the target of the model output prediction.

[0115] In a preferred embodiment of the present invention, preprocessing the sample data in triplet form includes encoding each sampling point triplet, specifically as follows:

[0116] 1) Encode the sampling time portion of each sampling point triplet. j =(t j ,z j ,m j ), we use continuous sine and cosine time coding to convert the observation time t j Encoded into a τ-dimensional vector, the odd and even bits of the vector are:

[0117]

[0118] Where k∈{0,...,τ / 2}, any sampling moment on the continuous time axis can be encoded, so that any sampling moment in the historical window set corresponds to a τ-dimensional encoding vector, that is,

[0119] 2) Encode the source device type of each sampling point. In actual power scenarios, the types of sampling devices may increase or decrease, and the encoding format of the One-Hot vector requires the number of types to be determined in advance, which is not conducive to expansion in actual scenarios. In the present invention, for the sampling point triplet s j =(t j ,z j ,m j ), we encode the sampled device type string m through the pre-trained language model BERT j , and obtain its text semantic representation vector (768 dimensions), and then use the feedforward neural network to map the vector into a τ-dimensional vector, that is: Among them U m , W m , b m is the parameter matrix of the network, and tanh is the hyperbolic tangent activation function. Due to the flexibility of the pre-language model, this encoding method can encode any word without having to determine the type of sampling device to be analyzed in advance, which greatly improves the scalability of the model.

[0120] 3) Encode the sampling point tuple. In the present invention, for the sampling point s j =(t j ,z j ,m j ), we use a feedforward neural network to map the sampled value scalar into a τ-dimensional vector, namely:

[0121] Thus, the τ-dimensional vector encoding of the sampling time, sampling device type, and sampling value in each tuple is obtained respectively.

[0122] In a preferred embodiment of the present invention, the encoding results of the three parts of each observation tuple are added together to obtain the encoding vector of the entire observation tuple:

[0123]

[0124] The encoding vector based on the entire observation tuple is further processed using a multi-head attention mechanism.

[0125] In a preferred embodiment of the present invention, a multi-head attention mechanism is used to capture the potential temporal dependencies in the user's historical window observation set and mine the user's electricity usage pattern. In this invention, we consider a dot product attention with h attention heads. For the i-th head, we respectively Matrix and The matrix transforms any observation triple s x The encoding vector h(s x ) is mapped to the d-dimensional Query vector and Key vector, that is:

[0126]

[0127] Then calculate any two observation points s x and s y The attention score between the i-th head

[0128]

[0129] In the above formula, exp() represents the exponential operation with the natural logarithm e as the base. Any observation point s can be obtained by weighted summing all other M observation points through the attention score x The output vector of the i-th head:

[0130]

[0131] In a further embodiment of the present invention, the output vectors of all observation points in the historical window are aggregated using mean aggregation, namely:

[0132]

[0133] Where |H| represents the number of observation points in the history window. By performing steps S2.6-S2.7 on each of the h attention heads, we can obtain the output matrix This matrix is finally passed through the feedforward neural network (FFN) to obtain the user-level feature representation. For the i-th user, its feature representation is u i =FFN(o i ).

[0134] In this embodiment, addressing the irregular sampling characteristics of power load time series data in real-world scenarios, a power load forecasting model based on a set function is designed. This model encodes any moment in time through continuous time coding, encodes the sampled device type using a pre-trained language model, and extracts temporal correlations within user power usage sequences through a self-attention mechanism. This model is suitable for the ever-increasing number of smart device types, uneven sampling intervals for the same device, and misaligned sampling points across multiple devices, demonstrating excellent scalability.

[0135] In a further embodiment of the present invention, the power load forecasting model based on the feedforward neural network calculates the forecast result of the point to be forecasted. Specifically, the m pred Equipment in t pred Power load forecast value at the moment It can be calculated by the following formula:

[0136]

[0137] Among them, || represents the concatenation of vectors.

[0138] The personalized electricity load forecasting method based on the set function proposed in the above embodiment has the following advantages and effects compared with the existing technology:

[0139] 1. The present invention models electricity usage sequences at the user level, focusing on accurately mining personalized electricity usage patterns on the user side, while the existing technology mainly focuses on the electricity usage status on the device side, and does not accurately distinguish specific users.

[0140] 2. The present invention designs a prediction model based on set functions for irregularly sampled power series prediction scenarios. It processes sampling points at any time through continuous time coding technology and uses a pre-trained model to distinguish different types of sampling devices. Compared with existing power prediction models, the present invention has stronger scalability, no special requirements for the sampling frequency of the sampling device, and can also be well applied when the sampling rates of different sampling devices are different and the sampling points are irregular. In the context of the increasing number of smart device terminals, it has strong practicality.

[0141] 3. The present invention deploys a distributed electricity consumption forecasting model based on the cloud-edge federated learning strategy, introduces a personalized federated learning regularization term, and trains personalized power load forecasting models for each region and a global forecasting model at the same time. Compared with existing federated learning solutions, it achieves more accurate regional forecasting accuracy and can provide a macro-effective reference for global power allocation.

[0142] Based on the same inventive concept, the embodiments of the present application also provide a set function-based personalized electricity load forecasting system for implementing the above-mentioned set function-based personalized electricity load forecasting method. The implementation solution provided by this system is similar to the implementation solution described in the above-mentioned method. Therefore, the specific limitations of the embodiment of the set function-based personalized electricity load forecasting system provided below can be found in the above-mentioned limitations of the set function-based personalized electricity load forecasting method, and will not be repeated here.

[0143] This embodiment provides a personalized electricity load forecasting system based on a set function, comprising: a smart metering device, an edge node, and a central cloud server;

[0144] The edge node is used to obtain the original data of power load of each metering point in the area through the smart metering device;

[0145] The edge node inputs the original power load data into the global model and the local personalized model respectively to obtain the global model prediction value and the local personalized model prediction value;

[0146] Among them, the edge node generates a local personalized model based on the global model initialization obtained from the central cloud server, and uses the original power load data to iteratively update the model parameters of the global model and the local personalized model, updates the local personalized model based on the updated model parameters, and sends the model parameter update amount of the global model to the central cloud server, so that the central cloud server updates the global model according to the model parameter update amount sent by each edge node. The global model and the local personalized model are both power load prediction models.

[0147] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0148] Reference Figure 3 , an embodiment of the present invention further provides a computer device 3, comprising: a memory 302 and a processor 301 and a computer program 303 stored in the memory 302. When the computer program 303 is executed on the processor 301, it implements the personalized electricity load forecasting method based on the set function as described in any one of the above methods.

[0149] The computer device 3 may be a desktop computer, a notebook computer, a PDA, a cloud server or other computing devices. The computer device 3 may include, but is not limited to, a processor 301 and a memory 302. Those skilled in the art will understand that Figure 3This is merely an example of the computer device 3 and does not constitute a limitation on the computer device 3 . The computer device 3 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device 3 may also include input and output devices, network access devices, etc.

[0150] The processor 301 may be a central processing unit (CPU), or 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, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.

[0151] In some embodiments, the memory 302 may be an internal storage unit of the computer device 3, such as a hard disk or memory of the computer device 3. In other embodiments, the memory 302 may also be an external storage device of the computer device 3, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the computer device 3. Furthermore, the memory 302 may include both an internal storage unit of the computer device 3 and an external storage device. The memory 302 is used to store an operating system, application programs, a boot loader, data, and other programs, such as the program code of the computer program. The memory 302 may also be used to temporarily store data that has been output or is about to be output.

[0152] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for personalized electricity load forecasting based on a set function as described in any one of the above methods is implemented.

[0153] In this embodiment, if the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process of the above-mentioned method embodiment by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of each of the above-mentioned method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium can at least include: any entity or device capable of carrying computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal, and software distribution medium. For example, a USB flash drive, mobile hard drive, magnetic disk, or optical disk. In some jurisdictions, based on legislation and patent practice, computer-readable media cannot be electric carrier signals or telecommunication signals.

[0154] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0155] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0156] In the embodiments disclosed in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as 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 interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0157] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A personalized electricity load forecasting method based on aggregate functions, characterized in that: The steps include: The edge node obtains the original data of power load at each metering point in the area to which it belongs; Inputting the power load raw data into the global model and the local personalized model respectively to obtain the global model prediction value and the local personalized model prediction value; The edge node generates the local personalized model based on the global model initialization obtained from the cloud, and iteratively updates the model parameters of the global model and the local personalized model using the original power load data. The local personalized model is updated based on the updated model parameters, and the model parameter update amount of the global model is sent to the cloud, so that the cloud updates the global model based on the model parameter update amount sent by each edge node. The global model and the local personalized model are both power load prediction models. The power load forecasting model is a power load forecasting model based on a set function, and the input of the power load forecasting model based on a set function is a triplet of s j =(t j ,z j ,m j ), where s j is the jth power load sampling point, t j is the sampling time of the jth power load sampling point, z j is the power load value of the jth power load sampling point, m j is the terminal type of the source of the j-th power load sampling point, and the power load forecasting model based on the aggregate function adapts to the original power load data of the irregularly sampled power time series through the input data in the form of triples.

2. The method for predicting personalized electricity load based on aggregate function according to claim 1, characterized in that: The updating of the global model and the local personalized model at the edge node includes the following steps: The edge node inputs data from a local historical window into the global model, and obtains updated global model parameters based on the difference between the data output by the global model and the data from the prediction window, wherein the data from the local historical window and the data from the prediction window are obtained by dividing the original power load data in chronological order through a sliding window. Inputting data of a local history window into the local personalized model, and obtaining updated local personalized model parameters based on the difference between the data output by the local personalized model and the data of the prediction window; Obtaining an update amount of the global model parameter based on the updated global model parameter, and sending the update amount to the cloud, so that the cloud updates the global model according to the update amount sent by each edge node; The local personalized model is updated based on the updated local personalized model parameters.

3. The method for predicting personalized electricity load based on aggregate function according to claim 1, characterized in that: The training steps of the electricity load forecasting model based on the aggregate function include: Extracting sample data for model training from the raw power load data; Preprocessing the sample data in triple form; Inputting the preprocessed sample data into a power load forecasting model based on a feedforward neural network to obtain a power load forecast value; updating the model parameters of the feedforward neural network-based power load forecasting model according to the difference between the power load forecast value and the actual power load value, and obtaining the updated power load forecasting model; Among them, the power load forecasting model based on the feedforward neural network adopts a multi-head attention mechanism method to capture the potential temporal dependencies in the irregularly sampled power time series corresponding to the sample data, and mine the user's power consumption characteristics.

4. The method for predicting personalized electricity load based on aggregate function according to claim 3 is characterized in that: Before preprocessing the sample data in triple form, the method further includes: Extracting paired historical window data and predicted window data from the sample data according to the set historical window length and the window length to be predicted; The historical window data is used as input data of the power load prediction model based on the feedforward neural network to obtain the power load prediction value; the prediction window data is used as the actual power load value to update the power load prediction model based on the feedforward neural network.

5. The method for predicting personalized electricity load based on aggregate function according to claim 4 is characterized in that: The sample data in triple form is preprocessed, including: The sampling time t of each sampling point triplet j The continuous sine and cosine time coding method is used to encode it into a τ-dimensional vector, and we get: Where, e t is the sampling time t j The corresponding τ-dimensional vector, x 2k (t j ) and x 2k+1 (t j ) represent the even and odd bits of the τ-dimensional vector, k∈{0,...,τ / 2}, represents a vector of dimension τ; For each sampling point triplet terminal type m j The pre-trained language model BERT is used to encode the text semantic representation vector, and then the feedforward neural network FFN is used to map the text semantic representation vector into a τ-dimensional vector to obtain: Where, e m For terminal type m j The corresponding τ-dimensional vector, U m , W m , b m is the parameter matrix of the feedforward neural network, and tanh is the hyperbolic tangent activation function; The power load value z of each sampling point triplet j The feedforward neural network FFN is used to map into a τ-dimensional vector, and the following is obtained: Where, e z is the power load value z j The corresponding τ-dimensional vector, U z , W z , b z is the parameter matrix of the feedforward neural network.

6. The method for predicting personalized electricity load based on aggregate function according to claim 5, characterized in that: The multi-head attention mechanism is used to capture the potential temporal dependencies in the irregularly sampled power time series corresponding to the sample data, including: Using dot product attention with h attention heads, for the i-th head, respectively, by learning the matrix and bond matrix Any observation point s in the historical window data x The encoding vector h(s x ) is mapped to the d-dimensional Query vector and Key vector, that is: Where, and Represent the Query vector and Key vector respectively, represents a vector of dimension τ×d, represents a vector of dimension d; Then calculate any two observation points s x and s y The attention score between the i-th head Where exp() represents the exponential operation with the natural logarithm e as the base, and any observation point s can be obtained by weighted summing all other M observation points through the attention score x The output vector of the i-th head Where, is the observation point s x and s j The attention score between the i-th head.

7. The method for predicting personalized electricity load based on aggregate function according to claim 6, characterized in that: Triples j The encoding vector h(s j ) is as follows:

8. The method for predicting personalized electricity load based on aggregate function according to claim 6, characterized in that: Based on the output vectors obtained by h attention heads, the expression of the user's electricity consumption characteristics is obtained through the feedforward neural network FFN as follows: u i =FFN(o i ) Where, superscript i is the number of h attention heads, subscript i is the user number, u i is the feature representation of the i-th user, o i is the output vector of the i-th attention head, o i is the output vector aggregation matrix of the i-th user, and |H| represents the number of observation points in the historical window.

9. The method for predicting personalized electricity load based on aggregate function according to claim 8, characterized in that: The expression of the power load prediction value is as follows: Where, represents user i's m pred Equipment in t pred The power load forecast value at the moment, || represents the concatenation of vectors.

Citation Information

Patent Citations

  • Federal learning method based on double-layer gradient descent

    CN118171718A