Household electricity short-term load prediction method and system

By combining multi-scale Transformer and diffusion models, it solves the shortcomings of traditional networks in capturing long-distance dependencies and adapting to variable-length sequence data in short-term household electricity load forecasting, achieving higher forecast accuracy and stability, and is suitable for households Short-term load forecasting of electricity consumption.

CN118586559APending Publication Date: 2024-09-03XIAN UNIV OF TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410862568.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

Traditional recurrent neural networks and long short-term memory networks are difficult to capture long-distance dependencies when processing short-term household electricity load data, and have insufficient ability to adapt to variable long sequence data. Moreover, household load has weak periodicity and strong uncertainty, resulting in low prediction accuracy. .

Method used

A short-term load forecasting method based on the combination of multi-scale Transformer and diffusion model is adopted. By acquiring and cleaning electrical appliance time series data and meteorological data, adding time features and performing feature merging processing, an improved Transformer encoder and diffusion model are constructed, and the model parameters are optimized. To achieve accurate prediction of short-term household load.

Benefits of technology

It improves the accuracy and robustness of short-term household electricity load forecasting, can better capture long-distance dependencies and uncertainties in data, enhances the generalization ability and prediction stability of the model, and is suitable for different household environments. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118586559A
    Figure CN118586559A
Patent Text Reader

Abstract

The invention discloses a household electricity short-term load prediction method and system, and belongs to the technical field of short-term power load prediction. The method comprises the following steps: firstly, acquiring load data and meteorological data of each household electric appliance through a sensor, and performing data cleaning and feature processing including time feature addition and feature combination; then, constructing a prediction model by adopting a multi-scale Transform and a diffusion model, and obtaining an optimal prediction model through training and parameter optimization; the optimal prediction model comprises an improved Transform encoder, a diffusion model and a Transform decoder, and the consistency in the data transmission process is ensured; in the prediction stage, the trained prediction model is used for predicting the family short-term load, a prediction result is converted into an original data range through an inverse transformation function, a final family load prediction result is obtained, and efficient prediction capacity is shown in a family scene.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] According to data from the National Energy Administration of China, by the end of 2023, China has installed more than 500 million smart meters, covering most urban and rural areas. This data shows that the popularity of smart meters has reached a fairly high level, providing a solid data foundation for household load forecasting. Smart meters can collect users' electricity consumption data in real time, including detailed information such as voltage, current, and power, which are essential for accurate load forecasting. Secondly, through accurate load forecasting, Chinese households can save an average of about 10% of their electricity bills each year, equivalent to about 200 yuan per household per year. This can not only reduce the economic burden of households, but also improve the overall energy efficiency. In recent years, with the rapid development of computer science and artificial intelligence, machine learning technology has been introduced into short-term load forecasting. These include artificial neural networks (ANN), support vector machines (SVM), random forests (RF), and long short-term memory (LSTM). Chen et al., the winners of the 2001 EUNITE load forecasting competition, were the first team to apply the support vector machine method to load forecasting. Since then, researchers have proposed various SVM-based forecasting methods to obtain more accurate forecasting results. In order to provide a high-precision and high-resolution short-term load forecasting method, Jiang et al. proposed a predictor based on support vector regression (SVR) and a forecasting method based on hybrid parameter optimization. Barman et al. proposed a regional hybrid short-term load forecasting model considering regional climatic conditions, which adopted the SVR model and locust optimization algorithm. The results show that the model has higher accuracy than the traditional short-term load forecasting model with temperature as the only climatic factor. The least squares support vector machine is an extension of the standard support vector machine, which uses nonlinear mapping to transform the second optimal inequality constraint problem in the original space into a linear system with equality constraints in the feature space, thereby improving the convergence speed and accuracy. In 2001, Breiman pioneered the introduction of the RF algorithm, which is an algorithm based on supervised learning ensemble learning and random attribute subspace theory. Later, the RF algorithm was applied to load forecasting problems, such as RF integrating multiple decision trees to form a classifier with strong generalization ability, fewer parameters and high prediction accuracy. Furthermore, Wu et al. improved the RF method and proposed a splitting algorithm based on grayscale projection. The experimental results showed that the algorithm has high prediction accuracy and robustness. In addition, Kong et al. proposed a prediction method based on deep belief network, which takes into account the influence of temperature and humidity. This method has been shown to have higher prediction accuracy, especially when the training sample is large and the influencing factors are complex.LSTM was first proposed by Hochreiter in 1997 and has been widely used in natural language processing, such as text, speech, handwriting recognition and machine translation. Kong et al. proposed a load forecasting framework based on LSTM, which was tested on a set of public real residential smart meter data. The results show that the method has high accuracy in the field of load forecasting.

[0003] However, most existing studies focus on the prediction of total power consumption of multiple residential and commercial buildings. These scenarios allow for fairly accurate inferences because aggregated data can balance the unpredictability of human behavior. There are many challenges in household load forecasting. First, residents' daily electricity consumption habits are the main uncontrollable factor in the forecasting task. Since these habits may change from time to time, this brings great uncertainty to the forecast. For example, the sleep schedule of family members, the frequency and way of using electrical appliances, etc., will have a significant impact on load forecasting. Second, although the historical load data and climate factors of the household are important prediction bases, there are also uncertainties. Changes in climate conditions, such as temperature and humidity, have a direct impact on household electricity demand. In addition, although historical load data can provide some reference, its prediction accuracy is still limited due to changes in residents' electricity consumption behavior. The task of predicting single-household power consumption is an important milestone for further improving demand response and energy-saving programs. Accurate household load forecasting can help power companies better manage power resources, reduce peak loads, improve energy efficiency, and ultimately reduce users' electricity bills. However, despite the importance of this task, the number of related studies is small and the existing results are not satisfactory. This further proves the complexity of the single-household load forecasting task.

