Supply power supply fault pre-judgment method based on random forest algorithm

By applying a fault prediction method based on random forest algorithm in the power system, a decision tree combination model of power grid equipment is constructed, and the problem of insufficient fault prediction accuracy and coverage in the existing technology is solved, more efficient fault prediction and maintenance optimization is achieved, and the quality of power supply service is improved.

CN119807913APending Publication Date: 2025-04-11YICHANG POWER SUPPLY CO OF STATE GRID HUBEI ELECTRIC POWER CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411881671.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The existing power system fault prediction technology has insufficient data quality and processing capabilities, and it is impossible to effectively predict complex fault conditions, resulting in insufficient prediction accuracy and coverage, and it is difficult to achieve rapid analysis and response in large-scale power grid environments.

Method used

The power supply fault prediction method based on the random forest algorithm is adopted. By collecting and processing the original data of power grid equipment, a decision tree combination model is constructed, sample attributes and number of decision trees are optimized, and classification performance and computing efficiency are improved.

Benefits of technology

This method can improve the accuracy and coverage of fault prediction, optimize maintenance decisions, reduce the occurrence of sudden failures, reduce economic losses caused by maintenance and shutdowns, and improve the quality of power supply services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807913A_ABST
    Figure CN119807913A_ABST
Patent Text Reader

Abstract

The invention discloses a random forest algorithm-based guaranteed power supply fault pre-judgment method, which comprises the following steps of: collecting original data of power grid equipment, and processing missing values and abnormal values in the original data; using the processed data to construct a decision tree combination model for power grid equipment evaluation through a random forest algorithm; based on the constructed decision tree combination model, the classification performance and the calculation efficiency of the random forest algorithm are improved by optimizing sample attributes and the number of decision trees; and defining a plurality of indexes to evaluate the constructed decision tree combination model. According to the method, potential faults can be pre-judged, the maintenance priority can be optimized, and sudden faults can be reduced; therefore, economic loss caused by maintenance and shutdown is reduced, and the method is an important means for improving power supply service quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power system fault assessment, and in particular to a power supply fault prediction method based on a random forest algorithm. Background Art

[0002] The reliability and safety of power systems are crucial to modern society. With the increase in electricity demand, the problem of power equipment failure and power outages caused by failures has become increasingly prominent. In existing technologies, the accuracy and real-time performance of fault prediction technology may be limited by data quality and processing capabilities. Many existing systems rely on historical data and simple fault pattern recognition, and cannot fully consider complex operating environments and diverse fault conditions, resulting in insufficient accuracy and coverage of fault prediction. In addition, the processing speed and real-time performance of fault prediction are also a challenge, especially in large-scale power grid environments, where rapid analysis and response to sudden failures remain a problem. Therefore, it is particularly important to use advanced data analysis and machine learning technologies to evaluate and predict faulty equipment in the power system, improve maintenance efficiency, and reduce economic losses caused by equipment failures.

[0003] The random forest algorithm is an ensemble learning method that improves the prediction performance and stability of the model by building multiple decision trees. Its main feature is that it can effectively handle high-dimensional data sets and various feature types, including numerical and categorical features. Through the self-service sampling technology, random forest generates multiple sample subsets during the training process, each of which is used to train a decision tree. This method introduces randomness, making each tree independent to a certain extent. Compared with a single decision tree, random forest significantly reduces the risk of overfitting of the model by voting (classification) or averaging (regression) the prediction results of all trees, and improves the accuracy and robustness of the overall prediction. In addition, random forest also has the ability to handle missing values ​​and can tolerate missing and noise in the data to a certain extent, which makes it very practical in practical applications. Feature importance assessment is also a major advantage. By calculating the contribution of features to the split of the decision tree, random forest can help identify the features that have the greatest impact on the prediction results. These characteristics make random forests perform well in processing complex data sets and solving practical problems. Summary of the invention

[0004] Based on the above background, the present invention provides a power supply fault prediction method based on random forest algorithm. Compared with the traditional prediction method, the method can predict potential faults and optimize maintenance priorities, and can reduce the occurrence of sudden faults; thereby reducing the economic losses caused by maintenance and downtime, and is an important means to improve the quality of power supply services.

