Fault classification method for power transmission system based on ga and xgboost-rf stacking algorithm
Patent Information
- Application Number
- CN202411250305.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2044-09-06
AI Technical Summary
然而,集成学习中的三种方法也有各自的优缺点,如Bagging的代表算法随机森林(RF)由于它的两个特点:训练集的有放回抽样和树的每个节点的特征的随机选择从而让它在分类和回归方面都比其他集成机器学习方法具有更优越的性能,但模型易过拟合;Boosting的代表算法极限梯度提升(XGBoost)将GradientBoosting算法中的目标函数通过二阶泰勒展开,正则化项展开,合并系数等操作进行了进一步的扩展使得运算速度提升巨大,但对数据过于敏感;而Stacking通过将不同的模型堆叠的方式虽然能有效提升性能指标,但相对的运算时间更长
[0059] Beneficial Effects: This invention provides a fault classification method for power transmission systems based on GA and XGBoost-RF stacked algorithms. The Extreme Gradient Boosting (XGBoost) algorithm is used as the base learner, and the Random Forest (RF) algorithm is used as the meta-learner to obtain the XGBoost-RF stacked algorithm model. By employing the stacking method in ensemble learning to combine the two algorithm models, the performance limitations of the algorithm are successfully overcome, thus enabling more accurate fault classification. To address the slow computation time of ensemble learning, a genetic algorithm is added during the training of the base learner for feature selection. Specifically, the accuracy function of the Extreme Gradient Boosting (XGBoost) algorithm is used as the fitness function, and the binary encoded genetic algorithm GA is used to select features from the original feature data in the fault feature dataset, obtaining an optimized feature subset. The selected optimized feature subset performs very well on both the base learner and the meta-learner. Furthermore, due to the reduction in the number of features, the overall computation time of the algorithm model is reduced while improving accuracy, achieving a balance between time and accuracy in the overall stacked algorithm model.
Smart Images