[0004] Compared with traditional recurrent neural networks (RNN) and long short-term memory networks, the attention mechanism of the Transformer model allows the calculation of each time step to be carried out in parallel, which speeds up the training speed and is particularly suitable for processing long sequence data. The self-attention mechanism of the Transformer model enables the model to capture long-distance dependencies, which is conducive to processing long-term time series data. In addition, the Transformer model can adapt to variable-length sequence data, making it highly adaptable, especially when processing sequence data with irregular time intervals. Due to the standardized self-attention mechanism, the Transformer has strong generalization ability and can process time series data of different scales and frequencies. The Transformer model is also very flexible and can adapt to prediction tasks of different complexity and accuracy requirements by increasing or decreasing the number of layers and adjusting the number and dimension of attention heads. In addition, the diffusion model simulates the uncertainty and noise of data in the real world by introducing Gaussian noise terms, which enables the model to better adapt to situations with large uncertainty and model uncertainty more accurately. The diversified results generated by the model can better reflect the true distribution of the data. Therefore, the diffusion model can more accurately simulate the uncertainty and noise of the data in the multi-feature time series prediction task, and dynamically capture the information propagation process, thereby improving the model's predictive ability and generalization ability. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a method and system for short-term household electricity load forecasting in response to the above-mentioned deficiencies in the prior art, which is used to solve the technical problems that traditional recurrent neural networks (RNNs) and long short-term memory networks (LSTMs) are difficult to capture long-distance dependencies when processing long sequence data, are insufficient to adapt to indefinite length sequence data, and have weak periodicity and strong uncertainty in household loads.

[0006] The present invention adopts the following technical solutions:

[0007] A method for predicting short-term household electricity load, comprising the following steps:

[0008] S1. Obtaining the time series load data of each electrical appliance in a specific residence and the meteorological data of the area where the residential residence is located;

[0009] S2, adding time features to the load data and meteorological data obtained in step S1, and performing feature merging processing on the load features, weather features and time features to obtain feature data, normalizing the obtained feature data and dividing it into a training set and a test set;

[0010] S3, build a short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model;

[0011] S4, using the training set and test set obtained in step S2 to train and test the short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model obtained in step S3, optimize the model parameters, and obtain a trained short-term load forecasting model;

[0012] S5. Use the short-term load forecasting model obtained in step S4 to forecast the household short-term load, obtain a normalized forecast result, and perform a denormalization process to obtain a final household load forecast result.

[0013] Preferably, data cleaning is performed on the load data and the meteorological data respectively, including duplicate value detection, missing value detection and abnormal value detection;

[0014] The duplicate value detection is specifically as follows: performing duplicate value detection on the obtained load data, defining a duplicate value detection threshold in advance, comparing the load values ​​at adjacent time points, and if it is found that the load values ​​at adjacent time points are the same or very close, marking them as duplicate values;

[0015] The missing value detection is specifically as follows: missing value detection is performed on the obtained load data, and the K nearest neighbor interpolation method is used to process the missing values;

[0016] The specific outlier detection is as follows: an exponentially weighted moving average method is used to perform outlier detection on the obtained load data.

[0017] Preferably, the missing value detection is specifically:

[0018] Determine the K value. For each missing value, calculate its distance to other samples in the data set through Euclidean distance, select the K samples closest to the missing value as the nearest neighbors, and take the average of the K nearest neighbors as the estimated value of the missing value;

[0019] Outlier detection is specifically as follows:

[0020] Choose a smoothing parameter λ between 0 and 1; for each time point t, according to the observed value x of the current data point t and the weighted average of the previous time point Determine the weighted average at the current time point If the current data point x t With weighted average If the difference between the two exceeds the set threshold, the data point is considered an outlier and the mean of the data is used to replace the outlier.

[0021] Preferably, a time feature is added, and the load feature, weather feature and time feature are combined to obtain feature data, and the obtained feature data is normalized and divided into a training set and a test set. Specifically:

[0022] Convert sampling moments into time features;

[0023] The load characteristics including the load of each electrical appliance and the total household load, the meteorological characteristics including the numerically processed meteorological data, and the time characteristics are combined to form the total load characteristics;

[0024] Normalize the total load characteristics using the minimum-maximum normalization method. For each characteristic, determine its allowed range and calculate its minimum value f in the entire data set. max and the maximum value f min ;

[0025] Convert the raw time series features into a format suitable for supervised learning models and divide the raw data into training and test sets.

[0026] Preferably, the original data is divided into a training set and a test set as follows:

[0027] Get the number of samples and features of the original time series data. For each time step, extract an input sequence of length seqLen and an output sequence of length targetLen from the original data.

[0028] Store the extracted input sequence and output sequence into the corresponding input sequence matrix and output sequence matrix and return;

[0029] Define the split ratio, where 80% of the data is used for training and 20% of the data is used for testing;

[0030] Calculate the index position of the partition, determine the boundary position of the training set and the test set according to the partition ratio and the number of samples, and divide the original data into the training set and the test set according to the boundary position.

[0031] Preferably, the short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model includes an improved Transformer encoder, a diffusion model, and a Transformer decoder; the improved Transformer encoder, the diffusion model, and the Transformer decoder are logically connected in series, the data shape is ensured to be consistent during data transmission, an inverse distribution is constructed to denoise white noise, and a neural network is used to predict the expected hidden state; the white noise is converted into the expected hidden state by stepwise approximation, so as to achieve accurate prediction of household short-term load.

[0032] Preferably, the improved Transformer encoder includes a position encoding layer, a temporal convolutional network residual block, a multi-feature fusion attention module, and a feedforward network;

[0033] By using the Transformer encoder to model the global dependencies in the sequence, the input sequence Mapped to three different representation spaces: query space, key space, and value space. These mappings are determined by the learned weight matrix W Q ,W K ,W V Implementation: For each head h, first calculate the dot product between the query (Q) and the key (K); then perform a scaling operation; then process it through the Softmax function to get the attention weight Using attention weights The value (V) is weighted summed to get the multi-head attention output; finally, the output head of all attention heads is summed h Splicing is performed along the last dimension to obtain the final result of the multi-head attention mechanism MultiHead(Q,K,V).

