Circuit breaker fault diagnosis method, model training method, medium and device
By optimizing the algorithm to train and improve the LightGBM model, and combining the cross-entropy loss function and gradient reconciliation mechanism function, the problem of fault diagnosis accuracy of multi-source heterogeneous data of circuit breakers is solved, the model's ability to learn complex samples is improved, and higher diagnostic accuracy is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2026-03-27
AI Technical Summary
The existing LightGBM model cannot effectively guarantee the accuracy of fault diagnosis results when processing multi-source heterogeneous data of circuit breakers, mainly due to the uneven data quality and the influence of factors such as noise and data loss.
The LightGBM model is improved by training an optimized algorithm. An improved objective function combining the cross-entropy loss function and the gradient reconciliation mechanism is used to extract and fuse features from multi-source heterogeneous data. Hyperparameter combinations are randomly initialized, and the optimal hyperparameter combination is determined through iterative optimization to enhance the model's learning ability for complex samples.
It improves the accuracy of circuit breaker fault diagnosis, enhances the model's ability to learn from complex and difficult-to-distinguish samples, and addresses the shortcomings of existing models in terms of accuracy.
Smart Images

Figure CN119337309B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of fault diagnosis, in particular to a circuit breaker fault diagnosis method, a model training method, a medium and equipment. BACKGROUND
[0002] In the prior art, the LightGBM model can be applied to circuit breaker fault diagnosis because it can process high-dimensional data and has high computing performance. However, as the complexity of the circuit breaker system continues to increase, the system generates more and more types of multi-source heterogeneous data, such as sensor data of voltage, current, temperature, and communication data of different protocols and formats. These multi-source heterogeneous data are often affected by noise, data loss, and time asynchronization during acquisition and processing, resulting in uneven data quality. This results in the existing LightGBM model not being able to effectively guarantee the accuracy of the fault diagnosis result when processing the multi-source heterogeneous data of the circuit breaker. SUMMARY
[0003] Therefore, it is necessary to provide a circuit breaker fault diagnosis method, a model training method, a medium and equipment to solve the problem that the accuracy of the fault diagnosis result of the existing LightGBM model cannot be effectively guaranteed when processing the multi-source heterogeneous data of the circuit breaker.
[0004] A method for training an improved LightGBM model based on an optimization algorithm, the method comprising:
[0005] Obtaining I sets of sample multi-source heterogeneous data of a circuit breaker; wherein I>1, each set of sample multi-source heterogeneous data includes sample data sampled by multiple data sources, and each set of sample multi-source heterogeneous data carries a corresponding fault label;
[0006] In each set of sample multi-source heterogeneous data, sample features of each sample data are extracted, and the extracted multiple sample features are fused to obtain I sample fusion features corresponding to each set of sample multi-source heterogeneous data;
[0007] Randomly initializing N combinations of current hyperparameters of the improved LightGBM model;
[0008] input each sample fusion feature in turn and obtain a predicted failure output by the improved LightGBM model set as different hyperparameter combinations, input the predicted failure and a corresponding failure label into a preset improved objective function to calculate fitness, so as to obtain fitness corresponding to the current N hyperparameter combinations; wherein, a loss function in the improved objective function comprises a cross-entropy loss function and a gradient harmonic mechanism function, the cross-entropy loss function is used to measure the difference between the predicted failure and the corresponding failure label, the difficulty of distinguishing the failure of the sample fusion feature corresponding to the sample multi-source heterogeneous data in the gradient harmonic mechanism function is positively correlated with the weight of the sample fusion feature, and the calculation proportion of the gradient harmonic mechanism function compared with the cross-entropy loss function increases with the increase of the current iteration number;
[0009] determine the optimal hyperparameter combination in the current N hyperparameter combinations according to the size of the fitness, and update the current N hyperparameter combinations using an optimization algorithm according to the optimal hyperparameter combination;
[0010] If the current iteration number is less than the preset iteration number threshold, then the current iteration number + 1, and return to execute the step of inputting each sample fusion feature in turn and obtaining a predicted failure output by the improved LightGBM model set as different hyperparameter combinations and the subsequent steps, until the current iteration number is equal to the preset iteration number threshold, the improved LightGBM model is set based on the optimal hyperparameter combination in the current N hyperparameter combinations, to obtain a target LightGBM model.
[0011] In one embodiment, the improved LightGBM model is randomly initialized as the current nth hyperparameter combination, denoted as:
[0012] X n = BK lb + rand(BK ub -BK lb )
[0013] In the above formula, X n is the nth hyperparameter combination, n is an integer between 1 and N; BK ub is the lower bound of the nth hyperparameter combination in the jth dimension; BK lb is the upper bound of the nth hyperparameter combination in the jth dimension; rand is a value randomly selected between 0 and 1.
[0014] In one embodiment, the predicted failure and the corresponding failure label are input into the preset improved objective function to calculate the fitness, denoted as:
[0015]
[0016]
[0017] L GHM = L CE β i
[0018] In the above formula, is the fitness of the ith sample fusion feature; f t (x i ) represents the tth tree model; F is the loss value of the loss function; g i is the first-order derivative of the loss function; h i is the second-order derivative of the loss function; ∑ k Ω(f k ) represents a regularization term; is the proportionality coefficient at the tth iteration, when t = 1, is a preset value; L CE is the loss value of the cross-entropy loss function; L GHM is the loss value of the gradient harmonization mechanism function; is the fitness of the optimal hyperparameter combination at the (t-1)th iteration; y i is the fault label of the ith sample fusion feature; is the predicted fault of the ith sample fusion feature; β i is the weight set for the ith sample fusion feature, the greater the difficulty of fault differentiation of the sample multi-source heterogeneous data corresponding to the ith sample fusion feature, the greater the β i is set.
[0019] In one of the embodiments, the method further comprises:
[0020] calculating the minimum distance between the sample multi-source heterogeneous data corresponding to the ith sample fusion feature and the remaining sample multi-source heterogeneous data, and setting the size of β i based on the minimum distance; wherein the minimum distance is negatively correlated with the size of β i .
[0021] In one of the embodiments, the method further comprises:
[0022] calculating the noise proportion in the sample multi-source heterogeneous data corresponding to the ith sample fusion feature, and setting the size of β i based on the noise proportion; wherein the noise proportion is positively correlated with the size of β i .
[0023] In one of the embodiments, the updating of the current N hyperparameter combinations using the optimization algorithm according to the optimal hyperparameter combination comprises:
[0024] According to the size between the random number r and the constant p, denoted as:
[0025]
[0026]
[0027] In the above formula, is the size of the n-th hyperparameter combination in the j-th dimension at the t+1-th iteration; is the size of the n-th hyperparameter combination in the j-th dimension at the t-th iteration; p is a preset constant; r is a random number between 0 and 1; t is the current iteration number; T is a preset iteration number threshold;
[0028] According to the fitness between different hyperparameter combinations, denoted as:
[0029]
[0030] is the size of the optimal hyperparameter combination in the j-th dimension at the t-th iteration so far; denotes the fitness of the n-th hyperparameter combination in the j-th dimension at the t-th iteration; denotes the fitness of the hyperparameter combination in the j-th dimension when the random size is set at the t-th iteration; c(0,1) represents Cauchy variation;
[0031] Compare the size between and If , replace with If , keep Among them, denotes the fitness of the improved LightGBM model when it is set as , and denotes the fitness of the improved LightGBM model when it is set as .
[0032] In one of the embodiments, the extracted multiple sample features are fused by:
[0033] Different weights are given to the extracted multiple sample features, and weighted average is performed to obtain corresponding sample fusion features; or,
[0034] The extracted multiple sample features are spliced by column to obtain corresponding sample fusion features; or,
[0035] The extracted multiple sample features are cross-combined to obtain corresponding sample fusion features.
[0036] A circuit breaker fault diagnosis method, the method comprises:
[0037] Obtaining real-time multi-source heterogeneous data of a circuit breaker;
[0038] Extracting real-time features of each real-time data in the real-time multi-source heterogeneous data, and performing feature fusion on the extracted real-time features to obtain corresponding real-time fusion features;
[0039] Inputting the real-time fusion features into a target LightGBM model, and obtaining a predicted fault output; wherein the target LightGBM model is trained by the method for training and improving a LightGBM model based on an optimization algorithm.
[0040] A computer-readable storage medium storing a computer program, the computer program being executed by a processor to cause the processor to perform the steps of the above method for training and improving a LightGBM model based on an optimization algorithm and the circuit breaker fault diagnosis method.
[0041] A terminal device comprising a memory and a processor, the memory storing a computer program, the computer program being executed by the processor to cause the processor to perform the steps of the above method for training and improving a LightGBM model based on an optimization algorithm and the circuit breaker fault diagnosis method.
[0042] The present application provides a circuit breaker fault diagnosis method, a model training method, a medium and a device, by obtaining multiple groups of multi-source heterogeneous data of a circuit breaker, and performing feature extraction and fusion on each group of data to form sample fusion features. The model inputs these sample fusion features in turn under the initial setting of multiple hyperparameter combinations, and calculates the fitness by using an improved objective function to evaluate the effect of each combination. The loss function of the improved objective function combines the cross-entropy loss function and the gradient harmonic mechanism function, wherein the gradient harmonic mechanism function adjusts the weight according to the difficulty of distinguishing the fault of the sample in the calculation process, so that the learning of difficult samples is more concentrated. In addition, with the increase of the number of iterations, the influence of the gradient harmonic mechanism function gradually increases, further improving the learning ability of the model for complex samples. Then, the current optimal hyperparameter combination is determined by continuously iterating through the optimization algorithm until a preset number of times are reached, thereby setting an optimized target LightGBM model. This method enhances the learning ability of the model for complex and difficult-to-distinguish samples through the improved objective function, and solves the deficiency of the existing model in accuracy. BRIEF DESCRIPTION OF DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only constitute some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.
[0044] Wherein:
[0045] Figure 1 A flowchart of a method for training an improved LightGBM model based on an optimization algorithm in an embodiment;
[0046] Figure 2 A flowchart of a circuit breaker fault diagnosis method in an embodiment;
[0047] Figure 3 A structural block diagram of a terminal device. DETAILED DESCRIPTION
[0048] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments only constitute some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0049] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed or can optionally include other steps or units inherent to the process, method, product or device.
[0050] In this document, the term "embodiment" means that a specific feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily all refer to the same embodiment, nor is it necessarily mutually exclusive of other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0051] As Figure 1 shown, Figure 1For a flowchart of the method of training an improved LightGBM model based on an optimization algorithm in an embodiment, the steps provided by the method of training an improved LightGBM model based on an optimization algorithm in the embodiment include:
[0052] S101, obtaining I groups of sample multi-source heterogeneous data of a circuit breaker.
[0053] Wherein, I>1, each group of sample multi-source heterogeneous data includes sample data sampled by multiple data sources, for example, the multiple data sources can be current sensors, voltage sensors, temperature sensors, and vibration sensors, etc., and the sample data sampled can include current, voltage, temperature, fault information, and vibration parameters, etc. Each group of sample multi-source heterogeneous data carries a corresponding fault label, for example, overload, fuse, high-temperature circuit breaking, short circuit, contact wear, and poor contact, etc.
[0054] For example, on a certain circuit breaker, a current sensor, a voltage sensor, a temperature sensor, and a vibration sensor are installed at the same time, and we sample data every other sampling period (for example, set to 10 minutes) to obtain a group of sample multi-source heterogeneous data, including recording the current value of the circuit breaker through the current sensor, recording the voltage value across the circuit breaker through the voltage sensor, recording the temperature around the circuit breaker through the temperature sensor, and recording the vibration amplitude of the circuit breaker through the vibration sensor. Thus, a total of I cycles are executed to obtain I groups of sample multi-source heterogeneous data.
[0055] Further, each group of collected data can be preprocessed, including data cleaning, missing value processing, and data smoothing, to ensure the quality and consistency of the data.
[0056] S102, in each group of sample multi-source heterogeneous data, sample features of each sample data are extracted respectively, and the extracted multiple sample features are fused to obtain I sample fusion features corresponding thereto.
[0057] Wherein, the sample feature refers to a specific index or attribute extracted from each group of sample multi-source heterogeneous data, used to describe the nature and change of the data. Feature fusion refers to the process of integrating sample features from different data sources.
[0058] For example, the average current value and the peak current value are extracted from the data of the current sensor; the highest temperature and the temperature change rate are extracted from the data of the temperature sensor; and the vibration frequency and the vibration amplitude are extracted from the data of the vibration sensor, etc. Then, a simple splicing method can be used to combine each feature into a feature vector, or a weighted fusion method can be used to assign different weights to different features and then combine them.
[0059] S103, randomly initialize the current N combinations of hyperparameters of the improved LightGBM model.
[0060] wherein each combination of hyperparameters refers to a set of parameters that need to be adjusted by the improved LightGBM during training, including the maximum depth of the decision tree max_depth, the learning rate learning_rate, the number of leaf nodes num_leaves, etc. In each combination, the value of each hyperparameter is randomly selected within a pre-set range. For example, if N is set to 50, 50 different combinations of hyperparameters are generated, each of which contains randomly selected num_leaves, max_depth, learning_rate, etc.
[0061] In one specific embodiment, the current n-th combination of hyperparameters of the improved LightGBM model is randomly initialized, denoted as:
[0062] X n = BK lb + rand(BK ub - BK lb )
[0063] In the above formula, X n is the n-th combination of hyperparameters, n is an integer between 1 and N; BK ub is the lower bound of the n-th combination of hyperparameters in the j-th dimension; BK lb is the upper bound of the n-th combination of hyperparameters in the j-th dimension; rand is a randomly selected value between 0 and 1.
[0064] For example, assume that an improved LightGBM model has three hyperparameters: learning rate, tree depth, and minimum sample size of leaf nodes. Their upper and lower bounds can be set as follows:
[0065] Learning rate: lower bound 0.01, upper bound 0.1;
[0066] Tree depth: lower bound 3, upper bound 10;
[0067] Minimum sample size of leaf nodes: lower bound 20, upper bound 100.
[0068] Through the random initialization of the above specific embodiments, the model can be allowed to explore the entire hyperparameter space, thereby avoiding falling into a local optimal solution.
[0069] S104, under the premise of setting the improved LightGBM model to different combinations of hyperparameters, input each sample fusion feature in turn and obtain the predicted failure output, input the predicted failure and the corresponding failure label into the pre-set improved objective function to calculate the fitness, so as to obtain the fitness corresponding to the current N combinations of hyperparameters.
[0070] wherein the improved LightGBM model in the embodiment is represented as:
[0071]
[0072] In the above formula, represents the predicted failure; f k (x i ) represents the kth decision tree; x i represents the i th sample fusion feature of the circuit breaker; F represents the tree model; and K represents the total number of decision trees.
[0073] Thus, the objective function can be constructed as:
[0074]
[0075] In the above formula, φ(y i ,F t-1 (x i )+f t (x i )) represents the loss function; y i represents the failure label of the i th sample fusion feature; F t-1 (x i ) represents the first t-1 tree models; f t (x i ) represents the t th tree model; Ω(f k ) represents the regularization term; ω represents the leaf weight of each tree; γ and λ are hyperparameters; and T represents the number of leaf nodes in the tree model.
[0076] To minimize the objective function, the LightGBM model uses the Newton method to seek an improved objective function to approximate the objective function, and the improved objective function is represented as:
[0077]
[0078] In the above formula, is the fitness, which is used to measure the performance of a certain current hyperparameter combination in the improved LightGBM, and in the embodiment, the smaller the fitness, the more suitable the combination for the current task; g i is the first-order derivative of the loss function F; h i is the second-order derivative of the loss function F;
[0079] Compared with the prior art, the loss function F in the embodiment includes a cross-entropy loss function and a gradient harmonic mechanism function.
[0080] The cross-entropy loss function is used to measure the difference between the predicted failure and the corresponding failure label, and the smaller the difference, the more accurate the prediction.
[0081] The difficulty of fault differentiation of the sample multi-source heterogeneous data corresponding to the sample fusion feature in the gradient adjustment mechanism function is positively correlated with the weight of the sample fusion feature. Thus, the improved LightGBM can better learn these complex samples and improve the recognition accuracy of complex samples to a certain extent. Meanwhile, the calculation proportion of the gradient adjustment mechanism function compared with the cross-entropy loss function increases with the increase of the current iteration number, that is, with the increase of the number of training iterations, the role of the gradient adjustment mechanism function gradually increases, so that the improved LightGBM further pays attention to the samples that are difficult to distinguish, thereby further improving the learning ability of complex data.
[0082] S105, determining the optimal hyperparameter combination in the current N hyperparameter combinations according to the size of the fitness, and updating the current N hyperparameter combinations using an optimization algorithm according to the optimal hyperparameter combination.
[0083] In this embodiment, we can take the hyperparameter combination with the minimum fitness as the optimal hyperparameter combination. Then we use optimization algorithms such as particle swarm optimization (PSO), genetic algorithm (GA), etc. to adjust the current N hyperparameter combinations. The optimization algorithm is based on the optimal hyperparameter combination to explore better parameter configurations
[0084] S106, determining whether the current iteration number is less than the preset iteration number threshold. If the current iteration number is less than the preset iteration number threshold, S107 is executed to increase the current iteration number by 1 and return to execute S104 and the subsequent steps. If the current iteration number is equal to the preset iteration number threshold, S108 is executed to set the improved LightGBM model based on the optimal hyperparameter combination in the current N hyperparameter combinations to obtain the target LightGBM model.
[0085] For example, it is assumed that the iteration number threshold is set to 20 times. The current iteration number is 19 times, and the steps in the optimization process are as follows: because the current iteration number (19 times) is less than the iteration number threshold (20 times). Therefore, S107 is executed to increase the current iteration number to 20 times, and step S104 is returned to train the model using the new hyperparameter combination, calculate the fitness, and update the hyperparameter combination. Then, because the current iteration number (20 times) is equal to the iteration number threshold (20 times), the improved LightGBM model is set based on the optimal hyperparameter combination in the N hyperparameter combinations obtained in the 20th iteration to obtain the target LightGBM model.
[0086] The method for training the improved LightGBM model based on the optimization algorithm can obtain multiple groups of multi-source heterogeneous data of the circuit breaker, and perform feature extraction and fusion on each group of data to form sample fusion features. The model is sequentially input with the sample fusion features under a plurality of initial set hyperparameter combinations, and an improved objective function is used to calculate the fitness to evaluate the effect of each combination. The loss function of the improved objective function combines a cross-entropy loss function and a gradient harmonic mechanism function. In the calculation process, the gradient harmonic mechanism function adjusts the weight according to the difficulty of distinguishing the fault of the sample, so that the learning of the difficult sample is more concentrated. In addition, with the increase of the number of iterations, the influence of the gradient harmonic mechanism function gradually increases, further improving the learning ability of the model to complex samples. Then, the current optimal hyperparameter combination is determined through continuous iteration by the optimization algorithm until a preset number of times are reached, so as to set the optimized target LightGBM model. Through the improved objective function, the learning ability of the model to complex and difficult-to-distinguish samples is enhanced, and the deficiency of the existing model in accuracy is solved.
[0087] In one embodiment, the feature fusion of the extracted plurality of sample features in S102 specifically includes any one of the following steps A1, A2 and A3. Wherein,
[0088] A1, different weights are assigned to the extracted plurality of sample features, and weighted average is performed to obtain corresponding sample fusion features.
[0089] Optionally, first, according to the importance of the features, a weight is set for each sample feature. For example, for the current, voltage and temperature features of a circuit breaker, it is believed that the current is more important for fault diagnosis, so a higher weight is given, while the temperature is relatively less important, so a lower weight is given. Then, weighted average is performed on all features to obtain corresponding sample fusion features.
[0090] A2, the extracted plurality of sample features are spliced by column to obtain corresponding sample fusion features.
[0091] In this way, cross combination can explore the nonlinear relationship between features, thereby improving the prediction ability of the model.
[0092] A3, the extracted plurality of sample features are cross combined to obtain corresponding sample fusion features.
[0093] Through the feature fusion of the embodiment, the influence of a single feature on the model can be alleviated, and the adaptability of the model to different fault modes can be improved.
[0094] In one embodiment, the predicted fault and the corresponding fault label are input into the preset improved objective function to calculate the fitness in S104, which is represented as:
[0095]
[0096] L GHM = L CE β i
[0097] In the above formula, is the fitness of the i-th sample fusion feature; f t (x i ) represents the t-th tree model; F is the loss value of the loss function; g i is the first-order derivative of the loss function; h i is the second-order derivative of the loss function; ∑ k Ω(f k ) represents a regularization term; is the proportionality coefficient at the t-th iteration, when t = 1, is a preset value; L CE is the loss value of the cross-entropy loss function; L GHM is the loss value of the gradient harmonic mechanism function; is the fitness of the optimal hyperparameter combination at the t-1-th iteration; y i is the fault label of the i-th sample fusion feature; is the predicted fault of the i-th sample fusion feature; β i is the weight set for the i-th sample fusion feature, the greater the difficulty of fault differentiation of the sample multi-source heterogeneous data corresponding to the i-th sample fusion feature, the greater the β i is set.
[0098] It can be understood that in the above specific embodiments, the greater the difficulty of fault differentiation of the sample multi-source heterogeneous data, the greater the β i is set, so that the improved LightGBM can better learn these complex samples, to a certain extent, to improve the recognition accuracy of complex samples. At the same time, because is continuously reduced in the iteration process, therefore is continuously increased accordingly, which makes the calculation proportion of the gradient harmonic mechanism function compared to the cross-entropy loss function increase with the increase of the current iteration number, so that the role of the gradient harmonic mechanism function gradually increases, so that the improved LightGBM further pays attention to those difficult-to-differentiate samples, thereby further improving the learning ability of complex data.
[0099] In one specific embodiment, the size of β i may also be set by the following specific steps: calculating the minimum distance between the sample multi-source heterogeneous data corresponding to the i-th sample fusion feature and the remaining sample multi-source heterogeneous data, and setting the size of β i based on the minimum distance.
[0100] The method for calculating the distance between data points can be chosen based on the differences in different features. For example, Euclidean distance, Manhattan distance, or other distance metrics suitable for the data type can be selected. For the multi-source heterogeneous data corresponding to the fusion feature of the i-th sample, we can obtain a total of I-1 distances. Sorting these I-1 distances will yield the minimum distance. Furthermore, in this specific embodiment, the minimum distance is set to be related to β. i The magnitudes of β and β are negatively correlated, therefore β can be achieved using the following formula. i Setting:
[0101]
[0102] In the above formula, mind i η represents the minimum distance between the multi-source heterogeneous data of the sample corresponding to the fusion feature of the i-th sample. η is a small preset positive number to prevent the distance from being zero.
[0103] In another specific embodiment, β can also be set through the following specific steps. i Size: Calculate the noise ratio in the multi-source heterogeneous data corresponding to the fused feature of the i-th sample, and set β based on the noise ratio. i Size.
[0104] The noise proportion can be determined by analyzing outliers and fluctuations in the data, or by using noise detection algorithms. Specific methods include: Signal-to-Noise Ratio (SNR) analysis: For signal-type data, the noise proportion can be determined by calculating the ratio of signal to noise. Statistical analysis: Statistical characteristics (such as variance and skewness) are used to assess the degree of data fluctuation, thereby estimating the noise proportion. Furthermore, in this specific embodiment, the noise proportion is set relative to β. i The magnitudes of β and β are positively correlated, therefore β can then be realized using the following formula. i Setting:
[0105] β i =α×n i
[0106] In the above formula, n i This represents the noise percentage of the i-th sample, and α is a coefficient used to adjust the weight.
[0107] In a specific embodiment, step S105, which updates the current N hyperparameter combinations using an optimization algorithm based on the optimal hyperparameter combination, specifically includes the following steps:
[0108] B1. Calculated based on the relationship between the random number r and the constant p, expressed as:
[0109]
[0110] In the above formula, Let be the size of the nth hyperparameter combination in the jth dimension at the (t+1)th iteration; is the size of the nth hyperparameter combination in the jth dimension at the tth iteration; p is a preset constant; r is a random number between 0 and 1; t is the current iteration number; T is the preset iteration number threshold.
[0111] B2. The fitness of different hyperparameter combinations is calculated and expressed as follows:
[0112]
[0113] Let be the size of the optimal hyperparameter combination in the j-th dimension so far in the t-th iteration; This represents the fitness of the nth hyperparameter combination in the jth dimension during the tth iteration; c represents the fitness of the hyperparameter combination in the t-th iteration when the j-th dimension is set to a random size; c(0,1) represents Cauchy mutation.
[0114] B3. Comparison and The size of the space, if Then use replace like Then retain
[0115] in, This indicates that the improved LightGBM model is set as follows: Adaptability at that time This indicates that the improved LightGBM model is set as follows: The fitness at time t+1. That is, only in the (t+1)th iteration... Parameters are updated only when the fitness of the parameter combination is less than that of the optimal parameter combination in the t-th iteration; otherwise, they remain unchanged.
[0116] In one embodiment, such as Figure 2 As shown, the present invention also proposes a circuit breaker fault diagnosis method. In this embodiment, the steps provided by the circuit breaker fault diagnosis method include:
[0117] S201, acquire real-time multi-source heterogeneous data of the circuit breaker.
[0118] S202, extract the real-time features of each real-time data in the real-time multi-source heterogeneous data, and fuse the extracted real-time features to obtain the corresponding real-time fused features.
[0119] In one specific embodiment, the above steps S201-S202 are basically the same as steps S101-S102 in the method of training and improving the LightGBM model based on optimization algorithm. The only difference is that real-time data is obtained from different data sources here, and these real-time data do not need to be labeled with fault tags.
[0120] S203 inputs real-time fused features into the target LightGBM model and obtains the output predicted fault.
[0121] The target LightGBM model was trained using the aforementioned method of improving the LightGBM model through optimization algorithms. The model calculates based on input features and outputs a predicted fault. This result can be used for real-time monitoring and early warning, helping operators to promptly identify and address potential circuit breaker problems.
[0122] Figure 3 An internal structural diagram of a terminal device in one embodiment is shown. Figure 3 As shown, the terminal device includes a processor, a memory, and a network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, this computer program enables the processor to implement the aforementioned method for training an improved LightGBM model based on an optimization algorithm and the circuit breaker fault diagnosis method. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to execute the aforementioned method for training an improved LightGBM model based on an optimization algorithm and the circuit breaker fault diagnosis method. Those skilled in the art will understand that… Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the solution of this application and does not constitute a limitation on the terminal device to which the solution of this application is applied. A specific terminal device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0123] A computer readable storage medium stores a computer program, which, when executed by a processor, implements the following steps: obtaining I groups of sample multi-source heterogeneous data of a circuit breaker; wherein I>1, each group of sample multi-source heterogeneous data includes sample data sampled by multiple data sources, and each group of sample multi-source heterogeneous data carries a corresponding fault label; in each group of sample multi-source heterogeneous data, sample features of each sample data are extracted respectively, and the extracted multiple sample features are fused to obtain corresponding I sample fusion features; randomly initializing N current hyperparameter combinations of an improved LightGBM model; on the premise of setting the improved LightGBM model to different hyperparameter combinations, each sample fusion feature is input in turn and a predicted fault output is obtained, the predicted fault and the corresponding fault label are input into a preset improved objective function to calculate fitness, so as to obtain the fitness corresponding to the N current hyperparameter combinations; wherein the loss function in the improved objective function includes a cross-entropy loss function and a gradient harmonic mechanism function, the cross-entropy loss function is used to measure the difference between the predicted fault and the corresponding fault label, the difficulty of distinguishing the sample multi-source heterogeneous data corresponding to the sample fusion feature in the gradient harmonic mechanism function is positively correlated with the weight of the sample fusion feature, and the calculation proportion of the gradient harmonic mechanism function compared with the cross-entropy loss function increases with the increase of the current iteration number; determining the optimal hyperparameter combination in the N current hyperparameter combinations according to the size of the fitness, updating the N current hyperparameter combinations using an optimization algorithm according to the optimal hyperparameter combination; if the current iteration number is less than a preset iteration number threshold, the current iteration number is incremented by 1, and the step of inputting each sample fusion feature into the improved LightGBM model under the premise of setting the improved LightGBM model to different hyperparameter combinations and the subsequent steps are executed again until the current iteration number is equal to the preset iteration number threshold, the improved LightGBM model is set based on the optimal hyperparameter combination in the N current hyperparameter combinations to obtain a target LightGBM model.
[0124] and the following steps are implemented: obtaining real-time multi-source heterogeneous data of a circuit breaker; extracting real-time features of each real-time data in the real-time multi-source heterogeneous data, and fusing the extracted multiple real-time features to obtain corresponding real-time fusion features; inputting the real-time fusion features into the target LightGBM model and obtaining a predicted fault output; wherein the target LightGBM model is trained by the above method of training the improved LightGBM model based on the optimization algorithm.
[0125] A terminal device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program: obtaining I groups of sample multi-source heterogeneous data of a circuit breaker; wherein I>1, each group of sample multi-source heterogeneous data comprises sample data sampled by multiple data sources, and each group of sample multi-source heterogeneous data carries a corresponding fault label; in each group of sample multi-source heterogeneous data, sample features of each sample data are extracted respectively, and the extracted multiple sample features are fused to obtain I sample fusion features corresponding thereto; N combinations of current hyperparameters of an improved LightGBM model are randomly initialized; on the premise that the improved LightGBM model is set to different combinations of hyperparameters, each sample fusion feature is input in turn and a predicted fault output is obtained, the predicted fault and the corresponding fault label are input into a preset improved objective function to calculate fitness, so as to obtain the fitness corresponding to the N combinations of current hyperparameters; wherein the loss function in the improved objective function comprises a cross-entropy loss function and a gradient harmonic mechanism function, the cross-entropy loss function is used to measure the difference between the predicted fault and the corresponding fault label, the difficulty of distinguishing the sample multi-source heterogeneous data corresponding to the sample fusion feature in the gradient harmonic mechanism function is positively correlated with the weight of the sample fusion feature, and the calculation proportion of the gradient harmonic mechanism function compared with the cross-entropy loss function increases with the increase of the current iteration number; the optimal combination of hyperparameters in the N combinations of current hyperparameters is determined according to the size of the fitness, and the N combinations of current hyperparameters are updated using an optimization algorithm according to the optimal combination of hyperparameters; if the current iteration number is less than a preset iteration number threshold, the current iteration number is incremented by 1, and the steps of inputting each sample fusion feature in turn and obtaining the predicted fault output on the premise that the improved LightGBM model is set to different combinations of hyperparameters and subsequent steps are returned to be executed, until the current iteration number is equal to the preset iteration number threshold, the improved LightGBM model is set based on the optimal combination of hyperparameters in the N combinations of current hyperparameters, to obtain a target LightGBM model.
[0126] and the following steps are implemented: obtaining real-time multi-source heterogeneous data of the circuit breaker; extracting real-time features of each real-time data in the real-time multi-source heterogeneous data, and fusing the extracted multiple real-time features to obtain corresponding real-time fusion features; inputting the real-time fusion features into the target LightGBM model and obtaining a predicted fault output.
[0127] It should be noted that the above circuit breaker fault diagnosis method, model training method, medium and device belong to one overall inventive concept, and the contents in the circuit breaker fault diagnosis method, model training method, medium and device embodiments can be mutually applicable.
[0128] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiment methods. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0129] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.
[0130] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A method for training an improved LightGBM model based on an optimization algorithm, characterized in that, The method includes: Get the circuit breaker Group sample multi-source heterogeneous data; among which, Each set of sample heterogeneous data includes sample data sampled from multiple data sources, and each set of sample heterogeneous data carries a corresponding fault tag; the sample data includes current, voltage, temperature, fault information and vibration parameters; the fault tags include overload, fuse, high temperature open circuit, short circuit, contact wear and poor contact; In each group of multi-source heterogeneous data, sample features are extracted for each sample, and the extracted sample features are fused to obtain the corresponding... Individual sample fusion features; Randomly initialize and improve the current N hyperparameter combinations of the LightGBM model; Given different hyperparameter combinations for the improved LightGBM model, each sample fusion feature is input sequentially, and the predicted fault is obtained. The predicted fault and its corresponding fault label are then input into a preset improvement objective function to calculate the fitness, thus obtaining the fitness corresponding to the current N hyperparameter combinations. The loss function in the improvement objective function includes a cross-entropy loss function and a gradient reconciliation mechanism function. The cross-entropy loss function measures the difference between the predicted fault and its corresponding fault label. The difficulty of fault differentiation in the sample fusion feature corresponding to the sample multi-source heterogeneous data is positively correlated with the weight of the sample fusion feature in the gradient reconciliation mechanism function. Furthermore, the calculation ratio of the gradient reconciliation mechanism function relative to the cross-entropy loss function increases with the current iteration number. The optimal hyperparameter combination among the current N hyperparameter combinations is determined based on the fitness value, and the current N hyperparameter combinations are updated using an optimization algorithm based on the optimal hyperparameter combination. If the current iteration number is less than the preset iteration number threshold, then increment the current iteration number by 1, and return to execute the steps of inputting the fusion features of each sample and obtaining the predicted fault output under the premise of setting the improved LightGBM model to different hyperparameter combinations, and subsequent steps, until the current iteration number is equal to the preset iteration number threshold. Then, set the improved LightGBM model based on the optimal hyperparameter combination among the current N hyperparameter combinations to obtain the target LightGBM model. The fitness is calculated by inputting the predicted fault and its corresponding fault label into a preset improvement objective function, expressed as: In the above formula, Let be the fitness of the fused features of the i-th sample; Represents the t-th tree model; This represents the loss value of the loss function. The first derivative of the loss function; This is the second derivative of the loss function; Represents the regularization term; This is the scaling factor for the t-th iteration. When t=1, This is the default value; The loss value of the cross-entropy loss function; The loss value of the gradient reconciliation mechanism function; The fitness of the optimal hyperparameter combination at the (t-1)th iteration; The fault label is the fused feature of the i-th sample; The predicted fault is the fusion feature of the i-th sample; The weight assigned to the fusion feature of the i-th sample increases the difficulty of fault differentiation among multi-source heterogeneous data corresponding to the fusion feature of the i-th sample. The larger the setting, the better.
2. The method according to claim 1, characterized in that, The nth combination of hyperparameters for the current improved LightGBM model, initialized randomly, is represented as: In the above formula, For the nth hyperparameter combination, n is an integer between 1 and N; This is the lower bound of the nth hyperparameter set in the j-th dimension; is the upper bound of the nth hyperparameter group in the jth dimension; rand is a value randomly selected between [0,1].
3. The method according to claim 1, characterized in that, The method further includes: Calculate the minimum distance between the multi-source heterogeneous data of the sample corresponding to the fusion feature of the i-th sample and the multi-source heterogeneous data of the other samples, and set the minimum distance based on the minimum distance. The size; where the minimum distance is... The magnitudes are negatively correlated.
4. The method according to claim 1, characterized in that, The method further includes: Calculate the noise ratio in the multi-source heterogeneous data corresponding to the fusion feature of the i-th sample, and set the noise ratio accordingly. The size; of which, the noise proportion and The magnitudes are positively correlated.
5. The method according to claim 1, characterized in that, The step of updating the current N hyperparameter combinations using an optimization algorithm based on the optimal hyperparameter combination includes: The calculation is based on the relationship between the random number r and the constant p, and is expressed as: In the above formula, Let be the size of the nth hyperparameter combination in the jth dimension at the (t+1)th iteration; is the size of the nth hyperparameter combination in the jth dimension at the tth iteration; p is a preset constant; r is a random number between 0 and 1; t is the current iteration number; T is a preset iteration number threshold; The fitness is calculated based on different combinations of hyperparameters, and is expressed as follows: Let be the size of the optimal hyperparameter combination in the j-th dimension so far in the t-th iteration; This represents the fitness of the nth hyperparameter combination in the jth dimension during the tth iteration; This represents the fitness of the hyperparameter combination in the t-th iteration when the j-th dimension is set to a random size; Represents Cauchy variation; Compare and The size of the space, if Then use replace ;like Then keep ;in, This indicates that the improved LightGBM model is set as follows: Adaptability at that time This indicates that the improved LightGBM model is set as follows: Adaptability at that time.
6. The method according to claim 1, characterized in that, The feature fusion of the extracted multiple sample features includes: Different weights are assigned to the extracted sample features, and a weighted average is performed to obtain the corresponding sample fusion features; or, The extracted features from multiple samples are concatenated column-wise to obtain the corresponding sample fusion features; or, Multiple extracted sample features are cross-combined to obtain the corresponding sample fusion features.
7. A method for diagnosing circuit breaker faults, characterized in that, The method includes: Acquire real-time multi-source heterogeneous data of the circuit breaker; Extract the real-time features of each real-time data in the real-time multi-source heterogeneous data, and fuse the extracted real-time features to obtain the corresponding real-time fused features; The real-time fused features are input into the target LightGBM model, and the predicted faults are obtained from the output; wherein the target LightGBM model is trained by the method described in any one of claims 1-6.
8. A computer-readable storage medium, characterized in that, The device stores a computer program that, when executed by a processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 7.
9. A terminal device, characterized in that, It includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Heating ventilation air conditioning system fault diagnosis method based on LightGBM algorithm and grid search algorithm
CN113378908A
Water chilling unit fault diagnosis method and system based on Bayesian optimization LightGBM, and medium
CN113792762A