Anomaly detection method for hydropower station data based on improved isolation forest algorithm

By improving the isolated forest algorithm and combining with the differential evolution algorithm to automatically select hyperparameters, the problem of difficulty in abnormal detection in hydropower station data cleaning is solved, and the accurate abnormal detection of hydropower station operation data is achieved, and the accuracy and efficiency of detection is improved.

CN114968706BActive Publication Date: 2025-04-29HOHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210491096.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-07
Publication Date
2025-04-29
Estimated Expiration
2042-05-07

AI Technical Summary

Technical Problem

The existing technology lacks adaptability in the field of hydropower station data cleaning, and cannot effectively detect and restore abnormal data in hydropower station operation data, making it difficult to evaluate the data recovery effect.

Method used

The abnormal detection method of hydropower station data based on improved isolated forest algorithm is adopted, and hyperparameters are automatically selected through differential evolution algorithms, and evolution iteration is limited to avoid over-optimization, so as to realize abnormal detection in intelligent hydropower station operation data.

Benefits of technology

It improves the accuracy of abnormal detection of hydropower station data, avoids the additional workload caused by over-optimization, and can achieve accurate detection of abnormalities in intelligent hydropower station operation data, achieving accurate detection of abnormal data of hydropower stations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114968706B_ABST
    Figure CN114968706B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for detecting abnormal data of an intelligent hydropower station based on an improved isolation forest algorithm, including: improving the isolation forest algorithm in combination with a differential evolution algorithm to realize automatic parameter adjustment of the isolation forest; designing an objective function according to the construction of the forest and the growth mode of the tree in the isolation forest algorithm; avoiding over-optimization by limiting the evolution gradient and determining the appropriate number of evolutionary iterations; performing anomaly detection on the operating data of the unit of the intelligent hydropower station using the optimal hyperparameter solution given by the comprehensive model to obtain the final anomaly detection result. The present invention is applicable to anomaly detection of all slow-variable data of an intelligent hydropower station, and the optimization result of differential evolution improves the accuracy of anomaly detection of hydropower station data. At the same time, by limiting the evolutionary iteration, the extra workload caused by over-optimization is avoided, and accurate detection of anomalies in the operating data of the intelligent hydropower station can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of hydropower station monitoring data mining, relates to a hydropower station abnormal data detection method, and specifically relates to a hydropower station data abnormality detection method based on an improved isolation forest algorithm. Background Art

[0002] As one of the main power generation methods in my country, hydropower generation has a series of advantages such as no fuel cost, long economic life, high degree of automation, and low comprehensive operating cost. It has great development potential and value. In order to achieve safe and stable operation of hydropower stations, it is necessary to track the operating status of hydropower station equipment in real time and build an intelligent monitoring system for hydropower station equipment. Accurate and comprehensive data cleaning is a prerequisite for the monitoring system to accurately analyze the operating conditions and diagnose faults of the units. The data cleaning process of intelligent hydropower stations can be divided into two steps: anomaly detection and anomaly recovery. From the perspective of practical application, as a large and complex coupled system, it is difficult to evaluate the recovery effect of the restored data when the real data is wrong. Therefore, it is very important to detect anomalies in hydropower station data, which can be extended to the specific application research of hydropower station intelligence.

[0003] Although current research has proposed many effective methods for data cleaning, there is no practical application in the field of hydropower station data cleaning. Due to the different regular characteristics of hydropower station operation data and the different sizes of data sets, it cannot have good adaptability.

[0004] Therefore, a new technical solution is needed to solve the above problems. Summary of the invention

[0005] Purpose of the invention: In order to overcome the deficiencies in the prior art, a method for detecting anomalies in hydropower station data based on an improved isolation forest algorithm is provided, which is suitable for slow-moving data of hydropower stations. The automatic selection of parameters improves the accuracy of anomaly detection. At the same time, by limiting evolutionary iterations, the extra workload caused by over-optimization is avoided, and accurate detection of anomalies in the operating data of intelligent hydropower stations can be achieved.

[0006] Technical solution: To achieve the above purpose, the present invention provides a hydropower station data anomaly detection method based on an improved isolation forest algorithm, comprising the following steps:

[0007] S1: Based on the differential evolution algorithm, the isolated Senla algorithm is improved;

[0008] S2: Design the objective function based on the establishment of the isolation forest and the growth mode of the tree;

[0009] S3: Avoid over-optimization by limiting the appropriate evolution gradient and determine the number of evolutionary iterations;

[0010] S4: Use the trained improved isolation forest algorithm to perform anomaly detection on the hydropower station data and obtain the final anomaly detection results.

[0011] Furthermore, in step S1, the differential evolution algorithm is used to improve the isolation forest algorithm, and the specific improvement method is:

[0012] A1: Generate the initial solution of the hyperparameters of the isolation forest based on experience, that is, the initial population. Randomly and uniformly generate M individuals in the solution space, each of which consists of an n-dimensional vector, as expressed by the following formula:

[0013] X i (0)=(x i,1 (0),x i,2 (0),x i,3 (0),…,x i,n (0)) (1)

[0014] Where i = 1, 2, 3, ..., M. The value of the jth dimension of the i-th individual is determined as follows:

[0015] X i,j =L j_min +rand(0,1)·(L j_max -L j_min ) (2)

[0016] In the formula, i=1,2,3,…,M; j=1,2,3,…n.

[0017] A2: Differential mutation of the basis vector. A scalable and randomly selected vector difference component is added to the basis vector. In the gth iteration, three individuals X are randomly selected from the population. p1 (g),X p2 (g),X p3 (g) and p1≠p2≠p3≠i, and the corresponding fitness f is obtained at the same time, and the generated mutation vector is:

[0018] V i (g) = X p1 (g)+F·(X p2 (g)-X p3 (g)) (3)

[0019] In the formula, (X p2 (g)-X p3 (g)) is the difference vector, F is the scaling factor, the value is a positive real number, generally a random number between (0,1], which can control the evolution rate of the population. When the evolution strategy is different, the mutation vector generated in this step is also different. The present invention uses the current-to-best algorithm template, and its specific evolution strategy is as follows:

[0020] V i (g) = X p1 (g)+F·(X best (g)-X i (g))+F·(X p2 (g)-X p3 (g)) (4)

[0021] Where, X best is the current best individual.

[0022] A3: Recombining the basis vector and mutation vector. The recombination algorithm is the most effective part of improving the evolutionary algorithm. It generates new individuals by combining the genetic information contained in the mating population. The formula for generating recombinant individuals is as follows:

[0023]

[0024] In the formula, cr∈[0,1] is the crossover probability, h i,j (g) represents the individual after mutation, x i,j (g) represents the original individual.

[0025] A4: Select the experimental individuals after reorganization. It is the process that the offspring formed by the evolutionary operations such as crossover and mutation are retained to the next generation by some method to form a new generation population. The present invention selects explicitly according to fitness, and the selection formula is as follows:

[0026]

[0027] When the fitness of the recombinant individual is higher, the individual is retained to the next generation of the population.

[0028] A5: Repeat the above steps until the evolution termination condition is met, output the optimal isolation forest hyperparameter solution, and build an isolation forest based on it.

[0029] Furthermore, in step S2, the objective function method is designed according to the establishment of the isolation forest and the growth mode of the tree:

[0030] In the Isolation Forest Algorithm, the hyperparameters that need to be set are: the number of trees in the forest n_estimators and the number of samples extracted from each tree max_samples. The objective function is designed from the perspective of the Isolation Forest Algorithm using the weak learner ensemble learning method to enhance the learning effect. The main idea is to improve the accuracy by using a weak learning algorithm and a training set multiple times.

[0031] In the face of large-scale hydropower station operation data sets, in order to ensure the learning effect, the most basic requirement is to train all the hydropower station data at least once. Based on the completely random sampling and replacement sampling method of each weak learner, if the number of trees and the sample size of each tree are too small, some hydropower station data will not be trained. If abnormal samples are not extracted, it will lead to missed judgments. Combined with the time complexity of the isolation forest algorithm of O(tψlog(ψ)), if the number of trees and the sample size of each tree are too large, the efficiency of hydropower station data anomaly detection will be reduced and the cost will increase. Therefore, the objective function here is designed to minimize the number of samples that have not been extracted in the data set while minimizing the time complexity.