[0034] Preferably, the position encoding layer first converts the historical load characteristic value H into a d-dimensional vector through a fully connected layer at time step t, and the position encoding layer uses sine and cosine functions to embed the position information of the sequence, and the position information and the input embedding value are added to form the output of the embedding layer;

[0035] The temporal convolutional network residual block contains causal convolution and dilated convolution structures. Suppose there is an input sequence x = {x1, x2, ..., x T}, and a convolution kernel h = {h1,h2,…,h K}, output sequence y = {y1,y2,…,y T};

[0036] The multi-feature fusion attention module performs weighted attention on the feature data from the load dimension, time dimension and weather dimension to obtain the output matrix F l 、F t and F w ;Then the information from the three aspects is fused to obtain a new feature matrix;

[0037] The feedforward network consists of two linear layers and an activation function. First, the input data is transformed linearly, that is, the input matrix is ​​multiplied by the weight matrix and a bias is added to obtain a new feature representation; then the output of the linear transformation is input into an activation function to obtain the activated feature representation; finally, the activated feature representation is transformed linearly again to obtain the output of the final feedforward network layer.

[0038] Preferably, the diffusion model includes a forward diffusion process and a reverse diffusion process;

[0039] First, the hidden state distribution of the diffusion neural network model is modeled; let h t is the hidden state output by the encoder, z t Represents the expected distribution of hidden states, using h t Approximate z t The true distribution of; According to the additivity of Gaussian distribution, the relationship between the original hidden state and the hidden state after T noise addition steps is obtained;

[0040] Second, the noise is mapped back to the original data space through a reverse process;

[0041] Next, the short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model is optimized by minimizing the negative log-likelihood, with the goal of eliminating Gaussian noise and taking the initial hidden state as a condition;

[0042] The closed form of the inverse distribution is obtained by maximizing the evidence lower bound;

[0043] Finally, in the simplified training process, the optimization objective is simplified by deleting the weight coefficients;

[0044] Through the above process, the inverse distribution is constructed to denoise the white noise, and the neural network is used to predict the desired hidden state; finally, the white noise is converted into the desired hidden state through step-by-step approximation to achieve accurate prediction of household short-term load.

[0045] In a second aspect, an embodiment of the present invention provides a household electricity short-term load forecasting system, comprising:

[0046] The data module obtains the time series load data of each electrical appliance in a specific residence, as well as the meteorological data of the area where the residential residence is located;

[0047] The feature module adds time features to the load data and meteorological data, and performs feature merging processing on the load features, weather features and time features to obtain feature data, normalizes the obtained feature data and divides it into a training set and a test set;

[0048] Construction module, constructing a short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model;

[0049] The optimization module uses the obtained training set and test set to train and test the short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model, optimizes the model parameters, and obtains the trained short-term load forecasting model;

[0050] The prediction module uses the optimized short-term load prediction model to predict the household short-term load, obtains the normalized prediction result and performs denormalization processing, and uses the inverse transformation function previously used for normalization to convert the predicted data back to the range of the original data to obtain the final household load prediction result.

[0051] In a third aspect, a computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned household electricity short-term load forecasting method when executing the computer program.

[0052] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned household electricity short-term load forecasting method.

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

[0054] A short-term household electricity load forecasting method can more comprehensively consider the factors affecting the load by acquiring time series load data and meteorological data and performing feature merging processing, thereby improving the accuracy of the forecast. At the same time, the combination of time features, load features and weather features makes the model applicable to different household environments, enhancing the versatility of the model; in short-term load forecasting, the time series of load data and meteorological data are the main input features. By performing feature merging processing on these data, data from different sources can be unified into a feature space, so that the machine learning model can more effectively learn the correlation between the data. The addition of time features can also help the model capture the law of load changes over time, further improving the forecast accuracy.

[0055] Furthermore, data cleaning can remove duplicate values, fill in missing values, identify and process outliers, thereby ensuring the quality of input data. In addition, data cleaning can also reduce abnormal noise in the data and improve the final effect of model training.

[0056] Data cleaning is an important step in data preprocessing, which can improve the quality and reliability of data. Among them, duplicate value detection can find and delete redundant data, reduce the amount of data and training time.

[0057] Furthermore, missing value detection and filling can ensure the integrity of the data, so that the model is not affected by missing data during the training process. Outlier detection and processing can prevent abnormal data from having a negative impact on model training and improve the robustness and prediction stability of the model.

[0058] Missing value detection selects the most similar samples for filling by calculating the distance to other samples, thus ensuring that the distribution of the filled data is consistent with the real data. Outlier detection detects and processes outliers by setting smoothing parameters and weighted averages to ensure the stability and consistency of the data.

[0059] Furthermore, feature merging can unify load features, weather features, and time features into a feature space, enriching the model’s input information. Normalization and data set partitioning can ensure that the model has consistent input distribution during training and testing, improving the model’s generalization ability.

[0060] Feature merging is to unify features from different sources so that the model can consider multiple influencing factors at the same time. Normalization can eliminate the dimensional differences between different features and avoid excessive influence of certain features on the model. The division of training set and test set can ensure that the model will not be overfitted during the training process, and at the same time, the performance of the model can be objectively evaluated during the test process.

[0061] Furthermore, the combination of multi-scale Transformer and diffusion model can simultaneously consider feature information of different scales and improve the accuracy of prediction. This combination method can make full use of the global modeling ability of Transformer and the denoising ability of diffusion model to improve the expression ability and prediction effect of the model.

[0062] The multi-scale Transformer can capture feature changes at different time scales, while the diffusion model gradually approaches the real data distribution through the denoising process. The combination of the two can make full use of the advantages of different models, making the final prediction results more accurate and stable.

[0063] Furthermore, the improved Transformer encoder can better model the global dependencies of sequence data and improve the encoding effect. Through the multi-feature fusion attention module, the information of different features can be more effectively integrated to improve the prediction ability of the model.

