Electrical parameter feature map identification method fusing PCA and KNN
By integrating the electrical parameter feature map recognition method of PCA and KNN, the problem of large dependence on feature selection and extraction and high demand for computing resources in household appliance classification recognition is solved, and efficient electrical classification recognition is achieved, improving the accuracy and robustness of the recognition.
Patent Information
- Application Number
- CN202510289678.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-04-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has problems such as large dependence on feature selection and extraction, high demand for computing resources, and complex high-dimensional data processing in the classification and identification of household appliances.
The electrical parameter feature map recognition method that fuses PCA and KNN is adopted, and phase information and frequency information are generated through Fourier transform, phase alignment is performed, and the phase is converted into image form. PCA dimensionality reduction is used and KNN classifier is used for identification.
This method can effectively extract the main feature components of the current waveform, reduce feature dimensions, improve the efficiency and accuracy of the classification algorithm, adapt to nonlinear relationships, and improve the accuracy and robustness of household appliance classification.
Smart Images

Figure CN119782771A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electrical appliance classification and identification, and specifically is an electrical parameter feature map identification method integrating PCA and KNN. Background Art
[0002] Principal Component Analysis (PCA) is a commonly used unsupervised dimensionality reduction algorithm that aims to transform high-dimensional data into a low-dimensional space through linear transformation while retaining as much information as possible from the original data. The PCA algorithm used to learn filters is based on one-dimensional vectors, which means that the two-dimensional matrix must first be converted into a one-dimensional vector before its principal component is calculated. Currently, no researchers have yet found a method to classify household appliances based on the PCA and KNN algorithm to analyze current waveform images.
[0003] The traditional method of classifying and identifying electrical appliances based on current waveform has the following main deficiencies and defects: 1. Classic models rely heavily on feature selection and extraction. In the task of classifying household appliances, how to select and extract the most discriminative features is a challenge. Traditional feature engineering methods may need to rely on domain expert experience and cannot fully utilize the potential information in the data.
[0004] 2. Deep learning models usually have large model size and number of parameters, which leads to high computing resource requirements. In the task of home appliance classification, especially in embedded devices or resource-constrained environments, it may be challenging to deploy and reason about deep learning models in real time.
[0005] 3. The original current waveform data is usually of high dimensionality and contains a large number of data points. Directly using these high-dimensional data for machine learning modeling will face problems such as high computational complexity and easy overfitting. Summary of the invention
[0006] The present invention aims to address the technical defects of the prior art and provide an electrical parameter feature map recognition method integrating PCA and KNN to solve the technical problems pointed out in the above background technology.
[0007] In order to achieve the above technical objectives, the present invention adopts the following technical solutions: The electrical parameter feature map recognition method integrating PCA and KNN includes: 1) Collect current data (high-frequency current data) under different circuit conditions, decode the collected data, and generate current values at standard points; 2) Remove noise and interference, then perform Fourier transform on the current data to generate phase information and frequency information of the current data, then perform phase alignment operation according to the standard data of each class, then perform inverse Fourier transform on the data to generate current data information after phase alignment, and convert the data into an image; 3) Input PCA model for dimensionality reduction; 4) Take the current waveform data after PCA dimension reduction as input, train a K nearest neighbor classification model, select the optimal hyperparameter configuration, and obtain the electrical appliance recognition model; 5) For the high-frequency current data collected in real time, smoothing is first performed and then the data is converted into images; then, the feature map is classified using the trained KNN classifier to determine the category label of the image.
[0008] Preferably, in step 1), a high-frequency data acquisition device is used to acquire current data under different circuit conditions, and the high-frequency data acquisition device is an oscilloscope, a sensor or a power monitoring device that supports high-frequency acquisition.
[0009] Preferably, the sampling frequency of the current data in step 1) is 16 kHz, and the household AC power is 220V.
[0010] Preferably, the current value of the standard points in step 1) is a piece of 510 current value data.
[0011] Preferably, in step 2), a smoothing method is used to eliminate measurement noise, and the value of the smoothing parameter α is 0.15.
[0012] Preferably, in step 2), the Fourier transform of the current data to generate the phase information and frequency information of the current data is achieved by the following formula: ; in It's a signal Representation in the frequency domain; Indicates frequency, Is an imaginary unit.
[0013] Preferably, in step 2), the phase alignment operation according to the standard data of each class is implemented by the following formula: ; ; in represents the difference in phase angle, represents the phase angle of the standard data, and Both represent the phase angle of the data to be phase aligned.
[0014] Preferably, step 3) comprises: a) Convert the input image into a matrix format using the CV method, decentralize, and calculate the covariance matrix; the formula is as follows: ; In the above formula, X is the initial matrix, N and n are the number of columns of the matrix, T represents the transpose of the matrix, S is the covariance matrix obtained from the matrix X, and the matrix in brackets is the decentralized matrix; b) Calculate the eigenvalues and eigenvectors of the matrix, take the first K principal components, K is a positive integer, and project the data onto the principal components; the formula is as follows: ; In this formula represents the decentralized matrix, represents the first K eigenvectors; c) Pair Matrix Each column vector of is normalized using the L2 norm; the formula is as follows: ; d) Multiply the Z matrix by Get the training data set and the test data set.
[0015] Preferably, in step 4), the selection of the optimal hyperparameter configuration is achieved through a cross-validation method.
[0016] In the above technical scheme, the current data can be collected by sensors or power monitoring equipment, and after the steps of preprocessing and feature extraction, the current data is drawn into a waveform graph, in which the horizontal axis represents time or sampling point and the vertical axis represents current value. In this way, the time domain information of the current can be displayed in the image. Then, the PCA dimensionality reduction technology is applied to process the two-dimensional current waveform image. PCA is a commonly used dimensionality reduction technology that can project high-dimensional data into a lower-dimensional subspace through linear transformation. Through PCA dimensionality reduction, the dimension of the data can be reduced, redundant information can be removed, and the most representative features can be extracted, which improves the accuracy of data dimensionality reduction and the robustness of the algorithm. Finally, the KNN algorithm is used to classify and identify the features after dimensionality reduction. KNN is an instance-based learning method that calculates the distance between the sample to be classified and the sample in the training set, finds the K nearest neighbor samples, and makes classification decisions based on their labels. In this application, KNN can classify and identify the waveform image to be classified based on the waveform image features of the known electrical appliance types in the training set.
[0017] Compared with the prior art, the innovative features of the method of the present invention are mainly reflected in: 1. Phase alignment: In signal processing, phase information is crucial for accurate feature extraction and signal alignment. Through Fourier transform, the phase of the current signal can be corrected and aligned to ensure that the phase error of the signal will not affect the recognition accuracy in the subsequent feature extraction process.
[0018] 2. Signal visualization: Convert the current signal into an image (such as a spectrum, a time-frequency diagram, or a waveform diagram after phase alignment). This method can capture more signal details and patterns. Input data in the form of images can more intuitively display signal characteristics to a certain extent. 3. Efficient dimensionality reduction: PCA can extract the main components from high-dimensional data, reduce the feature dimensions, and thus reduce computational complexity. This is especially important for processing image data, because image data is usually high in dimension. By selecting the principal components, PCA can remove noise and redundant information while retaining the important information of the original data as much as possible, thereby improving the performance of subsequent classification.
[0019] The present invention has the following beneficial technical effects: The present invention proposes a method of combining PCA with KNN to identify the waveform image of household electrical current signals. After the PCA algorithm performs dimensionality reduction, the algorithm extracts the main characteristic components of the current waveform, removes redundant information, and reduces the dimension of the features. This improves the efficiency and speed of the classification algorithm. The details are as follows: Feature conversion and dimensionality reduction: Converting current data into waveform images and applying the PCA model for dimensionality reduction can extract the main characteristic components of the current waveform, remove redundant information, and reduce the dimension of the features. This helps to simplify the complexity of the classification task and improve the efficiency and speed of the classification algorithm.
[0020] Utilization of image features: The current data can be converted into images, which can be processed and analyzed using the techniques and methods in the field of computer vision. As visual signals, images are more intuitive and interpretable, and can better capture the differences and similarities between electrical appliances. This helps improve the accuracy and robustness of household appliance classification.
[0021] Adapting to nonlinear relationships: By converting current data into images, the appliance classification problem can be transformed into an image classification problem. Deep learning models and computer vision algorithms have more powerful nonlinear modeling capabilities when dealing with image classification tasks, and can capture more complex features and relationships. This helps improve the performance of home appliance classification, especially when dealing with complex appliance classification problems.
[0022] Application of KNN algorithm: KNN algorithm is a simple and effective classification algorithm that performs classification by calculating the distance between the sample to be classified and the training sample. In image classification, KNN algorithm can calculate similarity based on the distance between images for classification. This image-based KNN algorithm can better capture the similarities and differences between electrical waveform images, thereby improving classification accuracy.
[0023] In summary, the beneficial effects of the above algorithms in the household appliance classification task include reducing feature dimensions, extracting main feature components, utilizing image features, adapting to nonlinear relationships, and combining with the KNN algorithm for classification. These effects are expected to improve the accuracy, efficiency, and robustness of classification, providing a new method and idea for household appliance classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is an electrical appliance training flow chart in the present invention.
[0025] Figure 2 This is an electrical appliance identification flow chart in the present invention.
[0026] Figure 3 This is the PCA flow chart of the present invention.
[0027] Figure 4 This is the flow chart of the KNN algorithm in the present invention. DETAILED DESCRIPTION
[0028] The specific embodiments of the present invention will be described in detail below. In order to avoid too much unnecessary details, the well-known structures or functions will not be described in detail in the following examples. The approximate language used in the following examples can be used for quantitative expression, indicating that the quantity can be allowed to have a certain change without changing the basic function. Unless otherwise defined, the technical and scientific terms used in the following examples have the same meaning as those generally understood by those skilled in the art to which the present invention belongs.
[0029] The image recognition method of household appliance current data based on PCA combined with KNN, the specific steps are as follows: 1. Construct a current waveform image dataset: Use high-frequency data acquisition equipment (oscilloscope, sensor or power monitoring equipment) to collect current data under different circuit conditions (sampling frequency is 16kHZ, household AC 220V). Decode the collected data and generate current values of standard points (510 current value data in one row). Use these 510 current value data to directly generate a standard current waveform image with coordinates (size 1000*400).
[0030] 2. Data preprocessing: First, remove noise and interference: use the smoothing method to eliminate measurement noise (the smoothing parameter α value is 0.15). Next, perform Fourier transform on the current data to generate the phase information and frequency information of the current data. The formula is as follows, where It's a signal Representation in the frequency domain Indicates frequency, Is an imaginary unit.
[0031] ; Then perform phase alignment based on the standard data of each class. The formula is as follows: represents the difference in phase angle, represents the phase angle of the standard data, and Both represent the phase angle of the data to be phase aligned.
[0032] ;
[0033] Then the data is inverse Fourier transformed to generate phase-aligned current data information. The data is converted into images and input into the PCA model for training.
[0034] 3. PCA for feature extraction: Input PCA model for dimensionality reduction (feature selection): Convert the input image into matrix format using CV method, decentralize, and calculate the covariance matrix (formula is as follows): ; In the above formula, X is the initial matrix, N and n are the number of columns of the matrix, T represents the transpose of the matrix, S is the covariance matrix obtained from the matrix X, and the matrix in brackets is the decentralized matrix; Calculate the eigenvalues and eigenvectors of the matrix (take the first K principal components, K is set to 35), and project the data onto the principal components. The formula is as follows: represents the decentralized matrix, Represents the first K eigenvectors ; Then the matrix Each column vector of is normalized using the L2 norm, as follows: ; Finally, multiply the Z matrix by Get the training data set and the test data set.
[0035] 4. KNN classifier training: The current waveform data after PCA dimensionality reduction is used as input to train a K-nearest neighbor (KNN) appliance recognition model. KNN is an instance-based machine learning algorithm that finds the K nearest neighbor samples (K is set to 5) around the input sample and makes predictions based on their categories. Through methods such as cross-validation, the optimal hyperparameter configuration is selected to achieve the best performance of the model on the validation set.
[0036] 5. Image recognition: For the high-frequency current data collected in real time, smoothing is first performed and then the data is converted into images. Then, the feature map is classified using the trained KNN classifier to determine the category label of the image.
[0037] The present invention is an electrical parameter feature map recognition method that integrates PCA (principal component analysis) and KNN (k nearest neighbor), and belongs to an application in the field of machine learning and pattern recognition. This method mainly uses electrical current signals to determine the type and usage status of electrical appliances. This technology can be widely used in power systems, industrial equipment monitoring, smart grids, electric vehicles and other fields.
[0038] As a commonly used dimensionality reduction technology, PCA can effectively extract the main information in the electrical parameter characteristics, reduce the data dimension, and reduce the computational complexity. The KNN algorithm is a classic classification algorithm that classifies by comparing the similarities between samples. The present invention innovatively combines the two for the recognition of electrical parameter feature maps, which can give full play to their advantages and improve the recognition effect.
[0039] The present invention first generates a current-time series coordinate diagram from electrical current data, combines the data dimension reduction and feature extraction capabilities of PCA, and the simple and intuitive classification algorithm of KNN, to achieve effective processing and analysis of complex current data. It is suitable for current feature recognition of different types of electrical equipment and various working conditions, including industrial production equipment, transformers and generators in power systems, etc. It can identify electrical equipment and monitor its status in scenarios with high real-time requirements, improving production efficiency and the stability of equipment operation.
[0040] In terms of specific implementation, the present invention mainly includes a data acquisition module, a preprocessing module, a PCA processing module, a feature selection module, and a KNN classification module.
[0041] 1. Data acquisition module Function: Responsible for collecting current data signals from electrical equipment in real time.
[0042] Implementation details: Use sensors or data acquisition equipment to regularly obtain current waveform data of electrical equipment.
[0043] 2. Preprocessing module Function: Preprocess the collected current data to ensure the accuracy and stability of subsequent analysis.
[0044] Implementation details: Phase alignment: Perform Fourier transform on the original signal to convert the signal from the time domain to the frequency domain. According to the phase information of the target frequency, adjust the phase of other frequency components to keep it consistent with the phase of the target frequency.
[0045] 3. PCA processing module Function: Use principal component analysis (PCA) to reduce the dimension of high-dimensional current data and extract key features.
[0046] Implementation details: Feature extraction: PCA technology is used to transform the current waveform image into a low-dimensional feature vector with statistical significance.
[0047] Principal component selection: Select the main components to retain the most significant current variation patterns.
[0048] 4. Feature Selection Module Function: Based on the PCA processing results, select and extract the most discriminative features for subsequent classification.
[0049] Implementation details: Feature screening: Based on the feature vectors generated by PCA, they are arranged in descending order and the top K most important features are selected.
[0050] 5. KNN classification module Function: Use the k-nearest neighbor (KNN) algorithm to classify and identify the selected features and determine the operating status of electrical equipment.
[0051] Implementation details: Distance metric: Calculate the Euclidean distance between feature vectors.
[0052] Classification decision: Determine the type and status of electrical appliances based on the KNN algorithm and output the corresponding results.
[0053] In summary, the electrical current characteristic diagram recognition method integrating PCA and KNN is an innovative means combining advanced data processing and machine learning technology, which provides an efficient and accurate solution for electrical equipment management and operation and maintenance, and has broad application prospects and practical value.
[0054] The embodiments of the present invention are described in detail above, but the contents are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the scope of the present invention shall be included in the protection scope of the present invention.
Claims
1. The electrical parameter characteristic map recognition method integrating PCA and KNN is characterized by: include: 1) Collect current data under different circuit conditions, decode the collected data, and generate current values of standard points; 2) Remove noise and interference, then perform Fourier transform on the current data to generate phase information and frequency information of the current data, then perform phase alignment operation according to the standard data of each class, then perform inverse Fourier transform on the data to generate current data information after phase alignment, and convert the data into an image; 3) Input PCA model for dimensionality reduction; 4) Take the current waveform data after PCA dimension reduction as input, train a K nearest neighbor classification model, select the optimal hyperparameter configuration, and obtain the electrical appliance recognition model; 5) For the high-frequency current data collected in real time, it is first smoothed and then converted into an image; then, the feature map is classified using the trained electrical appliance recognition model to determine the category label of the image.
2. The electrical parameter characteristic diagram recognition method integrating PCA and KNN according to claim 1 is characterized in that: In step 1), a high-frequency data acquisition device is used to acquire current data under different circuit conditions. The high-frequency data acquisition device is an oscilloscope, a sensor or a power monitoring device that supports high-frequency acquisition.
3. The electrical parameter characteristic diagram recognition method integrating PCA and KNN according to claim 1 is characterized in that: The sampling frequency of the current data in step 1) is 16kHZ, and the household AC power is 220V.
4. The electrical parameter characteristic diagram recognition method integrating PCA and KNN according to claim 1, characterized in that: The current value of the standard point number in step 1) is a piece of 510 current value data.
5. The electrical parameter characteristic diagram recognition method integrating PCA and KNN according to claim 1, characterized in that: In step 2), a smoothing method is used to eliminate measurement noise, and the smoothing parameter α is 0.
15.
6. The electrical parameter characteristic diagram recognition method integrating PCA and KNN according to claim 1, characterized in that: In step 2), the Fourier transform of the current data to generate the phase information and frequency information of the current data is achieved by the following formula: ; in It's a signal Representation in the frequency domain; Indicates frequency, Is an imaginary unit.
7. The electrical parameter characteristic diagram recognition method integrating PCA and KNN according to claim 1, characterized in that: In step 2), the phase alignment operation is performed according to the standard data of each class, which is achieved by the following formula: ; ; in represents the difference in phase angle, represents the phase angle of the standard data, and Both represent the phase angle of the data to be phase aligned.
8. The electrical parameter characteristic diagram recognition method integrating PCA and KNN according to claim 1, characterized in that: Step 3) includes: a) Convert the input image into a matrix format using the CV method, decentralize, and calculate the covariance matrix; the formula is as follows: ; In the above formula, X is the initial matrix, N and n are the number of columns of the matrix, T represents the transpose of the matrix, S is the covariance matrix obtained by the matrix X, and the matrix in brackets is the decentralized matrix; b) Calculate the eigenvalues and eigenvectors of the matrix, take the first K principal components, K is a positive integer, and project the data onto the principal components; the formula is as follows: ; In this formula represents the decentralized matrix, represents the first K eigenvectors; c) Pair Matrix Each column vector of is normalized using the L2 norm; the formula is as follows: ; d) Multiply the Z matrix by Get the training data set and the test data set.
9. The electrical parameter characteristic diagram recognition method integrating PCA and KNN according to claim 1, characterized in that: In step 4), the selection of the optimal hyperparameter configuration is achieved through the cross-validation method.
Citation Information
Patent Citations
Load identification method based on feature fusion
CN113807225A
Non-intrusive load identification method based on improved CNN
CN113989065A
Fault diagnosis method and system based on robust transfer subspace learning
CN116861353A
Non-intrusive user side load identification method, system, equipment and medium
CN117540249A
Non-Intrusive Appliance Load Monitoring Method using a Switching Factorial Hidden Markov Model and System applying the same
KR1020160141032A