Specific user identification and electricity consumption anomaly detection method based on multi-level electricity consumption characteristics

By building multi-level power consumption characteristics and optimized machine learning models, the problems of low recognition accuracy of hollow nest users and low detection efficiency of power consumption abnormalities in the existing technology are solved, and higher recognition accuracy and automated early warning functions are achieved.

CN119719966APending Publication Date: 2025-03-28CHINA JILIANG UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411787634.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the prior art, when identifying empty nest users from electricity consumption data and performing electricity consumption abnormality detection, there are problems such as low identification accuracy, poor classification accuracy on a few categories, and data imbalance.

Method used

Using a method based on multi-level power consumption characteristics, we collect and preprocess users' historical power consumption data, build shallow and deep power consumption characteristics, and optimize the convolutional neural network in combination with the multi-head attention mechanism to form a multi-level power consumption feature set. Then, a weighted decision tree and a random forest model are constructed, and the model parameters are optimized through the particle swarm optimization algorithm to improve the accuracy of empty-nest user identification, and to detect and warning electricity consumption anomalies.

Benefits of technology

It improves the accuracy of empty nest user identification and the efficiency of power consumption abnormality detection, reduces the misidentification rate of a few categories, and effectively deals with the problem of data imbalance, and realizes the automatic power consumption abnormality warning function.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719966A_ABST
    Figure CN119719966A_ABST
Patent Text Reader

Abstract

The invention discloses a specific user identification and power consumption anomaly detection method based on multilevel power consumption characteristics, and belongs to the technical field of power electronic control. The method mainly comprises the following steps: optimizing a convolutional neural network according to historical power consumption data of a user in combination with a manual and multi-head attention mechanism to extract multi-level power consumption characteristics, and performing secondary weighting on final votes in a random forest by constructing a weighted decision tree and calculating importance similarity of the weighted decision tree and a random forest characteristic to form a weighted random forest algorithm. And finally, optimizing a weighted random forest through a particle swarm optimization algorithm to identify a specific user of the empty nest elderly, then detecting daily power consumption of the empty nest user according to an abnormal power consumption index, and carrying out telephone early warning on management personnel in a cell where the empty nest user with abnormal power consumption is located. According to the method, the empty nest users can be identified online according to the historical power consumption data, early warning can be performed in time when the power consumption is abnormal, the safety of the empty nest users is guaranteed from the perspective of power consumption, and the method has certain practical value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power electronic control, and in particular to a method for identifying specific users and detecting abnormal power consumption based on multi-level power consumption characteristics. Background Art

[0002] With the continuous development of society and the general increase in life expectancy, the number of elderly people is increasing. The way to identify empty-nest elderly people mainly relies on manual door-to-door visits, and then regularly provide corresponding care to empty-nest elderly people based on the results of the visits. This method often consumes a lot of manpower and material resources. At present, big data technology has been widely used in many fields, including the power industry. With the support of massive electricity consumption data, combined with the current rapidly developing data analysis technologies such as machine learning and deep learning, it has become possible to accurately identify empty-nest users from the perspective of electricity consumption, and on this basis, it is possible to detect abnormal electricity consumption of empty-nest users, thereby protecting the life and property safety of power users from the perspective of electricity consumption.

[0003] At present, the research methods for achieving classification by mining users' electricity consumption data are mainly divided into supervised and unsupervised algorithms. Among them, the unsupervised classification algorithms mainly include K-means algorithm, fuzzy clustering algorithm, etc. The supervised algorithm trains the classification model through the relationship between the labels and features in the data, and finally classifies the users. It is mainly divided into two parts: feature extraction and building a classification model. Among them, the feature extraction methods are mainly divided into manual extraction, convolutional neural network CNN, time convolution network TCN automatic feature extraction, etc.; the models used for power user classification mainly include decision trees, support vector machines and other machine learning models and long short-term memory networks LSTM, gated recurrent units GRU and other deep learning models.

[0004] Although unsupervised algorithms such as clustering do not require pre-labeled data and can directly discover user electricity usage patterns from their electricity usage data, they do not use clear labels to guide classification, making the classification results difficult to interpret. In addition, there may be noise in the electricity usage data, which seriously affects the recognition accuracy. Among them, manual extraction of electricity usage features usually relies on the researcher's experience to design a suitable feature combination, and manual feature extraction is difficult to capture nonlinear and high-order relationships that may exist in the data. The deep learning classification model classifies users. Although its accuracy is improved compared to the traditional machine learning model, the actual number of empty-nest users is much smaller than the number of ordinary users. The model may tend to predict categories with larger data volumes, thereby ignoring categories with smaller data volumes, resulting in poor classification accuracy for minority classes. Summary of the invention