[0064] The improved Transformer encoder can better capture the global dependencies and local feature changes of sequence data through structures such as position encoding layers, temporal convolutional network residual blocks, and multi-feature fusion attention modules, thereby improving the accuracy of feature representation. The multi-head attention mechanism can fuse features in different representation spaces and improve the model's predictive ability.

[0065] Furthermore, the diffusion model can gradually approach the real data distribution and improve the prediction accuracy by denoising the noise data. The diffusion model can handle the random noise in the data, so that the model can still maintain a high prediction performance when facing noisy data.

[0066] The diffusion model simulates the load instability caused by the habitual differences of different households, and transforms the white noise into the desired hidden state through the step-by-step approximation method, thereby realizing the reconstruction of the hidden state of the load data. During the data transmission process, the diffusion model can effectively remove noise, ensure the consistency of data shape and the stability of prediction results.

[0067] It can be understood that the beneficial effects of the second aspect mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.

[0068] In summary, the present invention improves the accuracy of prediction by acquiring and processing time series load data and meteorological data based on the combination of multi-scale Transformer and diffusion model; data cleaning includes duplicate value removal, missing value filling and outlier processing, which ensures the integrity and consistency of input data, and reduces noise interference through normalization and data set division; the improved Transformer encoder and diffusion model improve the model's feature representation ability and robustness in dealing with variable household load scenarios. Feature merging processing enriches the model's input information, enables the model to learn multiple load influencing factors, and enhances the model's prediction ability; comprehensive data preprocessing and advanced modeling techniques, such as multi-scale Transformer and diffusion models, ensure high-quality data input, so that the present invention has higher performance and wider application prospects in short-term household electricity load forecasting.

[0069] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] Figure 1 A flowchart of the method for predicting short-term household electricity load of the present invention;

[0071] Figure 2 A neural network model structure diagram of the household electricity short-term load forecasting method of the present invention;

[0072] Figure 3 This is a structural diagram of an attention module in a model of a method for predicting short-term household electricity load of the present invention;

[0073] Figure 4 It is a schematic diagram of the TCN residual block structure in the model of the household electricity short-term load forecasting method of the present invention;

[0074] Figure 5 It is a schematic diagram of a diffusion model in the model of the household electricity short-term load forecasting method of the present invention;

[0075] Figure 6 A schematic diagram of a computer device provided by an embodiment of the present invention;

[0076] Figure 7 A block diagram of an electronic device provided according to an embodiment of the present invention;

[0077] Figure 8 This is a comparison chart of the prediction results of the present invention and the classical method at different time granularities. DETAILED DESCRIPTION

[0078] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are 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 creative work are within the scope of protection of the present invention.

[0079] In the description of the present invention, it should be understood that the terms “include” and “comprises” indicate the presence of described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.

[0080] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0081] It should be further understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present invention generally indicates that the associated objects are in an "or" relationship.

[0082] It should be understood that, although the terms first, second, third, etc. may be used to describe preset ranges, etc. in the embodiments of the present invention, these preset ranges should not be limited to these terms. These terms are only used to distinguish preset ranges from each other. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.

[0083] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0084] Various structural schematic diagrams of the embodiments disclosed in the present invention are shown in the accompanying drawings. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may additionally design regions / layers with different shapes, sizes, and relative positions according to actual needs.

[0085] The present invention provides a method for predicting short-term household electricity load. The load data and meteorological data of household appliances are obtained through sensors. After data cleaning and feature processing, including the addition of time features and feature merging, a multi-scale Transformer and diffusion model are used to build a prediction model, and the best prediction model is obtained through training and parameter optimization. In the prediction stage, the trained best prediction model is used to predict the household short-term load, and the prediction result is converted into the original data range through the inverse transformation function to obtain the final household load prediction result. Multi-feature fusion is used to provide more comprehensive data features, and the improved TCN residual block is used on the traditional encoder to further extract the time series information of the feature sequence to prevent its loss. At the same time, the diffusion model is introduced to simulate the uncertainty and noise of the data to improve the prediction accuracy and robustness of the model. Please refer to Figure 1 The present invention provides a method for predicting short-term household electricity load, comprising the following steps:

[0086] S1. Obtain the load data of each electrical appliance in a specific residence in time series, as well as the meteorological data of the area where the residential residence is located. The meteorological data includes temperature, humidity and wind speed. Perform data cleaning on the obtained load data and meteorological data. Data cleaning includes duplicate value detection, missing value detection and outlier detection.

[0087] S101. Deploy sensors to collect household load data. Household appliances that need to collect load data include electric lights, televisions, refrigerators, washing machines, air conditioners, humidifiers, water heaters, and range hoods. The data is recorded every 30 minutes, and the collected data is uniformly converted into KW according to international measurement units.

[0088] S102. For the acquisition of meteorological data, the meteorological data types to be collected include temperature, humidity, visibility, pressure, wind speed, and precipitation probability by accessing the meteorological API, and the meteorological data are organized into the same collection frequency as the load data to ensure the uniformity of data use;

[0089] S103, performing duplicate value detection on the obtained load data, defining a duplicate value detection threshold in advance, comparing the load values ​​at adjacent time points, and if it is found that the load values ​​at adjacent time points are the same or very close, marking them as duplicate values;

[0090] S104, performing missing value detection on the obtained load data, and using K-Nearest Neighbors (KNN) interpolation method to process the missing values;

[0091] S1041, determining the K value, that is, the number of neighbors to be considered, by a cross-validation method;

[0092] S1042. For each missing value, calculate its distance from other samples in the data set by Euclidean distance, select the K samples closest to the missing value as the nearest neighbors, and take the average of the K nearest neighbors as the estimated value of the missing value, that is:

[0093]

[0094] Among them, x i is a missing value, is the value of the nearest neighbor and K is the number of neighbors.

[0095] S105. Use an exponentially weighted moving average method to perform outlier detection on the obtained load data.

[0096] S1051, select a smoothing parameter λ between 0 and 1;