[0005] The technical solution adopted by the present invention is:

[0006] The power supply fault prediction method based on random forest algorithm includes the following steps:

[0007] Step 1: Collect the original data of power grid equipment and process the missing values ​​and outliers in the original data;

[0008] Step 2: Using the data processed in step 1, a decision tree combination model for power grid equipment evaluation is constructed through a random forest algorithm;

[0009] Step 3: Based on the decision tree combination model constructed in step 2, the classification performance and computational efficiency of the random forest algorithm are improved by optimizing sample attributes and the number of decision trees;

[0010] Step 4: Based on step 3, define multiple indicators to evaluate the decision tree combination model constructed in step 2. In step 1, the original data includes the equipment operation status, fault information, environmental factors and related alarm and maintenance records as shown in Table 1. Before the algorithm model is trained, the original data must be processed to ensure the quality and availability of the data and improve the accuracy of the analysis.

[0011] Table 1. Partial original data of power grid equipment

[0012]

[0013] Step 1 includes the following steps:

[0014] (1) Missing value processing:

[0015] After collecting the raw data of power grid equipment, the deletion method can be used to deal with missing values ​​in the data. The specific operation is to identify the rows or columns containing missing values, and select to delete these data according to the number and impact of the missing values. For the case of a small number of missing values, the deletion method can effectively simplify the data processing process and ensure the integrity of the data and the accuracy of the analysis.

[0016] (2) Outlier processing:

[0017] Z-score is a method for outlier detection. The Z-score method can detect outliers in the data. The calculation formula is:

[0018]

[0019] Where: x i is the data point; μ is the mean of all data points; σ is the standard deviation of all data points. i The absolute value of represents the distance between the score within the standard deviation and the overall mean. The threshold is generally set to 2.5. i |When it is greater than the threshold, it can be determined as an outlier.

[0020] In step 2, Random Forests (RF) is a composite algorithm composed of CART decision trees. It combines the characteristics of sample randomization and feature randomization to construct multiple trees to form a random forest based on decision trees. CART (Classification and Regression Trees) decision tree is a tree structure model for classification or regression. During the training process, CART recursively splits the data set and selects the best features and split points to minimize the Gini index. Each CART tree grows until the stopping condition is met, and no pruning is performed (ie, "keep intact"). Each decision tree in the random forest is called a base learner. Unlike the C4.5 decision tree, which uses the information gain ratio to identify feature attributes, the CART decision uses the Gini index to select the optimal features. If a sample set has K attribute classes, and the probability that a sample point belongs to the K attribute classes is recorded as, then the Gini index is defined as:

[0021]

[0022] In formula (2), Gini(p) represents the Gini index of data set p, p k It represents the proportion of category k in the data set, and K represents the number of categories.

[0023] As can be seen from formula (2), the Gini index describes the weighted probability expectation of a sample point being misclassified, where each probability is represented by p k , and used as weights; in the case of binary classification problems, a sample point either belongs to the first category with a probability of "p" or belongs to the second category with a probability of "1-p". Substituting these probabilities into formula (2) yields:

[0024] Gini(p)=p(1-p)+(1-p)(1-(1-p))=2p(1-p) (3);

[0025] If the samples are separated by attributes, the weight of the subsamples needs to be considered when calculating the Gini coefficient. Divide the sample set D into two data subsets D1 and D2 according to the feature measure A. The Gini coefficient of set D under condition A is defined as:

[0026]

[0027] In formula (4), Gini(D1) represents the Gini index of data subset D1, Gini(D2) represents the Gini index of data subset D2, D1|, |D2| are the number of samples of D1 and D2, |D is the total number of samples, and Gini(D,A) is the Gini coefficient after set D is partitioned by A=a. The larger the Gini coefficient, the greater the uncertainty of the sample set.

[0028] Figure 2 Among them, assume there is a sample set S = {S1, S2, …, S n}, then a forest is randomly constructed by multiple CART decision trees. Each decision tree in the forest is independently constructed, not associated with other decision trees, and serves as an independent weak classifier, so pruning is not required. Each decision tree in the random forest provides its own decision result. Finally, the option with the most votes is selected as the final result.