[0005] In view of the shortcomings of the prior art, the present invention proposes a method for specific user identification and abnormal power consumption detection based on multi-level power consumption features. First, the historical power consumption data of empty-nest and non-empty-nest users are collected, and the original data is preprocessed. The shallow power consumption feature indicators are constructed by the different power consumption habits of empty-nest and non-empty-nest users. At the same time, the multi-head attention mechanism (Multi-Head Attention, MHA) is used to optimize the convolutional neural network (Convolutional Neural Network, CNN) to obtain the deep power consumption features of empty-nest and non-empty-nest elderly people, and obtain a multi-level power consumption feature set that characterizes the two types of users. In order to improve the impact of data imbalance on the model and reduce the impact of some decision trees with poor classification accuracy on the classification results of random forest (RandomForest, RF), the weights are calculated according to the proportion of the two types of users in the sample to construct a weighted decision tree, and the final vote in the random forest is twice weighted by calculating the similarity of the importance of the weighted decision tree and the random forest feature to improve the traditional random forest algorithm, and the internal parameters of the weighted random forest are optimized by combining the particle swarm optimization algorithm, thereby improving the classification performance of the model. Then, the empty-nest and non-empty-nest user labels and the corresponding multi-level electricity consumption features are divided into training sets and test sets in a ratio of 7:3 to train the empty-nest user identification model. Finally, abnormal electricity consumption indicators are established for the identified empty-nest users to detect abnormal electricity consumption in their daily electricity consumption. When abnormal electricity consumption of an empty-nest user in a certain community is detected, an AT command is sent to the SIM900A communication module using the computer, so as to automatically call the management personnel of the community where the empty-nest user is located.

[0006] A method for identifying specific users and detecting abnormal power consumption based on multi-level power consumption characteristics comprises the following steps:

[0007] Step 1: Data preprocessing: Obtain users’ daily electricity consumption data through the power grid electricity consumption information collection system, fill in the missing values, and mark empty-nest and non-empty-nest user labels;

[0008] Step 2: Construct shallow electricity consumption characteristics: Construct shallow electricity consumption characteristic indicators to distinguish empty-nest users and non-empty-nest users through their different electricity consumption habits;

[0009] Step 3: Construct deep electricity consumption features: Use the multi-head attention mechanism (Multi-Head Attention, MHA) to optimize the convolutional neural network (Convolutional Neural Network, CNN) to build the MHA-CNN feature extraction model to obtain the deep electricity consumption features of empty-nest and non-empty-nest users;

[0010] Step 4: Construct multi-level electricity consumption features: Combine the shallow electricity consumption features extracted manually with the deep electricity consumption features extracted by the convolutional neural network to form multi-level electricity consumption features;

[0011] Step 5: Construct a weighted random forest model: Construct a weighted decision tree, and perform a secondary weighting on the final vote in the random forest by calculating the similarity between the weighted decision tree and the feature importance of the random forest to improve the traditional random forest algorithm to form a weighted random forest model;

[0012] Step 6: Train and test the empty-nest user identification model: The particle swarm optimization algorithm is used to optimize the internal parameters of the random forest, thereby improving the recognition performance of the weighted random forest model for empty-nest users. Finally, the empty-nest and non-empty-nest user labels and the corresponding multi-level electricity consumption characteristics are divided into training sets and test sets in a ratio of 7:3 to train and test the weighted random forest model, and finally the empty-nest user identification model is obtained;

[0013] Step 7: Abnormal power consumption detection for empty-nest users: Establish abnormal power consumption indicators for the identified empty-nest users and perform abnormal power consumption detection on the daily power consumption of empty-nest users;

[0014] Step 8: Alert for abnormal power consumption of empty-nest users: When abnormal power consumption of an empty-nest user in a community is detected and an alert call needs to be made to the community manager, an AT command is sent to the SIM900A communication module via the computer to automatically make an alert call to the manager of the community where the empty-nest user is located.

[0015] As a preference, step 1 data preprocessing process:

[0016] Considering that some data may be missing or abnormal during data collection, this article removes users whose missing data is greater than 30% of the annual data volume, and fills the missing data of other users with the mean, as shown in the following formula:

[0017]

[0018] In the formula, g(x d ) is the filling value, x d is the electricity consumption of the user on day d, x NAN is the fill value.

[0019] The electricity consumption data label of empty-nest users is marked as 1, and the electricity consumption data of non-empty-nest users is marked as 0.

[0020] As a preferred method, step 2 constructs the shallow power consumption feature process:

[0021] The date when abnormal power consumption data occurs is marked as 1, and the date when normal power consumption data occurs is marked as 0.

[0022] The shallow power consumption feature F = {F0, F1, F2, F3, F4} for distinguishing empty-nest users from non-empty-nest users is calculated based on the user power consumption data.

[0023] F0 represents the standard deviation of daily electricity consumption after differentiation, and the calculation formula is as follows:

[0024] f=|x d+1 -x d | (2)

[0025]

[0026]

[0027] where x d (1<d<365) represents the user's annual electricity consumption data, f j (j=1, ..., 364) is the difference in electricity consumption between two consecutive days, Represents the mean of the annual electricity consumption data after difference.

[0028] F1 is the fluctuation of electricity consumption in summer, expressed as:

[0029]