[0097] S1052: For each time point t, according to the observation value x of the current data point t and the weighted average of the previous time point The weighted average value at the current time point The calculation method is:

[0098]

[0099] S1053. Detect the current data point x according to a certain threshold t Is it the weighted average? If the difference between them exceeds the threshold, then the data point is considered as an outlier and the mean of the data is used to replace the outlier.

[0100] S2, adding time features to the load data and meteorological data cleaned in step S1, and performing feature merging processing on the load features, weather features and time features to obtain feature data, normalizing the obtained feature data and dividing it into a training set and a test set;

[0101] S201, converting the sampling time into a time feature;

[0102] Specifically, the sampled time information is converted into specific time features such as year, month, week number, whether it is a holiday, day of the week and hour, and digitized;

[0103] S202, combining the load characteristics including the load of each electrical appliance and the total household load, the meteorological characteristics including the numerically processed meteorological data, and the time characteristics to form a total load characteristic;

[0104] Since the frequency of meteorological data collection is lower than that of load data, it needs to be copied during feature fusion to ensure data consistency.

[0105] S203, normalize the total load characteristics, using the minimum-maximum normalization method. For each characteristic, determine its allowed range, and calculate its minimum value f in the entire data set. max and the maximum value f min ;

[0106] For each feature f i And for each sample, the specific normalization method is:

[0107]

[0108] Where f′ is the normalized feature value. Apply the above steps to all features in the dataset and normalize all features to the same range.

[0109] S204: Convert the original time series features into a format suitable for a supervised learning model.

[0110] S2041, obtaining the number of samples and the number of features of the original time series data, and for each time step, extracting an input sequence of length seqLen and an output sequence of length targetLen from the original data;

[0111] S2042, storing the extracted input sequence and output sequence into corresponding input sequence matrix and output sequence matrix and returning;

[0112] S2043. Define the partition ratio, where 80% of the data is used for training and 20% of the data is used for testing;

[0113] S2044. Calculate the index position of the partition, determine the boundary position of the training set and the test set according to the partition ratio and the number of samples, and divide the original data into the training set and the test set according to the boundary position.

[0114] S3, build a short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model;

[0115] See also Figure 2 The short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model includes an improved Transformer encoder, a diffusion model, and a Transformer decoder; the above modules are logically connected in series, and the output of the previous module is used as the input of the next module. The data shape must be consistent during data transmission.

[0116] The improved Transformer encoder includes a position encoding layer, a temporal convolutional network (TCN) residual block, a multi-feature fusion attention module, and a feedforward network.

[0117] In which, the position encoding layer first converts the historical load feature value H into a d-dimensional vector through a fully connected layer at time step t.

[0118] Considering the temporal characteristics of the input data, these vectors will pass through the position encoding module. The position encoding layer uses sine and cosine functions to embed the position information of the sequence, namely:

[0119]

[0120] Among them, pos represents the position of the element in the time series, i represents the dimension of the embedding vector, and d model Represents the dimension of the input embedding layer.

[0121] Finally, the location information and the input embedding value will be summed to form the output of the embedding layer. The multi-feature fusion attention module performs weighted attention on the feature data from the load dimension, time dimension, and weather dimension to obtain the output matrix F l 、F t and F w ; Then, the information from the three aspects is fused to obtain a new feature matrix;

[0122] The new feature matrix is ​​as follows:

[0123] X=Concat(F l ,F t ,F w )W

[0124] Among them, Concat(·) represents a cascade operation, and W represents a trainable parameter matrix.

[0125] See also Figure 3 , by using a regular Transformer encoder to model global dependencies in a sequence, where a scaled dot-product attention mechanism is utilized.

[0126] First, the input sequence Mapped to three different representation spaces: query space, key space, and value space. These mappings are determined by the learned weight matrix W Q ,W K ,W V accomplish;

[0127] Second, for each head h, first calculate the dot product between the query (Q) and the key (K);

[0128] Then perform a scaling operation (usually dividing by the square root of the query or key dimension);

[0129] Then the attention weight is obtained through the Softmax function Right now

[0130] Q,K,V=Linear(X)

[0131]

[0132] Among them, QK T represents the dot product between the query and the key, d k =d model is the dimension of the key, and uses the attention weights The values ​​(V) are weighted summed to obtain the multi-head attention output.

[0133] The multi-head attention output is specifically:

[0134] head h =Attention(Q,K,V)·V

[0135] Finally, the output head of all attention heads h Join along the last dimension and we get

[0136] MultiHead(Q,K,V)=Concat(head1,head2,…,head h )

[0137] Among them, Concat represents the concatenation operation, during which each head can be regarded as an independent attention mechanism.

[0138] See also Figure 4 , the TCN residual block contains causal convolution and dilated convolution structures, with an input sequence x = {x1, x2, ..., x T}, and a convolution kernel h = {h1,h2,…,h K}, output sequence y = {y1,y2,…,y T} is calculated as:

[0139]

[0140] Among them, r represents the expansion rate of the convolution kernel. The actual length of the convolution kernel with an expansion rate of r is K = 1 + (r-1) (K-1), that is, the length of the convolution kernel is expanded by r times.

[0141] The feed-forward network consists of two linear layers and an activation function.

[0142] First, the input data is transformed into a new feature representation through a linear transformation, that is, the input matrix is ​​multiplied by the weight matrix and the bias is added;

[0143] Next, the output of the linear transformation is input into an activation function to obtain the activated feature representation;

[0144] Finally, the activated feature representation is transformed again through a linear transformation to obtain the output of the final feedforward network layer, namely:

[0145] FFN(x)=ReLU(xW1+b1)W2+b2

[0146] Here, x is the input, W1 and W2 are weight matrices, b1 and b2 are biases, and ReLU is the activation function.

[0147] See also Figure 5 ,The diffusion model includes forward diffusion process and reverse diffusion process.

[0148] First, the hidden state distribution of the diffusion neural network model is modeled;