[0032] The method of the present invention constructs a mathematical model of the objective function as follows:

[0033] It is known that the total number of samples in the hydropower station data set to be tested is x. Assume that the number of trees is n, the number of samples drawn from each tree is m, and x is less than m·n, which is the total number of samples drawn.

[0034] Define the random variable x i as follows:

[0035]

[0036] Because the isolation forest used in the method of the present invention is completely randomly sampled, and the samples are replaced after each sampling, there is x i Independent and identically distributed, the probability that the i-th sample is not extracted is as follows:

[0037]

[0038] Combine x i Independent and identically distributed, so the mathematical expectation of the number of hydropower station data that are not extracted by a certain tree is as follows:

[0039]

[0040] At this point, the objective function required by the method of the present invention is obtained, that is, the function of the number of samples in the hydropower station operation data set that are not extracted by any isolated tree, and its dependent variables are the number of isolated trees in the isolation forest and the number of samples extracted from each tree.

[0041] Furthermore, in step S3, over-optimization is avoided by limiting the appropriate evolution gradient, and the method for determining the number of evolution iterations is:

[0042] According to the differential evolution algorithm and the characteristics of hydropower station operation data, the evolution stop gradient k is set to 1×10 -9, when the value of the next iteration of evolution objective function towards optimization is less than the gradient, the evolution stops.

[0043] The confusion matrix method was used for the final data test. A labeled hydropower station slow-variable operation data set was input into the improved isolation forest model in this method, and the recall rate, precision rate and F1 value were used as the final evaluation results of the anomaly detection model.

[0044] The method of the present invention comprises: improving the isolation forest algorithm in combination with the differential evolution algorithm to realize the automatic parameter adjustment of the isolation forest; designing the objective function according to the construction of the forest and the growth mode of the tree in the isolation forest algorithm; avoiding over-optimization by limiting the evolution gradient and determining the appropriate number of evolution iterations; performing anomaly detection on the operation data of the intelligent hydropower station unit according to the optimal hyperparameter solution given by the comprehensive model to obtain the final anomaly detection result.

[0045] The present invention is applicable to all slow-variable data anomaly detection of intelligent hydropower stations. The optimization results of differential evolution improve the accuracy of data anomaly detection of hydropower stations. At the same time, by limiting evolutionary iterations, the extra workload caused by over-optimization is avoided, and accurate anomaly detection in the operating data of intelligent hydropower stations can be achieved.

[0046] Beneficial effect: Compared with the prior art, the invention is innovative in that the differential evolution algorithm is used to improve the isolation forest algorithm in view of the poor effect of the classic parameters of the isolation forest algorithm, and automatic parameter adjustment is realized. It is suitable for all slow-variable data anomaly detection of intelligent hydropower stations, and the optimization results of differential evolution improve the accuracy of anomaly detection of hydropower station data. At the same time, by limiting the evolutionary iterations, the extra workload caused by over-optimization is avoided, and accurate detection of anomalies in the operating data of intelligent hydropower stations can be achieved, achieving accurate detection of abnormal data in hydropower stations. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 This is a flowchart of the improved abnormal detection of isolated forest hydropower station of the present invention;

[0048] Figure 2 A line graph of the oil level temperature of the No. 1 main transformer simulated and analyzed in an embodiment of the present invention;

[0049] Figure 3 Iteration diagram of the objective function value of the differential evolution algorithm simulated and analyzed in the embodiment of the present invention;

[0050] Figure 4 The improved automated isolation forest anomaly detection result diagram of the simulation analysis of the embodiment of the present invention;

[0051] Figure 5 This is a diagram showing the comparison results of anomaly detection based on the simulation analysis of an embodiment of the present invention. DETAILED DESCRIPTION

[0052] The present invention is further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.

[0053] The present invention provides a method for detecting anomaly in hydropower station data based on an improved isolation forest algorithm. Figure 1 , which comprises the following steps:

[0054] S1: Based on the differential evolution algorithm, the isolated Senla algorithm is improved;

