A non-intrusive load identification method integrating GRU and random forest
By integrating the GRU and random forest methods, combined with the Transformer attention mechanism and the LightGBM algorithm, the accuracy problem of multi-state load decomposition in non-invasive load monitoring is solved, and efficient identification of appliance status and low-cost appliance load status derivation are achieved, which is suitable for smart home energy efficiency management.
Patent Information
- Application Number
- CN202511026061.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-24
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2045-07-24
AI Technical Summary
Existing non-invasive load monitoring methods are not effective in multi-state load decomposition, especially for the decomposition of small sample states. They are also costly and difficult to accurately identify the load state of electrical appliances.
A non-intrusive load identification method integrating GRU and random forest is adopted. By constructing a state classification GRU deep neural network and state classification random forest based on the Transformer attention mechanism, combined with the LightGBM random forest algorithm, the current, active power and reactive power of the total electricity meter are used to classify the electrical appliance status. Combined with time series modeling and feature extraction, the accuracy of state recognition is improved.
It achieves high-accuracy recognition of different electrical appliance states, is suitable for smart home energy efficiency management, saves hardware modification costs, and has broad application prospects.
Smart Images

Figure CN120561865B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of non-invasive power load monitoring, and particularly relates to a non-invasive load identification method integrating GRU and random forest. Background Art
[0002] Non-intrusive load monitoring (NILM), also known as load disaggregation, analyzes household meter data to obtain information about each electrical load within a residence at any given point in time, including the number of loads, their type, their operating status, and electrical parameters such as voltage, current, and active power. Compared to traditional invasive load monitoring, NILM eliminates the need to install measuring devices on each user's electrical device to obtain the operating status of each device. This reduces the cost of acquiring data and eliminates the need to modify existing electrical wiring, making it a promising monitoring method. Non-intrusive load monitoring technology also offers significant environmental and economic benefits. Research has shown that by detecting faulty electrical devices and user appliance usage and operation strategies, providing detailed energy consumption analysis and real-time feedback to users, energy savings of up to 20% can be achieved. Therefore, electricity users play a key role in this process; raising awareness of how they use energy can lead to future energy savings of up to 15%.
[0003] NILM can generally be categorized into two approaches: load classification and load decomposition. Load classification typically involves feature extraction and classification to distinguish subloads within an aggregated load. Its primary task is to identify a set of useful characteristics of the electrical load. In this regard, various feature sets, including active and reactive power features, have been used to distinguish the profiles of subloads within an aggregated load. Furthermore, transient power spikes can be used to identify power-on events. Recently, voltage-current (VI) traces have been considered as image features for classification, which improves load uniqueness and facilitates transfer learning. However, despite numerous efforts to identify the correct features for electrical loads, it remains difficult to find a set of features that can describe and distinguish different load classes. In load decomposition, the energy decomposition problem is formulated as a source separation task, where a mixed signal is decomposed into the sum of multiple individual signals. For the decomposition of multi-state loads, [Multilabel Appliance Classification With Weakly Labeled Data for Non-Intrusive Load Monitoring] proposed a load identification method. They combined a convolutional neural network (CNN) with a recurrent neural network (RNN) to create a CRNN framework that can utilize weakly labeled data for device classification, thereby improving the algorithm's adaptability. In addition, scale-extended temporal convolutional networks (TCNs) are also used to decompose low-frequency loads. Although many methods have been proposed, they have been ineffective in decomposing multi-state loads. This is because the samples of different states in multi-state loads vary significantly. Conventional methods tend to overwhelm states with fewer samples when processing them, and most appliances are typically in standby mode, making decomposition of non-standby states ineffective. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a non-invasive load identification method integrating GRU and random forest, which is more robust to the number of samples of different electrical appliance states, and can accurately derive the load state of each electrical appliance based on the current, active power and reactive power of the total electricity meter. It has stronger versatility and lays the foundation for further application. The method of the present invention has a higher state recognition accuracy, and because it is based on low-frequency non-invasive sampling data sampled once every minute, there is no need for hardware modification of the electricity meter, which greatly saves costs. It is suitable for application scenarios such as smart home energy efficiency management, and has broad prospects for application and promotion.
[0005] The technical solution adopted by the present invention to solve the above technical problems is: a non-intrusive load identification method integrating GRU and random forest, which is a non-intrusive load identification method based on low-frequency sampling once per minute, and includes the following steps:
[0006] 1) Collect the training data of current, active power and reactive power of each single appliance, divide it into original training set and test data set, cluster the current, active power and reactive power of each single appliance, obtain the working state set of each single appliance, and extract features suitable for LightGBM random forest algorithm;
[0007] 2) Construct a state classification GRU deep neural network TAGRU based on the Transformer attention mechanism, use the extracted features suitable for the LightGBM random forest algorithm as training data to train the state classification GRU deep neural network TAGRU, and obtain the working state classification GRU model of each single appliance;
[0008] 3) Construct a state classification random forest, collect the total current, total active power and total apparent power at any moment as training data to train the state classification random forest, and obtain the working state classification random forest model of each single electrical appliance;
[0009] 4) Collecting the current, active power, and reactive power data of the total electric meter during operation, and feeding the collected data into the GRU model and random forest model for the working state classification of each single electrical appliance, classifying the working state of each single electrical appliance to obtain the working state category of each single electrical appliance;
[0010] 5) Integrate the results of the GRU model and the random forest model for the working state classification of each single electrical appliance to obtain the optimized working state category of each single electrical appliance, that is, the load state of each single electrical appliance.
[0011] Preferably, the specific process of step 1) is:
[0012] 1.1) Suppose there are N electrical appliances. The training data of their current, active power and reactive power at time t are collected and divided into the original training set and the test data set. The sequences of current, active power and reactive power in the original training set are
[0013] k'=1,2,…N, use meanshift clustering method to cluster them into M categories, requiring the number of categories M≤6, and obtain the cluster set, which is the working state set of each single electrical appliance;
[0014] When the number of clustering categories M>6, gradually increase the bandwidth parameter of the meanshift clustering method by 5 each time until the number of categories M≤6, and obtain the cluster set, which is the working state set of each single electrical appliance;
[0015] 1.2) Extract features suitable for the LightGBM random forest algorithm: For the LightGBM random forest algorithm, extract the total current i at time t t , total active power p t and total apparent power s t And the total current i at time t-1 t-1 , total active power p t-1 and total apparent power s t-1 , take the value mod(t,1440) / 1440 normalized by day at time t and the value mod(t,10080) / 10080 normalized by week at time t as features, that is:
[0016]
[0017] In the above formula, t%1440 represents the remainder when t is divided by 1440, and t%10080 represents the remainder when t is divided by 10080.
[0018] Preferably, the structure of the state classification GRU deep neural network TAGRU constructed in step 2) consists of a first GRU layer, a first ReLU nonlinear layer, a second GRU layer, four parallel attention layers, a Concat layer, a Flatten layer, a second ReLU nonlinear layer, a first fully connected layer, a Dropout layer, a second fully connected layer and a classification layer.
[0019] Preferably, the process of constructing the state classification random forest in step 3) is:
[0020] 3.1) For the GRU deep learning method, directly use the total current i at any time t , total active power p t and total apparent power s t As input features,
[0021] 3.2) Randomly sample with replacement from the original training set each time to obtain multiple training sets, and then train multiple decision trees based on the multiple training sets;
[0022] 3.3) For each decision tree, select the best feature value according to the Gini index when splitting the decision tree until all training samples of each node in each decision tree belong to the same class;
[0023] 3.4) Multiple decision trees are combined into a random forest using the voting method, thus obtaining a state classification random forest.
[0024] Preferably, the specific process of step 5) is:
[0025] 5.1) For the current electrical appliance Lj , extract its current i, active power p, and apparent power a as features, and feed them into the working state classification GRU model to obtain the current electrical appliance L j 's working state S1(L j );
[0026] 5.2) Extract the current i t and i t-1 , active power p t and p t-1 , apparent power a t and a t-1 , as well as the timestamp features t1 and t2, and feed them into the LightGBM random forest algorithm to obtain the current electrical appliance L j 's working state S2(L j );
[0027] 5.3) Set the state of the current electrical appliance L j to S1(L j ), that is, S(L j ) = S1(L j );
[0028] 5.4) If the number of training samples of the state S2(L j ) of the current electrical appliance L in the original training set < T1, and the smaller value of the detection accuracy and recall rate of the state S2(L j ) on the original training set ≥ T2, then let S(L j ) = S2(L j ), where T1 represents the threshold of the number of training samples per class, and T2 represents the effect threshold of the GRU deep learning method and the LightGBM random forest algorithm on the original training set; 5.5) If the number of training samples of the state S2(L j ) of the current electrical appliance L in the original training set ≥ T1, and the smaller value of the detection accuracy and recall rate of the state S2(L j ) on the original training set ≥ T2 and the smaller value of the detection accuracy and recall rate of the state S1(L j ) on the original training set < T2, then let S(L j ) = S2(L j ); j ) = S2(L j );
[0029] 5.6) If the number of training samples of the state S2(L j ) of the current electrical appliance L in the original training set < T2, and the smaller value of the detection accuracy and recall rate of the state S1(L[[ID=I=66]] j ) on the original training set < T2, then let the value of S(L j ) be S1(L j )、S2(L j ) The state with fewer training samples in the original training set is S(L j ) as the current electrical appliance L j load status.
[0030] Compared with the prior art, the present invention has the following advantages:
[0031] 1) This paper creatively combines the GRU deep neural network with a strong time series modeling capability with the Transformer attention mechanism, and introduces the LightGBM random forest algorithm. The resulting GRU model for classifying the working status of each single electrical appliance can not only mine the dependency between current, active power, apparent power, and time, but also highlight key points and find key segments and information, thus improving the performance of the ordinary GRU model.
[0032] 2) For states with few samples, the present invention obtains relatively accurate results by constructing a state classification random forest, effectively solving the problem of unbalanced load samples in multiple states;
[0033] 3) Compared to existing technologies, the method of the present invention is a non-invasive load identification method that is more robust to the number of samples of different appliance states. It can accurately derive the load state of each appliance based on the current, active power, and reactive power of the total electricity meter. It is more versatile and lays the foundation for further application. The method of the present invention has higher state recognition accuracy. Moreover, because it is based on low-frequency non-invasive sampling data once every minute, it does not require hardware modification of the electricity meter, which greatly saves costs. It is suitable for application scenarios such as smart home energy efficiency management and has broad prospects for application and promotion.
[0034] 4) Furthermore, the present invention combines the GRU deep learning method and the LightGBM random forest algorithm, so that it can select the appropriate algorithm in different situations, and obtains an identification effect that is better than a single-class algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 The confusion matrix of the six working states of the refrigerator in the embodiment on the test data set;
[0036] Figure 2 The structural diagram of the state classification GRU deep neural network TAGRU constructed by the present invention;
[0037] Figure 3 This is a current diagram of the total electric meter when it is working, collected in the embodiment;
[0038] Figure 4 The state of the TV set and the corresponding current diagram obtained by the working state classification GRU model in the embodiment;
[0039] Figure 5 Graph showing the actual current flow of the television set in the embodiment. DETAILED DESCRIPTION
[0040] The present invention will be described in further detail below with reference to the accompanying drawings and embodiments.
[0041] The non-intrusive load identification method integrating GRU and random forest in an embodiment includes the following steps:
[0042] 1) Collect the training data of current, active power and reactive power of each single appliance, divide it into original training set and test data set, cluster the current, active power and reactive power of each single appliance, obtain the working state set of each single appliance, and extract features suitable for LightGBM random forest algorithm.
[0043] The specific process of step 1) is:
[0044] 1.1) Suppose there are N=8 appliances / sub-meters, namely, rental room sub-meter, heat pump sub-meter, refrigerator sub-meter, power amplifier sub-meter, basement sub-meter, dishwasher sub-meter, washing machine sub-meter and restaurant sub-meter. The training data of current, active power and reactive power at time t are collected and divided into the original training set and the test data set. The sequences of current, active power and reactive power in the original training set are k'=1,2,…N, use meanshift clustering method to cluster them into M categories, requiring the number of categories M≤6, and obtain the cluster set, which is the working state set of each single electrical appliance;
[0045] When the number of clustered categories M>6, gradually increase the bandwidth parameter of the meanshift clustering method, and each time the bandwidth parameter value increases by 5 until the number of categories M≤6, and obtain the cluster set, which is the working state set of each single appliance. Taking the refrigerator as an example, the confusion matrix of the 6 working states obtained by clustering on the test data set is as follows Figure 1 As shown;
[0046] 1.2) Extract features suitable for the LightGBM random forest algorithm: For the LightGBM random forest algorithm, extract the total current i at time t t , total active power p t and total apparent power s t And the total current i at time t-1 t-1 , total active power p t-1 and total apparent power s t-1 , take the value mod(t,1440) / 1440 normalized by day at time t and the value mod(t,10080) / 10080 normalized by week at time t as features, that is:
[0047]
[0048] In the above formula, t%1440 represents the remainder when t is divided by 1440, and t%10080 represents the remainder when t is divided by 10080.
[0049] 2) Construct a state classification GRU deep neural network TAGRU based on the Transformer attention mechanism, use the extracted features suitable for the LightGBM random forest algorithm as training data to train the state classification GRU deep neural network TAGRU, and obtain the working state classification GRU model of each single electrical appliance.
[0050] like Figure 2 As shown in Figure 2, the structure of the state classification GRU deep neural network TAGRU constructed in step 2) consists of the first GRU layer, the first ReLU nonlinear layer, the second GRU layer, four parallel attention layers, the Concat layer, the Flatten layer, the second ReLU nonlinear layer, the first fully connected layer, the Dropout layer, the second fully connected layer and the classification layer.
[0051] 3) Construct a state classification random forest, collect the total current, total active power and total apparent power at any moment as training data to train the state classification random forest, and obtain the working state classification random forest model of each single electrical appliance.
[0052] The process of constructing the state classification random forest in step 3) is:
[0053] 3.1) For the GRU deep learning method, directly use the total current i at any time t , total active power p t and total apparent power s t As input features, namely;
[0054] 3.2) Randomly sample with replacement from the original training set each time to obtain multiple training sets, and then train multiple decision trees based on the multiple training sets;
[0055] 3.3) For each decision tree, select the best feature value according to the Gini index when splitting the decision tree until all training samples of each node in each decision tree belong to the same class;
[0056] 3.4) Multiple decision trees are combined into a random forest using the voting method, thus obtaining a state classification random forest.
[0057] 4) Collect the current when the total meter is working (see the current diagram of the total meter when working) Figure 3) The data of active power and reactive power are collected, and the collected data are respectively sent into the working state classification GRU model and the working state classification random forest model of each single electrical appliance to classify the working state of each single electrical appliance, and the working state categories of each single electrical appliance are obtained.
[0058] 5) Integrate the results of the working state classification GRU model and the working state classification random forest model of each single electrical appliance to obtain the optimized working state categories of each single electrical appliance, which are the load states of each single electrical appliance.
[0059] The specific process of step 5) is as follows:
[0060] 5.1) Take the TV as the current electrical appliance L j , for the current electrical appliance L j , extract its current i, active power p and apparent power a as features, and send them into the working state classification GRU model to obtain the working state S1(L j ) of the current electrical appliance L, and its state and the corresponding current diagram are as shown in j ; Figure 4 shown;
[0061] 5.2) Extract the current i t and i t-1 , active power p t and p t-1 , apparent power a t and a t-1 as well as the timestamp features t1 and t2, and send them into the LightGBM random forest algorithm to obtain the working state S2(L j ) of the current electrical appliance L; j )
[0062] 5.3) Set the state of the current electrical appliance L j to S1(L j ), that is, S(L j ) = S1(L j );
[0063] 5.4) If the number of training samples of the state S2(L j ) of the current electrical appliance L in the original training set < T1, and the smaller value of the detection accuracy and recall rate of the state S2(L j ) on the original training set ≥ T2, then let S(L j ) = S2(L j ) j), where T1 represents the threshold of the number of training samples for each category. In this embodiment, T1 = 400 is taken; T2 represents the effect threshold of the GRU deep learning method and the LightGBM random forest algorithm on the original training set. That is, when the performance metric value of a certain working state on the training set is less than a specific value, it means that the detection effect of this method or algorithm on this category on the original training set is not good enough. In this embodiment, T2 = 0.95 is taken;
[0064] 5.5) If the state S2(L j ) of the current electrical appliance L j ) in the original training set satisfies that the number of training samples ≥ T1, and the smaller value of the detection accuracy and recall rate of the state S2(L j ) on the original training set ≥ T2, and the smaller value of the detection accuracy and recall rate of the state S1(L j ) on the original training set < T2, then let S(L j ) = S2(L j );
[0065] 5.6) If the number of training samples of the state S2(L j ) of the current electrical appliance L j ) in the original training set < T1, and the smaller value of the detection accuracy and recall rate of the state S1(L j ) on the original training set < T2, then let the value of S(L j ) be the state with fewer training samples in the original training set among the two states of S1(L j ) and S2(L j ), and use S(L j ) as the load state of the current electrical appliance L j ). Figure 5 This is the actual current diagram of the TV in this embodiment.
[0066] The above non-intrusive load identification method integrating GRU and random forest can accurately deduce the load state of each electrical appliance based on the current, active power, and reactive power of the total meter. It has strong versatility, higher state recognition accuracy, and since it is based on low-frequency non-intrusive sampling data sampled once per minute, there is no need to modify the hardware of the meter, which greatly saves costs. It is suitable for application scenarios such as smart home energy efficiency management, and has broad application and promotion prospects.
Claims
1. A non-intrusive load identification method integrating GRU and random forest, characterized in that: The load identification method is a non-intrusive load identification method based on low-frequency sampling once per minute, and the load identification method includes the following steps: 1) Collect the training data of current, active power and reactive power of each single appliance, divide it into original training set and test data set, cluster the current, active power and reactive power of each single appliance, obtain the working state set of each single appliance, and extract features suitable for LightGBM random forest algorithm; 2) Construct a state classification GRU deep neural network TAGRU based on the Transformer attention mechanism, use the extracted features suitable for the LightGBM random forest algorithm as training data to train the state classification GRU deep neural network TAGRU, and obtain the working state classification GRU model of each single appliance; 3) Construct a state classification random forest, collect the total current, total active power and total apparent power at any moment as training data to train the state classification random forest, and obtain the working state classification random forest model of each single electrical appliance; 4) Collecting the current, active power, and reactive power data of the total electric meter during operation, and feeding the collected data into the GRU model and random forest model for the working state classification of each single electrical appliance, classifying the working state of each single electrical appliance to obtain the working state category of each single electrical appliance; 5) Integrate the results of the GRU model and the random forest model for the working state classification of each single appliance to obtain the optimized working state category of each single appliance, that is, the load state of each single appliance; The structure of the state classification GRU deep neural network TAGRU constructed in step 2) consists of the first GRU layer, the first ReLU nonlinear layer, the second GRU layer, four parallel attention layers, the Concat layer, the Flatten layer, the second ReLU nonlinear layer, the first fully connected layer, the Dropout layer, the second fully connected layer and the classification layer; The process of constructing the state classification random forest in step 3) is: 3.1) For the GRU deep learning method, directly use the total current i at any time t , total active power p t and total apparent power s t As input features, 3.2) Randomly sample with replacement from the original training set each time to obtain multiple training sets, and then train multiple decision trees based on the multiple training sets; 3.3) For each decision tree, select the best feature value according to the Gini index when splitting the decision tree until all training samples of each node in each decision tree belong to the same class; 3.4) Multiple decision trees are combined into a random forest using the voting method, thus obtaining a state classification random forest.
2. The non-intrusive load identification method integrating GRU and random forest according to claim 1 is characterized in that: The specific process of step 1) is: 1.1) Suppose there are N electrical appliances. The training data of their current, active power and reactive power at time t are collected and divided into the original training set and the test data set. The sequences of current, active power and reactive power in the original training set are k'=1,2,…N, use meanshift clustering method to cluster them into M categories, requiring the number of categories M≤6, and obtain the cluster set, which is the working state set of each single electrical appliance; When the number of clustering categories M>6, gradually increase the bandwidth parameter of the meanshift clustering method by 5 each time until the number of categories M≤6, and obtain the cluster set, which is the working state set of each single electrical appliance; 1.2) Extract features suitable for the LightGBM random forest algorithm: For the LightGBM random forest algorithm, extract the total current i at time t t , total active power p t and total apparent power s t And the total current i at time t-1 t-1 , total active power p t-1 and total apparent power s t-1 , take the value mod(t,1440) / 1440 normalized by day at time t and the value mod(t,10080) / 10080 normalized by week at time t as features, that is: In the above formula, t%1440 represents the remainder when t is divided by 1440, and t%10080 represents the remainder when t is divided by 10080.
3. The non-intrusive load identification method integrating GRU and random forest according to claim 1 is characterized in that: The specific process of step 5) is: 5.1) For the current electrical appliance L j , extract its current i, active power p and apparent power a as features, send them into the working state classification GRU model, and get the current appliance L j Working state S1(L j ); 5.2) Extraction current i t and i t-1 , active power p t and p t-1 , apparent power a t and a t-1 And timestamp features t1 and t2 are fed into the LightGBM random forest algorithm to obtain the current appliance L j Working state S2(L j ); 5.3) Set the current appliance L j The state is set to S1(L j ), that is, S(L j )=S1(L j ); 5.4) If the current electrical appliance L j The number of training samples of the state S2(L j ) in the original training set < T1, and the smaller value of the detection accuracy and recall rate of the state S2(L j ) on the original training set ≥ T2, then let S(L j ) = S2(L j ), where T1 represents the threshold of the number of training samples per class, and T2 represents the effect threshold of the GRU deep learning method and the LightGBM random forest algorithm on the original training set; 5.5) If the current electrical appliance L j has a number of training samples of state S2(L j ) in the original training set ≥ T1, and the smaller value of the detection accuracy and recall rate of state S2(L j ) on the original training set ≥ T2 and the smaller value of the detection accuracy and recall rate of state S1(L j ) on the original training set < T2, then let S(L j ) = S2(L j ); 5.6) If the current electrical appliance L j 's state S2(L j ) has a number of training samples < T2 in the original training set, and the smaller value of the detection accuracy and recall rate of state S1(L j ) on the original training set < T2, then set the value of S(L j ) to be the state with fewer training samples in the original training set among the two states S1(L j ) and S2(L j ), and use S(L j ) as the load state of the current electrical appliance L j .
Citation Information
Patent Citations
Random forest-based non-invasive home appliance identification method
CN107273920A
Sub-industry power load prediction method and device based on federated learning, and storage medium
CN115600717A