[0030]

[0031] In the formula represents the average annual electricity consumption of users, and D represents the number of summer days in that year.

[0032] F2 represents the fluctuation of electricity consumption in the 10 days before and after the Spring Festival, expressed as:

[0033]

[0034] F3 is the ratio of electricity consumption on working days to that on rest days, expressed as:

[0035]

[0036] Where n is the total number of weeks, x ac Represents the electricity consumption on the cth day in the ath week.

[0037] F4 is the peak-to-average power ratio, expressed as:

[0038]

[0040] where x max The maximum power consumption.

[0041] As a preferred method, step 3 constructs a deep power consumption feature process:

[0042] The multi-head attention mechanism uses multiple parallel attention functions to input different feature information of the data in the same area, and then concatenates or weights the results of these different attention functions, so as to comprehensively consider the relationship between multiple features. Its core is to weight the value matrix V according to the similarity between the query matrix Q and the key matrix K, which can be specifically expressed as:

[0043]

[0044] Where i∈[1,h], h is the number of heads, is the output value of the previous layer of network, and is the weight matrix, d k is the dimension of the key matrix K, softmax is the activation function, A i is the attention score of the i-th head.

[0045] The final output state is obtained by concatenating and linearly transforming the attention scores of each attention head, which can be expressed as:

[0046] O mha =(A1, ....A h )W o (11)

[0047] Where W o is the trainable weight matrix.

[0048] Convolutional neural networks are mainly composed of convolutional layers, pooling layers, and fully connected layers. The convolutional layer learns different local features of the input feature map through multiple convolution kernels of different sizes and shapes. Its calculation process can be expressed as:

[0049] y=f(∑x*w ij +b1) (12)

[0050] Where x is the input matrix, w ij is the weight matrix, b1 is the bias matrix, and f(·) is the ReLU activation function.

[0051] The pooling layer reduces the spatial dimension of the feature map by downsampling the output of the previous layer. The previous layer is usually located after the convolutional layer and uses the Adam optimization algorithm to perform supervised training on the MHA-CNN model. Its loss function is:

[0052]

[0053] where y u , They represent the actual type of user u and the type predicted by the model respectively.

[0054] After multiple convolutional layers and pooling layers, the deep electricity consumption features P of empty-nest and non-empty-nest users are finally output by the fully connected layer.

[0055] As a preferred method, step 4 constructs a multi-level electricity consumption feature process:

[0056] The shallow power consumption feature index F and the deep power consumption feature vector P are concatenated to obtain a multi-level power consumption feature set.

[0057] As a preference, step 5 constructs a weighted random forest model process:

[0058] The training data set D is extracted from the original data set by the bootstrap sampling method. D contains N samples, and the sample weight of each category is W. k , which can be expressed as:

[0059]

[0060] Where N is the total number of samples, n k is the number of samples of category k, and C is the total number of categories.

[0061] The similarity coefficient between the contribution rate of each feature of each decision tree and the contribution rate of the random forest feature is calculated by formula (15) , where the similarity coefficient ranges from [0, 1]. The closer it is to 1, the higher the correlation between the contribution rates of the two groups of features.

[0062]

[0063] In the formula N is the number of features.

[0064] The similarity coefficient is used as the weight of the decision tree in the final voting. The voting results of all decision trees are counted by this formula, and the mode with the most voting results is used as the final prediction result of the weighted random forest. The weighted random forest {T1, T2, ..., T t The final prediction result of} can be expressed as shown in formula (16):

[0065]

[0066] Where C is the set of all labels, and I(*) is the indicative function.

[0067] As a preferred method, step 6 is to train and test the empty-nest user identification model process:

[0068] Initialize the particle position and velocity as well as parameters such as group size, number of iterations, and acceleration factor, where each particle represents a set of potential parameters for the weighted random forest algorithm.

[0069] The fitness function of the particle swarm optimization algorithm is set to the recognition accuracy of the weighted random forest model for empty-nest users, and the optimization parameters are the number of decision trees and the maximum depth of the decision trees.

[0070] The fitness of each particle in the particle swarm is calculated according to the evaluation index of classification performance. If the fitness of the current particle position is better than the best position P found by the group, gdt The fitness of the particle is updated idt , and the best fitness position P among all particles gdt Update to the location of the particle. If the preset number of iterations is reached or the fitness reaches the global optimal solution, the number and maximum depth of the best decision tree are output, which can be specifically expressed as:

[0071]

[0072] Where d is the particle dimension, X is the particle location, V is the particle speed, and V id(t+1) With X id(t+1) Respectively represent the updated particle velocity and position. idt , P gdt They represent the best positions found by the individual and the group after t iterations respectively, ω represents the weight parameter, r1 and r2 represent random numbers in the interval [0, 1], and c1 and c2 represent acceleration coefficients.

[0073] The empty-nest and non-empty-nest user labels and the corresponding multi-level electricity consumption characteristics are divided into training sets and test sets in a ratio of 7:3 to train and test the weighted random forest model optimized by the particle swarm optimization algorithm, and finally the empty-nest user recognition model is obtained.

