A lightning stroke risk assessment method and device based on machine learning and a storage medium
By optimizing the semi-supervised K-means algorithm and LapSVM model using machine learning, and combining it with the PSO algorithm to optimize hyperparameters, the problems of data imbalance and subjective factors in lightning strike risk assessment were solved, achieving a higher accuracy in lightning strike risk assessment.
Patent Information
- Application Number
- CN202311105257.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-30
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2043-08-30
AI Technical Summary
Existing methods for assessing lightning risk mainly rely on the analytic hierarchy process (AHP) and entropy weighting, which are subject to subjective factors in weight allocation, cannot verify the accuracy of the assessment results, and cannot effectively address the problem of imbalanced lightning data.
A machine learning-based approach was adopted, using the semi-supervised K-means algorithm to label data, constructing a LapSVM model and combining it with the PSO algorithm to optimize hyperparameters. Lightning strike risk assessment was conducted in a data-driven manner, including data preprocessing, dataset partitioning, model training and validation, eliminating subjective factors and utilizing the data structure information of unlabeled samples.
It improves the accuracy of lightning strike risk assessment, solves the data imbalance problem, ensures the accuracy of assessment results, reduces reliance on labeled data, and achieves more efficient risk assessment.
Smart Images

Figure CN117056690B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of lightning risk assessment, in particular to a lightning risk assessment method and device based on machine learning and a storage medium. BACKGROUND
[0002] Extreme natural disasters can cause serious damage to power facilities, and wind power generation is hindered, resulting in power grid outages in local areas and further triggering power grid blackout emergency situations. As a common phenomenon in nature, lightning has become one of the main natural disasters threatening the safe and reliable operation of wind turbines. With the increasing height of wind turbines, wind turbines have moved from land to coast and wind farms have moved towards large-scale and clusterization, and the threat of lightning has also increased. When lightning occurs, lightning current flows through the lightning arrester and grounding device into the ground. For a long time, lightning has caused frequent accidents such as wind turbine blade rupture, fracture, and internal device damage, which has posed a great threat to the safe and reliable operation of wind turbines. As an important part of risk management, lightning risk assessment can provide a reference for improving the lightning protection capability of wind farms and wind farm design, therefore, it is necessary to conduct lightning risk assessment. Current lightning risk assessment is mainly carried out by analytic hierarchy process and entropy weight method, which has subjective factors in weight distribution and cannot verify the accuracy of the evaluation results. SUMMARY
[0003] The purpose of the present application is to provide a lightning risk assessment method and device based on machine learning and a storage medium, which is completely data-driven, removes subjective factors in risk assessment, solves the problem of unbalanced lightning data, and improves the accuracy of lightning risk assessment.
[0004] The purpose of the present application can be achieved by the following technical solutions:
[0005] A lightning risk assessment method based on machine learning, comprising the following steps:
[0006] S1, acquiring lightning data, wind farm related data and lightning disaster data and performing data preprocessing to construct a data set;
[0007] S2, marking the data set based on a semi-supervised K-means algorithm and dividing it into a training set and a validation set, wherein the data set is marked as lightning disaster data, non-lightning disaster data and unmarked data;
[0008] S3, constructing a LapSVM model and a PSO algorithm and initializing parameters, the LapSVM model is used for prediction according to input data, and outputs a lightning risk probability, the PSO algorithm optimizes the hyperparameters of the LapSVM model;
[0009] S4, input the training set data into the initial LapSVM model, train the model, generate the lightning risk probability according to the data label and the model parameter, evaluate the model performance using ROC-AUC and 5-fold cross-validation, and optimize the LapSVM model parameter using the PSO algorithm, when the termination condition is met, determine the optimal hyperparameter of the LapSVM model, and verify the model performance using the verification set;
[0010] S5, input the lightning data to be evaluated and the wind field related data as input, use the trained LapSVM model to evaluate the lightning risk, and output the lightning risk probability.
[0011] The data preprocessing includes data cleaning, data gridding and data normalization, wherein the data cleaning is used to eliminate the lightning data with peak value of 0-2kA and greater than 200kA, and the data gridding is used to fill all data into the corresponding latitude and longitude grid according to the occurrence position.
[0012] The labeling of the data set based on the semi-supervised K-means algorithm specifically includes the following steps:
[0013] S21, set the initial clustering center, regard N lightning disaster data as positive samples and mark them as 1, and take the center as a lightning disaster clustering center, and randomly select N data from the remaining data as N lightning disaster clustering centers;
[0014] S22, based on the semi-supervised K-means algorithm, calculate the distance between the unmarked samples and each clustering center, cluster the unmarked samples, and keep the membership relationship between the lightning disaster data and the lightning disaster clustering center unchanged;
[0015] S23, update the clustering center according to the clustered data;
[0016] S24, judge whether the clustering center changes, if it changes, return to step S22 to continue clustering, if it does not change, it means that the current clustering center is the optimal clustering center;
[0017] S25, regard the data closest to the N optimal lightning disaster clustering centers as negative samples and mark them as-1, and mark the remaining unmarked samples as 0.
[0018] The objective function of the LapSVM model is:
[0019]
[0020] wherein, is the 2-norm of the function f in the reproducing kernel Hilbert space; γ H , γ M is a penalty coefficient; is the manifold regularization term, which is related to the internal structure of data and the edge distribution; y i is the label of the ith data, l is the amount of labeled data, x i is the ith input data.
[0021] The objective function of the LapSVM model is simplified to a quadratic programming problem for solving:
[0022]
[0023]
[0024] subject to:
[0025]
[0026]
[0027] where L is the graph Laplacian, obtained by L=D-W, the diagonal matrix D is obtained by , W ij is the edge weight of data in the adjacency graph, J=[I 0] is an l x (l+u) matrix, I is an l x l unit matrix; Y is a diagonal matrix composed of labels Y=diag(y1,y2,…,y l ), K is the kernel function, u is the amount of unlabeled data, and β is the Laplacian operator.
[0028] The LapSVM model determines the label type of data through a decision function, and the decision function is:
[0029]
[0030] where α is the Lagrange multiplier, obtained by solving the objective function, K is the kernel function, x is the input data, x i is the ith input data, and b is the displacement term.
[0031] The PSO algorithm includes N particles, and the ith particle is represented as a D-dimensional vector X i =(x i1 ,x i2 ,…,x iD ), i=1, 2,…, N, and the velocity of the ith particle is represented as V i =(v i1 ,v i2 ,…,v iD );
[0032] In each iteration, the velocity and position of each particle are updated by the following equations:
[0033] v id =w×v id-1 +c1r1(p id +x id )+c2r2(p gd +x id )
[0034] x id =x id +v id
[0035] Where, p id p is the optimal position of the i-th particle. gd It is the global optimal position, c1 and c2 are learning factors, r1 and r2 are random numbers between 0 and 1, and w is the inertia weight;
[0036] By changing the particle velocity to update the particle position and finally obtaining the global optimal position, corresponding to the optimal hyperparameter.
[0037] In step S4, the termination condition is that the error is less than a preset limit or the number of iterations reaches a preset value.
[0038] A machine learning-based lightning strike risk assessment device includes a memory, a processor, and a program stored in the memory, wherein the processor executes the program to implement the method described above.
[0039] A storage medium having a program stored thereon, which, when executed, implements the method described above.
[0040] Compared with the prior art, the present invention has the following beneficial effects:
[0041] (1) This invention proposes a semi-supervised K-means algorithm to label data, which solves the problem of data imbalance and prevents positive samples from being labeled as negative samples, thereby improving the evaluation accuracy.
[0042] (2) This invention initializes model parameters by randomly dividing the data into training and validation sets. The training set data is then input into the initial LapSVM model. ROC-AUC and 5-fold cross-validation are used to evaluate model performance, and the PSO algorithm is used to optimize the LapSVM model. Finally, the validation set is used to verify model performance. Compared to the traditional analytic hierarchy process (AHP), this method is entirely data-driven, eliminating subjective factors in risk assessment. Using the LapSVM algorithm allows the model to utilize the data structure information of unlabeled samples during training, enabling the model to achieve excellent performance with limited labeled data, thus solving the problem of the extreme difficulty in obtaining labeled data in lightning strike risk assessment. Attached Figure Description
[0043] Figure 1A flow chart of the method of the present application;
[0044] Figure 2 A schematic diagram of a study area in an embodiment of the present application;
[0045] Figure 3 A schematic diagram of the lightning density distribution of a study area in an embodiment of the present application;
[0046] Figure 4 A schematic diagram of the lightning intensity distribution of a study area in an embodiment of the present application;
[0047] Figure 5 A lightning risk assessment result map of a study area in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The present application will be described in detail below with reference to the accompanying drawings and specific embodiments. The present embodiment is implemented on the premise of the technical solution of the present application, and gives a detailed implementation manner and specific operation process, but the protection scope of the present application is not limited to the following embodiments.
[0049] The present embodiment discloses a lightning risk assessment method based on machine learning, and relates to the field of lightning risk assessment. Compared with the traditional analytic hierarchy process, the method is completely data-driven, and subjective factors in risk assessment are removed. The method uses a semi-supervised K-means algorithm to solve the data imbalance problem; uses a LapSVM algorithm, so that the data structure information of unmarked samples can be used when training the model, allowing the model to have excellent performance under limited labeled data, and solving the problem that labeled data is extremely difficult to obtain in lightning risk assessment.
[0050] As shown in Figure 1 , the method specifically comprises the following steps:
[0051] S1, based on a lightning positioning system (Lightning Location System, LLS), lightning data, wind field related data and lightning disaster data are obtained and data preprocessing is performed, data with an amplitude of 0-2kA and greater than 200kA is removed by using data cleaning, and then the cleaned data is subjected to data gridding and data normalization processing to construct a data set;
[0052] After data cleaning, all data is filled into the corresponding latitude and longitude grid according to the occurrence position to realize gridding.
[0053] The grid that has caused lightning disaster is considered as a positive sample and is marked as 1. All samples are normalized using the function x=(x min -x max ) / (x min ), and the normalized value is in the range of 0-1.
[0054] S2, label the data set based on the semi-supervised K-means algorithm, take N thunder disaster data as positive samples, and randomly select N from the unlabeled data as negative sample clustering centers, use the semi-supervised K-means algorithm to find the optimal clustering center, and divide it into positive samples, negative samples and unlabeled samples according to the membership between data and clustering. After that, in order to avoid model overfitting, the data is randomly divided into training set (70%) and validation set (30%).
[0055] When labeling the data set based on the semi-supervised K-means algorithm, take the thunder disaster data as labeled data, and the rest of the data as unlabeled data, cluster, and label the non-thunder disaster data after clustering, which includes the following steps:
[0056] S21, set the initial clustering center. Assuming that there are N samples, in order to obtain the clustering center of non-thunder disaster, the number of clusters is set to N+1. Take N thunder disaster data as positive samples and mark them as 1, and take their center as a thunder disaster clustering center, and randomly select N data from the remaining data as N non-thunder disaster clustering centers;
[0057] S22, based on the semi-supervised K-means algorithm, based on the equation d(x k ,x i )=||x k -x i || 2 Calculate the distance between the unlabeled sample and each clustering center, cluster the unlabeled sample, and keep the membership relationship between the thunder disaster data and the thunder disaster clustering center unchanged, wherein x k is the clustering center and x i is the unlabeled sample;
[0058] S23, update the clustering center according to the clustered data;
[0059] S24, judge whether the clustering center has changed, if it has changed, return to step S22 to continue clustering, if it has not changed, it means that the current clustering center is the optimal clustering center;
[0060] S25, take the data closest to the N optimal non-thunder disaster clustering centers as negative samples and mark them as -1, and mark the remaining unlabeled samples as 0.
[0061] The semi-supervised K-means algorithm process is shown in Table 1.
[0062] Table 1 Semi-supervised K-means algorithm process
[0063]
[0064]
[0065] S3, construct a Laplacian support vector machine (Laplacian Support Vector Machine, LapSVM) model and a particle swarm optimization (Particle Swarm Optimization, PSO) algorithm, and initialize parameters.
[0066] In this embodiment, the PSO parameter initialization is set as: iteration number = 100, particle number N = 10. The LapSVM parameter range is set as: γ H ∈[0.001,1000],γ M ∈[0.001,1000],g=1 / 2σ 2 ∈[0.001,1000]。
[0067] S4, input the training set data into the initial LapSVM model, train the model, generate the lightning risk probability according to the data label and the model parameter, use ROC-AUC and 5-fold cross validation to evaluate the model performance, use PSO algorithm to optimize the LapSVM model parameter, when the termination condition is met, determine the optimal hyperparameter of the LapSVM model, and use the verification set to verify the model performance.
[0068] Unlike the traditional analytic hierarchy process, the present application uses the LapSVM algorithm of machine learning, which is completely data-driven, eliminates the subjective factors in the evaluation, and is based on the manifold hypothesis, which can obtain the edge geometric distribution information of the data, and overcomes the problem of requiring a large amount of labeled data for the remaining machine learning algorithms.
[0069] The LapSVM model judges the data label type through a decision function, and the decision function is:
[0070]
[0071] Wherein, α is the Lagrange multiplier, obtained by solving the objective function, K is the kernel function, x is the input data, x i is the i-th input data, and b is the displacement term.
[0072] The kernel function is generally divided into linear kernel, Gaussian kernel, Laplace kernel and sigmoid kernel function. The Gaussian kernel has few parameters, low complexity, and excellent performance in processing nonlinear problems. Therefore, the Gaussian kernel is selected as the kernel function used in this embodiment.
[0073]
[0074] In order to maximize the distance between the hyperplane and the support vector, the optimization problem can be represented as:
[0075]
[0076] where, is the 2-norm of function f in the reproducing kernel Hilbert space, γ H is the related penalty coefficient, controlling the complexity of function in the domain, is the manifold regularization term, which is related to the internal structure and marginal distribution of data, γ M is the related penalty coefficient, y i is the label of the i-th data, l is the amount of labeled data. and can be expressed as:
[0077]
[0078]
[0079] where W ij is the edge weight of data in the adjacency graph, f = [f(x1),..., f(x l+u )] T , L is the graph Laplacian, obtained by L = D - W; the diagonal matrix D is obtained by .
[0080] By introducing the relaxation variable, the objective function of LapSVM can be expressed as:
[0081]
[0082]
[0083] After using the Lagrange multiplier, the partial derivative can be obtained:
[0084]
[0085]
[0086] subject to:
[0087]
[0088]
[0089] where L is the graph Laplacian, obtained by L = D - W, the diagonal matrix D is obtained by , W ij is the edge weight of data in the adjacency graph, J = [I 0] is an l x (l + u) matrix, I is an l x l unit matrix, Y is a diagonal matrix composed of labels Y = diag(y1, y2,..., y l), K is a kernel function, u is the amount of unlabeled data, and β is a Laplacian operator.
[0090] By the above method, the objective function can be simplified as a standard quadratic programming problem. α can be obtained by solving the equation. Then, the decision function can be calculated to determine the lightning risk probability.
[0091] Using the PSO algorithm to obtain the optimal hyperparameter γ of LapSVM H , γ M , σ, eliminating subjective factors in the process of optimizing hyperparameters. The PSO algorithm contains N particles, the i-th particle is represented as a D-dimensional vector X i =(x i1 ,x i2 ,…,x iD ), i=1,2,…,N, the speed of the i-th particle is represented as V i =(v i1 ,v i2 ,…,v iD );
[0092] In each iteration, the speed and position of each particle are updated by the following equations:
[0093] v id =w×v id-1 +c1r1(p id +x id )+c2r2(p gd +x id )
[0094] x id =x id +v id
[0095] where p id is the individual optimal position of the i-th particle, p gd is the global optimal position, c1 and c2 are learning factors, r1 and r2 are random numbers between 0 and 1, and w is the inertia weight.
[0096] In the process of the PSO algorithm, the particle position is updated by changing the particle speed and finally obtaining the global optimal position. In this paper, the particle is represented by P(γ H ,γ MThe average of the area under the receiver operating characteristic curve (ROC-AUC) and 5-fold cross-validation are used to evaluate the performance of the algorithm in the optimization process. The algorithm terminates when the error is less than the limit or the number of iterations reaches the maximum. Using this algorithm can eliminate subjective factors in optimizing model hyperparameters and facilitate obtaining a global optimal solution.
[0097] S5, using the lightning data to be evaluated and the wind field related data as input, using the trained LapSVM model to perform lightning risk assessment, and outputting a lightning risk probability.
[0098] The above functions, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0099] The present embodiment analyzes the research area as shown in Figure 2 as an actual example to verify the effectiveness of the lightning risk assessment method of the present application. As shown in Figure 2 , the research area is located in the Yangtze River Delta region, and the area is centered at (31°28′30″N, 121°34′48″E). The lightning density distribution and lightning intensity distribution of the research area are shown in Figure 3 and Figure 4 .
[0100] The standard support vector machine and the lightning risk assessment method proposed in the present application are used to evaluate the lightning risk of the Yangtze River Delta region, and the model performance is shown in Table 2. The data set used contains 4424909 data and 97 lightning disaster data. According to Table 2, it is found that the performance of the method proposed in the present application can still train good performance in the case of limited labeled samples. And compared with the traditional method, the proposed method can judge the performance of the model through specific indicators.
[0101] Table 2 Performance comparison of the proposed method and SVM
[0102]
[0103] The lightning risk in the study area is evaluated using the trained model. The target area is divided into 4074 grids, and the lightning risk probability of each grid is calculated using the proposed method. The calculated results are divided into five categories: high risk, higher risk, medium risk, lower risk, and low risk using the natural breakpoint method. The evaluation results are shown in FIG. 6. Figure 5 As can be seen from the figure, the lightning risk is higher in the areas with high lightning density and high lightning intensity, and the areas with more wind turbines have higher lightning risk.
[0104] The preferred embodiments of the present application are described in detail above. It should be understood that those of ordinary skill in the art can make many modifications and changes without departing from the spirit and scope of the present application. Therefore, any technical solutions obtained by logical analysis, reasoning, or limited experiments based on the concept of the present application and the prior art should be within the scope of protection defined by the claims.
Claims
1. A method for lightning strike risk assessment based on machine learning, characterized in that, The method comprises the following steps: S1, acquiring lightning data, wind field related data and lightning disaster data and performing data preprocessing to construct a data set; S2, marking the data set based on a semi-supervised K-means algorithm and dividing the data set into a training set and a validation set, wherein the data set is marked as lightning disaster data, non-lightning disaster data and unmarked data; S3, constructing a LapSVM model and a PSO algorithm and initializing parameters, the LapSVM model is used for prediction according to input data and outputs a lightning risk probability, and the PSO algorithm is used for optimizing hyperparameters of the LapSVM model; S4, inputting the training set data into the initial LapSVM model to train the model, generating a lightning risk probability according to data labels and model parameters, evaluating the model performance by using ROC-AUC and 5-fold cross-validation, and optimizing the LapSVM model parameters by using the PSO algorithm, when a termination condition is met, determining the optimal hyperparameters of the LapSVM model, and verifying the model performance by using the validation set; S5, taking lightning data and wind field related data to be evaluated as input, and using the trained LapSVM model to evaluate the lightning risk and output a lightning risk probability. 2.The lightning strike risk assessment method based on machine learning according to claim 1, wherein, The data preprocessing comprises data cleaning, data gridding and data normalization, wherein the data cleaning is used to eliminate lightning data with a peak value of 0-2kA and greater than 200kA, and the data gridding is used to fill all data into corresponding latitude and longitude grids according to the occurrence position. 3.The lightning strike risk assessment method based on machine learning according to claim 1, wherein, The marking of the data set based on the semi-supervised K-means algorithm comprises the following steps: S21, setting an initial clustering center, taking N lightning disaster data as positive samples and marking them as 1, and taking the center as a lightning disaster clustering center, and randomly selecting N data from the remaining data as N lightning disaster clustering centers; S22, calculating the distance between unmarked samples and each clustering center based on the semi-supervised K-means algorithm, clustering the unmarked samples, and keeping the membership relationship between lightning disaster data and lightning disaster clustering centers unchanged; S23, updating the clustering center according to the clustered data; S24, judging whether the clustering center changes, if the clustering center changes, returning to step S22 to continue clustering, if the clustering center does not change, indicating that the current clustering center is the optimal clustering center; S25, taking data closest to the N optimal lightning disaster clustering centers as negative samples and marking them as -1, and marking the remaining unmarked samples as 0. 4.The lightning strike risk assessment method based on machine learning of claim 1, wherein, The objective function of the LapSVM model is: wherein, is the 2-norm of the function f in the reproducing kernel Hilbert space; γ H , γ M is a penalty coefficient; is a manifold regularization term, which is related to the internal structure and marginal distribution of the data, y i is the label of the i-th data, l is the amount of labeled data, x i is the i-th input data. 5.The lightning strike risk assessment method based on machine learning according to claim 4, wherein, The objective function of the LapSVM model is simplified as a quadratic programming problem for solving: subject to: where L is the graph Laplacian, obtained by L = D - W, with D a diagonal matrix obtained by D = JYJ ij being the edge weights of the data in the adjacency graph, J = [I 0] is a l x (l + u) matrix, I being the l x l identity matrix; Y is a diagonal matrix Y = diag(y1, y2,..., y l ), K is a kernel function, u is the amount of unlabeled data, and β is the Laplacian operator. 6.The lightning strike risk assessment method based on machine learning according to claim 4, wherein, The LapSVM model judges the data label type through a decision function, and the decision function is: where a is a Lagrange multiplier obtained by solving the objective function, K is a kernel function, x is an input data, x i is the i-th input data, and b is a bias term. 7.The lightning strike risk assessment method based on machine learning of claim 1, wherein, The PSO algorithm includes N particles, the i-th particle is represented as a D-dimensional vector X i = (x i1 , x i2 , …, x iD ), i = 1, 2, …, N, the velocity of the i-th particle is represented as V i = (v i1 , v i2 , …, v iD ); In each iteration, the speed and position of each particle are updated by the following equations: v id = w x v id-1 + c1r1(p id + x id ) + c2r2(p gd + x id ) x id = x id + v id where p id is the individual optimal position of the i-th particle, p gd is the global optimal position, c1 and c2 are learning factors, r1 and r2 are random numbers between 0 and 1, and w is the inertia weight; The particle position is updated by changing the particle speed, and the global optimal position corresponding to the optimal hyperparameters is finally obtained. 8.The lightning strike risk assessment method based on machine learning of claim 1, wherein, In step S4, the termination condition is that the error is less than a preset limit or the number of iterations reaches a preset value. 9.A lightning stroke risk assessment apparatus based on machine learning, comprising a memory, a processor, and a program stored in the memory, wherein, The processor implements the method of any one of claims 1-8 when executing the program.
10. A storage medium having stored thereon a program, characterized by The programs are executed to implement the method as claimed in any one of claims 1-8.
Citation Information
Patent Citations
Main speed reducer fault diagnosis method based on paired sparse Bayesian limit learning machine
CN108846411A
A method of enabling machine to compete more complex work
CN110163233A