[0029] The specific process is as follows;

[0030] S2-1: Sample random extraction:

[0031] Assume the training sample set contains n object data. Using the bootstrap resampling technique, n samples are randomly extracted. The decision tree model constructed by these samples is a single decision tree. Each extraction will generate a unique sample subset for training a single decision tree. Although some samples may be repeated, this method reduces the risk of the decision tree converging to a local optimum;

[0032] S2-2: Feature random selection:

[0033] Each sample in the dataset contains M attributes. During the splitting process of each node of the decision tree, m attributes are randomly selected from the M attributes, where m << M, without replacement; subsequently, the attribute with the minimum Gini coefficient is designated as the splitting attribute of the node in the m-attribute subset; during the growth process of the entire decision tree, the value of m remains unchanged;

[0034] S2-3: Repeat S2-1 and S2-2, train and generate a total of n CART decision trees. All the trees grow to the maximum extent without pruning, and finally a forest is formed;

[0035] S2-4: Aggregate the prediction results of these trees through a majority voting mechanism to determine the class of each sample, that is, whether a fault occurs.

[0036] In step 3, first obtain the upper bound of the error of the random forest, which is expressed by the following formula:

[0037]

[0038] where p * represents the upper bound of the error of the random forest algorithm, s represents the average strength of each decision tree in the random forest, and ρ represents the average correlation value between decision trees. It can be seen that the upper bound of the generalization error decreases as the average strength of the sub-decision trees increases and is proportional to the average value of the correlation between sub-decision trees.

[0039] The number m of randomly selected sample attributes in the random forest generation process has a significant impact on generalization error and model training. Assuming that the total number of sample attributes is M, one attribute is selected for each split. In the extreme case of m = M, the random forest algorithm is simplified to a decision tree algorithm. Current research shows that when m is log2M, the generalization error result is optimal.

[0040] Another key parameter in the random forest algorithm is the number of decision trees, denoted by C. It is important to note that a larger value of C does not necessarily mean better performance. As the number of decision trees increases, the classification accuracy of the random forest gradually improves and the convergence becomes better and better. However, when C reaches a certain threshold, the algorithm tends to stabilize. Beyond this point, increasing C will lead to diminishing returns and decreased operational efficiency.

[0041] Therefore, finding the best balance point requires continuous testing and refinement in the actual process; determining the number of decision trees C, the optimal number of decision trees is 50.

[0042] In step 4, in the binary classification problem, the actual value and the predicted value can only be (1,0), where 1 means that both the actual value and the predicted value are true and positive. 0 means that both the actual value and the predicted value are false and negative. The comparison result between the actual value and the predicted value is recorded as N(i,j), and the formula of the parameter true positive (TP) is as follows:

[0043]

[0044] Among them, N k (1,1) represents the true positive sample (TP) under category k; n represents the total number of samples, that is, the number of samples involved in classification; k is the number of test sets. n and k in the following formula also have the same meaning.

[0045] The formula for the parameter false negative (FN) is:

[0046]

[0047] Among them, N k (1,0) represents the number of samples in category k that are actually positive (1) but predicted to be negative (0), i.e., false negatives (FN).

[0048] The formula for the parameter false positive (FP) is:

[0049]

[0050] Among them, N k (0,1) represents the number of samples in category k that are actually negative (0) but predicted to be positive (1).

[0051] The formula for the parameter true negative (TN) is:

[0052]

[0053] Among them, N k (0,0) represents the true negative examples (TN) under category k, that is, the number of samples that are actually negative (0) and correctly predicted as negative (0) by the model.

[0054] In combination with the actual usage scenarios of the present invention, a true positive (TP) indicates the total number of entries for which both the sample value decision quantile and the predicted decision quantile of the random forest model are repairs; a false negative (FN) indicates the total number of entries for which the sample value decision quantile is repair but the predicted decision quantile of the random forest model is replacement; a false positive (FP) indicates the total number of entries for which the sample value decision quantile is replacement but the predicted decision quantile of the random forest model is repair; a true negative (TN) indicates the total number of entries for which the sample value decision quantile and the predicted decision quantile of the random forest model are mutually replaced.