[0149] Assume h t is the hidden state output by the encoder, z t Represents the expected distribution of hidden states, using h t Approximate z t The true distribution of .

[0150] The diffusion model is approximated by adding noise, namely:

[0151]

[0152] Among them, β t is an empirically determined noise scale.

[0153] According to the additivity of Gaussian distribution, the relationship between the original hidden state and the hidden state after T noise addition steps is:

[0154]

[0155] in, ∈ represents standard Gaussian noise. Secondly, the noise is mapped back to the original data space through the reverse process.

[0156] Define a reverse process modeled by parameter θ:

[0157]

[0158] Among them, μ θ and Σ θ is a function parameterized by a neural network.

[0159] Next, the model is optimized by minimizing the negative log-likelihood (NLL) with the goal of removing Gaussian noise and taking the starting hidden state as a condition.

[0160] By maximizing the Evidence Lower Bound (ELBO), the closed form of the reverse distribution is obtained:

[0161]

[0162] Among them, D KL Represents relative entropy.

[0163] For simplicity, the reverse process is rewritten as:

[0164]

[0165] Finally, in the simplified training process, the optimization objective is simplified by removing the weight coefficients, that is,

[0166]

[0167] Where,∈ is Gaussian noise,∈ θ is the noise predicted by the neural network.

[0168] Through the above process, the inverse distribution is constructed to denoise the white noise, and the neural network is used to predict the desired hidden state; finally, the white noise is converted into the desired hidden state through step-by-step approximation to achieve accurate prediction of household short-term load.

[0169] The Transformer decoder uses the traditional classic architecture. On the one hand, it concatenates all the features of the last time step of the encoder input sequence with all the features of the label sequence except the last time step to obtain the decoder input sequence. On the other hand, it accepts the processing results from the diffusion module and outputs the prediction results through the decoder processing.

[0170] S4, using the training set and test set obtained in step S2 to train and test the short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model obtained in step S3, optimize the model parameters, and obtain a trained short-term load forecasting model;

[0171] The training set and test set processed in step S2 are used as the input of the short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model. The training loss and verification loss of the short-term load forecasting model during the training process are recorded to optimize the model parameters such as learning rate, dropout, batch size, number of training cycles, hidden layer dimension and number of encoding and decoding layers to obtain a short-term load forecasting model with good performance.

[0172] S5. Use the short-term load forecasting model obtained in step S4 to forecast the household short-term load, obtain a normalized forecast result and perform a denormalization process, use the inverse transformation function previously used for normalization to convert the forecast data back to the range of the original data, and obtain the final household load forecast result.

[0173] By introducing the self-attention mechanism of the Transformer model, the present invention realizes parallel calculation of each time step, speeds up the training speed, and can effectively capture long-distance dependencies, which is suitable for processing long sequence and variable length sequence data. The standardized self-attention mechanism of Transformer enhances the generalization ability, enabling it to process time series data of different scales and frequencies, and adapt to different complexity and accuracy requirements by adjusting the number of layers and the number of attention heads.

[0174] In addition, the present invention combines the diffusion model and introduces Gaussian noise terms to simulate data uncertainty, thereby achieving more accurate prediction and more robust model adaptability for situations where household load periodicity is weak and data uncertainty is strong.

[0175] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as systems, methods or program products. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits", "modules" or "platforms".

[0176] In another embodiment of the present invention, a household electricity short-term load forecasting system is provided, which can be used to implement the above-mentioned household electricity short-term load forecasting method. Specifically, the household electricity short-term load forecasting system includes a data module, a feature module, a construction module, an optimization module and a prediction module.

[0177] Among them, the data module obtains the time series load data of each electrical appliance in a specific residence, as well as the meteorological data of the area where the residential residence is located;

[0178] The feature module adds time features to the load data and meteorological data, and performs feature merging processing on the load features, weather features and time features to obtain feature data, normalizes the obtained feature data and divides it into a training set and a test set;

[0179] Construction module, constructing a short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model;

[0180] The optimization module uses the obtained training set and test set to train and test the short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model, optimizes the model parameters, and obtains the trained short-term load forecasting model;

[0181] The prediction module uses the optimized short-term load prediction model to predict the household short-term load, obtains the normalized prediction result and performs denormalization processing to obtain the final household load prediction result.

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

[0183] Obtain the load data of the time series of each electrical appliance in a specific residence, as well as the meteorological data of the area where the residential area is located; add time features to the obtained load data and meteorological data, and perform feature merging processing on the load features, weather features and time features to obtain feature data, normalize the obtained feature data and divide it into a training set and a test set; construct a short-term load forecasting model based on the combination of a multi-scale Transformer and a diffusion model; use the obtained training set and test set to train and test the short-term load forecasting model based on the combination of a multi-scale Transformer and a diffusion model, optimize the model parameters, and obtain a trained short-term load forecasting model; use the obtained short-term load forecasting model to predict the household short-term load, obtain the normalized prediction result, and perform denormalization processing to obtain the final household load forecasting result.

[0184] In another embodiment of the present invention, the present invention also provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a terminal device for storing programs and data. It is understandable that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and the extended storage medium supported by the terminal device, and can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that more specific examples (non-exhaustive list) of the computer-readable storage medium here include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0185] Computer readable storage media also include data signals propagated in baseband or as part of a carrier wave, which carry readable program codes. Such propagated data signals can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable storage medium can also be any readable medium other than a readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.

[0186] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0187] The processor may load and execute one or more instructions stored in a computer-readable storage medium to implement the corresponding steps of the household electricity short-term load forecasting method in the above embodiment; the processor may load and execute the following steps:

[0188] Obtain the load data of the time series of each electrical appliance in a specific residence, as well as the meteorological data of the area where the residential area is located; add time features to the obtained load data and meteorological data, and perform feature merging processing on the load features, weather features and time features to obtain feature data, normalize the obtained feature data and divide it into a training set and a test set; construct a short-term load forecasting model based on the combination of a multi-scale Transformer and a diffusion model; use the obtained training set and test set to train and test the short-term load forecasting model based on the combination of a multi-scale Transformer and a diffusion model, optimize the model parameters, and obtain a trained short-term load forecasting model; use the obtained short-term load forecasting model to predict the household short-term load, obtain the normalized prediction result, and perform denormalization processing to obtain the final household load forecasting result.

