Isolation forest-based two-stage transformer fault diagnosis method improved by SSA-XGBoost
By optimizing the hyperparameters of XGBoost using isolated forest and an improved sparrow search algorithm, and combining them with feature selection, a two-stage transformer fault diagnosis method is constructed. This method solves the problems of sample imbalance and feature redundancy in existing technologies, and achieves efficient and accurate diagnosis of transformer faults.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING HUISI HUINENG TECH CO LTD
- Filing Date
- 2026-04-17
- Publication Date
- 2026-07-31
AI Technical Summary
Existing XGBoost-based transformer fault diagnosis methods suffer from problems such as difficulty in sample collection, imbalance in sample size, severe interference from abnormal data, redundancy of multi-dimensional features, and low efficiency in hyperparameter tuning. This leads to model training biased towards the majority class and low recognition rate of the minority class. Furthermore, the lack of a complete closed-loop link of anomaly filtering, fault classification, and performance evaluation makes it difficult to support iterative optimization and engineering implementation of the model.
An isolated forest model is used for anomaly detection and purification. The Sparrow Search Algorithm (SSA) is improved by combining Logistic chaotic mapping and Levy flight mutation strategy to optimize XGBoost hyperparameters. Key features are selected by embedded feature importance ranking to construct a two-stage fault diagnosis link, including anomaly detection and fault classification.
The model's ability to identify a minority of faults has been improved, the computational load has been reduced, and the anti-interference and stability of the diagnostic results have been enhanced, enabling accurate identification of transformer operating status and efficient classification of multiple fault types.
Smart Images