[0055] Combining the above definitions, the operational evaluation of the random forest model is defined as follows:

[0056] Recall is used to measure how many faulty devices the model can identify among the devices that actually have faults. A higher recall rate indicates that the model can effectively detect faulty devices and help take measures in advance to avoid the expansion of faults. The evaluation formula is:

[0057]

[0058] Accuracy refers to the ratio of the number of correct judgments of the classification model to the total number of results. The calculation formula for accuracy is:

[0059]

[0060] Precision refers to the proportion of correct predictions made by the random forest model in all sets of positive predictions. The accuracy is calculated by the formula:

[0061]

[0062] In the actual modeling process, recall and precision are often weighed against each other. In order to find a balance, a new indicator F1 score is proposed. The F1 score takes into account both recall and precision, and strives to achieve the highest value of both at the same time to achieve a balance. The calculation formula is as follows:

[0063]

[0064] The present invention provides a method for predicting power supply faults based on a random forest algorithm, and the technical effects are as follows:

[0065] 1) Aiming at the power supply interruption problem caused by power system equipment failure, the decision tree combination model for power grid equipment evaluation constructed by the method of the present invention using the random forest algorithm has high robustness and high precision, can effectively process complex power system fault data, and provide reliable maintenance evaluation, enhance the adaptability and data analysis capabilities of the model, and provide support for decision-making, which has practical application value for the stable operation of the power system and the improvement of power supply service quality.

[0066] 2) This invention proposes a power supply fault prediction method based on random forest algorithm to deal with the power supply interruption problem caused by faults. This power supply interruption prediction method based on random forest algorithm can improve the accuracy of fault prediction and optimize maintenance decisions, thereby effectively reducing maintenance costs and improving power supply service quality. This information provides effective technical support for equipment management and maintenance of power companies. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] The present invention will be further described below in conjunction with the accompanying drawings and examples;

[0068] Figure 1 This is a flowchart of a power outage prediction method based on a random forest algorithm.

[0069] Figure 2 This is the flow chart of the random forest algorithm.

[0070] Figure 3 Selection chart of random forest accuracy for different numbers of decision trees.

[0071] Figure 4 This is the accuracy analysis chart of the random forest algorithm. DETAILED DESCRIPTION

[0072] Example:

[0073] To illustrate the feasibility and effectiveness of the method proposed in this invention, the present invention takes a power supply company in a certain city as an example, and the training data comes from the statistical data of the power supply company in the past five years. First, the upper limit of the error of the random forest is obtained, which is expressed as follows:

[0074]

[0075] Among them, p * represents the upper limit of the error of the random forest algorithm, s represents the average strength of each decision tree in the random forest, and ρ represents the average correlation value between decision trees. It can be seen that the upper limit of the generalization error decreases with the increase of the average strength of the child decision tree and is proportional to the average value of the correlation between the child decision trees.

[0076] The number m of randomly selected sample attributes in the random forest generation process has a significant impact on generalization error and model training. Assuming that the total number of sample attributes is M, one attribute is selected for each split. In the extreme case of m = M, the random forest algorithm is simplified to a decision tree algorithm. Current research shows that when m is log2M, the generalization error result is optimal.

[0077] Another key parameter in the algorithm is the number of decision trees, denoted by C. It is important to note that a larger value of C does not necessarily mean better performance. As the number of decision trees increases, the classification accuracy of random forests gradually improves and converges better. However, when C reaches a certain threshold, the algorithm tends to stabilize. Beyond this point, increasing C will lead to diminishing returns and decreased operational efficiency.

[0078] Therefore, finding the best balance point requires continuous testing and refinement in the actual process. In order to ensure high accuracy, low omission rate and reduce algorithm complexity when determining the results, the present invention selects values ​​of 10, 20, 30, 50, 70 and 100 to generate the random forest algorithm. Subsequently, the diagnostic results of the random forest algorithm with different numbers of decision trees are evaluated to evaluate the performance of the random forest algorithm, such as Figure 3 As shown. Figure 3 As can be seen from the figure, as the number of decision trees increases, the accuracy of the model gradually improves. However, beyond 50 trees, the improvement in accuracy becomes negligible. Therefore, the optimal number of decision trees is determined to be 50.

