Load identification model training method and device, computer equipment, readable storage medium and program product
The joint L21 norm regularization and multi-model fusion method addresses high computational complexity and precision limitations in NILM by optimizing feature selection and combining diverse algorithms, resulting in efficient and accurate electric device identification.
Patent Information
- Application Number
- CN202510381752.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-07-15
AI Technical Summary
The existing load recognition model has too much training and calculation, and the existing feature screening model is inefficient in calculation, making it difficult to deal with high-dimensional feature scenarios and limited recognition accuracy.
By obtaining the power signal training samples of the total entrance of the power system user terminal, using the label matrix and combined L21 norm minimized screening load feature matrix, combining a variety of basic load recognition models such as extreme gradient enhancement, random forest, support vector machine and logistic regression model, a soft voting mechanism is used for model fusion.
The calculation amount of load recognition model training is reduced, the efficiency and recognition accuracy of feature screening are improved, and the adaptability of the model to complex load characteristics is enhanced.
Smart Images

Figure CN120316501A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electric power, and particularly to a method, device, computer equipment, computer-readable storage medium, and computer program product for training a load recognition model. Background Art
[0002] In a power system, non-intrusive load monitoring (NILM) related technologies collect power signals at the total inlet of the user side in real time, and separate the working state information of each electrical device from the power signals, so as to provide information support for the operation, management, regulation, etc. of the power system. Combining NILM with artificial intelligence model related technologies to construct a load recognition model can improve the corresponding recognition efficiency. However, at present, the amount of computation required for training the load recognition model is too large. Summary of the Invention
[0003] Based on this, in view of the above technical problems, it is necessary to provide a method, device, computer equipment, computer-readable storage medium, and computer program product for training a load recognition model to reduce the amount of computation required for training the load recognition model.
[0004] In a first aspect, the present application provides a method for training a load recognition model, including:
[0005] Obtaining a training sample of a power signal at the total inlet of the user side in a power system; the training sample includes a load feature matrix and a label matrix; wherein, the load feature matrix is obtained by performing feature extraction on the power signal, and the label matrix includes the electrical device categories corresponding to the power signal;
[0006] Screening the load feature matrix according to the label matrix and the joint L2,1 norm minimization to obtain a target load feature matrix;
[0007] Training a preset load recognition model according to the target load feature matrix to obtain a load recognition model.
[0008] In one embodiment, screening the load feature matrix according to the label matrix and the joint L2,1 norm minimization to obtain a target load feature matrix includes:
[0009] Obtaining a projection matrix from the load feature matrix to the label matrix;
[0010] Optimizing the projection matrix according to the label matrix and the joint L2,1 norm minimization to obtain a target projection matrix;
[0011] Screening the load feature matrix according to the target projection matrix to obtain a target load feature matrix.
[0012] In one embodiment, each row of the target projection matrix corresponds to a load feature in the load feature matrix;
[0013] According to the target projection matrix, the load feature matrix is screened to obtain a target load feature matrix, including:
[0014] Determine the L2 norm of each row of the target projection matrix as the importance score of each load feature corresponding to the target projection matrix;
[0015] According to the importance score, the load feature matrix is screened to obtain a target load feature matrix.
[0016] In one embodiment, according to the label matrix and the joint L21 norm minimization, the projection matrix is optimized to obtain a target projection matrix, including:
[0017] The projection matrix is optimized according to the following calculation formula to obtain a target projection matrix:
[0018]
[0019] In the formula, W is the projection matrix from the feature matrix to the label matrix, and the element W i,j in W represents the weight of the i-th load feature for the j-th electrical equipment category, μ is the regularization parameter, and ||·|| 2,1 represents the L21 norm; X T is the transpose matrix of the load feature matrix; Y is the label matrix.
[0020] In one embodiment, according to the target load feature matrix, a preset load recognition model is trained to obtain a load recognition model, including:
[0021] According to the target load feature matrix, a preset basic load recognition model is trained; the basic load recognition model includes at least two of the following: extreme gradient boosting model, random forest model, support vector machine model, and logistic regression model;
[0022] The trained basic load recognition models are fused to obtain a load recognition model.
[0023] In one embodiment, the trained basic load recognition models are fused to obtain a load recognition model, including:
[0024] According to the soft voting mechanism, the trained basic load recognition models are fused to obtain a load recognition model.
[0025] Second, the present application also provides a load recognition model training device, including:
[0026] An acquisition module, configured to acquire training samples of power signals at the total inlet of the user side in a power system; the training samples include a load feature matrix and a label matrix; wherein, the load feature matrix is obtained by performing feature extraction on the power signals, and the label matrix includes the categories of electrical equipment corresponding to the power signals.
[0027] A matrix module, configured to screen the load feature matrix according to the label matrix and the joint L2,1 norm minimization to obtain a target load feature matrix.
[0028] A training module, configured to train a preset load recognition model according to the target load feature matrix to obtain a load recognition model.
[0029] In a third aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the load recognition model training method in the first aspect are implemented.
[0030] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the load recognition model training method in the first aspect are implemented.
[0031] In a fifth aspect, the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the load recognition model training method in the first aspect are implemented.
[0032] The above load recognition model training method, device, computer device, computer-readable storage medium, and computer program product are based on training samples of power signals at the total inlet of the user side in a power system. By obtaining a target load feature matrix according to the label matrix and the joint L2,1 norm minimization, the screening of the load feature matrix is realized, so that the target load feature matrix reduces the data volume without losing the features required for training the load recognition model. Further, the preset load recognition model is trained using the target load feature matrix to obtain a load recognition model. Since the data volume of the target load feature matrix is reduced, the computational amount required for training is also reduced accordingly. Description of the Drawings
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required to be used in the description of the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0034] Figure 1Schematic diagram of the process of the load identification model training method in an embodiment;
[0035] Figure 2 Another schematic diagram of the process of the load identification model training method in an embodiment;
[0036] Figure 3 Another schematic diagram of the process of the load identification model training method in an embodiment;
[0037] Figure 4 Schematic diagram of the soft voting mechanism in an embodiment;
[0038] Figure 5 Block diagram of the structure of the load identification model training device in an embodiment;
[0039] Figure 6 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0040] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. As used herein, "a plurality" may mean two or more unless otherwise specified.
[0041] The following first explains the nouns related to the technical solutions provided by the present application as follows:
[0042] Switching, that is, connecting and disconnecting, refers to the operation of connecting or disconnecting an electrical device to or from the power grid through switching equipment, connecting the corresponding power equipment and disconnecting the corresponding power equipment.
[0043] Z-score standardization is a commonly used data preprocessing method, which aims to convert data with different dimensions or units into a unified scale for easy comparison and analysis.
[0044] One-Hot Encoding, a method of converting categorical variables into binary vectors, where each category corresponds to a unique binary vector, and only one element in the vector is 1, and the rest are 0.
[0045] Norm is a concept in mathematics used to measure the magnitude (or distance) of a vector.
[0046] L1 norm, that is, Manhattan norm, represents the sum of the absolute values of the elements in a vector.
[0047] L2 norm, which refers to the square root of the sum of the squares of the elements of a vector.
[0048] The L21 norm is a mixed norm, that is, a joint L21 norm, which combines the L2 norm and the L1 norm.
[0049] XGBoost: Extreme Gradient Boosting tree model, which is a distributed tree model based on gradient boosting.
[0050] Soft voting mechanism: It is a method of multi-model voting in ensemble learning. Each base model gives a probability estimate, and the final prediction result is the weighted average of the probabilities of all base models.
[0051] F1 Score, an indicator used to measure the accuracy of binary classification models. It takes into account both the precision and recall of the classification model.
[0052] The following is an explanation of the technical solution provided by this application:
[0053] Under the trend of the continuous expansion of the scale of power grid users, the increasing popularity of household electrical appliances, and the development of power service demands towards refinement, deeply mining the characteristics of users' electricity consumption behavior and realizing accurate analysis of power data have become important topics in the field of electrical technology. Non-intrusive load monitoring (NILM) is a method that can automatically sense users' electricity consumption behavior without relying on internal devices of users, but only relying on external analysis tools and means. This technology collects the power signals at the total entrance of the user side in real time, combines model algorithms to separate the working state information of each electrical appliance, and feeds the visual analysis results back to the user terminal, thus constructing a management mechanism of "data collection - load identification - energy efficiency optimization".
[0054] Compared with the traditional monitoring scheme that requires installing sensors at multiple points, non-intrusive load identification only needs to collect the power signals at the total entrance of the user side in real time. This single-point deployment mode not only greatly reduces the equipment transformation cost, but also effectively eliminates users' privacy concerns due to its characteristic of not requiring in-house installation, significantly improving the feasibility of technology promotion. The application of this technology can guide users to optimize their electricity consumption behavior patterns, relieve load overload, and optimize the power grid supply-demand relationship. With the integration and innovation of artificial intelligence and edge computing technologies, the application potential of non-intrusive load identification will be further accelerated.
[0055] In a power system, the extraction and screening of load characteristics are important steps in load identification. Load characteristics are the characteristics with commonality and high distinguishability selected from load data. These appropriate load characteristics play a decisive role in the subsequent load identification effect. Currently, for load identification, a large number of load characteristics have been extracted in the prior art. However, with the increase in the feature dimension, there are often a large amount of redundant and noisy information in the feature set, and not all features are effective. This not only increases the computational complexity but also may lead to model overfitting and reduce the identification performance. Therefore, how to screen out the most discriminative and robust feature subset from the high-dimensional feature set has become a key point and a difficult problem in the current research on non-intrusive load identification.
[0056] The prior art has the following deficiencies: First, the existing feature screening models for load characteristics need to traverse the data set multiple times or perform iterative optimization during the calculation process, resulting in the time complexity increasing exponentially with the feature dimension, low computational efficiency, and increased computational cost. Therefore, it is difficult to handle high-dimensional feature scenarios. Second, the existing load identification models for load characteristics are too single. The existing methods mostly rely on a single classifier and are difficult to comprehensively capture the complex mapping relationship between load characteristics and the categories of electrical equipment, resulting in limited overall identification accuracy.
[0057] Based on the above analysis, the present application provides a method for training a load identification model. The following further illustrates the technical solution provided by the present application by way of examples:
[0058] In one embodiment, as Figure 1 shown, a method for training a load identification model is provided. In this embodiment, an example is given where the method is applied to a terminal. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes steps S101 to S103:
[0059] Step S101: The server obtains training samples of the power signal at the total entrance of the user side in the power system; the training samples include a load feature matrix and a label matrix; wherein, the load feature matrix is obtained by extracting features from the power signal, and the label matrix includes the categories of electrical equipment corresponding to the power signal.
[0060] Among them, the user side can be the end that consumes electricity in the power system, which can be compared with the power generation side. Exemplarily, the total electricity meter corresponding to one household can be used as a user side. The total entrance of the user side can be the total entrance representing the access of the user side to the power system, and the power system delivers electrical energy to the user side through this total entrance.
[0061] In some embodiments, the power signal may be information related to the total power consumption signal, that is, it may be the total information of the user side about the power usage situation within a preset period, which enables the trained model to perform load identification based on non-invasive identification technology without obtaining detailed power usage information of each electrical device within the user side, etc. Exemplarily, the power signal may include power usage information of various devices such as air conditioners and refrigerators at the user side.
[0062] Among them, the load feature matrix may be a matrix representing one or more dimensional features of the power signal. Exemplarily, the load feature matrix may include features of the power signal in aspects such as active power, reactive power, power factor, current amplitude, root mean square current, DC component of current, crest factor of current, and standard deviation of current.
[0063] In some embodiments, some power signals can be labeled manually to label the electrical device categories corresponding to some power signals, so as to obtain a partial label matrix, and then use an artificial intelligence model to label the remaining power signals according to the partial label matrix, so as to obtain a label matrix. In some embodiments, after using the artificial intelligence model to label the remaining power signals according to the partial label matrix, a manual method can be used to check and verify the labeling results of the model, so as to reduce the workload of manual labeling, improve the labeling efficiency, and ensure the accuracy of the labeling.
[0064] In some embodiments, in the label matrix, 0 and 1 can be used to represent whether the power signal belongs to a certain or specific electrical device category. Exemplarily, 1 can be used to represent that the electrical device belongs to a certain or specific electrical device category, and 0 represents that it does not belong to a certain or specific electrical device category. For example, if the vector corresponding to the power signal in the label matrix is [1, 0, 0], it can indicate that the electrical device category of the power signal is a microwave oven; if it is [0, 1, 0], it can indicate that the electrical device category of the power signal is an air conditioner; if it is [0, 0, 1], it can indicate that the electrical device category of the power signal is a washing machine.
[0065] In some embodiments, the electrical device categories can be customized according to actual needs. For example, for the household electricity usage scenario, the electrical device categories can include electrical device categories such as refrigerators, televisions, and air conditioners; again, for the office scenario, the electrical device categories can be electrical device categories such as printers, servers, and conference room projectors.
[0066] Step S102: The server screens the load feature matrix according to the label matrix and the joint L21 norm minimization to obtain the target load feature matrix.
[0067] In some embodiments, the server can screen the load feature matrix according to the label matrix and through joint L21 norm minimization. Among them, the minimization can represent minimizing the difference between the screened load feature matrix and the label matrix, that is, making the load feature matrix and the label matrix satisfy the mapping relationship as much as possible while making the projection matrix as sparse as possible.
[0068] In some embodiments, the server can determine that the sum of one or more rows in the load feature matrix is 0, or the sum of one or more columns in the load feature matrix is 0 through joint L21 norm minimization, so as to eliminate the load features corresponding to the row or column. In some embodiments, the server can establish a sparse regularization model based on joint L21 norm minimization, solve the optimization problem of the model, and according to the L2 norm corresponding to certain rows in the optimized projection matrix (the projection matrix from the load feature matrix to the label matrix) being close to 0, eliminate the corresponding load features.
[0069] Step S103: The server trains a preset load recognition model according to the target load feature matrix to obtain a load recognition model.
[0070] In some embodiments, the preset load recognition model can include one model or a model combined by multiple models.
[0071] In some embodiments, the preset load recognition model can include multiple models of the same type or different types.
[0072] The above technical solution is based on the training samples of the power signals at the total entrance of the user side in the power system. By obtaining the target load feature matrix according to the label matrix and joint L21 norm minimization, this realizes the screening of the load feature matrix and reduces the data volume while not losing the features required for training the load recognition model. Further, the preset load recognition model is trained using the target load feature matrix to obtain a load recognition model. Since the data volume of the target load feature matrix is reduced, the computational amount required for training is also reduced accordingly.
[0073] In one of the embodiments, the foregoing "screen the load feature matrix according to the label matrix and joint L21 norm minimization to obtain the target load feature matrix" may include steps S201 to S203:
[0074] Step S201: The server obtains the projection matrix from the load feature matrix to the label matrix.
[0075] Step S202: The server optimizes the projection matrix according to the label matrix and joint L21 norm minimization to obtain the target projection matrix.
[0076] In some embodiments, the projection matrix may also be a matrix formed based on representing the on / off status of electrical devices with 0 and 1. Accordingly, the projection matrix can be optimized according to the label matrix and the joint L21 norm minimization to remove columns or rows with a value of 0, obtaining the target projection matrix.
[0077] Step S203: The server screens the load feature matrix according to the target projection matrix to obtain the target load feature matrix.
[0078] In some embodiments, since the target projection matrix is obtained by optimizing the projection matrix, and there is a corresponding relationship between the projection matrix and the load feature matrix, the load feature matrix can be optimized according to the target projection matrix, thereby obtaining the target load feature matrix.
[0079] By optimizing the projection matrix according to the label matrix and the joint L21 norm minimization to obtain the target projection matrix, since the projection matrix is the projection matrix from the load feature matrix to the label matrix, the load feature matrix is screened according to the target projection matrix, thus realizing the determination of the target load feature matrix.
[0080] In one of the embodiments, each row of the target projection matrix corresponds to a load feature in the load feature matrix; the foregoing "screening the load feature matrix according to the target projection matrix to obtain the target load feature matrix" may include: determining the L2 norm of each row of the target projection matrix as the importance score of each load feature corresponding to the target projection matrix; screening the load feature matrix according to the importance score to obtain the target load feature matrix.
[0081] In some embodiments, for the importance scores of each load feature, the server may sort them according to the scores from high to low, and screen the load feature matrix according to the sorting result to obtain the target load feature matrix. For example, the top 5, 6, or 7 load features corresponding to the highest scores can be selected and combined to form the target load feature matrix.
[0082] The server uses the L2 norm of each row of the target projection matrix as the importance score of each load feature corresponding to the target projection matrix, and screens the load features according to the importance score, which enables the determined target load feature matrix to accurately retain the load features required for load recognition model training while having less data volume.
[0083] In one of the embodiments, the foregoing "optimizing the projection matrix according to the label matrix and the joint L21 norm minimization to obtain the target projection matrix" may include: optimizing the projection matrix according to the following calculation formula to obtain the target projection matrix:
[0084]
[0085] In the formula, W is the projection matrix from the feature matrix to the label matrix, and the element W in W i,j represents the weight of the i-th load feature for the j-th electrical equipment category, μ is the regularization parameter, and ||·|| 2,1 represents the L21 norm; X T is the transpose matrix of the load feature matrix; Y is the label matrix.
[0086] In one embodiment, the aforementioned "training a preset load recognition model based on the target load feature matrix to obtain a load recognition model" may include: training a preset basic load recognition model based on the target load feature matrix; the basic load recognition model includes at least two of the following: extreme gradient boosting model, random forest model, support vector machine model, and logistic regression model; fusing the trained basic load recognition models to obtain a load recognition model.
[0087] In some embodiments, the server may divide the target load feature matrix into two parts: one part is used for model training, and the other part is used to verify the training effect of the model.
[0088] In some embodiments, the training of multiple basic load recognition models may be carried out simultaneously, or partially simultaneously, or non-simultaneously.
[0089] In some embodiments, the basic load recognition model may include one each of models such as extreme gradient boosting model, random forest model, support vector machine model, and logistic regression model.
[0090] By using the target load feature matrix to train a preset basic load recognition model, the basic load recognition model includes models such as extreme gradient boosting model, random forest model, support vector machine model, and logistic regression model, and fusing the trained basic load recognition models to obtain a load recognition model. This helps to avoid the errors that may be generated by a single type of basic load recognition model, enabling the load recognition model to integrate the characteristics of different basic load recognition models, thereby helping to improve the effect of the load recognition model in load recognition and improving the recognition accuracy.
[0091] In one embodiment, the aforementioned "fusing the trained basic load recognition models to obtain a load recognition model" may include: fusing the trained basic load recognition models according to the soft voting mechanism to obtain a load recognition model.
[0092] Exemplarily, as described above, based on the soft voting mechanism, weights can be assigned to the output results corresponding to each basic load recognition model respectively, and the final output result can be determined by weighted average.
[0093] In some embodiments, the weights corresponding to different types of basic load identification models may be the same or different. Exemplarily, the weights corresponding to the basic load identification models can be customized or modified according to actual requirements. Exemplarily, the accuracy of the output results (i.e., the basic identification results) corresponding to each basic load identification model can be determined, and the weights can be determined based on the accuracy.
[0094] By using the soft voting mechanism, the trained basic load identification models are fused to obtain a load identification model. This combines the advantages of different basic load identification models, which helps to improve the accuracy and generalization ability of the load identification model, and at the same time enhances the adaptability of the load identification model to complex load characteristics.
[0095] In an exemplary embodiment, a method for training a load identification model is provided. By constructing a sparse regularization model based on joint L21-norm minimization to screen load features, when facing a high-dimensional feature set, it does not require excessive computational complexity and computational cost. At the same time, a load identification classification model based on a soft voting mechanism for multi-index fusion is constructed. Through the soft voting mechanism for multi-index fusion, the prediction results of each basic model are weighted and fused, leveraging the advantages of multiple different models, thereby improving the accuracy and generalization ability of load identification. As Figure 3 shown, the corresponding flow diagram of this method is given, which is divided into 5 steps. The specific steps are as follows:
[0096] Step 1: Data collection and preprocessing. Use a high-frequency sampling device to obtain the current and voltage data of the bus (corresponding to the aforementioned power signals). Assume that only one electrical device has a switching event at the same moment. Detect the switching events of electrical devices based on power changes, and obtain the steady-state current and voltage data of each electrical device within one cycle from the steady-state aggregated data before and after the event. Then, data cleaning techniques such as missing value filling, sampling record deduplication, and outlier removal are used on the data.
[0097] Step 2: Calculate load features. Based on the steady-state current and voltage data described in Step 1, construct a multi-dimensional feature space from the time domain, frequency domain, and statistical perspectives, and extract a total of 20 load features. Specifically, there are: active power, reactive power, power factor, current amplitude, current effective value, current DC component, crest factor of current, current standard deviation, coefficient of variation of current, kurtosis of current, skewness of current, interquartile range of current, entropy of the positive half-cycle curve of current, area of the positive half-cycle curve of current, total harmonic distortion rate of current, and the amplitudes of the 3rd, 5th, 7th, 9th, and 11th harmonics of current. After the above-extracted features are standardized by Z-Score, they form a feature matrix X = [x1, x2, …, x N (corresponding to the aforementioned load feature matrix), where the dimension of X is 20×N, xN It represents the 20×1 feature vector of the Nth electrical equipment sample, where N is the total number of electrical equipment samples;
[0098] Among them, the active power P, reactive power Q, and power factor are calculated as follows:
[0099]
[0100]
[0101] In the formula, k is the harmonic order, is the effective value of the kth harmonic voltage, is the effective value of the kth harmonic current, and θ k is the phase difference of the kth harmonic;
[0102] Among them, the current amplitude I peak is calculated as follows:
[0103] I peak = max(i n ), where i n represents the instantaneous value of the steady-state current at the nth sampling point;
[0104] Among them, the effective value of the current I RMS and the DC component of the current I μ are calculated as follows:
[0105]
[0106] In the formula, i n represents the instantaneous value of the steady-state current, and N is the number of sampling points;
[0107] Among them, the crest factor CF of the current is calculated as follows:
[0108]
[0109] In the formula, I peak is the maximum value of the steady-state current, and I RMS is the effective value of the current;
[0110] Among them, the standard deviation I σ of the current is calculated as follows:
[0111]
[0112] In the formula, is the average value of the steady-state current;
[0113] Among them, the coefficient of variation I CV of the current is calculated as follows:
[0114]
[0115] Among them, the kurtosis I of the current kur is calculated as follows:
[0116]
[0117] Among them, the skewness I of the current skew is calculated as follows:
[0118]
[0119] Among them, the interquartile range I of the current IQR is calculated as follows:
[0120] I IQR = I 75% - I 25%
[0121] In the formula, I 75% is the current value at the 75% position in the steady-state current, and I 25% is the current value at the 25% position in the steady-state current;
[0122] Among them, the entropy I of the positive half-cycle curve of the current s is calculated as follows:
[0123]
[0124] In the formula, p n is the normalized value of the positive half-cycle curve of the steady-state current;
[0125] Among them, the calculation formula for the area S of the positive half-cycle curve of the current is as follows:
[0126] s = ∫max(i n , 0)dt
[0127] In the formula, max(i n , 0) represents the value of the positive half-cycle curve of the steady-state current;
[0128] Among them, the total harmonic distortion rate THD of the current I is calculated as follows,
[0129]
[0130] In the formula, I1 represents the fundamental current amplitude, and I h is the amplitude of the hth harmonic current;
[0131] Among them, the harmonic amplitude I of the current kmIt can be obtained through Fourier decomposition, and the expression is as follows:
[0132]
[0133] where i is the steady-state current, k is the harmonic order, M is the maximum harmonic order, ω1 is the fundamental frequency, φ k is the phase, and I km is the amplitude of the k-th harmonic;
[0134] Step 3: Load feature screening. A sparse regularization model based on the joint L21-norm minimization is used to screen the features of the feature matrix X in Step 2 to obtain the feature matrix X after feature screening * . Regarding the sparse regularization model based on the joint L21-norm minimization in Step 3, it may include Step 301 to Step 303:
[0135] Step 301: Construct a label matrix Y. The load labels are one-hot encoded to obtain a label set Y = [y1, y2,..., y N T , the dimension of Y is N×C, where C is the number of categories of electrical appliances. Here, "category" corresponds to the aforementioned categories of electrical appliances. For example, the categories may include microwave ovens, air conditioners, washing machines, etc.; where y N represents the one-hot encoded vector of the N-th sample, and the specific representation of y N is as follows:
[0136] y N = [y N1 , y N2 ,..., y Nj ,..., y NC T ,
[0137]
[0138] Step 302: Establish an optimization problem for the sparse regularization model based on the joint L21-norm minimization. Its optimization problem is expressed as follows:
[0139]
[0140] where W is the projection matrix from the feature matrix to the label matrix, and its dimension is 20×C. The element W i,j in W represents the weight of the i-th feature for the j-th category of electrical appliances, μ is the regularization parameter, and ||·|| 2,1 represents the L21-norm; X T is the transpose of the aforementioned feature matrix.
[0141] The specific calculation formula of the L21-norm is as follows:
[0142]
[0143] Wherein, A is a matrix of n rows and m columns; A i,j represents the element in the i-th row and j-th column of A.
[0144] Step 303: After solving the optimization problem, obtain the optimized projection matrix W * (corresponding to the aforementioned target projection matrix), calculate the L2 norm of each row of W * to obtain the importance score s of the i-th feature i , and its specific calculation formula is as follows:
[0145]
[0146] Wherein, represents the element in the i-th row and j-th column of the optimized projection matrix W*.
[0147] Sort the importance scores of all features from large to small, and select the top 10 features as the filtered features to form the feature matrix X after feature screening * (corresponding to the aforementioned target load feature matrix).
[0148] Step 4: Train and test four basic models (corresponding to the aforementioned basic load recognition models), divide the load samples into a training set and a test set, and then build 4 basic models such as an XGBoost model, a random forest model, a support vector machine model, and a logistic regression model respectively. Input the feature matrix X after feature screening in Step 3 * into the basic models, and train and test the 4 basic learning models on the training set and the test set respectively.
[0149] Step 5: According to the classification results of the 4 trained basic models in Step 4, obtain the final load classification result output according to the soft voting mechanism based on the multi-index fusion weight, as specifically shown Figure 4 as shown. Thus, the aforementioned load recognition model is obtained.
[0150] The soft voting mechanism based on the multi-index fusion weight in Step 5 may include Step 501 to Step 503:
[0151] Step 501: Obtain the output probability vector P of the m-th basic model for the test sample m , and the specific expression is as follows:
[0152] P m = [p m1 , p m2 ,..., p mx ,..., p mC, m = 1, 2, 3, 4
[0153] In the formula, P m represents the output probability vector of the m-th base model for the test sample, and p mx represents the probability that the m-th base model determines that the test sample belongs to the x-th electrical equipment category. C is the number of categories of electrical equipment;
[0154] Step 502: Calculate the weighted average probability vector P based on the multi-index fusion weights of different base models final , and the specific calculation is as follows:
[0155]
[0156] In the formula, Accuracy m represents the accuracy of the m-th model on the test set, and F1 m represents the F1 score of the m-th model on the test set, and Precision m represents the precision of the m-th model on the test set. α, β, and γ represent the weights of the three evaluation indicators, satisfying α + β + γ = 1. ω m represents the weight of the m-th model, represents the probability value of the x-th electrical equipment category in the weighted average probability vector P final .
[0157] Step 503: Select the electrical equipment category corresponding to the maximum probability in the weighted average probability vector P final as the load recognition result of the test sample.
[0158] In the above technical solution, by using the sparse regularization model based on the joint L21-norm minimization to perform feature screening on the load characteristics, only the projection matrix between the feature matrix and the label matrix needs to be constructed, and the optimization problem about this projection matrix is solved. According to the sparsity of the optimized projection matrix, the importance degree of different features can be obtained. The algorithm does not require too many model parameters, is easy to calculate, and has a low calculation cost. At the same time, by using the soft voting mechanism based on multi-index fusion to perform load recognition classification, the outputs of different models are fused according to the accuracy, F1 score, and precision of different models, so as to obtain the final load recognition result. Specifically, 4 base models such as the XGBoost model, the random forest model, the support vector machine model, and the logistic regression are selected. The prediction results of each base model are weighted and fused through the soft voting mechanism of multi-index fusion, and the advantages of different models are utilized, so as to significantly improve the accuracy and generalization ability of load recognition, and at the same time enhance the adaptability of the model to complex load characteristics.
[0159] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are displayed in sequence according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this article, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0160] Based on the same inventive concept, an embodiment of the present application also provides a load recognition model training device for implementing the above-mentioned load recognition model training method. The implementation solution provided by this device to solve problems is similar to the implementation solution described in the above method. Therefore, the specific limitations in one or more embodiments of the load recognition model training device provided below can refer to the limitations on the load recognition model training method in the above text, and will not be repeated here.
[0161] In an exemplary embodiment, as Figure 5 shown, the present application also provides a load recognition model training device 500, including:
[0162] An acquisition module 501, configured to acquire training samples of power signals at the total inlet of the user side in the power system; the training samples include a load feature matrix and a label matrix; wherein, the load feature matrix is obtained by performing feature extraction on the power signal, and the label matrix includes the types of electrical equipment corresponding to the power signal;
[0163] A matrix module 502, configured to screen the load feature matrix according to the label matrix and the joint L21 norm minimization to obtain a target load feature matrix;
[0164] A training module 503, configured to train a preset load recognition model according to the target load feature matrix to obtain a load recognition model.
[0165] In one of the embodiments, the matrix module 502 is further configured to screen the load feature matrix according to the label matrix and the joint L21 norm minimization to obtain a target load feature matrix, including:
[0166] Obtain a projection matrix from the load feature matrix to the label matrix;
[0167] Optimize the projection matrix according to the label matrix and the joint L21 norm minimization to obtain a target projection matrix;
[0168] Screen the load feature matrix according to the target projection matrix to obtain the target load feature matrix.
[0169] In one embodiment, each row of the target projection matrix corresponds to a load feature in the load feature matrix;
[0170] The matrix module 502 is further configured to screen the load feature matrix according to the target projection matrix to obtain the target load feature matrix, including: determining the L2 norm of each row of the target projection matrix as the importance score of each load feature corresponding to the target projection matrix; screening the load feature matrix according to the importance score to obtain the target load feature matrix.
[0171] In one embodiment, the matrix module 502 is further configured to optimize the projection matrix according to the label matrix and the joint L21 norm minimization to obtain the target projection matrix, including: optimizing the projection matrix according to the following calculation formula to obtain the target projection matrix:
[0172]
[0173] In the formula, W is the projection matrix from the feature matrix to the label matrix, and the element W in W i,j represents the weight of the i-th load feature to the j-th electrical equipment category, μ is the regularization parameter, and ||·|| 2,1 represents the L21 norm; X T is the transposed matrix of the load feature matrix; Y is the label matrix.
[0174] In one embodiment, the training module 503 is further configured to train a preset load recognition model according to the target load feature matrix to obtain a load recognition model, including: training a preset basic load recognition model according to the target load feature matrix; the basic load recognition model includes at least two of the following: extreme gradient boosting model, random forest model, support vector machine model, and logistic regression model; fusing the trained basic load recognition models to obtain the load recognition model.
[0175] In one embodiment, the training module 503 is further configured to fuse the trained basic load recognition models to obtain a load recognition model, including: fusing the trained basic load recognition models according to the soft voting mechanism to obtain the load recognition model.
[0176] Each module in the above load recognition model training device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0177] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in Figure 6 . The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the data required for the load identification model training method, such as training samples, etc. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a load identification model training method.
[0178] Those skilled in the art can understand that Figure 6 the structure shown in is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0179] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.
[0180] In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.
[0181] In an embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.
[0182] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include Read-Only Memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, Resistive Random Access Memory (ReRAM), Magnetoresistive Random Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene memory, etc. Volatile memory can include Random Access Memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, Artificial Intelligence (AI) processors, etc., without limitation.
[0183] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope recorded in this application.
[0184] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation to the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A method for training a load identification model, characterized in that, Including: Obtaining training samples of power signals at the total entrance of the user side in the power system; The training samples include a load feature matrix and a label matrix; wherein, the load feature matrix is obtained by performing feature extraction on the power signal, and the label matrix includes the category of electrical equipment corresponding to the power signal; Screening the load feature matrix according to the label matrix and the minimization of the joint L21 norm to obtain a target load feature matrix; Training a preset load recognition model according to the target load feature matrix to obtain a load recognition model.
2. The method according to claim 1, characterized in that, The screening the load feature matrix according to the label matrix and the minimization of the joint L21 norm to obtain a target load feature matrix includes: Obtaining a projection matrix from the load feature matrix to the label matrix; Optimizing the projection matrix according to the label matrix and the minimization of the joint L21 norm to obtain a target projection matrix; Screening the load feature matrix according to the target projection matrix to obtain a target load feature matrix.
3. The method according to claim 2, characterized in that, Each row of the target projection matrix corresponds to a load feature in the load feature matrix; The screening the load feature matrix according to the target projection matrix to obtain a target load feature matrix includes: Determining the L2 norm of each row of the target projection matrix as the importance score of each load feature corresponding to the target projection matrix; Screening the load feature matrix according to the importance score to obtain a target load feature matrix.
4. The method according to claim 2, characterized in that, The optimizing the projection matrix according to the label matrix and the minimization of the joint L21 norm to obtain a target projection matrix includes: Optimizing the projection matrix according to the following calculation formula to obtain a target projection matrix: where \(W\) is the projection matrix from the feature matrix to the label matrix, and the element \(W_{ij}\) in \(W\) i,j represents the weight of the \(i\)-th load feature for the \(j\)-th electrical equipment category, \(\mu\) is the regularization parameter, and \(\|\cdot\|\) 2,1 denotes the L2,1 norm; \(X^T\) T is the transpose matrix of the load feature matrix; \(Y\) is the label matrix.
5. The method according to any one of claims 1 to 4, characterized in that, The training a preset load recognition model according to the target load feature matrix to obtain a load recognition model includes: Training a preset basic load recognition model according to the target load feature matrix; the basic load recognition model includes at least two of the following: extreme gradient boosting model, random forest model, support vector machine model, and logistic regression model; Fusing the trained basic load recognition models to obtain the load recognition model.
6. The method according to claim 5, characterized in that The fusing the trained basic load recognition models to obtain the load recognition model includes: Fusing the trained basic load recognition models according to the soft voting mechanism to obtain the load recognition model.
7. A load identification model training device, characterized in that, The device includes: An obtaining module, configured to obtain training samples of power signals at the total entrance of the user side in the power system; the training samples include a load feature matrix and a label matrix; wherein, the load feature matrix is obtained by performing feature extraction on the power signal, and the label matrix includes the category of electrical equipment corresponding to the power signal; A matrix module, configured to screen the load feature matrix according to the label matrix and the minimization of the joint L21 norm to obtain a target load feature matrix; A training module, configured to train a preset load recognition model according to the target load feature matrix to obtain a load recognition model.
8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 6.