[0074] As a preferred embodiment, step 7 is the process of detecting abnormal power consumption of empty-nest users:

[0075] If the current electricity consumption E(t) of the empty-nest user is 0, it is determined that a power outage has occurred in the home of the empty-nest elderly.

[0076] If the current electricity consumption E(t) is not 0, then determine whether the variance of the empty-nest user's electricity consumption in the past 12 hours is less than 1% of the average electricity consumption of the empty-nest user in the past 12 hours. If it is true, it is determined that there is a sudden situation at the empty-nest user's home, such as the user fainting or no one at home, and relevant personnel need to go to the user's home for further judgment. It can be expressed as:

[0077]

[0078]

[0079]

[0080] Where E(t) represents the current electricity consumption of the empty-nest user, E(t-1) represents the electricity consumption of the empty-nest user in the past hour, and so on; F(t) represents the mean and variance of the electricity consumption of empty-nest users in the past 12 hours.

[0081] As a preferred embodiment, step 8, the abnormal power consumption alarm process of empty-nest users:

[0082] First, make sure the SIM900A module is intact and fully functional, prepare a SIM card that supports GSM / GPRS communication, and a USB to TTL module to achieve serial communication between the computer and the SIM900A module.

[0083] Assemble the SIM900A module and connect it to the computer to ensure that the SIM900A module can communicate normally.

[0084] When abnormal electricity consumption of an empty-nest user in a community is detected and an early warning call is needed to the community manager, the computer sends an AT command (such as "ATD <phone number>") to the SIM900A module. After the SIM900A module parses the command, it initiates a call to the target phone number through the mobile network.

[0085] The method adopted is mainly to combine the shallow power consumption features constructed by artificial experience with the deep features extracted by deep learning neural network to form a multi-level power consumption feature set, and to perform secondary weighting on the final vote in the random forest by constructing a weighted decision tree and calculating the similarity of the weighted decision tree and the feature importance of the random forest. The traditional random forest algorithm is then used to form a weighted random forest algorithm. The internal parameters of the weighted random forest are then optimized by the particle swarm optimization algorithm, thereby improving the model's recognition performance for empty-nest users. After training and testing the weighted random forest model using the multi-level power consumption feature set, the optimal parameters are saved to form an empty-nest user recognition model. This model can be used in combination with power consumption data to identify empty-nest users for unknown types of users. Finally, the daily power consumption of empty-nest users is detected based on the power consumption abnormality index. If it is detected that a certain empty-nest user in a community has abnormal power consumption and it is necessary to call the community manager, the computer sends an AT command to the SIM900A communication module, thereby automatically calling the manager of the community where the empty-nest user is located. The operation flow chart is shown below. Figure 1 shown. BRIEF DESCRIPTION OF THE DRAWINGS

[0086] Figure 1 This is a flow chart of specific user identification and abnormal power consumption detection of the present invention.

[0087] Figure 2 This is the weighted random forest structure diagram.

[0088] Figure 3Flowchart for optimizing weighted random forest parameters for particle swarm optimization algorithm.

[0089] Figure 4 This is an application scenario diagram in the present invention. DETAILED DESCRIPTION

[0090] The technical solutions in the embodiments of the present invention will be clearly and completely described below in combination with the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0091] Embodiment 1: A method for identifying specific users and detecting abnormal power consumption based on multi-level power consumption characteristics, comprising the following steps:

[0092] Step 1: Data preprocessing: Obtain users’ daily electricity consumption data through the power grid electricity consumption information collection system, fill in the missing values, and mark empty-nest and non-empty-nest user labels;

[0093] Step 2: Construct shallow electricity consumption characteristics: Construct shallow electricity consumption characteristic indicators to distinguish empty-nest users and non-empty-nest users through their different electricity consumption habits;

[0094] Step 3: Construct deep electricity consumption features: Use the multi-head attention mechanism (Multi-Head Attention, MHA) to optimize the convolutional neural network (Convolutional Neural Network, CNN) to build the MHA-CNN feature extraction model to obtain the deep electricity consumption features of empty-nest and non-empty-nest users;

[0095] Step 4: Construct multi-level electricity consumption features: Combine the shallow electricity consumption features extracted manually with the deep electricity consumption features extracted by the convolutional neural network to form multi-level electricity consumption features;

[0096] Step 5: Construct a weighted random forest model: Construct a weighted decision tree, and perform a secondary weighting on the final vote in the random forest by calculating the similarity between the weighted decision tree and the feature importance of the random forest to improve the traditional random forest algorithm to form a weighted random forest model;

[0097] Step 6: Train and test the empty-nest user identification model: The particle swarm optimization algorithm is used to optimize the internal parameters of the random forest, thereby improving the recognition performance of the weighted random forest model for empty-nest users. Finally, the empty-nest and non-empty-nest user labels and the corresponding multi-level electricity consumption characteristics are divided into training sets and test sets in a ratio of 7:3 to train and test the weighted random forest model, and finally the empty-nest user identification model is obtained;

