Leakage current waveform matching method based on combination of multi-machine learning and weighted voting mechanism
Through multi-machine learning combined with weighted voting mechanism, the problem of leakage current type identification in the existing technology is solved, and the accurate matching and type identification of leakage current waveforms are achieved, which improves the accuracy and robustness of detection.
Patent Information
- Application Number
- CN202411737727.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-25
AI Technical Summary
The existing leakage current detection methods fail to effectively utilize actual fault leakage or electric shock signals as action criteria, making it difficult to accurately identify the leakage current type.
The leakage current waveform matching method combined with the weighted voting mechanism is adopted. The current data is preprocessed through wavelet transformation, Z-score outlier processing and min-max normalization processing, and the features of the time domain, frequency domain and time frequency domain are extracted, and the support vector machine, random forest, K nearest neighbor, BP neural network and RBF neural network are trained. The final waveform matching and type identification are achieved in combination with the weighted voting mechanism.
It improves the precise matching and classification identification capabilities of leakage current waveforms, improves the classification accuracy and robustness of the model, and reduces the possible deviations and misclassification problems caused by a single model.
Smart Images

Figure CN119691462A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of leakage current detection technology, and specifically to a leakage current waveform matching method combining multi-machine learning with a weighted voting mechanism. Background Art
[0002] Power supply substations are a vital component of the power system. Any leakage issues can lead to safety hazards such as electrical fires and equipment damage. Therefore, effectively diagnosing and addressing leakage current is crucial to ensuring the safe operation of the entire power system and improving power supply reliability. Leakage current can lead to unstable power supply and affect power quality.
[0003] Currently, leakage current detection methods typically use amplitude comparison, current pulse, and phase-amplitude discrimination. However, these methods rely on amplitude and phase changes before and after a fault or leakage event, and do not use actual fault leakage or electric shock signals as action criteria. Therefore, it is necessary to develop a leakage current waveform matching method to accurately identify leakage current types.
[0004] Therefore, there is an urgent need to improve this shortcoming. The present invention studies and improves the existing technology and its shortcomings, and provides a leakage current waveform matching method that combines multi-machine learning with a weighted voting mechanism. Summary of the Invention
[0005] The purpose of the present invention is to provide a leakage current waveform matching method combining multi-machine learning with a weighted voting mechanism to solve the problems raised in the above background technology.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a leakage current waveform matching method combining multi-machine learning with a weighted voting mechanism, comprising the following steps:
[0007] S1. Preprocessing of current data:
[0008] First, wavelet transform is used for filtering and denoising to eliminate the influence of high-frequency noise as much as possible. Then, Z-score is used to process outliers in the denoised current signal. Finally, min-max normalization is used to complete the preprocessing of the current data.
[0009] S2. Feature extraction of current data:
[0010] Feature extraction is performed from three levels: time domain, frequency domain, and time-frequency domain. In the time domain, six feature quantities of the current signal are extracted: mean, equation, kurtosis, skewness, root mean square, and peak-to-peak value. In the frequency domain, three feature quantities are extracted: signal dominant frequency, spectral entropy, and frequency component energy ratio. For time-frequency domain features, the signal short-time energy entropy and short-time Fourier entropy are extracted as time-frequency domain features to construct feature vectors.
[0011] S3. Establishment and training of multiple machine learning models:
[0012] Based on the feature vectors obtained in steps S1 and S2, a data set was created and divided into a training set, a validation set, and a test set in a ratio of 8:1:1. The same data set was input into five neural networks, namely support vector machine (SVM), random forest algorithm, K-nearest neighbor algorithm, BP neural network, and RBF neural network, for training to obtain trained models;
[0013] S4. Leakage current waveform matching using multiple machine learning models combined with a weighted voting mechanism:
[0014] Based on the five machine learning models that have been trained and adjusted, a multi-model weighted voting mechanism is established. The optimal result selected based on weighted voting is then used as the final waveform matching result to achieve waveform matching and type identification of leakage current.
[0015] Furthermore, in step S1, the wavelet transform filtering and denoising includes the following three steps:
[0016] 1)Wavelet decomposition
[0017] For the signal x(t), the wavelet decomposition formula can be expressed as:
[0018]
[0019] Where: is the scale factor, used for the low-frequency approximation component; is the scale function of the low-frequency part; d j,k is the detail coefficient, used for high-frequency noise components; ψ j,k(t) is the wavelet function;
[0020] 2) Threshold processing
[0021] Based on the wavelet decomposition, denoising is performed by applying a soft threshold operation to the high-frequency components:
[0022] d' j,k =sign(d j,k )·max(|d j,k |-λ,0);
[0023] Where: λ is the threshold, Where σ is the standard deviation of the noise, n is the sample size; d j,k With d' j,k are the high frequency components before and after processing respectively;
[0024] 3) Wavelet reconstruction
[0025] Use the low-frequency components and the processed high-frequency components to reconstruct the signal:
[0026]
[0027] Where: x recon (t) is the denoised signal.
[0028] Furthermore, in step S1, Z-score outlier processing is performed on the basis of wavelet denoising, and the specific steps are as follows:
[0029] 1) Calculate the signal mean and standard deviation
[0030] For a signal segment X={x1,x2,…,x n}, calculate the mean μ and standard deviation σ:
[0031]
[0032] 2) Z-score calculation
[0033] Z-score is used to measure the degree to which data deviates from the mean. The formula is:
[0034]
[0035] If a data point |Z i |>A, A is the set threshold, then it is considered that x i is an outlier;
[0036] 3) Outlier processing
[0037] For the outlier point x i , replace it with the mean of the previous and next points:
[0038]
[0039] Furthermore, in step S1, after the outlier processing is completed, min-max normalization processing is performed to scale the data to the range of [0, 1], and the formula is:
[0040]
[0041] Where: X is the data to be normalized, X min With X max are the minimum and maximum values of the data.
[0042] Furthermore, in step S2, six characteristic quantities of the current signal, namely, mean, equation, kurtosis, skewness, root mean square, and peak-to-peak value, are extracted in the time domain. The method for obtaining each characteristic quantity is as follows:
[0043] 1) Mean: reflects the central trend of the current signal and is used to determine the offset of the signal;
[0044]
[0045] Where: x i is the i-th sampling point of the current signal, and n is the number of sampling points;
[0046] 2) Variance: describes the degree of discreteness of the data and is used to analyze the fluctuation range of the current signal;
[0047]
[0048] 3) Kurtosis: describes the sharpness of the signal. A high kurtosis means that the signal has more peaks.
[0049]
[0050] 4) Skewness: used to measure the symmetry of the signal. Positive skewness indicates right skewness, and negative skewness indicates left skewness.
[0051]
[0052] 5) Root mean square: reflects the energy of the signal and represents the "effective value" of the signal;
[0053]
[0054] 6) Peak-to-peak value: used to measure the maximum fluctuation amplitude of the current signal, indicating the difference between the maximum and minimum values;
[0055] Peak-to-Peak=max(x i )-min(x i ).
[0056] Furthermore, in step S2, in the frequency domain, frequency domain features are extracted by Fourier transform, which can reveal the characteristics of the signal in frequency and extract three characteristic quantities: signal main frequency, spectral entropy, and frequency component energy ratio. The method for obtaining each characteristic quantity is as follows:
[0057] 1) Dominant frequency: The frequency component with the largest amplitude in the spectrum, which can reflect the dominant frequency of the signal; the calculation process is as follows:
[0058] Perform Fourier transform on the current signal x(t) to convert the time domain signal into a frequency domain signal;
[0059]
[0060] Where X(f) represents the complex spectrum value at frequency f, N is the number of signal sampling points, and x n is the sampling point of the nth time domain;
[0061] Then perform spectrum amplitude calculation to calculate the amplitude of each frequency component |X(f)|:
[0062]
[0063] Where Re(X(f)) and Im(X(f)) represent the real and imaginary parts of the spectrum, respectively;
[0064] Finally, find the maximum frequency component: find the frequency corresponding to the maximum value in the spectrum amplitude |X(f)|, which is the main frequency, as shown in the following formula:
[0065] f dominant =arg max|X(f)|;
[0066] 2) Spectral entropy: This measures the complexity of the frequency distribution. A higher entropy value indicates a more complex frequency component. It is calculated by normalizing the spectrum energy distribution. The calculation process is as follows:
[0067] Spectrum energy calculation: Perform Fourier transform on the signal to obtain the spectrum X(f), and calculate the energy of each frequency component |X(f k )| 2 ;
[0068] |X(f k )| 2 =Re(X(f k )) 2 +Im(X(f k )) 2 ;
[0069] Where, X(f k ) is the frequency f k The spectrum value of
[0070] Normalize the energy of each frequency component to obtain the probability distribution of each frequency component:
[0071]
[0072] Where, P k is the frequency component f k The normalized energy of
[0073] Calculate the spectral entropy value using the normalized spectral energy distribution:
[0074]
[0075] Where K is the total number of frequency components, SE is the spectrum entropy value;
[0076] 3) Frequency component energy ratio: Indicates the ratio of energy within a specific frequency range to the total energy, used to reflect the main frequency characteristics of the signal; the calculation method is as follows:
[0077] Set the frequency range [f1,f2] and calculate the sum of the frequency component energies in this frequency range:
[0078]
[0079] Calculate the total spectral energy of a signal:
[0080]
[0081] Where: f max is the highest frequency of the spectrum;
[0082] Divide the energy in the frequency band by the total energy to obtain the frequency component energy ratio ER:
[0083]
[0084] Furthermore, in step S2, for the time-frequency domain features, the signal short-time energy entropy and short-time Fourier entropy are extracted as the time-frequency domain features, and the calculation method is as follows:
[0085] 1) Short-term energy entropy: used to describe the complexity of the energy distribution of a signal within a short time window, and can reveal the time-varying characteristics of the signal;
[0086] The signal is divided into multiple overlapping or non-overlapping short time windows. For each time window t, the signal energy E in the window is calculated. t ;
[0087]
[0088] The energy E of each window t Normalize and get the ratio of each window energy to the total energy P t ;
[0089]
[0090] The normalized energy distribution is used to calculate the short-time energy entropy STEE, which reflects the complexity of the energy distribution;
[0091]
[0092] 2) Short-time Fourier entropy, which is used to describe the complexity of the signal frequency distribution and its changes over time;
[0093] On the basis of obtaining the spectrum entropy SE, the spectrum entropy of all time windows is averaged to obtain the short-time Fourier entropy STFTE of the entire signal, which reflects the time-frequency complexity of the entire signal.
[0094] As shown in the following formula:
[0095]
[0096] Where SE(t) is the spectral entropy in time window t.
[0097] Furthermore, in step S3, the training process of the five neural networks is as follows:
[0098] I. The training and verification steps of the support vector machine are as follows:
[0099] 1) Select kernel function: Select the kernel function based on the linear separability of the data;
[0100] 2) Hyperparameter setting: determine the penalty parameter C and kernel function parameter γ;
[0101] The penalty parameter C controls the tolerance of classification errors. The larger the C value, the more the model pursues smaller classification errors.
[0102] The kernel parameter γ determines the influence range of the RBF kernel. A larger value indicates a smaller influence range.
[0103] 3) Model training: Use the training set data to fit the model and minimize the classification error by optimizing the hyperplane that maximizes the margin;
[0104] 4) Validation and parameter tuning: Use the validation set to test different hyperparameter combinations and select the hyperparameters that achieve the best validation set accuracy.
[0105] II. The training and validation steps of the random forest algorithm are as follows:
[0106] 1) Set hyperparameters: determine the number of decision trees (forest size), maximum depth, minimum number of split samples, etc.
[0107] 2) Generate subsamples: Randomly extract samples from the training set with replacement to create a different training subset for each decision tree;
[0108] 3) Train each decision tree: train a decision tree for each subsample, and use "information gain" as the metric in the splitting process;
[0109] 4) Validation and parameter tuning: Use the validation set to test different parameter combinations and adjust hyperparameters to improve validation set performance;
[0110] III. The training and verification steps of the K-nearest neighbor algorithm are as follows:
[0111] 1) Select the number of neighbors K: Determine the most appropriate value of the number of neighbors K;
[0112] 2) Select distance metric: Select Manhattan distance as the distance metric;
[0113] 3) Classification: For each sample to be classified, calculate the distance between it and all training samples and classify it according to the categories of its nearest K neighbors;
[0114] 4) Validation and parameter tuning: Use the validation set to test different K values and select the optimal K value for the final model;
[0115] IV. The training and verification steps of BP neural network are as follows:
[0116] 1) Set up the network structure: determine the number of neurons in the input layer, hidden layer, and output layer;
[0117] 2) Initialize weights and biases: Randomly initialize the network's weights and biases and start training with small values;
[0118] 3) Forward propagation: Input the training data into the network and calculate the output of each neuron layer by layer until the prediction result of the output layer is obtained;
[0119] 4) Calculate the loss function: Calculate the error between the model prediction result and the true label through the loss function (mean square error);
[0120] 5) Backpropagation: Calculate the gradient of the loss function, pass the gradient from the output layer back to the input layer through the chain rule, and adjust the weights and biases in the network;
[0121] 6) Iterative training: Repeat the forward propagation and backpropagation process on the training set until the predetermined number of iterations or error threshold is reached;
[0122] 7) Validation and parameter adjustment: Use the validation set to adjust hyperparameters such as the number of hidden layers and learning rate to optimize model performance;
[0123] V. The training and verification steps of the RBF neural network are as follows:
[0124] 1) Determine the network structure: The RBF network consists of an input layer, an RBF hidden layer, and an output layer;
[0125] 2) Set the radial basis function center: Select the center point of the RBF kernel, use the K-means algorithm to cluster the training data, and use each cluster center as the center of an RBF kernel;
[0126] 3) Determine the width of the RBF kernel: Set the width parameter based on the distance distribution, and use the average distance from the sample point to the center in the clustering result to determine it;
[0127] 4) Calculate the RBF hidden layer output: Calculate the distance between each input sample and the center of the RBF kernel, and then calculate the output of each RBF node through the RBF function. The RBF function is as follows:
[0128]
[0129] Where h i (x) is the output of the i-th RBF node, x is the input sample, c i is the center of the i-th RBF kernel, and σ is the width parameter.
[0130] Furthermore, the step S4 specifically includes the following sub-steps:
[0131] S41. Using the test set as input, the five trained models are used to obtain matching results of each model for the leakage current waveform.
[0132] S42. Vote on the classification results of the five models, using weighted voting (weights are assigned based on the performance of the model on the validation set) as the voting mechanism to obtain the voting results;
[0133] S43. Based on the final result of the voting, the type classification result of the leakage current is output to achieve accurate matching and type identification of the leakage current waveform.
[0134] Furthermore, the implementation process of the weighted voting mechanism is as follows:
[0135] 1) During model training and validation, the performance of each model is evaluated based on the validation set results, and the accuracy of each model is calculated as the model score on the validation set;
[0136] 2) Model weight distribution:
[0137] The scores of each model are standardized for use in weighted voting, and the weight of each model is calculated as follows:
[0138]
[0139] Where, s i represents the score of the i-th model on the validation set, ω i is the weight of the i-th model, and the sum of all weights is 1;
[0140] 3) Use the test set to input the five trained models and obtain the matching results of each model on the leakage current waveform;
[0141] 4) Multiply the prediction result of each leakage current category (the prediction result here is the probability / %) that the model believes that the feature vector belongs to a certain leakage current type) by the weight of the model ω i, get the weighted score, and calculate the sum of the weighted scores of each model, as shown in the following formula:
[0142]
[0143] Where, P i,class is the prediction result of model i for a certain category;
[0144] 5) The category with the highest weighted score is taken as the final leakage current waveform matching result;
[0145] 6) Output the final weighted voting result to obtain the matching category of the leakage current waveform and achieve accurate type identification.
[0146] The present invention provides a leakage current waveform matching method combining multi-machine learning with a weighted voting mechanism, which has the following beneficial effects:
[0147] The effect of the present invention is reflected in the precise matching and classification identification of leakage current waveforms, and the classification accuracy and robustness of the model are effectively improved through the multi-model weighted voting mechanism. The specific effects are as follows:
[0148] 1. By extracting multiple features (such as mean, kurtosis, dominant frequency, spectral entropy, and short-term energy entropy) from the time, frequency, and time-frequency domains, the leakage current waveform is comprehensively and deeply characterized. This multi-dimensional feature extraction method enables the classification model to more fully identify the characteristics of different types of leakage current, significantly improving the model's recognition accuracy.
[0149] 2. We use five machine learning algorithms: support vector machine (SVM), random forest, K-nearest neighbor (KNN), BP neural network, and RBF neural network, combining the strengths of each model. This multi-model fusion ensures complementarity, further improving classification accuracy and robustness, and reducing the bias and misclassification issues that may arise from a single model.
[0150] 3. A weighted voting mechanism assigns weights based on performance on the validation set, giving the best-performing model for different waveform types greater weight in the final decision. Weighted voting makes decisions more scientific and rational, resulting in more accurate and reliable leakage current waveform matching results in practical applications.
[0151] 4. The leakage current waveform matching method proposed in this invention is not only applicable to general leakage current type identification but can also be extended to other types of current waveform analysis and identification tasks. For example, leakage protection systems for household appliances and industrial equipment, as well as power line fault detection, are examples. Its precise waveform matching and classification capabilities provide technical support for various power safety management applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0152] Figure 1 This is a schematic flow chart of the steps of a leakage current waveform matching method using multi-machine learning combined with a weighted voting mechanism according to the present invention;
[0153] Figure 2 Schematic diagram of the specific steps of step S1 of the leakage current waveform matching method using multi-machine learning combined with a weighted voting mechanism of the present invention;
[0154] Figure 3 This is a specific step of step S4 of the leakage current waveform matching method combining multi-machine learning with a weighted voting mechanism of the present invention. DETAILED DESCRIPTION
[0155] The following embodiments of the present invention are described in further detail with reference to the accompanying drawings and examples. The following examples are used to illustrate the present invention but are not intended to limit the scope of the present invention.
[0156] like Figure 1-Figure 3 As shown, a leakage current waveform matching method combining multi-machine learning with a weighted voting mechanism includes the following steps:
[0157] S1. Preprocessing of current data:
[0158] First, wavelet transform is used for filtering and denoising to eliminate the influence of high-frequency noise as much as possible. Then, Z-score is used to process outliers in the denoised current signal. Finally, min-max normalization is used to complete the preprocessing of the current data.
[0159] In this embodiment, wavelet transform filtering and denoising includes the following three steps:
[0160] 1)Wavelet decomposition
[0161] For the signal x(t), the wavelet decomposition formula can be expressed as:
[0162]
[0163] Where: is the scale factor, used for the low-frequency approximation component; is the scale function of the low-frequency part; d j,k is the detail coefficient, used for high-frequency noise components; ψ j,k(t) is the wavelet function;
[0164] 2) Threshold processing
[0165] Based on the wavelet decomposition, denoising is performed by applying a soft threshold operation to the high-frequency components:
[0166]
[0167] Where: λ is the threshold, Where σ is the standard deviation of the noise, n is the sample size; d j,k With d' j,k are the high frequency components before and after processing respectively;
[0168] 3) Wavelet reconstruction
[0169] Use the low-frequency components and the processed high-frequency components to reconstruct the signal:
[0170]
[0171] Where: x recon (t) is the signal after denoising;
[0172] In this embodiment, Z-score outlier processing is performed on the basis of wavelet denoising. The specific steps are as follows:
[0173] 1) Calculate the signal mean and standard deviation
[0174] For a signal segment X={x1,x2,…,x n}, calculate the mean μ and standard deviation σ:
[0175]
[0176] 2) Z-score calculation
[0177] Z-score is used to measure the degree to which data deviates from the mean. The formula is:
[0178]
[0179] If a data point |Z i |>A, A is the set threshold, then it is considered that x i is an outlier;
[0180] 3) Outlier processing
[0181] For the outlier point x i , replace it with the mean of the previous and next points:
[0182]
[0183] In this embodiment, after the outlier processing is completed, min-max normalization processing is performed to scale the data to the range of [0, 1]. The formula is:
[0184]
[0185] Where: X is the data to be normalized, X min With X max is the minimum and maximum value of the data;
[0186] This preprocessing process provides high-quality denoised signal data for subsequent steps. It removes high-frequency noise through wavelet transform, eliminates outliers through Z-score, and standardizes the signal using normalization techniques, providing smooth and comparable data for subsequent feature extraction and machine learning models.
[0187] S2. Feature extraction of current data:
[0188] In order to extract the features in the current signal that can reflect the characteristics of different types of leakage current, feature extraction is performed from three levels: time domain, frequency domain, and time-frequency domain;
[0189] In this embodiment, six characteristic quantities of the current signal are extracted in the time domain, namely, mean, equation, kurtosis, skewness, root mean square, and peak-to-peak value. The method for obtaining each characteristic quantity is as follows:
[0190] 1) Mean: reflects the central trend of the current signal and is used to determine the offset of the signal;
[0191]
[0192] Where: x i is the i-th sampling point of the current signal, and n is the number of sampling points;
[0193] 2) Variance: describes the degree of discreteness of the data and is used to analyze the fluctuation range of the current signal;
[0194]
[0195] 3) Kurtosis: describes the sharpness of the signal. A high kurtosis means that the signal has more peaks.
[0196]
[0197] 4) Skewness: used to measure the symmetry of the signal. Positive skewness indicates right skewness, and negative skewness indicates left skewness.
[0198]
[0199] 5) Root mean square: reflects the energy of the signal and represents the "effective value" of the signal;
[0200]
[0201] 6) Peak-to-peak value: used to measure the maximum fluctuation amplitude of the current signal, indicating the difference between the maximum and minimum values;
[0202] Peak-to-Peak=max(x i )-min(x i );
[0203] In this embodiment, in the frequency domain, the frequency domain features are extracted by Fourier transform, which can reveal the characteristics of the signal in frequency. Three characteristic quantities are extracted: the main frequency of the signal, the spectrum entropy, and the frequency component energy ratio. The method for obtaining each characteristic quantity is as follows:
[0204] 1) Dominant frequency: The frequency component with the largest amplitude in the spectrum, which can reflect the dominant frequency of the signal; the calculation process is as follows:
[0205] Perform Fourier transform on the current signal x(t) to convert the time domain signal into a frequency domain signal;
[0206]
[0207] Where X(f) represents the complex spectrum value at frequency f, N is the number of signal sampling points, and x n is the sampling point of the nth time domain;
[0208] Then perform spectrum amplitude calculation to calculate the amplitude of each frequency component |X(f)|:
[0209]
[0210] Where Re(X(f)) and Im(X(f)) represent the real and imaginary parts of the spectrum, respectively;
[0211] Finally, find the maximum frequency component: find the frequency corresponding to the maximum value in the spectrum amplitude |X(f)|, which is the main frequency, as shown in the following formula:
[0212] f dominant =arg max|X(f)|;
[0213] 2) Spectral entropy: This measures the complexity of the frequency distribution. A higher entropy value indicates a more complex frequency component. It is calculated by normalizing the spectrum energy distribution. The calculation process is as follows:
[0214] Spectrum energy calculation: Perform Fourier transform on the signal to obtain the spectrum X(f), and calculate the energy of each frequency component |X(f k )| 2 ;
[0215] |X(f k )| 2 =Re(X(f k )) 2 +Im(X(f k )) 2 ;
[0216] Where, X(f k ) is the frequency f k The spectrum value of
[0217] Normalize the energy of each frequency component to obtain the probability distribution of each frequency component:
[0218]
[0219] Where, P k is the frequency component f k The normalized energy of
[0220] Calculate the spectral entropy value using the normalized spectral energy distribution:
[0221]
[0222] Where K is the total number of frequency components, SE is the spectrum entropy value;
[0223] 3) Frequency component energy ratio: Indicates the ratio of energy within a specific frequency range to the total energy, used to reflect the main frequency characteristics of the signal; the calculation method is as follows:
[0224] Set the frequency range [f1,f2] and calculate the sum of the frequency component energies in this frequency range:
[0225]
[0226] Calculate the total spectral energy of a signal:
[0227]
[0228] Where: f max is the highest frequency of the spectrum;
[0229] Divide the energy in the frequency band by the total energy to obtain the frequency component energy ratio ER:
[0230]
[0231] In this embodiment, for the time-frequency domain features, the signal short-time energy entropy and short-time Fourier entropy are extracted as the time-frequency domain features, and the calculation method is as follows:
[0232] 1) Short-term energy entropy: used to describe the complexity of the energy distribution of a signal within a short time window, and can reveal the time-varying characteristics of the signal;
[0233] The signal is divided into multiple overlapping or non-overlapping short time windows. For each time window t, the signal energy E in the window is calculated. t ;
[0234]
[0235] The energy E of each window t Normalize and get the ratio of each window energy to the total energy P t ;
[0236]
[0237] The normalized energy distribution is used to calculate the short-time energy entropy STEE, which reflects the complexity of the energy distribution;
[0238]
[0239] 2) Short-time Fourier entropy, which is used to describe the complexity of the signal frequency distribution and its changes over time;
[0240] On the basis of obtaining the spectrum entropy SE, the spectrum entropy of all time windows is averaged to obtain the short-time Fourier entropy STFTE of the entire signal, which reflects the time-frequency complexity of the entire signal.
[0241] As shown in the following formula:
[0242]
[0243] Where SE(t) is the spectrum entropy in time window t;
[0244] After completing the feature extraction in the time domain, frequency domain, and time-frequency domain, the 11 extracted eigenvalues are combined to obtain the feature vector;
[0245] S3. Establishment and training of multiple machine learning models:
[0246] Based on the feature vectors obtained in steps S1 and S2, a data set was created and divided into a training set, a validation set, and a test set in a ratio of 8:1:1. The same data set was input into five neural networks, namely support vector machine (SVM), random forest algorithm, K-nearest neighbor algorithm, BP neural network, and RBF neural network, for training to obtain trained models;
[0247] In this embodiment, the training process of the five neural networks is as follows:
[0248] I. The training and verification steps of the support vector machine are as follows:
[0249] 1) Select kernel function: Select the kernel function based on the linear separability of the data;
[0250] 2) Hyperparameter setting: determine the penalty parameter C and kernel function parameter γ;
[0251] The penalty parameter C controls the tolerance of classification errors. The larger the C value, the more the model pursues smaller classification errors.
[0252] The kernel parameter γ determines the influence range of the RBF kernel. A larger value indicates a smaller influence range.
[0253] 3) Model training: Use the training set data to fit the model and minimize the classification error by optimizing the hyperplane that maximizes the margin;
[0254] 4) Validation and parameter tuning: Use the validation set to test different hyperparameter combinations and select the hyperparameters that achieve the best validation set accuracy.
[0255] II. The training and validation steps of the random forest algorithm are as follows:
[0256] 1) Set hyperparameters: determine the number of decision trees (forest size), maximum depth, minimum number of split samples, etc.
[0257] 2) Generate subsamples: Randomly extract samples from the training set with replacement to create a different training subset for each decision tree;
[0258] 3) Train each decision tree: train a decision tree for each subsample, and use "information gain" as the metric in the splitting process;
[0259] 4) Validation and parameter tuning: Use the validation set to test different parameter combinations and adjust hyperparameters to improve validation set performance;
[0260] III. The training and verification steps of the K-nearest neighbor algorithm are as follows:
[0261] 1) Select the number of neighbors K: Determine the most appropriate value of the number of neighbors K;
[0262] 2) Select distance metric: Select Manhattan distance as the distance metric;
[0263] 3) Classification: For each sample to be classified, calculate the distance between it and all training samples and classify it according to the categories of its nearest K neighbors;
[0264] 4) Validation and parameter tuning: Use the validation set to test different K values and select the optimal K value for the final model;
[0265] IV. The training and verification steps of BP neural network are as follows:
[0266] 1) Set up the network structure: determine the number of neurons in the input layer, hidden layer, and output layer;
[0267] 2) Initialize weights and biases: Randomly initialize the network's weights and biases and start training with small values;
[0268] 3) Forward propagation: Input the training data into the network and calculate the output of each neuron layer by layer until the prediction result of the output layer is obtained;
[0269] 4) Calculate the loss function: Calculate the error between the model prediction result and the true label through the loss function (mean square error);
[0270] 5) Backpropagation: Calculate the gradient of the loss function, pass the gradient from the output layer back to the input layer through the chain rule, and adjust the weights and biases in the network;
[0271] 6) Iterative training: Repeat the forward propagation and backpropagation process on the training set until the predetermined number of iterations or error threshold is reached;
[0272] 7) Validation and parameter adjustment: Use the validation set to adjust hyperparameters such as the number of hidden layers and learning rate to optimize model performance;
[0273] V. The training and verification steps of the RBF neural network are as follows:
[0274] 1) Determine the network structure: The RBF network consists of an input layer, an RBF hidden layer, and an output layer;
[0275] 2) Set the radial basis function center: Select the center point of the RBF kernel, use the K-means algorithm to cluster the training data, and use each cluster center as the center of an RBF kernel;
[0276] 3) Determine the width of the RBF kernel: Set the width parameter based on the distance distribution, and use the average distance from the sample point to the center in the clustering result to determine it;
[0277] 4) Calculate the RBF hidden layer output: Calculate the distance between each input sample and the center of the RBF kernel, and then calculate the output of each RBF node through the RBF function. The RBF function is as follows:
[0278]
[0279] Where h i (x) is the output of the i-th RBF node, x is the input sample, c i is the center of the i-th RBF kernel, σ is the width parameter;
[0280] S4. Leakage current waveform matching using multiple machine learning models combined with a weighted voting mechanism:
[0281] Based on the five machine learning models that have been trained and tuned, a multi-model weighted voting mechanism is established. The optimal result selected based on the weighted voting is then used as the final waveform matching result to achieve waveform matching and type identification of leakage current. This specifically includes the following sub-steps:
[0282] S41. Using the test set as input, the five trained models are used to obtain matching results of each model for the leakage current waveform.
[0283] S42. Vote on the classification results of the five models, using weighted voting (weights are assigned based on the performance of the model on the validation set) as the voting mechanism to obtain the voting results;
[0284] S43. Based on the final result of the voting, output the type classification result of the leakage current to achieve accurate matching and type identification of the leakage current waveform;
[0285] In this embodiment, the implementation process of the weighted voting mechanism is as follows:
[0286] 1) During model training and validation, the performance of each model is evaluated based on the validation set results, and the accuracy of each model is calculated as the model score on the validation set;
[0287] 2) Model weight distribution:
[0288] The scores of each model are standardized for use in weighted voting, and the weight of each model is calculated as follows:
[0289]
[0290] Where, s i represents the score of the i-th model on the validation set, ω i is the weight of the i-th model, and the sum of all weights is 1;
[0291] 3) Use the test set to input the five trained models and obtain the matching results of each model on the leakage current waveform;
[0292] 4) Multiply the prediction result of each leakage current category (the prediction result here is the probability / %) that the model believes that the feature vector belongs to a certain leakage current type) by the weight of the model ω i , get the weighted score, and calculate the sum of the weighted scores of each model, as shown in the following formula:
[0293]
[0294] Where, P i,class is the prediction result of model i for a certain category;
[0295] 5) The category with the highest weighted score is taken as the final leakage current waveform matching result;
[0296] 6) Output the final weighted voting result to obtain the matching category of the leakage current waveform and achieve accurate type identification.
[0297] The embodiments of the present invention are presented for purposes of illustration and description and are not intended to be exhaustive or to limit the invention to the disclosed forms. Many modifications and variations will be apparent to those skilled in the art. The embodiments are chosen and described in order to better illustrate the principles of the invention and its practical application and to enable those skilled in the art to understand the invention and design various embodiments with various modifications as suited for specific applications.
Claims
1. A leakage current waveform matching method combining multi-machine learning with a weighted voting mechanism, characterized in that: The following steps are involved: S1. Preprocessing of current data: Firstly, wavelet transform is used for filtering and denoising, then Z-score is used for outlier processing of the denoised current signal, and finally min-max normalization is used; S2. Feature extraction of current data: Feature extraction is performed from three levels: time domain, frequency domain, and time-frequency domain. In the time domain, six feature quantities of the current signal, namely, mean, equation, kurtosis, skewness, root mean square, and peak-to-peak value, are extracted; in the frequency domain, three feature quantities, namely, signal main frequency, spectrum entropy, and frequency component energy ratio, are extracted; for time-frequency domain features, the signal short-time energy entropy and short-time Fourier entropy are extracted as time-frequency domain features to construct feature vectors; S3. Establishment and training of multiple machine learning models: According to the feature vectors obtained in step S1 and step S2, a data set is prepared, and the data set is divided into a training set, a validation set and a test set in a ratio of 8:1:
1. The same data set is input into five neural networks, namely, a support vector machine, a random forest algorithm, a K-nearest neighbor algorithm, a BP neural network and a RBF neural network, for training to obtain a trained model; S4. Leakage current waveform matching based on multiple machine learning models combined with weighted voting mechanism: Based on the five machine learning models that have been trained and adjusted, a multi-model weighted voting mechanism is established. Then the optimal result selected based on weighted voting is used as the final waveform matching result to achieve waveform matching and type identification of leakage current.
2. The leakage current waveform matching method of multi-machine learning combined with weighted voting mechanism according to claim 1 is characterized in that: In step S1, wavelet transform filtering and denoising includes the following three steps: 1)Wavelet decomposition For the signal x(t), the wavelet decomposition formula can be expressed as: Where: is the scale factor, used for the low-frequency approximate component; is the scale function of the low-frequency part; d j,k is the detail coefficient, used for high-frequency noise components; ψ j,k(t) is the wavelet function; 2) Threshold Processing Based on wavelet decomposition, denoising is performed by applying a soft threshold operation to the high-frequency components: of j,k =sign(d j,k )·max(|d j,k |-λ,0); Where: λ is the threshold, Where σ is the standard deviation of the noise, n is the sample size; d j,k With d' j,k They are the high frequency components before and after processing respectively; 3) Wavelet reconstruction Signal reconstruction using low-frequency components and processed high-frequency components: Where: x recon (t) is the signal after denoising.
3. The leakage current waveform matching method of multi-machine learning combined with weighted voting mechanism according to claim 1 is characterized in that: In step S1, Z-score outlier processing is performed on the basis of wavelet denoising, and the specific steps are as follows: 1) Calculate the signal mean and standard deviation For a signal segment X = {x1, x2, ..., x n }, calculate the mean μ and standard deviation σ: 2) Z-score calculation Z-score is used to measure the degree to which the data deviates from the mean. The formula is: If a data point |Z i |>A, A is the set threshold, then it is considered that x i is an outlier; 3) Outlier processing For an outlier point x i , replace it with the mean of the previous and next points:
4. The leakage current waveform matching method of multi-machine learning combined with weighted voting mechanism according to claim 1 is characterized in that: In step S1, after the outlier processing is completed, min-max normalization processing is performed to scale the data to the range of [0,1], and the formula is: Among them: X is the data to be normalized, X min With X max are the minimum and maximum values of the data.
5. The leakage current waveform matching method of multi-machine learning combined with weighted voting mechanism according to claim 1 is characterized in that: In step S2, six characteristic quantities of the current signal, namely, mean value, equation, kurtosis, skewness, root mean square, and peak-to-peak value, are extracted in the time domain. The method for obtaining each characteristic quantity is as follows: 1) Mean: reflects the central trend of the current signal and is used to determine the offset of the signal; Where: x i is the i-th sampling point of the current signal, and n is the number of sampling points; 2) Variance: describes the discreteness of the data and is used to analyze the fluctuation range of the current signal; 3) Kurtosis: describes the sharpness of the signal. A high kurtosis means that the signal has more peaks. 4) Skewness: used to measure the symmetry of the signal, positive skewness indicates right skewness, negative skewness indicates left skewness; 5) Root mean square: reflects the energy of the signal and indicates the "effective value" of the signal; 6) Peak-to-peak value: used to measure the maximum fluctuation amplitude of the current signal, indicating the difference between the maximum value and the minimum value; Peak-to-Peak=max(x i )-min(x i )。 6. The leakage current waveform matching method of multi-machine learning combined with weighted voting mechanism according to claim 1 is characterized in that: In step S2, in the frequency domain, frequency domain features are extracted by Fourier transform, which can reveal the characteristics of the signal in frequency, and extract three characteristic quantities of signal main frequency, spectrum entropy, and frequency component energy ratio. The method for obtaining each characteristic quantity is as follows: 1) Dominant frequency: The frequency component with the largest amplitude in the spectrum, which can reflect the dominant frequency of the signal; the calculation process is as follows: Perform Fourier transform on the current signal x(t) to convert the time domain signal into a frequency domain signal; In the formula, X(f) represents the complex spectrum value at frequency f, N is the number of signal sampling points, and x n is the sampling point of the nth time domain; Then the spectrum amplitude is calculated to calculate the amplitude of each frequency component |X(f)|: Where Re(X(f)) and Im(X(f)) represent the real and imaginary parts of the spectrum, respectively; Finally, find the maximum frequency component: find the frequency corresponding to the maximum value in the spectrum amplitude |X(f)|, which is the main frequency, as shown in the following formula: f dominant =argmax|X(f)|; 2) Spectral entropy: It measures the complexity of frequency distribution. The higher the entropy value, the more complex the frequency components. It is calculated by normalizing the spectrum energy distribution. The calculation process is as follows: Spectrum energy calculation: Perform Fourier transform on the signal to obtain the spectrum X(f), and calculate the energy of each frequency component |X(f k )| 2 ; |X(f k )| 2 =Re(X(f k )) 2 +Im(X(f k )) 2 ; In the formula, X(f k ) is the frequency f k The spectrum value of Normalize the energy of each frequency component to obtain the probability distribution of each frequency component: Where P k is the frequency component f k The normalized energy of Calculate the spectral entropy value using the normalized spectral energy distribution: Where K is the total number of frequency components, SE is the spectral entropy value; 3) Frequency component energy ratio: It indicates the ratio of energy within a specific frequency range to total energy, and is used to reflect the main frequency characteristics of the signal. The calculation method is as follows: Set the frequency range [f1,f2] and calculate the sum of the frequency component energies in this frequency range: Calculate the total spectral energy of a signal: Where: f max is the highest frequency of the spectrum; Divide the energy in the frequency band by the total energy to get the frequency component energy ratio ER:
7. The leakage current waveform matching method of multi-machine learning combined with weighted voting mechanism according to claim 1 is characterized in that: In step S2, for the time-frequency domain features, the signal short-time energy entropy and short-time Fourier entropy are extracted as the time-frequency domain features, and the calculation method is as follows: 1) Short-time energy entropy: used to describe the complexity of the energy distribution of a signal within a short time window, and can reveal the time-varying characteristics of the signal; The signal is divided into several overlapping or non-overlapping short time windows. For each time window t, the signal energy E in the window is calculated. t ; The energy E of each window t Normalize to get the ratio of each window energy to the total energy P t ; The short-time energy entropy (STEE) is calculated using the normalized energy distribution, reflecting the complexity of the energy distribution. 2) Short-time Fourier entropy, which is used to describe the complexity of the signal frequency distribution and its changes over time; On the basis of obtaining the spectrum entropy SE, the spectrum entropies of all time windows are averaged to obtain the short-time Fourier entropy STFTE of the entire signal, which reflects the time-frequency complexity of the entire signal; As shown below: Where SE(t) is the spectral entropy in time window t.
8. The leakage current waveform matching method of multi-machine learning combined with weighted voting mechanism according to claim 1 is characterized in that: In step S3, the training process of the five neural networks is as follows: Ⅰ. The training and verification steps of support vector machine are as follows: 1) Select kernel function: Select the kernel function based on the linear separability of the data; 2) Hyperparameter setting: determine the penalty parameter C and kernel function parameter γ; The penalty parameter C controls the tolerance of classification errors. The larger the C value, the more the model pursues smaller classification errors. The kernel parameter γ determines the influence range of the RBF kernel. A larger value indicates a smaller influence range. 3) Model training: Use the training set data to fit the model and minimize the classification error by optimizing the hyperplane that maximizes the margin; 4) Verification and parameter adjustment: Use the validation set to test different hyperparameter combinations and select the hyperparameters that optimize the validation set accuracy. Ⅱ. The training and verification steps of the random forest algorithm are as follows: 1) Set hyperparameters: determine the number of decision trees, maximum depth, and minimum number of split samples; 2) Generate subsamples: randomly extract samples from the training set with replacement to create different training subsets for each decision tree; 3) Train each decision tree: train a decision tree for each sub-sample, and use "information gain" as the indicator in the splitting process; 4) Validation and parameter adjustment: Use the validation set to test different parameter combinations and adjust hyperparameters to improve validation set performance; III. The training and verification steps of the K-nearest neighbor algorithm are as follows: 1) Select the number of neighbors K: determine the most appropriate value of the number of neighbors K; 2) Select distance metric: Select Manhattan distance as the distance metric; 3) Classification: For each sample to be classified, calculate the distance between it and all training samples, and classify it according to the categories of the nearest K neighbors; 4) Validation and parameter adjustment: Use the validation set to test different K values and select the optimal K value for the final model; IV. The training and verification steps of BP neural network are as follows: 1) Set up the network structure: determine the number of neurons in the input layer, hidden layer, and output layer; 2) Initialize weights and biases: Randomly initialize the weights and biases of the network and start training with small values; 3) Forward propagation: input the training data into the network and calculate the output of each neuron layer by layer until the prediction result of the output layer is obtained; 4) Calculate the loss function: The error between the model prediction result and the true label is calculated through the loss function; 5) Back propagation: Calculate the gradient of the loss function, pass the gradient from the output layer back to the input layer through the chain rule, and adjust the weights and biases in the network; 6) Iterative training: Repeat the forward propagation and back propagation process on the training set until the predetermined number of iterations or error threshold is reached; 7) Validation and parameter adjustment: Use validation sets to adjust hyperparameters and optimize model performance; V. The training and verification steps of RBF neural network are as follows: 1) Determine the network structure: The RBF network consists of an input layer, an RBF hidden layer, and an output layer; 2) Set the radial basis function center: select the center point of the RBF kernel, use the K-means algorithm to cluster the training data, and use each cluster center as the center of an RBF kernel; 3) Determine the width of the RBF kernel: Set the width parameter according to the distance distribution, and use the average distance from the sample point to the center in the clustering result to determine; 4) Calculate the RBF hidden layer output: Calculate the distance between each input sample and the center of the RBF core, and then calculate the output of each RBF node through the RBF function. The RBF function is as follows: In the formula, h i (x) is the output of the i-th RBF node, x is the input sample, c i is the center of the i-th RBF kernel, and σ is the width parameter.
9. The leakage current waveform matching method of multi-machine learning combined with weighted voting mechanism according to claim 1 is characterized in that: The step S4 specifically includes the following sub-steps: S41, using the test set to input the five trained models, and obtaining the matching result of each model to the leakage current waveform; S42, voting on the classification results of the five models, using weighted voting as a voting mechanism, and obtaining the voting results; S43. Based on the final result of the voting, the type classification result of the leakage current is output to achieve accurate matching and type identification of the leakage current waveform.
10. The leakage current waveform matching method of multi-machine learning combined with weighted voting mechanism according to claim 9 is characterized in that: The implementation process of the weighted voting mechanism is as follows: 1) During model training and verification, the performance of each model is evaluated based on the results of the verification set, and the accuracy of each model is calculated as the score of the model on the verification set; 2) Model weight allocation: The score of each model is standardized for use in weighted voting, and the weight of each model is calculated as shown below: In the formula, s i represents the score of the i-th model on the validation set, ω i is the weight of the i-th model, and the sum of all weights is 1; 3) Use the test set to input the five trained models and obtain the matching results of each model for the leakage current waveform; 4) Multiply the prediction result of each leakage current category (here the prediction result is the probability / %) that the model believes that the feature vector belongs to a certain leakage current type by the weight ω of the model i , get the weighted score, and calculate the sum of the weighted scores of each model, as shown in the following formula: Where P i,class is the prediction result of model i for a certain category; 5) The category with the highest weighted score is taken as the final leakage current waveform matching result; 6) Output the final weighted voting result to obtain the matching category of the leakage current waveform and achieve accurate type identification.
Citation Information
Cited By
Leakage current intelligent diagnosis method based on multi-point cooperative acquisition and data fusion
CN121763164A
Electric leakage monitoring method and system and intelligent electric leakage protection circuit breaker
CN121906343A
Signal feature and multi-model fusion-based plaintext and confidential identification method
CN122174182A