Figure CN122490188A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of transformer condition monitoring and fault diagnosis technology, specifically to a two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost. Background Technology
[0002] Power transformers are core hub equipment in power systems and industrial power distribution systems, undertaking critical functions such as power conversion, voltage regulation, and load distribution. Their stable operation is directly related to power supply reliability, production continuity, and electricity safety. Dissolved gas analysis (DGA) in oil is currently the mainstream technology for transformer insulation fault diagnosis. However, traditional diagnostic methods such as the IEC three-ratio method rely on fixed coding rules and fault boundary thresholds, which have inherent defects such as poor adaptability to complex operating conditions, weak early fault identification capability, susceptibility to data interference, and low diagnostic accuracy. They are difficult to meet the core requirements of transformer operation and maintenance for "early detection and accurate judgment".
[0003] Machine learning-based intelligent diagnostic technology provides an effective path to overcome the limitations of traditional methods. Among them, the XGBoost model has become one of the core models for DGA data-driven fault diagnosis due to its excellent nonlinear fitting ability, anti-interference ability, and small sample adaptability. However, existing XGBoost-based diagnostic methods still have significant bottlenecks in practical engineering applications: First, it is difficult to collect transformer fault samples, the number of normal and fault samples is seriously imbalanced, and abnormal interference data is easily mixed into the samples, causing the model training to be biased towards the majority class, and the recognition rate of minority class faults is low; Second, multi-dimensional DGA derived features have linear correlation and redundancy, which can easily lead to the curse of dimensionality, increasing computational complexity while masking key fault features and reducing the model's generalization ability.
[0004] Furthermore, the diagnostic performance of the XGBoost model is significantly affected by hyperparameter configuration. Traditional hyperparameter tuning methods such as grid search and random search are inefficient and prone to blindness. Conventional swarm intelligence optimization methods such as Sparrow Search Algorithm (SSA) suffer from uneven initial population distribution and are prone to getting trapped in local optima, making it difficult to obtain the optimal hyperparameter combination suitable for engineering scenarios. At the same time, most existing diagnostic methods lack a complete closed-loop link of "anomaly filtering-fault classification-performance evaluation", making it difficult to analyze the causes of fault misjudgment and support the iterative optimization and engineering implementation of the model. Summary of the Invention
[0005] To address the above problems, this invention provides a two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost, comprising the following steps: S1: Collect dissolved gas component data in transformer oil, and construct multiple sets of derived ratio features based on the gas component data to form a multi-dimensional DGA feature dataset; S2: Perform outlier identification, correction, and standardization on the DGA feature dataset, extract normal samples from the dataset, and divide it into training and validation sets for the isolated forest model; S3: Train the Isolation Forest model using normal samples, calculate the average path length of all samples across all decision trees in the Isolation Forest, and convert it into an outlier score. ,in for The average path length correction term of the binary tree constructed from each sample; the average path length of the sample in the isolated forest; the optimal anomaly threshold is determined by combining the F1 score of the validation set; a high-confidence pure anomaly sample set is obtained by screening; and a pure sample set is constructed by matching normal samples. S4: The sparrow search algorithm SSA is improved by introducing Logistic chaotic mapping, adaptive weights and Levy flight mutation strategy. The macro-average F1 score of the XGBoost model validation set is used as the fitness function to globally optimize the core hyperparameters of XGBoost and output the optimal hyperparameter combination. S5: Based on the optimal hyperparameter combination, the optimal feature subset is selected by ranking the importance of XGBoost embedded features, and the training of the XGBoost multi-class fault diagnosis model is completed using a clean sample set; S6: Input the DGA feature data of the transformer to be diagnosed into the trained Isolation Forest model and XGBoost model in sequence to form a two-stage diagnostic link of "anomaly detection-fault classification" and output the diagnostic results of transformer operating status and fault type.
[0006] Preferably, in step S1, the dissolved gas component data in the oil includes hydrogen (H2), methane (CH4), ethane (C2H6), ethylene (C2H4), and acetylene (C2H2); the derived ratio characteristics include the ratios between each gas component, the ratio of each gas component to total hydrocarbons, and the ratio of each gas component to total gas, wherein the total hydrocarbons are the sum of the contents of CH4, C2H6, C2H4, and C2H2, and the total gas is the sum of the contents of H2, CH4, C2H6, C2H4, and C2H2.
[0007] Preferably, in step S2, box plots are used to identify outliers in each feature dimension, and the outlier determination interval is determined based on the interquartile range. Outliers exceeding the interval are filled and corrected using the mean of adjacent samples or the median of features in the same dimension. For numerical overflow anomalies of derived ratio features, upper and lower thresholds are set for truncation correction. After correction, Z-score standardization is performed on the feature dataset to eliminate the dimensional differences between different features.
[0008] Preferably, in step S3, samples with anomaly scores greater than the optimal anomaly threshold are identified as initial anomaly samples. The cosine similarity between the initial anomaly samples is calculated based on the standardized DGA features, and duplicate and redundant samples with excessive similarity are removed. Marginal anomaly samples are added according to the proportion of deduplicated samples, and finally a high-confidence pure anomaly sample set is obtained.
[0009] Preferably, in step S4, the population of the improved SSA is initialized using a Logistic chaotic mapping, based on the chaotic sequence formula: A chaotic sequence is generated, and then linearly mapped to the search range of each hyperparameter to obtain the initial population matrix. For the first The chaotic sequence value of the next iteration. Indicates the first The chaotic sequence value of the next iteration. These are the control parameters for the chaos coefficients.
[0010] Preferably, in step S4, the exploration phase of the improved SSA is set with an adaptive weight that is dynamically adjusted with the number of iterations to balance the algorithm's global exploration and local development capabilities; a Levy flight mutation strategy is introduced for a preset proportion of individual participants, and a random jump step size is generated through the Levy flight step size formula to guide the population out of the local optimum.
[0011] Preferably, in step S4, the development stage of the improved SSA sets a shrinkage factor that decreases with the number of iterations. This shrinkage factor reduces the search step size, and the update formula is based on the individual position. | Complete individual location updates to achieve localized fine-grained search, where The first in the SSA population The update location of each individual, The first in the SSA population The current location of each individual. This represents the globally optimal position for the SSA population. This is the shrinkage factor in the SSA iteration process.
[0012] Preferably, in step S5, the feature importance score is quantified by calculating the gain value of the feature during the splitting process of the XGBoost decision tree, all features are sorted in descending order of importance score, a cumulative importance percentage threshold is set, and features that meet the cumulative percentage requirement are selected to form the optimal feature subset.
[0013] Preferably, in step S5, the XGBoost multi-class fault diagnosis model uses CART tree as the base classifier, adopts an additive ensemble strategy to construct a classifier set, uses the log-likelihood loss function to measure the difference between the predicted value and the true label during training, adds a regularization term to control the model complexity, and iteratively optimizes the model parameters through a gradient boosting strategy.
[0014] Preferably, in step S6, the isolated forest model outputs the normal / abnormal judgment result of the sample to be diagnosed. For the sample judged as abnormal, the XGBoost model outputs the probability value of its belonging to each fault type, and selects the category corresponding to the maximum probability as the final fault type. The model's diagnostic performance is evaluated using multiple dimensions of indicators such as accuracy, precision, recall, and F1 score, and the cause of fault misjudgment is analyzed in combination with the confusion matrix.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: By using isolated forests to detect and purify abnormal samples, the problems of sample distribution imbalance and abnormal data interference are solved. Redundant samples are removed, which can reduce the subsequent computational load, while improving the model's ability to identify minority faults and ensuring the anti-interference and stability of diagnostic results.
[0016] This paper improves the sparrow search algorithm by integrating Logistic chaotic mapping, adaptive weights, and Levy flight mutation strategy. It solves the problems of imbalance between global exploration and local development and premature convergence in traditional SSA, and completes global optimization of XGBoost hyperparameters to improve the convergence efficiency and classification performance of the model.
[0017] Key feature selection is achieved by using XGBoost embedded feature importance ranking, which retains core fault information while compressing feature dimensions. Combined with optimized hyperparameters, a multi-classification model is constructed to identify the transformer operating status. Attached Figure Description
[0018] Figure 1 This is an overall flowchart of the method of the present invention; Figure 2 This is a graph showing the distribution of feature importance in XGBoost embedded feature filtering and the change in validation set accuracy. Figure 3 This is a non-normalized confusion matrix diagram of the transformer fault diagnosis model test set of the present invention. Detailed Implementation
[0019] This invention proposes a two-stage transformer fault diagnosis method based on Isolation Forest-Improved SSA-XGBoost. This method constructs a collaborative diagnostic system of Isolation Forest anomaly filtering, Improved SSA hyperparameter optimization, and XGBoost classification. Through hierarchical optimization logic of sample purification, feature screening, parameter optimization, and fault classification, it achieves end-to-end integration of anomaly data removal, key feature extraction, accurate model parameter adaptation, and multi-type fault identification. This method is adaptable to the actual operating conditions of power transformers, characterized by unbalanced sample distribution and redundant feature dimensions. It combines high fault identification accuracy with strong anti-interference stability, providing effective technical support for the condition monitoring and safe operation and maintenance of power equipment. (Reference) Figure 1 The steps of this invention are as follows: Step 1: Collect characteristic data on dissolved gases and their derivative ratios in transformer oil; Step 2: Perform outlier correction and standardization on the feature data, and extract normal samples to divide the isolated forest into training and validation sets; Step 3: Train the isolated forest model using normal samples, and combine threshold optimization and light deduplication to screen high-confidence, pure, and anomalous samples to reduce the subsequent computational load; Step 4: Introduce Logistic chaotic mapping, adaptive weights, and Levy flight mutation strategy to improve the Sparrow Search Algorithm (SSA) and optimize the hyperparameters of the XGBoost model; Step 5: Based on optimized hyperparameters and embedded feature selection, train the XGBoost model using clean anomalous samples to achieve accurate state classification; Step 6: Evaluate diagnostic performance using multi-dimensional metrics such as accuracy and F1 score, analyze the causes of misjudgments using the confusion matrix, and verify the effect of clean samples on improving model performance.
[0020] Specifically, the specific steps of the power transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost proposed in this invention are as follows: Step 1: Collect characteristic data of dissolved gases and their derivative ratios in transformer oil. Data was collected from power transformers, including data on dissolved gases in the oil, namely hydrogen (H2), methane (CH4), ethane (C2H6), ethylene (C2H4), and acetylene (C2H2). The 28-dimensional DGA features of the dissolved gas data in the oil, expanded by ratio, are shown in Table 1. Table 1. DGA Data Feature Extension ; In Table 1, numbers 6 to 28 are all extended fault characteristics, where total hydrocarbons = CH4 + C2H6 + C2H4 + C2H2 and total gas = H2 + CH4 + C2H6 + C2H4 + C2H2.
[0021] Step 2: Perform outlier correction and standardization on the feature data, and extract normal samples to divide the isolated forest into training and validation sets; (1) Outlier identification and correction Box plots are used to locate outliers in each feature dimension. Let the first outlier be... Lower quartiles of dimensional features Upper quartiles Calculate the interquartile range ; will exceed The feature values within the range are determined to be outliers; For identified outliers, the mean of adjacent samples is used for filling correction first, with the following formula:
[0022] In the formula, These are the corrected eigenvalues. , , , , , , , The first , , , , , , , The first sample The original eigenvalues of the dimension, This represents the total number of dissolved gases in the transformer oil sample. This indicates that the median is taken; to address numerical overflow anomalies caused by the denominator approaching 0 in the derived ratio feature, an additional upper limit threshold is set. The ratio characteristic values exceeding the threshold will be uniformly corrected to 80, while those less than 10 will be corrected. -6 The minimum value is corrected to 10. -6 To avoid interference from extreme values.
[0023] (2) Feature standardization processing 28-dimensional feature matrix after outlier correction ,, Let the set be the real number set; perform standardization to eliminate dimensional differences; let the corrected i-th... The mean of the dimensional features is Standard deviation Then the standardized eigenvalues The formula for calculation is:
[0024]
[0025]
[0026] In the above formula: To avoid local minima with a standard deviation of zero, and to ensure the validity of the calculation.
[0027] (3) Dataset partitioning After standardizing all the data, normal samples are extracted to divide the isolated forest into training / validation sets. This invention is based on 550 sets of power transformer fault samples, covering six categories: medium and low temperature overheating, high temperature overheating, partial discharge, low energy discharge, high energy discharge and normal state. 140 normal samples were extracted and divided into training set and validation set in a ratio of 8:2.
[0028] Step 3: Train the isolated forest model using normal samples, and then screen out high-confidence, pure, outlier samples to reduce the computational load in the future. (1) Using the training samples of the dataset divided in step 2 as input, learn the normal distribution pattern.
[0029] (2) Anomaly detection execution: Input the full dataset after preprocessing in step 2 into the trained model, and calculate the average path length of the sample in all decision trees; the formula for calculating the average path length is:
[0030] In the formula, For the sample Average path length in an isolated forest The total number of decision trees in an isolated forest. For the sample In the Path length in an isolated forest decision tree; The degree of anomaly is quantified by calculating the average path length of the sample across all decision trees, and further converted into an isolation forest anomaly score. Combined with the F1 score of the isolation forest validation set, 50 candidate thresholds are iterated to determine the optimal anomaly threshold and isolation forest anomaly score. The optimal anomaly threshold is used to identify anomalous samples. If the anomaly score in the isolated forest is less than or equal to the optimal threshold, the samples are considered normal and the results are directly output. Specifically, the isolated forest anomaly score... The calculation formula is as follows:
[0031] The correction term for the average path length of the binary tree is: , for The average path length correction term for the binary tree constructed from the samples. For the first Harmonic number.
[0032] Anomaly sample screening: All samples identified as anomalies are collected to form an initial anomaly sample set. Cosine similarity between samples is calculated based on standardized DGA features, and duplicate / redundant samples with similarity greater than 85% are removed. If the proportion of duplicate samples is less than 70% after deduplication, edge samples with the highest anomaly scores are added, ultimately resulting in a high-confidence, clean anomaly sample set with 385 samples. This sample set can be directly used for subsequent feature selection and fault classification, and statistically, it can reduce the computational load of subsequent models by more than 60%. Partial data of the clean anomaly sample set is shown in Table 2. Table 2. Examples of partial data from the pure abnormal sample set. ; Step 4: Introduce Logistic chaotic mapping, adaptive weights, and Levy flight mutation strategy to improve the Sparrow Search Algorithm (SSA) and optimize the hyperparameters of the XGBoost model; (1) Initialize the population The population is initialized using a Logistic chaotic mapping, as shown in the following formula:
[0033] In the formula: Indicates the first The chaotic sequence value of the next iteration; For the first The chaotic sequence value of the next iteration. This is used to generate the randomness of the initial population of hyperparameters; These are the control parameters for the chaos coefficients.
[0034] By mapping the chaotic sequences of each dimension to the search range of the corresponding hyperparameters through linear transformation, an initial population matrix is obtained, which makes the individuals uniformly distributed in the solution space and improves the foundation of global exploration.
[0035] (2) Search phase division Set the exploration probability p=0.8 and generate random numbers. By comparison The decision to proceed with p is to enter either the exploration or development phase: when At this point, the exploration phase begins, employing two strategies to achieve global optimization; when At that time, the development phase begins, and localized refined search is achieved through the shrinkage factor.
[0036] (3) Exploration Phase Strategies (a) Adaptive weighting strategy Set adaptive weights that dynamically adjust with the number of iterations. The formula is:
[0037] In the formula, To improve the current iteration count of SSA, To improve the maximum number of iterations in SSA, the weights are linearly decreased from 0.9 to 0.2 to balance global exploration and local development.
[0038] (b) Levy flight variation strategy: Levy flight stride length is introduced for 70% of the participants. The stride length generation formula is as follows:
[0039] In the formula, the stability index of Levy's flight is... , To follow a standard normal distribution random variables, scale parameters of Levy flight It can escape local optima by using its long-distance jump characteristic; This is a gamma function.
[0040] (4) Development Phase Strategy (a) Adjustment of contraction factor: Set the shrinkage factor during the SSA iteration process. As the number of iterations decreases, the formula becomes:
[0041] In the formula, To obtain random numbers that follow a uniform distribution in [0,1], the shrinkage factor is linearly decreased from 2 to 0.2 to reduce the search step size and achieve local refinement.
[0042] (b) Individual location update: The formula for updating individual positions during the development phase is:
[0043] In the formula, The first in the SSA population The update location of each individual, The first in the SSA population The current location of each individual. The global optimal position of the SSA population is determined by shrinking towards the optimal position to achieve local development.
[0044] (5) Fitness assessment and iteration termination Using the macro-average F1 score of the XGBoost model on the validation set as the fitness function, after iterating to the maximum number of times, the hyperparameter combination corresponding to the globally optimal position is output, thus completing the optimization. The final optimal hyperparameter combination is: , , , .
[0045] Step 5: Based on optimized hyperparameters and embedded feature selection, train the XGBoost model using clean samples to achieve accurate state classification. (1) Data partitioning: Extract high-confidence normal samples (abnormal scores determined by Isolation Forest). The optimal threshold (with a normal:abnormal ratio of approximately 3:7) was used to control the number of samples. After merging these samples with the clean abnormal samples to form a clean sample set, a total of 469 samples were obtained. These samples were then stratified into training, validation, and test sets in a 6:2:2 ratio to ensure a balanced distribution of samples in each class. The distribution of the clean sample set after partitioning is shown in Table 3. Table 3 Distribution of Pure Sample Set ; (2) Quantification of feature importance and screening of key features A clean set of outlier samples is input into the XGBoost model, and initial training begins based on the optimal hyperparameters. During training, the importance of features is quantified by calculating the gain value of each feature during the decision tree splitting process. Importance score of dimensional features The calculation formula is:
[0046] In the formula, For the total number of decision trees, For the first The set of all nodes involved in the splitting feature. For nodes Chinese characteristics The sum of the first-order gradients of the corresponding samples, For nodes Chinese characteristics The sum of the corresponding sample second-order gradients, , Features in the left child node The sum of the corresponding first-order gradients and the sum of the second-order gradients. , Features in the right child node The sum of the corresponding first-order gradients and the sum of the second-order gradients. is the L2 regularization coefficient of XGBoost.
[0047] according to The 28-dimensional features are sorted in descending order, and a cumulative importance percentage threshold is set. ( ), filter out those that meet the requirements The former These features form the optimal feature subset, achieving effective compression of feature dimensions. The importance score for the feature at the k-th position after sorting.
[0048] (3) XGBoost model training (a) Based on the optimal hyperparameters and the selected feature subset, an XGBoost multi-classification model is constructed. The model uses CART trees as the base classifier and employs an additive ensemble strategy to construct the classifier set. The prediction output formula is:
[0049] In the formula, For the first The predicted category for each sample, This represents the total number of CART base classifiers in XGBoost. For the first CART tree for samples Category The predicted score.
[0050] (b) During training, the log-likelihood loss function is used to measure the difference between the predicted value and the true label. The calculation formula is:
[0051]
[0052] The parameters to be optimized for the XGBoost model are as follows. For the first The true label of each sample for category c (1 indicates belonging to the category, 0 indicates not belonging). This represents the number of leaf nodes in a single CART tree. This is the XGBoost node splitting threshold. For the first Cart tree The weight of each leaf node, For XGBoost model regularization terms, For the first CART tree for samples Category The predicted score.
[0053] (c) The model parameters are iteratively optimized using a gradient boosting strategy. In the t-th iteration, the training objective of the base classifier is to minimize the second-order Taylor expansion of the loss function, i.e.:
[0054] In the formula, This represents the current iteration of XGBoost gradient boosting. For the loss function at the th The first-order gradient at the output of the wheel model. For the loss function at the th The second-order gradient at the output of the wheel model; Completed in the previous round of training All model parameters of the wheel model; This represents the loss function value of the previous benchmark model; It is the cumulative prediction output of the XGBoost additive model.
[0055] (4) Multi-state classification and result output The reconstructed abnormal sample test set is input into the trained XGBoost model, and the model outputs the probability value of each sample belonging to each category. The calculation formula is:
[0056] The category with the highest probability value is selected as the final diagnostic result of the sample, so as to achieve accurate classification of six states of transformer: normal, medium and low temperature overheating, high temperature overheating, partial discharge, low energy discharge, and high energy discharge.
[0057] At the same time, combined with the anomaly detection results of the isolated forest in step 3, samples that are determined to be normal are directly output as "normal", forming a complete diagnostic link of "anomaly detection - fault classification" to ensure the comprehensiveness and accuracy of the diagnostic results.
[0058] Step 6: Evaluate diagnostic performance using multi-dimensional metrics such as accuracy and F1 score, analyze the causes of misjudgments using the confusion matrix, and verify the effect of clean samples on improving model performance.
[0059] (1) Calculation of multi-dimensional indicators (a) Accuracy :
[0060] In the formula, The number of true positives (correctly identified faults). This represents the number of true negatives (correctly identifying normal results). This represents the number of false positives (normal data mistakenly identified as faults). This represents the number of false negatives (faults mistakenly identified as normal).
[0061] (b) Accuracy :
[0062] c) Recall rate :
[0063] (d) F1 score:
[0064] Macro average index Macro average accuracy :
[0065] Macro average recall :
[0066] Macro average F1 score :
[0067] (2) Confusion matrix Construct a confusion matrix where rows represent the true class and columns represent the predicted class. Matrix elements quantify the mapping relationship between the true class and the predicted class.
[0068] Off-diagonal elements visually represent the distribution of misjudgments for different fault types. Combined with the key features selected in step 5, the distribution differences of misjudged samples in the feature space are analyzed. The frequency of main diagonal elements directly determines the recall rate of each category. If the proportion of a certain type of diagonal element is low, the feature engineering or model hyperparameters of that type of fault need to be optimized in a targeted manner.
[0069] Verification Implementation Examples refer to Figure 2 , Figure 2 The results of feature importance distribution and validation set accuracy variation curves obtained based on XGBoost embedded feature selection are shown. As can be seen from the figure, the validation set accuracy reaches its maximum value of 87.23% when the first 25 features are selected. However, the validation set accuracy tends to plateau after the first 11 features are selected. Therefore, the first 11 features are selected in the following order: H2 / (C2H4+C2H2), CH4 / (C2H4+C2H2), CH4 / H2, C2H4 / total gas, C2H2 / CH4, C2H2 / C2H6, C2H2 / C2H4, H2 / total gas, C2H6 / total gas, C2H2, and C2H4 / (C2H6+C2H2).
[0070] Based on optimized hyperparameters and embedded feature selection, an XGBoost model is trained using pre-defined clean samples, and the test set is used as input for transformer fault diagnosis. Its non-normalized confusion matrix is shown below. Figure 3As shown in Table 4, the evaluation indicators were calculated according to the method described in step 6.
[0071] Table 4. Fault Classification Evaluation Indicators for the Test Set ; As shown in Table 4, the average precision, recall, and F1 score for each fault type were 95.84%, 95.09%, and 95.39%, respectively. The normal category achieved 100% precision, recall, and F1 score. The F1 scores for the medium-low temperature overheating and high temperature overheating categories also exceeded 95%. Only the F1 score for low-energy discharge was slightly below 90%. The overall classification performance of this test set was excellent. Therefore, the method proposed in this invention can effectively reduce the false positive rate and ensure the accuracy of fault identification in DGA fault diagnosis of power transformers, fully verifying the practicality and reliability of this method in power transformer fault diagnosis scenarios.
[0072] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0073] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost, characterized in that, Includes the following steps: S1: Collect dissolved gas component data in transformer oil, and construct multiple sets of derived ratio features based on the gas component data to form a multi-dimensional DGA feature dataset; S2: Perform outlier identification, correction, and standardization on the DGA feature dataset, extract normal samples from the dataset, and divide it into training and validation sets for the isolated forest model; S3: Train the Isolation Forest model using normal samples, calculate the average path length of all samples across all decision trees in the Isolation Forest, and convert it into an outlier score. ,in for The average path length correction term of the binary tree constructed from each sample; the average path length of the sample in the isolated forest; the optimal anomaly threshold is determined by combining the F1 score of the validation set; a high-confidence pure anomaly sample set is obtained by screening; and a pure sample set is constructed by matching normal samples. S4: The sparrow search algorithm SSA is improved by introducing Logistic chaotic mapping, adaptive weights and Levy flight mutation strategy. The macro-average F1 score of the XGBoost model validation set is used as the fitness function to globally optimize the core hyperparameters of XGBoost and output the optimal hyperparameter combination. S5: Based on the optimal hyperparameter combination, the optimal feature subset is selected by ranking the importance of XGBoost embedded features, and the training of the XGBoost multi-class fault diagnosis model is completed using a clean sample set; S6: Input the DGA feature data of the transformer to be diagnosed into the trained Isolation Forest model and XGBoost model in sequence to form a two-stage diagnostic link of "anomaly detection-fault classification" and output the diagnostic results of transformer operating status and fault type.
2. The two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost according to claim 1, characterized in that, In step S1, the dissolved gas component data in the oil includes hydrogen (H2), methane (CH4), ethane (C2H6), ethylene (C2H4), and acetylene (C2H2); the derived ratio characteristics include the ratios between each gas component, the ratio of each gas component to total hydrocarbons, and the ratio of each gas component to total gas, wherein the total hydrocarbons are the sum of the contents of CH4, C2H6, C2H4, and C2H2, and the total gas is the sum of the contents of H2, CH4, C2H6, C2H4, and C2H2.
3. The two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost according to claim 1, characterized in that, In step S2, box plots are used to identify outliers in each feature dimension. The outlier determination interval is determined based on the interquartile range. Outliers exceeding the interval are filled and corrected using the mean of adjacent samples or the median of features in the same dimension. For numerical overflow anomalies of derived ratio features, upper and lower thresholds are set for truncation correction. After correction, Z-score standardization is performed on the feature dataset to eliminate the dimensional differences between different features.
4. The two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost according to claim 1, characterized in that, In step S3, samples with anomaly scores greater than the optimal anomaly threshold are identified as initial anomaly samples. The cosine similarity between the initial anomaly samples is calculated based on the standardized DGA features, and duplicate and redundant samples with excessive similarity are removed. Marginal anomaly samples are added based on the proportion of deduplicated samples, and finally a high-confidence pure anomaly sample set is obtained.
5. The two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost according to claim 1, characterized in that, In step S4, the population of the improved SSA is initialized using a Logistic chaotic mapping, based on the chaotic sequence formula: A chaotic sequence is generated, and then linearly mapped to the search range of each hyperparameter to obtain the initial population matrix. For the first The chaotic sequence value of the next iteration. Indicates the first The chaotic sequence value of the next iteration. These are the control parameters for the chaos coefficients.
6. The two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost according to claim 1, characterized in that, In step S4, the exploration phase of the improved SSA is set with an adaptive weight that is dynamically adjusted with the number of iterations to balance the algorithm's global exploration and local development capabilities; a Levy flight mutation strategy is introduced for a preset proportion of individual participants, and a random jump step size is generated through the Levy flight step size formula to guide the population out of local optima.
7. The two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost according to claim 1, characterized in that, In step S4, the development phase of the improved SSA is set with a shrinkage factor that decreases with the number of iterations. This shrinkage factor reduces the search step size, and the update formula is based on the individual position. | Complete individual location updates to achieve localized fine-grained search, where The first in the SSA population The update location of each individual, The first in the SSA population The current location of each individual. This represents the globally optimal position for the SSA population. This is the shrinkage factor in the SSA iteration process.
8. The two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost according to claim 1, characterized in that, In step S5, the feature importance score is quantified by calculating the gain value of the feature during the splitting process of the XGBoost decision tree. All features are sorted in descending order of importance score, a cumulative importance percentage threshold is set, and features that meet the cumulative percentage requirement are selected to form the optimal feature subset.
9. The two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost according to claim 1, characterized in that, In step S5, the XGBoost multi-class fault diagnosis model uses CART tree as the base classifier, adopts an additive ensemble strategy to construct a classifier set, uses the log-likelihood loss function to measure the difference between the predicted value and the true label during training, adds a regularization term to control the model complexity, and iteratively optimizes the model parameters through a gradient boosting strategy.
10. The two-stage transformer fault diagnosis method based on isolated forest-improved SSA-XGBoost according to claim 1, characterized in that, In step S6, the isolated forest model outputs the normal / abnormal judgment result of the sample to be diagnosed. For the sample judged as abnormal, the XGBoost model outputs the probability value of its belonging to each fault type. The category corresponding to the maximum probability is selected as the final fault type. The model's diagnostic performance is evaluated using multiple dimensions such as accuracy, precision, recall, and F1 score. The cause of fault misjudgment is analyzed in combination with the confusion matrix.