[0098] Step 7: Abnormal power consumption detection for empty-nest users: Establish abnormal power consumption indicators for the identified empty-nest users and perform abnormal power consumption detection on the daily power consumption of empty-nest users;

[0099] Step 8: Alert for abnormal power consumption of empty-nest users: When abnormal power consumption of an empty-nest user in a community is detected and an alert call needs to be made to the community manager, an AT command is sent to the SIM900A communication module via the computer to automatically make an alert call to the manager of the community where the empty-nest user is located.

[0100] Specific steps:

[0101] (1) Data processing:

[0102] 1) Considering that some data may be missing or abnormal during data collection, this paper excludes users whose data missing amount is greater than 30% of the annual data volume, and fills the missing data of other users with the mean value, as shown in the following formula:

[0103]

[0104] In the formula, g(x d ) is the filling value, x d is the electricity consumption of the user on day d, x NAN is the fill value.

[0105] 2) The electricity consumption data label of the empty-nest user is marked as 1, and the electricity consumption data of the non-empty-nest user is marked as 0.

[0106] (2) Constructing shallow electricity consumption characteristics:

[0107] The shallow power consumption feature F = {F0, F1, F2, F3, F4} for distinguishing empty-nest users from non-empty-nest users is calculated based on the user power consumption data.

[0108] 1) F0 represents the standard deviation of daily electricity consumption after differentiation, and the calculation formula is as follows:

[0109] f=|x d+1 -x d | (22)

[0110]

[0111]

[0112] where x d (1<d<365) represents the user's annual electricity consumption data, f j (j=1, ..., 364) is the difference in electricity consumption between two consecutive days, Represents the mean of the annual electricity consumption data after difference.

[0113] 2) F1 is the fluctuation of electricity consumption in summer, expressed as:

[0114]

[0115]

[0116] In the formula represents the average annual electricity consumption of users, and D represents the number of summer days in that year.

[0117] 3) F2 represents the fluctuation of electricity consumption in the 10 days before and after the Spring Festival, expressed as:

[0118]

[0119] 4) F3 is the ratio of electricity consumption on working days to that on rest days, expressed as:

[0120] Where n is the total number of weeks, x ac Represents the electricity consumption on the cth day in the ath week.

[0121] 5) F4 is the peak-to-average power ratio, expressed as:

[0122]

[0123] where x max The maximum power consumption.

[0124] (3) Constructing deep electricity consumption characteristics:

[0125] 1) The multi-head attention mechanism uses multiple parallel attention functions to locate different feature information of the input data in the same area, and then concatenates or weights the results of these different attention functions, so as to comprehensively consider the relationship between multiple features. Its core is to weight the value matrix V according to the similarity between the query matrix Q and the key matrix K, which can be specifically expressed as:

[0126]

[0127] Where i∈[1,h], h is the number of heads, is the output value of the previous layer of network, and is the weight matrix, d k is the dimension of the key matrix K, softmax is the activation function, A i is the attention score of the i-th head.

[0128] The final output state is obtained by concatenating and linearly transforming the attention scores of each attention head, which can be expressed as: O mha =(A1, ....A h )W o (31)

[0129] Where W o is the trainable weight matrix.

[0130] Convolutional neural networks are mainly composed of convolutional layers, pooling layers, and fully connected layers. The convolutional layer learns different local features of the input feature map through multiple convolution kernels of different sizes and shapes. Its calculation process can be expressed as:

[0131] y=f(∑x*w ij +b1) (32)

[0132] Where x is the input matrix, w ij is the weight matrix, b1 is the bias matrix, and f(·) is the ReLU activation function.

[0133] The pooling layer reduces the spatial dimension of the feature map by downsampling the output of the previous layer. The previous layer is usually located after the convolutional layer and uses the Adam optimization algorithm to perform supervised training on the MHA-CNN model. Its loss function is:

[0134] where y u , They represent the actual type of user u and the type predicted by the model respectively.

[0135] After multiple convolutional layers and pooling layers, the deep electricity consumption features P of empty-nest and non-empty-nest users are finally output by the fully connected layer.

[0136] (4) Constructing multi-level electricity consumption characteristics:

[0137] The shallow power consumption feature index F and the deep power consumption feature vector P are concatenated to obtain a multi-level power consumption feature set.

[0138] (5) Constructing a weighted random forest model:

[0139] 1) Extract the training data set D from the original data set by the self-service sampling method. D contains N samples, and the sample weight of each category is W. k , which can be expressed as:

[0140]

[0141] Where N is the total number of samples, n k is the number of samples of category k, and C is the total number of categories.

[0142] 2) Calculate the similarity coefficient d(X, X) between the contribution rate of each feature of each decision tree and the contribution rate of the random forest feature. t ), where the similarity coefficient ranges from [0 to 1]. The closer it is to 1, the higher the correlation between the contribution rates of the two groups of features. It can be expressed as:

[0143]

[0144] In the formula N is the number of features, and the weighted random forest structure is as follows Figure 2 shown.

[0145] 3) The similarity coefficient is used as the weight of the decision tree in the final voting. The voting results of all decision trees are counted by this formula, and the mode with the most voting results is used as the final prediction result of the weighted random forest. The weighted random forest {T1, T2, ..., T t The final prediction result of} can be expressed as:

[0146]

[0147] Where C is the set of all labels, and I(*) is the indicative function.

[0148] (6) Train and test the empty-nest user identification model:

[0149] 1) Initialize the position and velocity of the particles and parameters such as the group size, number of iterations, and acceleration coefficient, where each particle represents a set of potential parameters of the weighted random forest algorithm.

[0150] 2) The fitness function of the particle swarm optimization algorithm is set to the recognition accuracy of the weighted random forest model for empty-nest users, and the optimization parameters are the number of decision trees and the maximum depth of the decision trees.

[0151] 3) Calculate the fitness of each particle in the particle swarm according to the evaluation index of classification performance. If the fitness of the current particle position is better than the best position P found by the group, gdt The fitness of the particle is updated idt , and the best fitness position P among all particles gdt Update to the location of the particle. If the preset number of iterations is reached or the fitness reaches the global optimal solution, the number and maximum depth of the best decision tree are output, which can be specifically expressed as:

[0152]

[0153] Where d is the particle dimension, X is the particle location, V is the particle speed, and V id(t+1) With X id(t+1) Represent the updated particle speed and position, P idt , P gdt They represent the best positions found by the individual and the group after t iterations respectively, ω represents the weight parameter, r1 and r2 represent random numbers in the interval [0, 1], and c1 and c2 represent acceleration coefficients.

[0154] 4) The particle swarm optimization algorithm optimizes the weighted random forest parameters flow chart as follows Figure 3 As shown in the figure, finally, the empty-nest and non-empty-nest user labels and the corresponding multi-level electricity consumption characteristics are divided into training sets and test sets in a ratio of 7:3 to train and test the weighted random forest model optimized by the particle swarm optimization algorithm, and finally the empty-nest user recognition model is obtained.

[0155] (7) Abnormal power consumption detection for empty-nest users:

[0156] 1) If the current electricity consumption E(t) of the empty-nest user is 0, it is determined that a power outage has occurred in the home of the empty-nest elderly.

[0157] 2) If the current electricity consumption E(t) is not 0, then determine whether the variance of the empty-nest user's electricity consumption in the past 12 hours is less than 1% of the average electricity consumption of the empty-nest user in the past 12 hours. If it is true, it is determined that there is a sudden situation at the empty-nest user's home, such as the user fainting or no one at home, and relevant personnel need to go to the user's home for further judgment, which can be expressed as:

[0158]

[0159]

[0160]

[0161] Where E(t) represents the current electricity consumption of the empty-nest user, E(t-1) represents the electricity consumption of the empty-nest user in the past hour, and so on; F(t) represents the mean and variance of the electricity consumption of empty-nest users in the past 12 hours.

[0162] (8) Warning of abnormal electricity consumption of empty-nest users:

[0163] 1) First, make sure that the SIM900A module is intact and fully functional, prepare a SIM card that supports GSM / GPRS communication, and a USB to TTL module to achieve serial communication between the computer and the SIM900A module.

[0164] 2) Assemble the SIM900A module and connect it to the computer to ensure that the SIM900A module can communicate normally.

[0165] 3) When abnormal electricity consumption of an empty-nest user in a community is detected and an early warning call needs to be made to the community manager, the computer sends an AT command (such as "ATD <phone number>") to the SIM900A module. After the SIM900A module parses the command, it initiates a call to the target phone number through the mobile network.

[0166] Figure 4 This is an application scenario diagram of the present invention.

[0167] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. It should be understood by those skilled in the art that the embodiments may be modified, replaced, or altered without departing from the spirit and principles of the present invention, and the scope of the present invention is limited by the attached claims and their equivalents.

Claims

1. A method for identifying specific users and detecting abnormal power consumption based on multi-level power consumption characteristics, characterized in that: The steps include: (1) Obtain users’ daily electricity consumption data through the power grid electricity consumption information collection system, fill in the missing values, and mark empty-nest and non-empty-nest user labels; (2) Extracting shallow electricity consumption features for distinguishing empty-nest and non-empty-nest users based on labels and electricity consumption data; (3) Using the multi-head attention mechanism (MHA) to optimize the convolutional neural network (CNN) and build the MHA-CNN feature extraction model to obtain the deep electricity consumption characteristics of empty-nest and non-empty-nest users; (4) The shallow power consumption features extracted manually and the deep power consumption features extracted by the convolutional neural network are combined to form a multi-level power consumption feature; (5) Build a weighted decision tree, and perform secondary weighting on the final vote in the random forest by calculating the similarity between the weighted decision tree and the feature importance of the random forest to improve the traditional random forest algorithm and form a weighted random forest model; (6) The particle swarm optimization algorithm is used to optimize the internal parameters of the random forest, thereby improving the recognition performance of the weighted random forest model for empty-nest users. Finally, the empty-nest and non-empty-nest user labels and the corresponding multi-level electricity consumption characteristics are divided into training sets and test sets in a ratio of 7:3 to train and test the weighted random forest model, and finally the empty-nest user recognition model is obtained; (7) Establishing abnormal power consumption indicators for the identified empty-nest users to detect abnormal power consumption in the daily power consumption of the empty-nest users; (8) When it is detected that an empty-nest user in a community has abnormal electricity consumption and it is necessary to make an early warning call to the community manager, an AT command is sent to the SIM900A communication module via a computer, thereby automatically making an early warning call to the manager of the community where the empty-nest user is located.