[0079] Figure 4 This is the accuracy analysis chart of the random forest algorithm. Figure 4 All three algorithms shown in the table use 20% of the original dataset to verify accuracy. Figure 4 It can be seen that the accuracy of the random forest classification model proposed in the present invention is improved by 8% and 12% respectively. This once again confirms the superiority of the algorithm model of the present invention.

Claims

1. A power supply fault prediction method based on random forest algorithm, characterized by It includes the following steps: Step 1: Collect the original data of power grid equipment and process the missing values and outliers in the original data; Step 2: Utilize the data processed in Step 1 to construct a decision tree combination model for power grid equipment evaluation through the random forest algorithm; Step 3: Based on the decision tree combination model constructed in Step 2, improve the classification performance and calculation efficiency of the random forest algorithm by optimizing the sample attributes and the number of decision trees; Step 4: On the basis of Step 3, define multiple metrics to evaluate the decision tree combination model constructed in Step 2.

2. The method for predicting power supply failure based on random forest algorithm according to claim 1 is characterized in that: The following steps are included in Step 1: (1) Missing value processing: After collecting the original data of power grid equipment, for the missing values in the data, identify the rows or columns containing missing values, and select to delete this data according to the number and impact degree of the missing values; (2) Outlier processing: The Z-score method can be used to detect outliers in the data, and the calculation formula is: Where: x i is the data point; μ is the mean of all data points; σ is the standard deviation of all data points; Z i The absolute value of represents the distance between the score within the standard deviation and the overall mean. The threshold is generally set to 2.

5. i |When it is greater than the threshold, it can be determined as an outlier.

3. The method for predicting power supply failure based on random forest algorithm according to claim 1 is characterized in that: In Step 2, each decision tree in the random forest is called a base learner; the CART decision uses the Gini index to select the optimal feature; if a sample set has K attribute classes, the probability that a sample point belongs to K attribute classes is denoted as, then the Gini index is defined as: In formula (2), Gini(p) represents the Gini index of data set p, p k Indicates the proportion of category k in the data set, and K represents the number of categories; As can be seen from formula (2), the Gini index describes the weighted probability expectation of a sample point being misclassified, where each probability is represented by p k , and as weight; In the case of a binary classification problem, a sample point either belongs to the first class with a probability of "p" or belongs to the second class with a probability of "1 - p". Substituting these probabilities into Equation (2) gives: Gini(p) = p(1 - p) + (1 - p)(1 - (1 - p)) = 2p(1 - p) (3); If the samples are separated by an attribute, the weights of the sub-samples need to be considered when calculating the Gini coefficient; the sample set D is divided into two data subsets D1 and D2 according to the feature measure A, then the Gini coefficient of the set D under the condition A is defined as: In Equation (4), Gini(D1) represents the Gini index of the data subset D1, Gini(D2) represents the Gini index of the data subset D2, |D1|, |D2| are the number of samples in D1 and D2 respectively, |D| is the total number of samples, and Gini(D, A) is the Gini coefficient of the set D after being divided by A = a; the larger the Gini coefficient, the greater the uncertainty of the sample set.

4. The method for predicting power supply failure based on random forest algorithm according to claim 3 is characterized in that: Suppose there is a sample set S = {S1, S2, ..., S n }, a forest is randomly constructed by multiple CART decision trees; each decision tree in the forest is constructed independently, not associated with other decision trees, and acts as an independent weak classifier, so no pruning is required; each decision tree in the random forest provides its own decision results; finally, the option with the most votes is selected as the final result; the specific process is as follows; S2-1: Sample random extraction: Suppose the training sample set contains n object data, and the bootstrap resampling technique is used to randomly extract n samples. The decision tree model constructed by these samples is a single decision tree; each extraction will generate a unique sample subset for training a single decision tree; S2-2: Feature random selection: Each sample in the data set contains M attributes; during the splitting process of each node of the decision tree, randomly select m attributes from the M attributes, m << M, without replacement; subsequently, the attribute with the smallest Gini coefficient is designated as the splitting attribute of the node in the m-attribute subset; during the growth process of the entire decision tree, the value of m remains unchanged; S2-3: Repeat S2-1 and S2-2, train and generate a total of n CART decision trees, and all the trees grow to the maximum extent without pruning, finally forming a forest; S2-4: The prediction results of these trees are aggregated through a majority voting mechanism to determine the category of each sample, that is, whether a fault occurs or not.