[0055] S2: Design objective function based on improving the establishment of isolated forest and the growth mode of trees;

[0056] S3: Avoid over-optimization by limiting the appropriate evolution gradient and determine the number of evolutionary iterations;

[0057] S4: Use the trained improved isolation forest algorithm to perform anomaly detection on the hydropower station data and obtain the final anomaly detection results.

[0058] In step S1 of this embodiment, the differential evolution algorithm is used to improve the isolation forest algorithm. The specific method includes the following:

[0059] A1: Generate the initial solution of the hyperparameters of the isolation forest based on experience, that is, the initial population. Randomly and uniformly generate M individuals in the solution space, each of which consists of an n-dimensional vector, as expressed by the following formula:

[0060] X i (0)=(x i,1 (0),x i,2 (0),x i,3 (0),…,x i,n (0)) (1)

[0061] Where i = 1, 2, 3, ..., M. The value of the jth dimension of the i-th individual is determined as follows:

[0062] X i,j =L j_min +rand(0,1)·(L j_max -L j_min ) (2)

[0063] In the formula, i=1,2,3,…,M; j=1,2,3,…n.

[0064] A2: Differential mutation of the basis vector. A scalable and randomly selected vector difference component is added to the basis vector. In the gth iteration, three individuals X are randomly selected from the population.p1 (g),X p2 (g),X p3 (g) and p1≠p2≠p3≠i, and the corresponding fitness f is obtained at the same time, and the generated mutation vector is:

[0065] V i (g) = X p1 (g)+F·(X p2 (g)-X p3 (g)) (3)

[0066] In the formula, (X p2 (g)-X p3 (g)) is the difference vector, F is the scaling factor, the value is a positive real number, generally a random number between (0,1], which can control the evolution rate of the population. When the evolution strategy is different, the mutation vector generated in this step is also different. In the present invention, the current-to-best algorithm template is selected, and its specific evolution strategy is as follows:

[0067] V i (g) = X p1 (g)+F·(X best (g)-X i (g))+F·(X p2 (g)-X p3 (g)) (4)

[0068] Where, X best is the current best individual.

[0069] A3: Recombining the basis vector and mutation vector. The recombination algorithm is the most effective part of improving the evolutionary algorithm. It generates new individuals by combining the genetic information contained in the mating population. The formula for generating recombinant individuals is as follows:

[0070]

[0071] In the formula, cr∈[0,1] is the crossover probability, h i,j (g) represents the individual after mutation, x i,j (g) represents the original individual.

[0072] A4: Select the experimental individuals after reorganization. It is the process of retaining the offspring formed by the evolutionary operations such as crossover and mutation to the next generation in a certain way to form a new generation of population. This paper selects explicitly based on fitness, and the selection formula is as follows:

[0073]

[0074] When the fitness of the recombinant individual is higher, the individual is retained to the next generation of the population.

[0075] A5: Repeat the above steps until the evolution termination condition is met, output the optimal isolation forest hyperparameter solution, and build an isolation forest based on it.

[0076] In step S2 of this embodiment, the objective function is designed according to the establishment of the isolation forest and the growth mode of the trees as follows:

[0077] In the Isolation Forest Algorithm, the hyperparameters that need to be set are: the number of trees in the forest n_estimators and the number of samples extracted from each tree max_samples. The objective function is designed from the perspective of the Isolation Forest Algorithm using the weak learner ensemble learning method to enhance the learning effect. The main idea is to improve the accuracy by using a weak learning algorithm and a training set multiple times.

[0078] In the face of large-scale hydropower station operation data sets, in order to ensure the learning effect, the most basic requirement is to train all the data of the hydropower station at least once. Based on the completely random sampling and replacement sampling method of each weak learner, if the number of trees and the sample size of each tree are too small, some hydropower station data will not be trained. If abnormal samples are not extracted, it will lead to missed judgments. Combined with the time complexity of the isolation forest algorithm of O(tψlog(ψ)), if the number of trees and the sample size of each tree are too large, the efficiency of anomaly detection of hydropower station data will be reduced and the cost will increase. Therefore, the objective function here is designed to minimize the number of samples that have not been extracted in the data set while minimizing the time complexity. This method will construct the mathematical model of the objective function as follows:

[0079] It is known that the total number of samples in the hydropower station data set to be tested is x. Assume that the number of trees is n, the number of samples drawn from each tree is m, and x is less than m·n, which is the total number of samples drawn.

[0080] Define the random variable x i as follows:

[0081]

[0082] Because the isolation forest used in the present invention is completely randomly sampled, and the samples are replaced after each sampling, there is x i Independent and identically distributed, the probability that the i-th sample is not extracted is as follows:

[0083]

[0084] Combine x i Independent and identically distributed, so the mathematical expectation of the number of hydropower station data that are not extracted by a certain tree is as follows:

[0085]

[0086] At this point, the objective function required by the method of the present invention is obtained, that is, the function of the number of samples in the hydropower station operation data set that are not extracted by any isolated tree, and its dependent variables are the number of isolated trees in the isolation forest and the number of samples extracted from each tree.

[0087] In step S3 of this embodiment, over-optimization is avoided by limiting the appropriate evolution gradient, and the method for determining the number of evolution iterations is:

[0088] According to the differential evolution algorithm and the characteristics of hydropower station operation data, the evolution stop gradient k is set to 1×10 -9 , when the value of the next iteration of evolution objective function towards optimization is less than the gradient, the evolution stops.

[0089] In step S4 of this embodiment, the trained improved isolation forest algorithm is used to perform anomaly detection training and testing on the hydropower station data. Specifically, a labeled hydropower station slow-variable operation data set is input into the improved isolation forest model in this method, and finally the recall rate, precision rate and F1 value are used as the final evaluation results of the anomaly detection model.

[0090] The confusion matrix method was used for the final data test. A labeled hydropower station slow-variable operation data set was input into the improved isolation forest model of the present invention, and the recall rate, accuracy rate and F1 value were used as the final evaluation results of the anomaly detection model.

[0091] Based on the above scheme, in order to verify the actual effect of the scheme of the present invention, the following simulation experiments and simulation analysis are carried out:

[0092] This embodiment is simulated and verified on the PyCharm platform. In this embodiment, a workstation database of a hydropower station in Taizhou, Zhejiang Province is used for experimental analysis. This workstation database records the annual operation data of the hydropower station from 2017 to 2020. The experimental link of this embodiment selects the oil level temperature of the No. 1 main transformer of the pumped storage power station as the experimental object, and selects a total of 42,507 data from May 5 to May 6, 2017 as the analysis object. Figure 2 The following is a line graph of the analysis object. When the unit is started, the oil level temperature of the main transformer begins to rise in a logarithmic form, and when the unit is stopped, the oil level temperature of the main transformer begins to drop in a logarithmic form.

[0093] Temperature data is a slow-changing data, which generally does not have sudden changes in value at a certain moment. Its theoretical line chart should show a consistent fluctuation trend. Figure 2It can be seen that in the temperature rising stage, that is, the unit operating condition, there are multiple, single samples with sharp increases in values, that is, abnormal data. On the contrary, in the temperature falling stage representing the unit stopping condition, no samples with sharp changes in values ​​were found, that is, no data mutation abnormality occurred.

[0094] Since the temperature data is affected by the start and stop of the unit, the temperature rises when the unit is in operation and drops when the unit is stopped, which has a certain periodicity, and the data regularity and abnormal characteristics are similar in each start and stop cycle of the unit. In order to show the simulation results more clearly, this embodiment only selects the data segments of the two complete temperature rise and fall processes in the data as cleaning cases. In this simulation experiment, the data segments with serial numbers 7215 to 25396 in this group of data are selected, totaling 18182 temperature data samples.

[0095] 1. Automated hyperparameter selection