2. A method for identifying specific users and detecting abnormal power consumption based on multi-level power consumption characteristics according to claim 1, characterized in that: In order to ensure data quality, the original electricity consumption data needs to be preprocessed and marked as empty nest or non-empty nest labels: Step 1: Considering that some data may be missing or abnormal during data collection, this article removes users whose missing data is greater than 30% of the annual data volume, and fills the missing data of other users with the mean, as shown in the following formula: In the formula, g(x d ) is the filling value, x d is the electricity consumption of the user on day d, x NAN is the fill value; Step 2: Label the electricity consumption data of empty-nest users as 1, and the electricity consumption data of non-empty-nest users as 0.

3. The method for identifying specific users and detecting abnormal power consumption based on multi-level power consumption characteristics according to claim 1 is characterized in that: Calculate the shallow power consumption feature F={F0,F1,F2,F3,F4} for distinguishing empty-nest and non-empty-nest users based on the user power consumption data; F0 represents the standard deviation of daily electricity consumption after differentiation, and the calculation formula is as follows: f=|x d+1 -x d | (2) where x d (1 < d < 365) represents the annual electricity consumption data of the user, and f j (j = 1, …, 364) is the difference in electricity consumption between two adjacent days, represents the mean value after the annual electricity consumption data is differenced; F1 is the fluctuation of electricity consumption in summer, expressed as: In the formula represents the average annual electricity consumption of users, and D represents the number of summer days in that year; F2 represents the fluctuation of electricity consumption in the 10 days before and after the Spring Festival, expressed as: F3 is the ratio of electricity consumption on working days to that on rest days, expressed as: Where n is the total number of weeks, x ac represents the electricity consumption on the cth day in the ath week; F4 is the peak-to-average power ratio, expressed as: where x max The maximum power consumption.

4. A method for identifying specific users and detecting abnormal power consumption based on multi-level power consumption characteristics according to claim 1, characterized in that: The multi-head attention mechanism (MHA) is used to optimize the convolutional neural network (CNN) to build the MHA-CNN feature extraction model to obtain the deep electricity consumption characteristics of empty-nest and non-empty-nest users; The multi-head attention mechanism uses multiple parallel attention functions to input different feature information of the data in the same area, and then concatenates or weights the results of these different attention functions, so as to comprehensively consider the relationship between multiple features. Its core is to weight the value matrix V according to the similarity between the query matrix Q and the key matrix K, which can be specifically expressed as: Where i∈[1,h], h is the number of heads, is the output value of the previous layer of network, and is the weight matrix, d k is the dimension of the key matrix K, softmax is the activation function, A i is the attention score of the i-th head; The final output state is obtained by concatenating and linearly transforming the attention scores of each attention head, which can be expressed as: Oh mha =(A1,....A h )W o (11) Where W o is the trainable weight matrix; Convolutional neural networks are mainly composed of convolutional layers, pooling layers, and fully connected layers. The convolutional layer learns different local features of the input feature map through multiple convolution kernels of different sizes and shapes. Its calculation process can be expressed as: y=f(∑x*w ij +b1) (12) Where x is the input matrix, w ij is the weight matrix, b1 is the bias matrix, and f(·) is the ReLU activation function; The pooling layer reduces the spatial dimension of the feature map by downsampling the output of the previous layer. The previous layer is usually located after the convolutional layer and uses the Adam optimization algorithm to perform supervised training on the MHA-CNN model, and its loss function is: where y u , Respectively represent the actual type of user u and the type predicted by the model; After multiple convolutional layers and pooling layers, the deep electricity consumption features P of empty-nest and non-empty-nest users are finally output by the fully connected layer.

5. A method for identifying specific users and detecting abnormal power consumption based on multi-level power consumption characteristics according to claim 1, characterized in that: The shallow power consumption feature index F and the deep power consumption feature vector P are concatenated to obtain a multi-level power consumption feature set.