5. The method for predicting power supply failure based on random forest algorithm according to claim 1 is characterized in that: In step 3, the upper limit of the error of the random forest is first obtained, which is expressed as follows: Among them, p * represents the upper limit of the error of the random forest algorithm, s represents the average strength of each decision tree in the random forest, and ρ represents the average correlation value between decision trees; the upper limit of the generalization error decreases with the increase of the average strength of the child decision tree, and is proportional to the average value of the correlation between the child decision trees; The number m of sample attributes randomly selected during the random forest generation process has a significant impact on the generalization error and model training; assuming that the total number of sample attributes is M, one attribute is selected for each split. In the extreme case of m=M, the random forest algorithm is simplified to a decision tree algorithm; when m is log2M, the generalization error result is optimal.

6. The method for predicting power supply failure based on random forest algorithm according to claim 5 is characterized in that: Another key parameter in the random forest algorithm is the number of decision trees, denoted by C; the optimal number of decision trees, C, is determined to be 50.

7. The method for predicting power supply failure based on random forest algorithm according to claim 1 is characterized in that: In step 4, in the binary classification problem, the actual value and the predicted value can only be (1, 0), where 1 means that both the actual value and the predicted value are true and positive; 0 means that both the actual value and the predicted value are false and negative; the comparison result of the actual value and the predicted value is recorded as N(i, j), and the formula of the parameter true positive (TP) is as follows: Among them, N k (1,1) represents the true positive example (TP) of category k; n represents the total number of samples, that is, the number of samples involved in classification; k is the number of test sets. n and k in the following formula also have the same meaning; The formula for the parameter false negative (FN) is: Among them, N k (1,0) represents the number of samples that are actually positive (1) but predicted to be negative (0) under category k, i.e., false negatives (FN); The formula for the parameter false positive (FP) is: Among them, N k (0,1) represents the number of samples in category k that are actually negative (0) but predicted to be positive (1); The formula for the parameter true negative (TN) is: Among them, N k (0,0) represents the true negative examples (TN) under category k, that is, the number of samples that are actually negative (0) and correctly predicted as negative (0) by the model; True positives (TP) indicate the total number of entries for which both the sample value decision and the predicted decision of the random forest model are repair; false negatives (FN) indicate the total number of entries for which the sample value decision is repair but the predicted decision of the random forest model is replacement; false positives (FP) indicate the total number of entries for which the sample value decision is replacement but the predicted decision of the random forest model is repair; true negatives (TN) indicate the total number of entries for which the sample value decision and the predicted decision of the random forest model are mutually alternative.

8. The method for predicting power supply failure based on random forest algorithm according to claim 7 is characterized in that: The operational evaluation of the random forest model is defined as follows: Recall is used to measure how many faulty devices the model can identify among the devices that actually have faults. A higher recall rate indicates that the model can effectively detect faulty devices. The evaluation formula is: Accuracy refers to the ratio of the number of correct judgments of the classification model to the total number of results. The calculation formula for accuracy is: Precision refers to the proportion of correct predictions made by the random forest model in all sets of positive predictions. The accuracy is calculated by the formula:

9. The method for predicting power supply failure based on random forest algorithm according to claim 8 is characterized in that: In the actual modeling process, recall rate and precision rate are often weighed against each other. In order to find a balance point, an indicator F1 score is proposed. The F1 score takes into account both recall rate and precision rate, and strives to achieve the highest value of both at the same time to achieve a balance. The calculation formula is as follows:

Citation Information

Cited By

  • Composite material structure damage probability evaluation method and device and electronic equipment

    CN121011279A