[0189] See also Figure 6 , the terminal device is a computer device, and the computer device 60 of this embodiment includes: a processor 61, a memory 62, and a computer program 63 stored in the memory 62 and executable on the processor 61. When the computer program 63 is executed by the processor 61, the method for calculating the composition of fluid in the reservoir transformation wellbore in the embodiment is realized. To avoid repetition, it is not described one by one here. Alternatively, when the computer program 63 is executed by the processor 61, the functions of each model / unit in the calculation system for the composition of fluid in the reservoir transformation wellbore in the embodiment are realized. To avoid repetition, it is not described one by one here.

[0190] The computer device 60 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The computer device 60 may include, but is not limited to, a processor 61 and a memory 62. Those skilled in the art will appreciate that Figure 6 This is only an example of the computer device 60 and does not constitute a limitation of the computer device 60. It 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 may also include input and output devices, network access devices, buses, etc.

[0191] The processor 61 may be a central processing unit (CPU), or other general-purpose processors, central processing units, graphics 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, data processing logic based on quantum computing, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0192] The memory 62 may be an internal storage unit of the computer device 60, such as a hard disk or memory of the computer device 60. The memory 62 may also be an external storage device of the computer device 60, 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 60.

[0193] Furthermore, the memory 62 may include both an internal storage unit of the computer device 60 and an external storage device. The memory 62 is used to store computer programs and other programs and data required by the computer device. The memory 62 may also be used to temporarily store data that has been output or is to be output.

[0194] Any reference to memory, database or other media used in the embodiments provided in the present application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0195] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0196] See also Figure 7 The terminal device 600 is an electronic device, and the electronic device is in the form of a general computing device. The components of the electronic device may include but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.

[0197] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 performs the steps according to various exemplary embodiments of the present invention described in the above method section of this specification. For example, the processing unit 610 can perform the following steps: Figure 1 Follow the steps shown in .

[0198] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 6201 and / or a cache storage unit 6202 , and may further include a read-only storage unit (ROM) 6203 .

[0199] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0200] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0201] The electronic device 600 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 600, and / or communicate with any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms, etc.

[0202] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, 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 described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention described and shown in the drawings here can usually be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in 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.

[0203] The advantages of the present invention are verified by using a certain household load data.

[0204] Specifically, refer to Figure 8 As shown, in order to verify the actual effect of the present invention in household power load forecasting, the prediction effects are compared with those of the BiLSTM model and the DeepAR model respectively; as shown in Table 1, the prediction error values ​​of different models at different time granularities.

[0205] Table 1 Prediction error values ​​of different models at 1 minute, 15 minutes and 30 minutes time granularity

[0206]

[0207]

[0208] As shown in Table 1, by comparing the present invention with the classical method, the present invention has lower error values ​​in load forecasting than the other two forecasting methods, and performs best.

[0209] By comparing with the BiLSTM model and the DeepAR model at different time granularities, the present invention performs best in all error values, proving its superiority in household power load forecasting. Specifically, at 1 minute, 15 minutes and 30 minutes time granularities, the present invention outperforms the other two forecasting methods in indicators such as MAPE, SMAPE, MAE, RMSE and RRSE, further verifying its high accuracy and high stability.

[0210] In summary, the present invention provides a method and system for predicting short-term load of household electricity. The present invention performs well in predicting short-term load of household electricity and has significant application value and technical advantages.

[0211] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device 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 in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in 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, which will not be repeated here.

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

[0213] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present invention 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 to be beyond the scope of the present invention.

[0214] In the embodiments provided by the present invention, it should be understood that the disclosed devices / terminals and methods can be implemented in other ways. For example, the device / terminal embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, 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.

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

[0216] 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. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0217] If the integrated module / unit is implemented in the form of 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 invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

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

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

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

Claims

1. A method for predicting short-term household electricity load, characterized in that: The following steps are involved: S1. Obtaining the time series load data of each electrical appliance in a specific residence and the meteorological data of the area where the residential residence is located; S2, adding time features to the load data and meteorological data obtained in step S1, and performing feature merging processing on the load features, weather features and time features to obtain feature data, normalizing the obtained feature data and dividing it into a training set and a test set; S3, build a short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model; S4, using the training set and test set obtained in step S2 to train and test the short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model obtained in step S3, optimize the model parameters, and obtain a trained short-term load forecasting model; S5. Use the short-term load forecasting model obtained in step S4 to forecast the household short-term load, obtain a normalized forecast result, and perform a denormalization process to obtain a final household load forecast result.

2. The household electricity short-term load forecasting method according to claim 1, characterized in that: Carry out data cleaning on load data and meteorological data respectively, including duplicate value detection, missing value detection and outlier detection; The duplicate value detection is specifically as follows: performing duplicate value detection on the obtained load data, defining a duplicate value detection threshold in advance, comparing the load values ​​at adjacent time points, and if it is found that the load values ​​at adjacent time points are the same or very close, marking them as duplicate values; The missing value detection is specifically as follows: missing value detection is performed on the obtained load data, and the K nearest neighbor interpolation method is used to process the missing values; The specific outlier detection is as follows: an exponentially weighted moving average method is used to perform outlier detection on the obtained load data.

3. The household electricity short-term load forecasting method according to claim 2, characterized in that: Missing value detection is as follows: Determine the K value. For each missing value, calculate its distance to other samples in the data set through Euclidean distance, select the K samples closest to the missing value as the nearest neighbors, and take the average of the K nearest neighbors as the estimated value of the missing value; Outlier detection is specifically as follows: Choose a smoothing parameter λ between 0 and 1; for each time point t, according to the observed value x of the current data point t and the weighted average of the previous time point Determine the weighted average at the current time point If the current data point x t With weighted average If the difference between the two exceeds the set threshold, the data point is considered an outlier and the mean of the data is used to replace the outlier.