6. A method for identifying specific users and detecting abnormal power consumption based on multi-level power consumption characteristics according to claim 1, characterized in that: Build a weighted decision tree, and perform secondary weighting on the final vote in the random forest by calculating the similarity between the weighted decision tree and the feature importance of the random forest. The traditional random forest algorithm is used to construct a weighted random forest model. The main steps are: Step 1: Extract a training dataset D from the original dataset by bootstrapping. D contains N samples, and the sample weight of each category is W. k , which can be expressed as: Where N is the total number of samples, n k is the number of samples of category k, and C is the total number of categories; Step 2: Calculate the similarity coefficient between the contribution rate of each feature of each decision tree and the contribution rate of the random forest feature through formula (15) The similarity coefficient ranges from [0,1], and the closer it is to 1, the higher the correlation between the contribution rates of the two groups of features; In the formula N is the number of features; Step 3: Use the similarity coefficient as the weight of the decision tree in the final vote. Use this formula to count the voting results of all decision trees, and use the most voting results as the final prediction result of the weighted random forest. The weighted random forest {T1, T2, …, T t The final prediction result of} can be expressed as shown in formula (16): Where C is the set of all labels, and I(*) is the indicative function.

7. A method for identifying specific users and detecting abnormal power usage based on multi-level power usage characteristics according to claim 1, characterized in that: The particle swarm optimization algorithm is used to optimize the internal parameters of the random forest, thereby improving the recognition performance of the weighted random forest model for empty-nest users. Finally, the empty-nest and non-empty-nest user labels and the corresponding multi-level electricity consumption characteristics are divided into training sets and test sets in a ratio of 7:3 to train and test the weighted random forest model. Finally, the empty-nest user recognition model is obtained. The main steps are: Step 1: Initialize the position and velocity of the particles and parameters such as the group size, number of iterations, and acceleration coefficient, where each particle represents a set of potential parameters of the weighted random forest algorithm; Step 2: Set the fitness function of the particle swarm optimization algorithm to the recognition accuracy of the weighted random forest model for empty-nest users, and the optimization parameters are the number of decision trees and the maximum depth of the decision trees; Step 3: Calculate the fitness of each particle in the particle swarm according to the evaluation index of classification performance. If the fitness of the current particle position is better than the best position P found by the group, gdt The fitness of the particle is updated idt , and the best fitness position P among all particles gdt Update to the location of the particle. If the preset number of iterations is reached or the fitness reaches the global optimal solution, the number and maximum depth of the best decision tree are output, which can be specifically expressed as: Where d is the particle dimension, X is the particle location, V is the particle speed, and V id(t+1) With X id(t+1) Represent the updated particle speed and position, P idt , P gdt Respectively represent the best position found by the individual and the group after t iterations, ω represents the weight parameter, r1 and r2 represent random numbers in the interval [0,1], and c1 and c2 represent the acceleration coefficients; Step 4: Divide the empty-nest and non-empty-nest user labels and the corresponding multi-level electricity consumption characteristics into training sets and test sets in a ratio of 7:3 to train and test the weighted random forest model optimized by the particle swarm optimization algorithm, and finally obtain the empty-nest user recognition model.

8. A method for identifying specific users and detecting abnormal power consumption based on multi-level power consumption characteristics according to claim 1, characterized in that: Establish abnormal power consumption indicators for the identified empty-nest users to detect abnormal power consumption in the daily power consumption of empty-nest users. The abnormal power consumption is usually: Case 1: If the current electricity consumption E(t) of the empty-nest user is 0, it is determined that a power outage has occurred in the empty-nest elderly person’s home; Case 2: If the current power consumption E(t) is not 0, then determine whether the variance of the empty-nest user's power consumption in the past 12 hours is less than 1% of the average power consumption of the empty-nest user in the past 12 hours. If it is true, it is determined that there is a sudden situation at the empty-nest user's home, such as the user fainting or no one at home, and relevant personnel need to go to the user's home for further judgment, which can be expressed as: Where E(t) represents the current electricity consumption of the empty-nest user, E(t-1) represents the electricity consumption of the empty-nest user in the past hour, and so on; F(t) represents the mean and variance of the electricity consumption of empty-nest users in the past 12 hours.

9. A method for identifying specific users and detecting abnormal power usage based on multi-level power usage characteristics according to claim 1, characterized in that: When it is detected that an empty-nest user in a community has abnormal electricity consumption and it is necessary to call the community manager for an early warning, the computer sends an AT command to the SIM900A communication module to automatically call the manager of the community where the empty-nest user is located. The main steps are: Step 1: First, make sure that the SIM900A module is intact and fully functional, prepare a SIM card that supports GSM / GPRS communication, and a USB to TTL module to achieve serial communication between the computer and the SIM900A module; Step 2: Assemble the SIM900A module and connect it to the computer to ensure that the SIM900A module can communicate normally; Step 3: When abnormal power consumption of an empty-nest user in a community is detected and a warning call needs to be made to the community manager, the computer sends an AT command (such as "ATD <phone number>") to the SIM900A module. After the SIM900A module parses the command, it initiates a call to the target phone number through the mobile network.

Citation Information

Cited By

  • Method and system for monitoring elderly people living alone through electricity utilization information

    CN120508764A