[0096] After obtaining the objective function required by the differential evolution algorithm, this embodiment will use artificial experience to give the approximate value range of the number of hyperparameter trees n_estimators and the number of samples extracted from each tree max_samples, where the upper limit of the number of trees is the total number of samples. The sample size of each tree is about 4 times the number of trees, which is used as the constraint condition of the objective function. In this embodiment, the number of trees ranges from 10 to 600, and the number of samples on each tree ranges from 155 to 2200. In the hydropower station data cleaning, depending on the amount of data to be cleaned, the stop gradient k is set to 1×10 -9 That is, if the value of the next evolutionary objective function changes less than k in the optimization direction, the optimization is stopped to avoid unnecessary increase in the time complexity of subsequent use of isolation forests to detect anomalies due to excessive optimization iterations. In the case of hydropower station data cleaning in this embodiment, the stopping gradient represents the number of samples that have not been extracted by a certain isolated tree.

[0097] Based on this, we input the objective function to be optimized, the constraints of the objective function, the stop gradient of the evolution, set the scaling factor to 0.5, the recombination probability to 0.7, and use the differential evolution algorithm to get the objective function value iteration as follows: Figure 3 As shown. The evolution finally stops at the eighth iteration, and the corresponding objective function size is 9.80859×10 -11 , the number of isolated trees corresponding to the optimal solution is 548, and the number of samples extracted from each tree is 2200.

[0098] 2. Improved analysis of isolation forest anomaly detection results

[0099] After obtaining the hyperparameters through the differential evolution algorithm, they are input into the isolation forest model. The model anomaly detection results are as follows: Figure 4 shown.

[0100] like Figure 4 As shown, the identified abnormal data is indicated by marking in red. The improved isolation forest algorithm proposed in this embodiment realizes the identification of abnormal data occurring during the operation of the unit. There is no misjudgment for the period when no abnormality occurs during the unit stop. Only a small amount of misjudgment occurs when the unit is just started, and the detection effect is better.

[0101] In order to demonstrate the superiority of the method proposed in this embodiment, the traditional isolation forest algorithm and several typical methods based on different anomaly detection principles are used to detect anomalies on the data set, including the isolation forest algorithm based on anomaly sets, the LOF algorithm based on proximity, the DBSCAN algorithm based on density, the MCD algorithm based on linear models, and the ABOD algorithm based on probability. This embodiment uses the F-score based on the confusion matrix to quantitatively analyze the effect of anomaly detection, and evaluates the detection effects of these methods by calculating the recall rate and accuracy indicators.

[0102] In order to make the results more objective, each algorithm was tested 100 times and the average value was taken. The results are shown in Table 1. In order to more clearly compare the test results of different algorithms, the obtained results are visualized, as shown in Table 1. Figure 5 shown. Figure 5 In the figure, the results are from left to right: the improved isolation forest algorithm proposed by the present invention, the traditional isolation forest algorithm, the local anomaly factor algorithm, the density clustering algorithm, the minimum covariance determinant algorithm, and the angle-based outlier detection algorithm. The above methods are compared from the recall rate, accuracy rate, F1 value, and algorithm time consumption. The recall rate represents the degree of missed judgment of abnormal data by the model. The higher the recall rate, the less missed abnormal data; the accuracy rate represents the degree of misjudgment of normal data by the model. The higher the accuracy rate, the less misjudged normal data; the F1 value represents the overall detection effect of the model. The larger the value, the better the detection effect.

[0103] Table 1. Comparison results of anomaly detection

[0104]

[0105] From the above simulation results, it can be seen that the improved isolation forest model proposed in this embodiment can well identify the abnormal data contained in the data set information, and the recall rate and accuracy are better than other algorithm detection effects. From the perspective of algorithm time consumption, it can be seen from Table 1 that, except for the isolation forest algorithm improved in this embodiment, the isolation forest algorithm is only slightly higher than the LOF algorithm, and its detection effect is second only to the ABOD algorithm, which takes the longest time. Based on this, the isolation forest algorithm proposed in this embodiment optimizes the detection effect by reasonably strengthening the effect of integrated learning while minimizing the time consumption.

Claims