4. The method for predicting short-term household electricity load according to claim 1, characterized in that: Add time features, merge the load features, weather features and time features to obtain feature data, normalize the obtained feature data and divide it into training set and test set. Specifically: Convert sampling moments into time features; The load characteristics including the load of each electrical appliance and the total household load, the meteorological characteristics including the numerically processed meteorological data, and the time characteristics are combined to form the total load characteristics; Normalize the total load characteristics using the minimum-maximum normalization method; for each characteristic, determine its allowed range and calculate its minimum value f in the entire data set max and the maximum value f min ; Convert the raw time series features into a format suitable for supervised learning models and divide the raw data into training and test sets.

5. The household electricity short-term load forecasting method according to claim 4, characterized in that: The original data is divided into training set and test set as follows: Get the number of samples and features of the original time series data. For each time step, extract an input sequence of length seqLen and an output sequence of length targetLen from the original data. Store the extracted input sequence and output sequence into the corresponding input sequence matrix and output sequence matrix and return; Define the split ratio, where 80% of the data is used for training and 20% of the data is used for testing; Calculate the index position of the partition, determine the boundary position of the training set and the test set according to the partition ratio and the number of samples, and divide the original data into the training set and the test set according to the boundary position.

6. The household electricity short-term load forecasting method according to claim 1, characterized in that: The short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model includes an improved Transformer encoder, a diffusion model, and a Transformer decoder; the improved Transformer encoder, the diffusion model, and the Transformer decoder are logically connected in series, and the data shape is guaranteed to be consistent during data transmission. An inverse distribution is constructed to denoise the white noise, and a neural network is used to predict the expected hidden state; the white noise is converted into the expected hidden state by stepwise approximation to achieve accurate prediction of household short-term load.

7. The method for predicting short-term household electricity load according to claim 6, characterized in that: The improved Transformer encoder includes a position encoding layer, a temporal convolutional network residual block, a multi-feature fusion attention module, and a feedforward network; By using the Transformer encoder to model the global dependencies in the sequence, the input sequence Mapped to three different representation spaces: query space, key space, and value space. These mappings are determined by the learned weight matrix W Q ,W K ,W V Implementation: For each head h, first calculate the dot product between the query (Q) and the key (K); then perform a scaling operation; then process it through the Softmax function to get the attention weight Using attention weights The value (V) is weighted summed to obtain the multi-head attention output; finally, the output head of all attention heads is summed h Splicing is performed along the last dimension to obtain the final result of the multi-head attention mechanism MultiHead(Q,K,V).

8. The method for predicting short-term household electricity load according to claim 7, characterized in that: The position encoding layer first converts the historical load feature value H into a d-dimensional vector through a fully connected layer at time step t. The position encoding layer uses sine and cosine functions to embed the position information of the sequence. The position information and the input embedding value are added to form the output of the embedding layer. The temporal convolutional network residual block contains causal convolution and dilated convolution structures. Suppose there is an input sequence x = {x1, x2, ..., x T }, and a convolution kernel h = {h1,h2,…,h K }, output sequence y = {y1,y2,…,y T }; The multi-feature fusion attention module performs weighted attention on the feature data from the load dimension, time dimension and weather dimension to obtain the output matrix F l 、F t and F w ;Then the information from the three aspects is fused to obtain a new feature matrix; The feedforward network consists of two linear layers and an activation function. First, the input data is transformed linearly, that is, the input matrix is ​​multiplied by the weight matrix and a bias is added to obtain a new feature representation; then the output of the linear transformation is input into an activation function to obtain the activated feature representation; finally, the activated feature representation is transformed linearly again to obtain the output of the final feedforward network layer.

9. The method for predicting short-term household electricity load according to claim 6, characterized in that: The diffusion model includes forward diffusion process and reverse diffusion process; First, the hidden state distribution of the diffusion neural network model is modeled; let h t is the hidden state output by the encoder, z t Represents the expected distribution of hidden states, using h t Approximate z t The true distribution of; According to the additivity of Gaussian distribution, the relationship between the original hidden state and the hidden state after T noise addition steps is obtained; Second, the noise is mapped back to the original data space through a reverse process; Next, the short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model is optimized by minimizing the negative log-likelihood, with the goal of eliminating Gaussian noise and taking the initial hidden state as a condition; The closed form of the inverse distribution is obtained by maximizing the evidence lower bound; Finally, in the simplified training process, the optimization objective is simplified by deleting the weight coefficients; Through the above process, the inverse distribution is constructed to denoise the white noise, and the neural network is used to predict the desired hidden state; finally, the white noise is converted into the desired hidden state through step-by-step approximation to achieve accurate prediction of household short-term load.

10. A household electricity short-term load forecasting system, characterized in that: include: The data module obtains the time series load data of each electrical appliance in a specific residence, as well as the meteorological data of the area where the residential residence is located; The feature module adds time features to the load data and meteorological data, and performs feature merging processing on the load features, weather features and time features to obtain feature data, normalizes the obtained feature data and divides it into a training set and a test set; Construction module, constructing a short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model; The optimization module uses the obtained training set and test set to train and test the short-term load forecasting model based on the combination of multi-scale Transformer and diffusion model, optimizes the model parameters, and obtains the trained short-term load forecasting model; The prediction module uses the optimized short-term load prediction model to predict the household short-term load, obtains the normalized prediction result and performs denormalization processing, and uses the inverse transformation function previously used for normalization to convert the predicted data back to the range of the original data to obtain the final household load prediction result.

Citation Information

Cited By

  • Method for predicting load of air conditioner in office building and storage medium

    CN119168146A

  • SDP-BiLSTM-based short-term day-ahead load prediction model and prediction method

    CN119202667A

  • Power demand dynamic prediction method based on multi-scale hybrid architecture

    CN119990477A