Figure CN119089322B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of fault diagnosis technology, and in particular to a fault classification method for power transmission systems based on GA and XGBoost-RF stacking algorithms. Background Technology
[0002] Fault diagnosis technology is becoming increasingly important in power systems. Power systems consist of many complex dynamic devices that are frequently susceptible to various types of interference, leading to faults. The ability to quickly acquire and process fault information is crucial for maintaining power systems. With the increase in computer storage capacity and processing speed, data-driven methods have become the most popular technology in fault diagnosis. Over the past few decades, many methods, such as Principal Component Analysis (PCA) and Partial Least Squares (PLS), have been applied to fault diagnosis, but they are generally not applicable to fault classification. Fault classification aims to determine the type of fault detected, which is essential for designing a good industrial system.
[0003] Currently, many machine learning methods are used for fault classification, which can be considered a multi-class classification problem in machine learning algorithms. However, current research mainly focuses on fault classification using single algorithms. For fault classification in power transmission systems, it is difficult to design a single classifier to achieve the desired performance under different conditions. For example, the Support Vector Machine (SVM) method is not good at handling multi-class problems and is sensitive to missing data. The Artificial Neural Network (ANN) method is difficult to interpret and has many parameters that need to be tuned. Ensemble learning methods overcome the shortcomings of a single model by voting or averaging multiple models, thereby improving the performance of fault classification. However, the three methods in ensemble learning also have their own advantages and disadvantages. For example, Random Forest (RF), a representative algorithm of Bagging, has superior performance in classification and regression compared to other ensemble machine learning methods due to its two characteristics: sampling with replacement of the training set and random selection of features for each node of the tree. However, the model is prone to overfitting. Extreme Gradient Boosting (XGBoost), a representative algorithm of Boosting, further extends the objective function of Gradient Boosting by expanding the second-order Taylor expansion, expanding the regularization term, and merging the coefficients, which greatly improves the computation speed. However, it is too sensitive to data. Stacking, by stacking different models, can effectively improve performance metrics, but the computation time is relatively longer. Summary of the Invention
[0004] This invention provides a fault classification method for power transmission systems based on GA and XGBoost-RF stacking algorithms to overcome the aforementioned technical problems.
[0005] To achieve the above objectives, the technical solution of the present invention is as follows:
[0006] A fault classification method for power transmission systems based on GA and XGBoost-RF stacking algorithms includes the following steps:
[0007] S1: Obtain the fault characteristic dataset of the power transmission system;
[0008] The fault feature dataset includes the original feature data and the original fault labels;
[0009] The original feature data includes the three-phase voltage data and three-phase current data collected under the fault conditions of the power transmission system at both ends of the motor;
[0010] S2: Using the accuracy function of the Extreme Gradient Boosting (XGBoost) algorithm as the fitness function, the binary encoded genetic algorithm (GA) is used to select feature data from the original feature data in the fault feature dataset to obtain an optimized feature subset.
[0011] S3: Randomly divide the optimized feature subset and obtain the data training set and data test set;
[0012] S4: Use the Extreme Gradient Boosting (XGBoost) algorithm as the base learner and the Random Forest (RF) algorithm as the meta learner to obtain the XGBoost-RF stacked algorithm model.
[0013] The XGBoost-RF stacking algorithm model is trained and predicted using the data training set to obtain an optimized XGBoost-RF stacking algorithm model.
[0014] The algorithm prediction training includes using a five-fold cross-validation method to train and predict the base learner based on the data training set, so as to obtain the predicted fault labels and put them into the optimized feature subset as new feature data, thereby obtaining a new dataset;
[0015] The ten-fold cross-validation method is used to train and predict the meta-learner based on the new dataset, and the RF decision tree model is obtained based on the Gini coefficient used for decision tree branch node partitioning as the probability index for fault classification of power transmission system.
[0016] S5: Input the data test set into the optimized XGBoost-RF stacking algorithm model to obtain the fault classification results of the power transmission system.
[0017] Furthermore, S2 specifically includes the following steps:
[0018] S21: The original feature data in the fault feature dataset is encoded using the binary encoding genetic algorithm GA, and the encoded original feature data is used as the population individuals of the initial population of the genetic algorithm GA.
[0019] S22: The accuracy function of the Extreme Gradient Boosting (XGBoost) algorithm for fault classification is used as the fitness function in the Genetic Algorithm (GA) for evaluating the performance of fitness value calculation and feature selection results of individuals in the population.
[0020] S23: Obtain the accuracy function value of each individual in the initial population, and take the best individual in the population corresponding to the current best accuracy function value as the next generation individual in the population;
[0021] S24: Perform selection, crossover, and mutation genetic operations on the remaining individuals in the initial population excluding the best individuals to obtain the next generation of individuals.
[0022] And based on the next generation of individuals obtained through selection, crossover, and mutation genetic operators, a new population is obtained by combining them with the best individuals in the population;
[0023] And use the new population as the initial population;
[0024] S25: Repeat steps S23 to S24 until the preset maximum number of iterations is reached;
[0025] The population individuals corresponding to the current optimal accuracy function value are then used as the selected feature data, and an optimized feature subset is obtained based on the selected feature data.
[0026] Furthermore, S4 employs a five-fold cross-validation method to train and predict the base learner based on the training data set, specifically including the following steps:
[0027] S41: The five-fold cross-validation method is used to divide the training data set into a first training set and a first test set.
[0028] S42: Construct a first initial decision tree model based on the Extreme Gradient Boosting (XGBoost) algorithm, and obtain an XGBoost decision tree model based on the first training set;
[0029] S43: Input the first test set into the XGBoost decision tree model to obtain the predicted fault labels of the power transmission system.
[0030] Furthermore, the method for constructing the initial decision tree model is specifically as follows:
[0031] S421: Set the objective function of the t-th decision tree in XGBoost as follows:
[0032]
[0033] In the formula: n represents the number of samples and sample i = 1, 2, ..., n; This represents the model's loss function, i.e., the loss between the actual sample value and the predicted value; y i This represents the actual value of sample i; Ω(f) represents the combined prediction of the first t decision trees for sample i; t ) represents the regularization coefficient for the complexity of the t-th tree, and T represents the depth of the current tree; ω represents the node value of the leaf node; γ and λ represent hyperparameters used to control the penalty strength of the regularization coefficient;
[0034] S422: Based on the principle of Boosting, obtain the common prediction value of the first t decision trees for sample i. The expression is:
[0035]
[0036] In the formula: f t (X i ) represents the prediction value of the t-th tree for sample i;
[0037] S423: Based on S422, rewrite the objective function of the t-th decision tree of XGBoost as follows:
[0038]
[0039] Expanding the objective function using the second-order Taylor formula, we get:
[0040]
[0041] Where: g i with h i They represent the first and second derivatives, respectively, and
[0042] S424: To minimize the objective function, obtain the optimized objective function based on the objective function expanded by the second-order Taylor formula;
[0043]
[0044] S425: f t (X i ) is defined as in, This represents the weight value of sample i in the leaf node; and the optimization objective function is rewritten according to the regularization coefficient as follows:
[0045]
[0046] In the formula: I j ={i|q(x i)=j} represents the value of the q-th decision tree at leaf node j; ω j That is Variations;
[0047] make The objective function can then be rewritten as follows:
[0048]
[0049] S426: Taking the derivative of the rewritten objective function and setting it to 0, we obtain the optimal solution ω for the weights of the leaf nodes. j * for
[0050]
[0051] Based on the optimal solution ω of the leaf node weights j * Construct an information gain function to evaluate the reliability of the classifier's predictions. Its expression is
[0052]
[0053] S427: Based on the information gain function Obtain the gain value (Gain) of each leaf node during the split, and use this gain value to obtain the initial decision tree model, expressed as follows:
[0054]
[0055] In the formula: Θ R This represents the optimal value of the objective function when the value is partitioned into the right subtree, and Θ = G,H; Θ L This represents the optimal value of the objective function when the value is partitioned into the right subtree; H L G L H represents the partitioning to the left subtree. j G j Value; H R G R H represents the partitioning to the right subtree. j G j Value, that is: This represents the fraction representing the new left cotyledon. This represents the fraction representing the new right cotyledon. γ represents the original number of leaves, and γ represents the regularity coefficient of the newly added leaves.
[0056] Furthermore, the expression for the Gini coefficient used for decision tree branch node partitioning, as described in S4, is:
[0057]
[0058] In the formula: α represents the feature used to partition the new dataset using the ten-fold cross-validation method; D i Let represent the subset of samples after dividing the new dataset; D represents the new dataset; k represents the fault category, and k = 1, 2, 3, ..., K; p k This represents the probability of the k-th fault category.
[0059] Beneficial Effects: This invention provides a fault classification method for power transmission systems based on GA and XGBoost-RF stacked algorithms. The Extreme Gradient Boosting (XGBoost) algorithm is used as the base learner, and the Random Forest (RF) algorithm is used as the meta-learner to obtain the XGBoost-RF stacked algorithm model. By employing the stacking method in ensemble learning to combine the two algorithm models, the performance limitations of the algorithm are successfully overcome, thus enabling more accurate fault classification. To address the slow computation time of ensemble learning, a genetic algorithm is added during the training of the base learner for feature selection. Specifically, the accuracy function of the Extreme Gradient Boosting (XGBoost) algorithm is used as the fitness function, and the binary encoded genetic algorithm GA is used to select features from the original feature data in the fault feature dataset, obtaining an optimized feature subset. The selected optimized feature subset performs very well on both the base learner and the meta-learner. Furthermore, due to the reduction in the number of features, the overall computation time of the algorithm model is reduced while improving accuracy, achieving a balance between time and accuracy in the overall stacked algorithm model. Attached Figure Description
[0060] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0061] Figure 1 This is a flowchart of the fault classification method for power transmission systems based on the GA and XGBoost-RF stacking algorithms of the present invention;
[0062] Figure 2 This is a flowchart of the feature selection process using the genetic algorithm in this embodiment;
[0063] Figure 3 This is a flowchart illustrating the use of cross-validation in this embodiment;
[0064] Figure 4 This is a flowchart of the Boosting algorithm in this embodiment;
[0065] Figure 5 This is a flowchart of the Bagging algorithm in this embodiment;
[0066] Figure 6 This is a power system simulation diagram used for verification in this embodiment;
[0067] Figure 7 This is a comparison chart of different metrics with other comparative machine learning algorithms in this embodiment;
[0068] Figure 8 This is a comparison chart of the computation time of this embodiment with other machine learning algorithms.
[0069] Figure 9 This is the core flowchart of the power transmission system fault classification method based on the GA and XGBoost-RF stacking algorithm in this embodiment. Detailed Implementation
[0070] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0071] This embodiment provides a fault classification method for power transmission systems based on GA and XGBoost-RF stacking algorithms, such as Figure 1 As shown, it includes the following steps:
[0072] S1: Obtain the fault characteristic dataset of the power transmission system;
[0073] The fault feature dataset includes the original feature data and the original fault labels;
[0074] The original feature data includes the three-phase voltage data and three-phase current data collected under the fault conditions of the power transmission system at both ends of the motor;
[0075] S2: Using the accuracy function of the Extreme Gradient Boosting (XGBoost) algorithm as the fitness function, the binary encoded genetic algorithm (GA) is used to select feature data from the original feature data in the fault feature dataset to obtain an optimized feature subset. This includes the following steps:
[0076] S21: The original feature data in the fault feature dataset is encoded using the binary encoding genetic algorithm GA, and the encoded original feature data is used as the population individuals of the initial population of the genetic algorithm GA.
[0077] S22: The accuracy function of the Extreme Gradient Boosting (XGBoost) algorithm for fault classification is used as the fitness function in the Genetic Algorithm (GA) for evaluating the performance of fitness value calculation and feature selection results of individuals in the population.
[0078] S23: Obtain the accuracy function value of each individual in the initial population, and take the best individual in the population corresponding to the current best accuracy function value as the next generation individual in the population;
[0079] S24: Perform selection, crossover, and mutation genetic operations on the remaining individuals in the initial population excluding the best individuals to obtain the next generation of individuals;
[0080] And based on the next generation of individuals obtained through selection, crossover, and mutation genetic operators, a new population is obtained by combining them with the best individuals in the population;
[0081] And use the new population as the initial population;
[0082] S25: Repeat steps S23 to S24 until the preset maximum number of iterations is reached;
[0083] Then, the population individuals corresponding to the current optimal accuracy function value are used as the selected feature data, and an optimized feature subset is obtained based on the selected feature data;
[0084] In this embodiment, the fault feature dataset of the power transmission system in S1 is calculated in five iterations using a genetic algorithm and a limiting gradient boosting algorithm to obtain the feature set with the highest accuracy in the limiting gradient algorithm. This step belongs to the data processing part and is mainly implemented by the genetic algorithm. When using the genetic algorithm for feature selection, it attempts to select the feature subset that has the greatest impact on model performance from the input feature set. This process is accomplished through operations such as crossover, mutation, and selection in the genetic algorithm. Figure 2As shown, the basic principle of feature selection using genetic algorithms is to find the optimal binary code. During feature selection, all individuals in the population are represented by a random binary number. The length of the number is the same as the number of features being selected. Each bit in the code represents a feature; if the i-th bit is 1, the feature is selected; if the i-th bit is 0, the feature is not selected. The dataset typically consists of x rows and y columns, with each row representing a sample and each column representing a feature. For example, when using genetic algorithms and the extreme gradient boosting algorithm for feature selection, if the dataset has 6 features, the genetic algorithm will generate k 6-bit binary numbers (k being the population size set by the user), such as 001100. This row of numbers represents all samples in the dataset that only select the third and fourth features for input into the extreme gradient boosting algorithm for training. After all encoding is complete, the fitness function is calculated to determine the quality of each individual. After all judgments are completed, the individual with the highest fitness, i.e., the best individual in the population, is unconditionally copied to the next generation of the new population. Then, genetic operators such as selection, crossover, and mutation are performed on the parent population to breed the next generation of the new population. If the set number of iterations is reached, the best gene string is returned and used as the basis for feature selection. In this embodiment, when using a genetic algorithm for feature selection, the accuracy (ACC) value of the target algorithm model, i.e., the extreme gradient boosting algorithm, is used as the fitness function. The ACC value is calculated through the confusion matrix, which is defined as follows:
[0085] Suppose we have a binary classification problem where the labels have two categories: positive and negative. The confusion matrix would look like this:
[0086]
[0087] The confusion matrix can be used to obtain a series of metrics in machine learning algorithms:
[0088] 1. Accuracy (ACC): The proportion of correctly classified samples out of the total sample size. The formula is:
[0089]
[0090] 2. Precision (PRE): The proportion of positive examples that are correctly predicted. The formula is:
[0091]
[0092] 3. Recall (REC): The proportion of samples that are actually positive that are correctly predicted as positive. The formula is:
[0093]
[0094] 4. F1 score: The harmonic mean of precision and recall, calculated using the following formula:
[0095]
[0096] These metrics provide comprehensive information about the performance of classification models, helping to evaluate the model's performance in different aspects. They can also be used to compare models during the final performance comparison process to see the merits of each model.
[0097] S3: Randomly divide the optimized feature subset and obtain the data training set and data test set;
[0098] S4: Use the Extreme Gradient Boosting (XGBoost) algorithm as the base learner and the Random Forest (RF) algorithm as the meta learner to obtain the XGBoost-RF stacked algorithm model.
[0099] The XGBoost-RF stacking algorithm model is trained and predicted using the data training set to obtain an optimized XGBoost-RF stacking algorithm model.
[0100] The algorithm prediction training includes using a five-fold cross-validation method to train and predict the base learner based on the data training set, so as to obtain the predicted fault labels and put them into the optimized feature subset as new feature data, thereby obtaining a new dataset;
[0101] Specifically, the five-fold cross-validation method is used to train and predict the base learner based on the training data set, which includes the following steps:
[0102] S41: The five-fold cross-validation method is used to divide the training data set into a first training set and a first test set.
[0103] S42: Construct a first initial decision tree model based on the Extreme Gradient Boosting (XGBoost) algorithm, and obtain an XGBoost decision tree model based on the first training set;
[0104] The method for constructing the initial decision tree model is as follows:
[0105] S421: Set the objective function of the t-th decision tree in XGBoost as follows:
[0106]
[0107] In the formula: n represents the number of samples and sample i = 1, 2, ..., n; This represents the model's loss function, i.e., the loss between the actual sample value and the predicted value; y i This represents the actual value of sample i; Ω(f) represents the combined prediction of the first t decision trees for sample i; t ) represents the regularization coefficient for the complexity of the t-th tree, and T represents the depth of the current tree; ω represents the node value of the leaf node; γ and λ represent hyperparameters used to control the penalty strength of the regularization coefficient;
[0108] S422: Based on the principle of Boosting, obtain the common prediction value of the first t decision trees for sample i. The expression is:
[0109]
[0110] In the formula: f t (X i ) represents the prediction value of the t-th tree for sample i;
[0111] S423: Based on S422, rewrite the objective function of the t-th decision tree of XGBoost as follows:
[0112]
[0113] Expanding the objective function using the second-order Taylor formula, we get:
[0114]
[0115] Where: g i with h i They represent the first and second derivatives, respectively, and
[0116] S424: To minimize the objective function, obtain the optimized objective function based on the objective function expanded by the second-order Taylor formula;
[0117]
[0118] S425: f t (X i ) is defined as in, This represents the weight value of sample i in the leaf node; and the optimization objective function is rewritten according to the regularization coefficient as follows:
[0119]
[0120] In the formula: I j ={i|q(x i )=j} represents the value of the q-th decision tree at leaf node j; ω j That is Variations;
[0121] make The objective function can then be rewritten as follows:
[0122]
[0123] S426: Taking the derivative of the rewritten objective function and setting it to 0, we obtain the optimal solution ω for the weights of the leaf nodes. j * for
[0124]
[0125] Based on the optimal solution ω of the leaf node weights j * Construct an information gain function to evaluate the reliability of the classifier's predictions. Its expression is
[0126]
[0127] S427: Based on the information gain function Obtain the gain value (Gain) of each leaf node during the split, and use this gain value to obtain the initial decision tree model, expressed as follows:
[0128]
[0129] In the formula: Θ R This represents the optimal value of the objective function when the value is partitioned into the right subtree, and Θ = G,H; Θ L This represents the optimal value of the objective function when the value is partitioned into the right subtree; H L G L H represents the partitioning to the left subtree. j G j Value; H R G R H represents the partitioning to the right subtree. j G j Value, that is: This represents the fraction representing the new left cotyledon. This represents the fraction representing the new right cotyledon. γ represents the original number of leaves, and γ represents the regularity coefficient of the newly added leaves;
[0130] S43: Input the first test set into the XGBoost decision tree model to obtain the predicted fault labels of the power transmission system;
[0131] In this embodiment, based on the base learner, five-fold cross-validation is used to perform training and prediction on the obtained training data set by optimizing feature subset division, that is, five-fold cross-validation is performed again in the extreme gradient boosting algorithm to obtain the prediction result, wherein k-fold cross-validation technology is used, and the k-fold cross-validation is as Figure 3 shown, that is, k times of data set division are performed, and for each division, training and testing are performed on different data sets to obtain results. This approach can avoid the contingency caused by the division of the training set and the test set, and will not lose data information. However, if the samples have been sorted according to fault types, this method will lose a large amount of information in the data when used. Therefore, the data should be randomly shuffled before using this method. Extreme Gradient Boosting (XGBoost) is one of the Boosting algorithms in ensemble learning algorithms, and the algorithm principle of Boosting is as Figure 4 shown, the basic constituent elements of the XGBoost algorithm are decision trees, and there is an order among these decision trees that constitute XGBoost: the generation of the next decision tree will take into account the prediction result of the previous decision tree, that is, the deviation of the previous decision tree is taken into account, so that the training samples misclassified by the previous decision trees will receive more attention in the subsequent process, and then the next decision tree is trained based on the adjusted sample distribution. In this embodiment, through the five-fold cross-validation calculation of the XGBoost algorithm, when different parts of the data set are used as test sets, the corresponding predicted fault classification of the test set can be obtained through the XGBoost algorithm. Next, the prediction result of the XGBoost algorithm and the optimized feature subset in S2 are combined into a new data set, which is imported into the random forest algorithm (RF) for training;
[0132] A ten-fold cross-validation method is adopted to train and predict the meta-learner according to the new data set, and an RF decision tree model is obtained based on the Gini coefficient used for splitting the branch nodes of decision trees as the probability index for fault classification of the power transmission system;
[0133] The random forest in this embodiment is a representative algorithm of the Bagging algorithm, and the principle of the Bagging algorithm is as Figure 5 shown; all base estimators of the random forest algorithm are decision trees. In the process of constructing a decision tree, n features (n<N) are selected with replacement from N total features of the new data set, and the selected n features are used to train the decision tree. When the decision tree is split, m attributes (m<M) are selected from M attributes of the sample, and then the optimal splitting point and splitting attribute are selected through information gain or Gini impurity. A large number of decision trees are generated according to this mode to obtain the RF decision tree model;
[0134] The principle of the random forest algorithm when performing a fault classification task is as follows:
[0135] The input is a dataset D = {(x1,y1),(x2,y2),...,(x m ,y m )}, where x i Let i = 1, 2, ..., m be the i-th sample, and y i Let i = 1, 2, ..., m be the i-th label, T be the number of weak classifiers, and the output be the final strong classifier f(x).
[0136] For i = 1, 2, ..., T, the following definition holds:
[0137] 1. The training set is sampled for the t-th time, and a total of m times, to obtain a sampling set D containing m samples. t ;
[0138] 2. If the dataset has N features, then use the sampling set D. t Training the t-th decision tree model G t (x), when splitting nodes in the decision tree, randomly selects from all features. Each feature is selected, and then the optimal feature is chosen from the selected features for node partitioning.
[0139] The node division of the t-th decision tree is determined by judging the feature by information entropy or Gini coefficient. In this embodiment, the Gini coefficient is used to judge the feature.
[0140] The Gini coefficient represents the probability of misclassifying a randomly selected sample in a dataset. The smaller the coefficient, the lower the probability of misclassifying the selected sample. The formula is defined as follows:
[0141]
[0142] Where D is the dataset, k = 1, 2, ..., K represents the k-th category, p k This represents the probability of the k-th category. The optimal splitting feature is selected using the Gini coefficient by comparing the differences in Gini coefficients after splitting with different features, and choosing the feature that reduces the Gini coefficient the most.
[0143]
[0144] Where α represents the feature used in this partitioning, and D i This represents the subset of samples after the split. This formula represents the difference between the original dataset and the resulting subset D. i The weighted sum of the Gini coefficients;
[0145] During the branching process of the decision tree, the feature node with the smallest Gini coefficient is always selected for splitting until a complete RF decision tree model is constructed.
[0146] 3. All T classifiers determine the fault category through majority voting. Majority voting refers to the random forest algorithm's majority vote on x. i When performing classification, each tree in the Random Forest algorithm is paired with x. i To make predictions, after all trees have been predicted, the category predicted by the most trees in the random forest algorithm is taken as x. i The category.
[0147] S5: Input the data test set into the optimized XGBoost-RF stacking algorithm model to obtain the fault classification results of the power transmission system.
[0148] In this embodiment, to verify the effectiveness of the present invention in fault classification of power transmission systems, MATLAB was used for simulation, and a 400×100 kWh power transmission system with generators at both ends was pre-built. 3 A three-phase transmission line system of V. For example... Figure 6 As shown, the system consists of two 400×10 3 The system consists of generators, each located at one end of the transmission line, to simulate and study various faults at different locations along the line. Distributed type parameters were used to model the line to obtain more accurate results when implementing the proposed scheme on ultra-long transmission lines. Three-phase voltage and current samples at each end were measured using the three-phase VI measurement block in the SimPowerSystem toolbox as features of the dataset. The transmission line is 300km long, and different types of faults are sampled along the line at different locations. The system has four outputs: A (phase A), B (phase B), C (phase C), and G (grounding). An output of 0 or 1 indicates the presence or absence of a fault on the corresponding line. A total of 7860 samples were collected, representing 6 fault types. The specific fault types are shown in the table below.
[0149] Table 1. Fault Categories of Three-Phase Circuit Systems
[0150] 0 0 0 0 No fault 1 0 0 1 LG fault (between phase A and GND) 0 0 1 1 LL fault (between phase A and phase B) 1 0 1 1 LLG fault (between phases A and B and GND) 0 1 1 1 LLL fault (between three phases) 1 1 1 1 LLLG fault (three-phase symmetry fault)
[0151] After obtaining the dataset, the power transmission system fault classification method based on GA and XGBoost-RF stacked algorithms in this implementation was used for fault classification, and the corresponding ACC, PRE, REC, and F1 score indicators were obtained. These results were compared with classic machine learning algorithms. This validation also used the RF algorithm, SVM algorithm, Adaptive Boosting (AdaBoost) algorithm, Gradient Boosting (GBC) algorithm, and XGBoost algorithm to classify faults and obtain a series of indicators. The comparison results are as follows: Figure 7As shown. Furthermore, to compare the algorithm runtimes, the runtimes of power transmission system fault classification methods based on GA and XGBoost-RF stacked algorithms, as well as the runtimes of the algorithms used for comparison, were obtained on this dataset. The standard was the average runtime of five consecutive runs. The comparison results are shown below. Figure 8 As shown.
[0152] The test conclusion of this embodiment is: From Figure 7 It can be concluded that the power transmission system fault classification method based on the GA and XGBoost-RF stacking algorithm provided in this embodiment outperforms other comparative algorithms on this dataset, achieving the maximum value in all four indicators; from Figure 8 It can be concluded that the fault classification method for power transmission systems based on the GA and XGBoost-RF stacked algorithms has reached the level of the single algorithm in terms of running time. Combining the two major criteria of algorithm superiority and inferiority, the rationality and effectiveness of the fault classification method for power transmission systems based on the GA and XGBoost-RF stacked algorithms in fault classification are verified.
[0153] The overall beneficial effects of this implementation are as follows: First, a single machine learning algorithm in a power system is difficult to obtain accurate results due to its inherent performance limitations, which may lead to additional resource consumption. In response to this problem, such as... Figure 9 This embodiment employs a stacking method from ensemble learning to combine two models, successfully overcoming the performance limitations of the algorithm and enabling more accurate fault classification. Furthermore, considering the advantages and disadvantages of the three ensemble learning methods and their respective algorithms, an extreme gradient boosting algorithm was chosen as the base learner, and a random forest algorithm as the meta-learner in a stacked configuration. This combines the three major modes of ensemble learning algorithms—Bagging, Boosting, and Stacking—further improving accuracy and other metrics. Finally, addressing the slow computation time of ensemble learning, this embodiment incorporates a genetic algorithm for feature selection during the base learner training process. The selected feature subset performs very well on both the base and meta-learners. Moreover, the reduced number of features improves accuracy while decreasing the overall computation time of the algorithm model, achieving a balance between time and accuracy in the overall stacked algorithm model. This method not only assists prosecutors in making fault classification decisions but also provides experience for performance research on stacked algorithms.
[0154] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A fault classification method for power transmission systems based on GA and XGBoost-RF stacking algorithms, characterized in that, Includes the following steps: S1: Obtain the fault characteristic dataset of the power transmission system; The fault feature dataset includes the original feature data and the original fault labels; The original feature data includes the three-phase voltage data and three-phase current data collected under the fault conditions of the power transmission system at both ends of the motor; S2: Using the accuracy function of the Extreme Gradient Boosting (XGBoost) algorithm as the fitness function, the binary encoded genetic algorithm (GA) is used to select feature data from the original feature data in the fault feature dataset to obtain an optimized feature subset. Specifically, the following steps are included: S21: The original feature data in the fault feature dataset is encoded using the binary encoding genetic algorithm GA, and the encoded original feature data is used as the population individuals of the initial population of the genetic algorithm GA. S22: The accuracy function of the Extreme Gradient Boosting (XGBoost) algorithm for fault classification is used as the fitness function in the Genetic Algorithm (GA) for evaluating the performance of fitness value calculation and feature selection results of individuals in the population. S23: Obtain the accuracy function value of each individual in the initial population, and take the best individual in the population corresponding to the current best accuracy function value as the next generation individual in the population; S24: Perform selection, crossover, and mutation genetic operations on the remaining individuals in the initial population excluding the best individuals to obtain the next generation of individuals; And based on the next generation of individuals obtained through selection, crossover, and mutation genetic operators, a new population is obtained by combining them with the best individuals in the population; And use the new population as the initial population; S25: Repeat steps S23 to S24 until the preset maximum number of iterations is reached; Then, the population individuals corresponding to the current optimal accuracy function value are used as the selected feature data, and an optimized feature subset is obtained based on the selected feature data; S3: Randomly divide the optimized feature subset and obtain the data training set and data test set; S4: Use the Extreme Gradient Boosting (XGBoost) algorithm as the base learner and the Random Forest (RF) algorithm as the meta learner to obtain the XGBoost-RF stacked algorithm model. The XGBoost-RF stacking algorithm model is trained and predicted using the data training set to obtain an optimized XGBoost-RF stacking algorithm model. The algorithm prediction training includes using the five-fold cross-validation method to train and predict the base learner based on the data training set, so as to obtain the predicted fault labels and put them into the optimized feature subset as new feature data, thereby obtaining a new dataset; The ten-fold cross-validation method is used to train and predict the meta-learner based on the new dataset, and the RF decision tree model is obtained based on the Gini coefficient used for decision tree branch node partitioning as the probability index for fault classification of power transmission system. S4 employs a five-fold cross-validation method to train and predict the base learner based on the training data set. Specifically, it includes the following steps: S41: The five-fold cross-validation method is used to divide the training data set into a first training set and a first test set. S42: Construct a first initial decision tree model based on the Extreme Gradient Boosting (XGBoost) algorithm, and obtain an XGBoost decision tree model based on the first training set; S43: Input the first test set into the XGBoost decision tree model to obtain the predicted fault labels of the power transmission system; S5: Input the data test set into the optimized XGBoost-RF stacking algorithm model to obtain the fault classification results of the power transmission system.
2. The fault classification method for power transmission systems based on GA and XGBoost-RF stacking algorithms according to claim 1, characterized in that, The method for constructing the initial decision tree model is as follows: S421: Set the objective function of the t-th decision tree in XGBoost as follows: In the formula: n Indicates the number of samples and the sample ……n ; This represents the model's loss function, which is the loss between the actual sample value and the predicted value. Indicates sample The actual value; Indicates the preceding t Decision trees work together on the sample i The predicted value; Indicates the first t The regularization coefficient for the complexity of a tree, and ; T Indicates the current depth of the tree; This represents the node value of a leaf node; , This represents a hyperparameter used to control the penalty level of the regularization coefficient; S422: Based on the principle of Boosting, we obtain the first... t Decision trees work together on the sample i Predicted value The expression is: In the formula: Indicates the first t Tree samples i The predicted value; S423: According to S422, the XGBoost... t The objective function of the decision tree is rewritten as follows: Expanding the objective function using the second-order Taylor formula, we get: In the formula: and They represent the first and second derivatives, respectively, and , ; S424: To minimize the objective function, obtain the optimized objective function based on the objective function expanded by the second-order Taylor formula; S425: Will Defined as ,in, Indicates sample i The weight values on the leaf nodes; And based on the regularization coefficient, the optimization objective function is rewritten as follows: In the formula: Representing the q The decision tree at the leaf node j The value of ; That is Variations; make , The objective function can then be rewritten as follows: S426: Taking the derivative of the rewritten optimization objective function and setting it to 0 yields the optimal solution for the weights of the leaf nodes. for The optimal solution based on the weights of the leaf nodes Construct an information gain function to evaluate the reliability of the classifier's predictions. Its expression is S427: Based on the information gain function Get the gain value of each leaf node during the split. According to the gain value Obtain the initial decision tree model, whose expression is: In the formula: This represents the optimal value of the objective function when the value is partitioned into the right subtree, and ; This represents the optimal value of the objective function when the value is divided into the right subtree; , Indicates when partitioning to the left subtree , value; , Indicates when partitioning to the right subtree , Value, that is: This represents the fraction representing the new left cotyledon. This represents the fraction representing the new right cotyledon. This represents the original fraction of the leaf. This represents the regularity coefficient of the newly added leaves.
3. The fault classification method for power transmission systems based on GA and XGBoost-RF stacking algorithms according to claim 2, characterized in that, The expression for the Gini coefficient used for decision tree branch node partitioning, as described in S4, is: In the formula: This indicates the features used to partition the new dataset using the 10-fold cross-validation method; This represents the subset of samples after the new dataset has been divided. D This represents a new dataset; Indicates the fault category, and ; Indicates the first The probability of each fault category.
Citation Information
Patent Citations
Fault diagnosis method for oil-immersed transformer
CN116263814A
Transfer-learning-based life prediction and health assessment method for aero-engine
WO2023231995A1