1. A hydropower station data anomaly detection method based on an improved isolation forest algorithm, characterized in that: The steps include: S1: Improve the isolation forest algorithm based on the differential evolution algorithm; S2: Design the objective function based on the establishment of the isolation forest and the growth mode of the tree; S3: Avoid over-optimization by limiting the appropriate evolution gradient and determine the number of evolutionary iterations; S4: Use the trained improved isolation forest algorithm to perform anomaly detection on the hydropower station data to obtain the final anomaly detection results; The improvement of the isolated Senla algorithm in step S1 includes the following steps: A1: Generate the initial solution of the hyperparameters of the isolation forest based on experience, that is, the initial population, and randomly and uniformly generate M individuals in the solution space. Each individual consists of an n-dimensional vector, as expressed in the following formula: X i (0)=(x i,1 (0),x i,2 (0),x i,3 (0),…,x i,n (0)) (1) Where i = 1, 2, 3, ..., M, and the j-th dimension value of the i-th individual is taken as follows: X i,j =L j_min +rand(0,1)·(L j_max -L j_min ) (2) Where, i = 1, 2, 3, ..., M; j = 1, 2, 3, ... n; A2: Differential mutation of basis vectors: A scalable and randomly selected vector difference component is added to the basis vector. In the gth iteration, three individuals X are randomly selected from the population. p1 (g),X p2 (g),X p3 (g) and p1≠p2≠p3≠i, and the corresponding fitness f is obtained at the same time, and the generated mutation vector is: V i (g)=X p1 (g)+F·(X p2 (g)-X p3 (g)) (3) In the formula, (X p2 (g)-X p3 (g)) is the difference vector, F is the scaling factor, and the mutation vector generated by this step is different when the evolution strategy is different. A3: Reorganize the basis vector and mutation vector: The formula for generating recombinant individuals is as follows: In the formula, cr∈[0,1] is the crossover probability, h i,j (g) represents the individual after mutation, x i,j (g) represents the original individual; A4: Select the experimental individuals after reorganization. The selection formula is as follows: When the fitness of the recombinant individual is higher, the individual is retained to the next generation of the population; A5: Repeat the above steps until the evolution termination condition is met, output the optimal isolation forest hyperparameter solution, and build an isolation forest based on it; In step A2, the current-to-best algorithm template is selected, and its specific evolution strategy is as follows: V i (g)=X p1 (g)+F·(X best (g)-X i (g))+F·(X p2 (g)-X p3 (g))(4) Where, X best is the current optimal individual; The design method of the objective function in step S2 is: Construct a mathematical model of the objective function: The total number of samples in the hydropower station data set to be tested is known to be x. Assume that the number of trees is n, the number of samples extracted from each tree is m, and x is less than m·n, which is the total number of samples extracted. Define the random variable x i as follows: x i Independent and identically distributed, the probability that the i-th sample is not extracted is as follows: Combine x i Independent and identically distributed, so the mathematical expectation of the number of hydropower station data that are not extracted by a certain tree is as follows: The required objective function is obtained, which is the function of the number of samples in the hydropower station operation data set that are not extracted by any isolated tree. Its dependent variables are the number of isolated trees in the isolation forest and the number of samples extracted from each tree.

2. The hydropower station data anomaly detection method based on the improved isolation forest algorithm according to claim 1 is characterized in that: In step S3, over-optimization is avoided by limiting the appropriate evolution gradient, and the method for determining the number of evolution iterations is: According to the differential evolution algorithm and the characteristics of hydropower station operation data, the evolution stop gradient k is set, and the evolution is stopped when the value of the next iterative evolution objective function changes towards the optimization direction is less than the gradient.

3. The hydropower station data anomaly detection method based on the improved isolation forest algorithm according to claim 1 is characterized in that: The specific method of using the trained improved isolation forest algorithm to perform anomaly detection on the hydropower station data in step S4 is: inputting a labeled hydropower station slow variable operation data set into the improved isolation forest model to obtain the final anomaly detection result.

4. The hydropower station data anomaly detection method based on the improved isolation forest algorithm according to claim 1 is characterized in that: In step S4, the recall rate, precision rate and F1 value are finally used as the final evaluation results of the anomaly detection model.

Citation Information

Patent Citations

  • Isolated forest underwater artificial target detection method based on genetic algorithm

    CN110503629A

  • Time series robust efficient modeling method based on isolated forest and extreme learning machine

    CN111159259A