CN115129607A - Power grid safety analysis machine learning model test method, device, equipment and medium - Google Patents
Power grid safety analysis machine learning model test method, device, equipment and medium Download PDFInfo
- Publication number
- CN115129607A CN115129607A CN202210849025.3A CN202210849025A CN115129607A CN 115129607 A CN115129607 A CN 115129607A CN 202210849025 A CN202210849025 A CN 202210849025A CN 115129607 A CN115129607 A CN 115129607A
- Authority
- CN
- China
- Prior art keywords
- sample
- power grid
- machine learning
- learning model
- analysis machine
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Quality & Reliability (AREA)
- Computer Hardware Design (AREA)
- Artificial Intelligence (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Medical Informatics (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Supply And Distribution Of Alternating Current (AREA)
Abstract
The invention aims to provide a power grid safety analysis machine learning model test method, a device, equipment and a medium, wherein the method comprises the following steps: acquiring a fault sample set of power grid operation, wherein the fault sample set comprises original samples input as a power grid safety analysis machine learning model; applying disturbance to an original sample to generate a first antagonizing sample; performing iterative optimization on the first antagonistic sample by taking the minimum difference between the first antagonistic sample and the original as a target and taking the output error classification result of the power grid security analysis machine learning model as a constraint condition to obtain a final attack sample; inputting the final attack sample into a power grid security analysis machine learning model to obtain a first classification result; and comparing the first classification result with a correct result to obtain a test result. By automatically generating and inputting the anti-attack sample to the model, the robustness and the safety of model decision are tested, the anti-attack effect of the anti-attack sample is quantitatively evaluated, the risk of the model decision is found, and the application safety of the model is improved.
Description
Technical Field
The invention belongs to the safety field of intelligent analysis models of large power grids, and particularly relates to a power grid safety analysis machine learning model testing method, device, equipment and medium.
Background
With the continuous development and application of artificial intelligence technology, it plays an important role in the management and control of power systems. The operation control of the power system is mainly to provide high-quality electric energy, so that the power system needs to be planned and monitored, and the management control of the power system becomes more and more difficult as the scale of the power system is continuously increased. Artificial intelligence technologies such as artificial neural networks, fuzzy set theories and deep learning are effectively applied to the power system, and the artificial intelligence technologies show a good development trend in the application of the power system.
However, the safety problem of the application of the artificial intelligence in the analysis and control of the power system cannot be ignored, and especially when the artificial intelligence is attacked by unsuspectable data or models, the output result of the artificial intelligence model may be greatly deviated, and the safety of the operation decision of the power grid is threatened.
Disclosure of Invention
The invention aims to provide a power grid security analysis machine learning model testing method, a device, equipment and a medium, which aim to solve the problem that in the prior art, when artificial intelligence in a power system is attacked by data or a model which is not easy to perceive, the output result of the artificial intelligence model can be greatly deviated.
In order to achieve the purpose, the invention adopts the following technical scheme:
the invention provides a power grid safety analysis machine learning model testing method in a first aspect, which comprises the following steps:
acquiring a fault sample set of power grid operation, wherein the fault sample set at least comprises original samples input as a power grid safety analysis machine learning model;
applying a disturbance to the original sample to generate a first antagonizing sample;
performing iterative optimization on the first countermeasure sample by taking the minimum difference between the first countermeasure sample and the original as a target and taking an error classification result output by the power grid security analysis machine learning model as a constraint condition to obtain a final attack sample;
inputting the final attack sample into the power grid security analysis machine learning model to obtain a first classification result;
and comparing the first classification result with a correct result to obtain a test result of the power grid safety analysis machine learning model.
As an optional technical solution of the present invention, the step of obtaining a fault sample set of power grid operation specifically includes:
setting a power grid operation mode and fault conditions, and generating a fault sample in a simulation mode; the sample characteristics of the fault sample are electric quantity related to the safety of the power grid, and the label is whether the power grid is stable after the fault;
and carrying out normalization processing on the fault sample to obtain a fault sample set.
As an optional technical solution of the present invention, after the step of generating the fault sample by simulation, if the number of the first-class samples in the fault sample is lower than a set threshold, a new first-class sample is generated by using a SMOTE method.
As an optional technical solution of the present invention, the structure of the power grid security analysis machine learning model includes: the optical fiber comprises an input layer, three full connection layers, a Dropout layer and an output layer, wherein a BN layer is arranged between every two full connection layers.
As an optional technical solution of the present invention, in the step of iteratively optimizing the first antagonizing sample, an Adam method is adopted to iteratively optimize the first antagonizing sample.
As an optional technical solution of the present invention, in the step of targeting the minimum difference between the first countermeasure sample and the original, an objective function is as follows:
min||1/2(tanh(λ)+1)-x|| 2 +c·Θ(1/2(tanh(λ)+1))
wherein λ is a set variable; x is the original sample.
As an optional technical solution of the present invention, the step of comparing the first classification result with the correct result to obtain the test result of the power grid safety analysis machine learning model specifically includes:
comparing the first classification result with a correct result to obtain a first evaluation accuracy of the power grid security analysis machine learning model after a final attack sample is input into the power grid security analysis machine learning model;
inputting the original sample into the power grid safety analysis machine learning model to obtain a second evaluation accuracy of the power grid safety analysis machine learning model;
and comparing the first evaluation accuracy with the second evaluation accuracy to obtain an accuracy reduction result of the power grid safety analysis machine learning model as a test result.
In a second aspect of the present invention, there is provided a power grid security analysis machine learning model testing apparatus, including:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a fault sample set of power grid operation, and the fault sample set at least comprises original samples which are input as a power grid safety analysis machine learning model;
the first sample generation module is used for applying disturbance to the original sample to generate a first antagonizing sample;
the second sample generation module is used for carrying out iterative optimization on the first countermeasure sample by taking the minimum difference between the first countermeasure sample and the original as a target and taking the error classification result output by the power grid security analysis machine learning model as a constraint condition to obtain a final attack sample;
the first result generation module is used for inputting the final attack sample into the power grid security analysis machine learning model to obtain a first classification result;
and the second result generation module is used for comparing the first classification result with a correct result to obtain a test result of the power grid safety analysis machine learning model.
As an optional technical solution of the present invention, the obtaining module specifically includes:
the simulation unit is used for acquiring a fault sample set of power grid operation, and the steps specifically comprise: setting a power grid operation mode and fault conditions, and generating a fault sample in a simulation mode; the sample characteristics of the fault sample are electrical quantities related to the safety of the power grid, and the label is whether the power grid is stable after the fault;
and the normalization unit is used for performing normalization processing on the fault sample to obtain a fault sample set.
As an optional technical solution of the present invention, the second result generating module specifically includes:
the first evaluation accuracy generation unit is used for comparing the first classification result with a correct result to obtain first evaluation accuracy of the power grid security analysis machine learning model after a final attack sample is input into the power grid security analysis machine learning model;
the second evaluation accuracy generation unit is used for inputting the original sample into the power grid safety analysis machine learning model to obtain second evaluation accuracy of the power grid safety analysis machine learning model;
and the comparison unit is used for comparing the first evaluation accuracy with the second evaluation accuracy to obtain an accuracy reduction result of the power grid safety analysis machine learning model as a test result.
In a third aspect of the present invention, an electronic device is provided, which includes a processor and a memory, wherein the processor is configured to execute a computer program stored in the memory to implement the power grid safety analysis machine learning model testing method described above.
In a fourth aspect of the present invention, a computer-readable storage medium is provided, which stores at least one instruction, and the at least one instruction when executed by a processor implements the power grid safety analysis machine learning model testing method described above.
Compared with the prior art, the invention has the following beneficial effects:
1) according to the power grid security analysis machine learning model testing method provided by the invention, the anti-attack sample is automatically generated and input into the power grid security analysis machine learning model, the robustness and the security of the model decision are tested, and the anti-sample attack effect is quantitatively evaluated, so that the model decision risk is found, and the model application security is improved.
2) According to the power grid safety analysis machine learning model testing method provided by the invention, disturbance added to an anti-sample generated by an optimization algorithm is hardly noticeable by a user, and the model decision performance can be obviously reduced under a small disturbance condition, so that the machine learning robustness of power grid safety intelligent analysis is tested, the disturbance resistance of the model is evaluated, the model decision risk is excavated, and a foundation is provided for a power artificial intelligent safety protection technical framework and scheme.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate exemplary embodiments of the invention and, together with the description, serve to explain the invention and are not intended to limit the invention. In the drawings:
fig. 1 is a flowchart of a power grid security analysis machine learning model testing method according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a step of obtaining a fault sample set of power grid operation in the embodiment of the present invention.
Fig. 3 is a flowchart of a test result obtaining process of the power grid safety analysis machine learning model in the embodiment of the present invention.
Fig. 4 is a schematic structural diagram of a machine learning model of power grid security analysis in the embodiment of the present invention.
Fig. 5 is a schematic diagram of a power grid security analysis machine learning model testing method according to an embodiment of the present invention.
Fig. 6 is a block diagram of a power grid security analysis machine learning model testing apparatus according to an embodiment of the present invention.
Fig. 7 is a block diagram of an acquisition module according to an embodiment of the present invention.
Fig. 8 is a block diagram of a second result generation module according to an embodiment of the present invention.
Fig. 9 is a block diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
The following detailed description is exemplary in nature and is intended to provide further explanation of the invention as claimed. Unless otherwise defined, all technical terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of exemplary embodiments according to the invention.
Example 1
The embodiment 1 of the invention provides a power grid security analysis machine learning model testing method, which realizes quantitative evaluation of sample attack resisting effect by testing the decision performance of a power grid security analysis machine learning model under the attack of resisting samples, thereby providing a basis for a subsequent electric power artificial intelligence security protection technical framework and scheme.
As shown in fig. 1 and 5, a power grid safety analysis machine learning model testing method includes the following steps:
and S1, acquiring a fault sample set of the power grid operation, wherein the fault sample set at least comprises original samples which are input by a power grid safety analysis machine learning model.
As shown in fig. 2, the step of obtaining a fault sample set of power grid operation specifically includes:
s11, setting information such as various operation modes, fault conditions and the like of the power grid, and simulating to generate a large number of fault samples; the electric quantity related to the safety of the power grid is selected as a sample characteristic, and the label is whether the power grid is stable after the fault.
As a specific example of the scheme, the power of a generator is randomly changed at 80% -120% aiming at a specific power system, various fault simulations under a large number of operation modes are carried out, a protection device starts to remove a fault line after 0.15s, the simulation sampling interval is 0.01s, and the duration is 10s, so that a fault sample set is obtained.
In other embodiments, historical data may also be collected by the actual system as a sample set of faults.
As a specific example of the scheme, an electrical quantity related to the safety of the power grid is selected as a sample characteristic, and the selected key operation parameters are shown in table 1.
TABLE 1 operating characteristics
As a specific example of the scheme, sample labels of a fault sample set are generated, and the label is whether the power grid is stable after the fault.
For each operation mode in the fault sample set, aiming at the faults in the expected fault set, judging whether the system is stable by adopting a time domain simulation method, and if the system can be kept stable, marking the label as 1; if the system is out of stability, the label is 0. The expected failure set refers to a preset set, each element in the set describes a failure condition (such as a failure location, a failure duration, and the like), and the failure sample set is a failure sample generated by setting the preset failures and then generating data and tags, such as setting a failure type, a location, a failure duration, and load data.
And S12, carrying out sample equalization processing on the fault sample set.
And if the number of the samples of the first category in the fault samples is lower than a set threshold, generating a new sample of the first category by using a SMOTE method.
The reason is that the set of fault samples generated by the simulation tends to be unbalanced. Because the power grid can be kept stable in the past after the power grid fails, the number of instability samples is relatively small, and therefore a new instability sample is generated through the SMOTE method.
As a specific example of the present scheme, taking the instability sample as the sample of the first category, i.e. the sample of the minority category, for the sample of the minority category x i SMOTE calculates Euclidean distance from the SMOTE to other samples in a minority sample set to obtain k neighbor samples of the SMOTE, and randomly selects a plurality of samples from the k neighbor samples to be respectively matched with x i Synthesizing new minority samples according to a random proportion, thereby increasing the number of the minority samples, wherein the expression is as follows:
in the formula:is a minority class sample x i K neighbor samples of (1);is composed of x i Andsynthesizing a new minority sample according to a random proportion; ξ is a random number that follows a uniform distribution over the interval (0, 1).
And S13, carrying out normalization processing on the fault sample to obtain a fault sample set.
As a specific example of the present solution, a Min-Max Normalization (Min-Max Normalization) is adopted to process a fault sample set, and the following formula is used:
wherein max is the maximum value of the sample data, and min is the minimum value of the sample data.
In this scheme, electric wire netting safety analysis machine learning model is used for judging whether stable after the electric wire netting breaks down, as shown in fig. 4, electric wire netting safety analysis machine learning model structure includes: the optical fiber comprises an input layer, three full connection layers, a Dropout layer and an output layer, wherein a BN layer is arranged between every two full connection layers. The input vector of any layer is x, the output vector is z, and the expression of the fully-connected layer is as follows:
z=f(Wx+b) (3)
in the formula: w, b are weight parameter and offset parameter to be learned; f (-) is the activation function.
As a specific example of the scheme, the activation function adopts a ReLU function, a batch normalization layer is adopted, the mean value and the standard deviation of input data of each layer of neural network are within a certain range through normalization and linear transformation, and the speed and the stability of model training are improved; the loss function is a cross-entropy loss function capable of measuring the probability distribution difference, the batchSize is set to be 16, the learning rate is set to be 0.01, and the model is trained by using a back propagation algorithm through an Adam optimization solver.
And S2, applying disturbance to the original sample to generate a first antagonizing sample.
S3, setting the measurement distance between the first countermeasure sample and the original sample, the number N of times of optimizing the countermeasure sample generation algorithm, an optimization method, an attack target label and the like; a perturbation that is imperceptible is applied to the first challenge sample (attack sample) so that the model gives an erroneous signature with high confidence. The gap between the confrontational sample and the corresponding original sample should be kept as small as possible; in addition, the challenge samples should be such that the model is misclassified, and the higher the probability of the wrong target class, the better.
Specifically, the measurement distance between the first countermeasure sample and the original sample is L2 norm, and a new optimization target is set through L2 norm, so that the optimization method can be rapidly converged, and the effect of resisting sample attack is ensured.
In the scheme, the optimization method for constructing the attack sample is an Adam method.
Since the stability evaluation after the grid fault is a 2-class problem, namely the label is 1 when the stability is stable and 0 when the instability is lost. Thus, the attack targets against the sample are set to: by resisting attack, the power grid security analysis machine learning model judges the real stable sample as instability and judges the real instability sample as stability, so that the performance of the power grid security analysis machine learning model is reduced or fails.
In the scheme, the problem of sample attack resistance is set as an optimization problem with constraint, wherein the optimization target is as follows:
min D(x,x+η) (4)
wherein η is the disturbance amount of the confrontation sample.
The corresponding constraints are:
mod el(x+η)=C t (5)
wherein, model (x + eta) is the discrimination result of the output of the model after the confrontation sample is input into the neural network, C t Is a target category label.
Another constraint is:
x+η∈[0,1] n (6)
that is, the feature of each dimension of the generated countermeasure sample is limited to the range of [0, 1], and n is a feature dimension. And changing the discrimination result of the power grid security analysis machine learning model under the condition of ensuring that the disturbance to the anti sample is as small as possible, namely limiting the characteristic amplitude of the input x after the attack within the range of [0, 1] so as to ensure that the attack is not discovered as far as possible.
Setting a new variable lambda, and converting the problem of optimizing eta into the problem of optimizing the variable lambda, namely:
η=1/2(tanh(λ)+1)-x (7)
by this transformation, expression (6) is naturally satisfied. A new variable lambda is introduced, and the problem of optimizing eta is converted into the problem of optimizing the variable lambda, so that the solving difficulty of the optimization problem is greatly simplified.
After the change, the objective function is transformed into:
min||1/2(tanh(λ)+1)-x|| 2 + c · Θ (1/2(tanh (λ) +1)) (8) wherein c is a constant that balances the weights of the two terms of the objective function; the function Θ (·) is defined as:
where β (x) is the output of the last hidden layer, and the maximum value of this vector corresponds to the correct class. σ is a set parameter, and changing the value of σ can change the confidence of the misclassification. The larger the σ value, the greater the probability of being misclassified. Ci is a class output by the model that is different from the target class Ct. And (3) performing iterative generation of the anti-attack sample by adopting an Adam method to obtain a sample x + eta after the anti-attack as a final attack sample.
And S4, inputting the final attack sample x + eta into the power grid security analysis machine learning model, and outputting a power grid stability judgment result as a first classification result.
And S5, comparing the first classification result with a correct result, and testing the reduction degree of the discrimination effect of the neural network model after resisting attack, so as to evaluate the anti-attack effect of the deep learning model and obtain the test result of the power grid security analysis machine learning model. As shown in fig. 3, the present step specifically includes the following steps:
and S51, comparing the first classification result with a correct result to obtain a first evaluation accuracy of the power grid security analysis machine learning model after the final attack sample is input into the power grid security analysis machine learning model.
S52, inputting the original sample into the power grid safety analysis machine learning model to obtain a second evaluation accuracy of the power grid safety analysis machine learning model; and evaluating the discrimination performance of the neural network. In the scheme, model evaluation is performed on an IEEE39 node standard test example, and the evaluation accuracy of the constructed neural network is 97.1%.
And S53, comparing the first evaluation accuracy with the second evaluation accuracy to obtain an accuracy reduction result of the power grid safety analysis machine learning model as a test result.
As can be seen from the following table 2, as the number of optimization times is increased, the sample amplitude change proportion is increased, the accuracy of the model prediction result of the neural network is remarkably reduced, and when the characteristic amplitude of the input x is only changed by about 2%, the evaluation accuracy of the neural network model is reduced to below 60%, so that the effectiveness of the sample attack method is verified.
TABLE 2 Effect of the Algorithm against attacks
Example 2
As shown in fig. 6, a power grid safety analysis machine learning model testing apparatus includes:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a fault sample set of power grid operation, and the fault sample set at least comprises original samples which are input as a power grid safety analysis machine learning model.
The first sample generation module is used for applying disturbance to the original sample to generate a first antagonizing sample;
the second sample generation module is used for carrying out iterative optimization on the first countermeasure sample by taking the minimum difference between the first countermeasure sample and the original as a target and taking the error classification result output by the power grid security analysis machine learning model as a constraint condition to obtain a final attack sample;
the first result generation module is used for inputting the final attack sample into the power grid security analysis machine learning model to obtain a first classification result;
and the second result generation module is used for comparing the first classification result with a correct result to obtain a test result of the power grid safety analysis machine learning model.
As shown in fig. 7, in this scheme, the obtaining module specifically includes:
the simulation unit is used for acquiring a fault sample set of power grid operation, and the steps specifically comprise: setting a power grid operation mode and fault conditions, and generating a fault sample in a simulation mode; the sample characteristics of the fault sample are electrical quantities related to the safety of the power grid, and the label is whether the power grid is stable after the fault;
and the normalization unit is used for performing normalization processing on the fault sample to obtain a fault sample set.
As shown in fig. 8, in this scheme, the second result generating module specifically includes:
the first evaluation accuracy generation unit is used for comparing the first classification result with a correct result to obtain first evaluation accuracy of the power grid security analysis machine learning model after a final attack sample is input into the power grid security analysis machine learning model;
the second evaluation accuracy generation unit is used for inputting the original sample into the power grid safety analysis machine learning model to obtain second evaluation accuracy of the power grid safety analysis machine learning model;
and the comparison unit is used for comparing the first evaluation accuracy with the second evaluation accuracy to obtain an accuracy reduction result of the power grid safety analysis machine learning model as a test result.
Example 3
As shown in fig. 9, the present invention further provides an electronic device 100 for implementing the method for testing the machine learning model of the power grid security analysis in embodiment 1; the electronic device 100 comprises a memory 101, at least one processor 102, a computer program 103 stored in the memory 101 and executable on the at least one processor 102, and at least one communication bus 104. The memory 101 may be used for storing a computer program 103, and the processor 102 implements the steps of the power grid safety analysis machine learning model test method according to embodiment 1 by running or executing the computer program stored in the memory 101 and calling the data stored in the memory 101. The memory 101 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data) created according to the use of the electronic device 100, and the like. In addition, the memory 101 may include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other non-volatile solid state storage device.
The at least one Processor 102 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The processor 102 may be a microprocessor or the processor 102 may be any conventional processor or the like, and the processor 102 is the control center of the electronic device 100 and connects the various parts of the electronic device 100 with various interfaces and lines.
The memory 101 in the electronic device 100 stores a plurality of instructions to implement a power grid security analysis machine learning model testing method, and the processor 102 may execute the plurality of instructions to implement:
acquiring a fault sample set of power grid operation, wherein the fault sample set at least comprises original samples input as a power grid safety analysis machine learning model;
applying a disturbance to the original sample to generate a first antagonizing sample;
performing iterative optimization on the first countermeasure sample by taking the minimum difference between the first countermeasure sample and the original as a target and taking an error classification result output by the power grid security analysis machine learning model as a constraint condition to obtain a final attack sample;
inputting the final attack sample into the power grid security analysis machine learning model to obtain a first classification result;
and comparing the first classification result with a correct result to obtain a test result of the power grid safety analysis machine learning model.
Example 4
The integrated modules/units of the electronic device 100 may be stored in a computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow in the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium and used for instructing related hardware to implement the steps of the above-described embodiments of the method when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying computer program code, recording medium, U.S. disk, removable hard disk, magnetic disk, optical disk, computer Memory, and Read-Only Memory (ROM).
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting the same, and although the present invention is described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: modifications and equivalents may be made to the embodiments of the invention without departing from the spirit and scope of the invention, which is to be covered by the claims.
Claims (10)
1. A power grid safety analysis machine learning model test method is characterized by comprising the following steps:
obtaining a fault sample set of power grid operation, wherein the fault sample set at least comprises original samples input as a power grid safety analysis machine learning model;
applying a disturbance to the original sample to generate a first antagonizing sample;
performing iterative optimization on the first countermeasure sample by taking the minimum difference between the first countermeasure sample and the original as a target and taking an error classification result output by the power grid security analysis machine learning model as a constraint condition to obtain a final attack sample;
inputting the final attack sample into the power grid security analysis machine learning model to obtain a first classification result;
and comparing the first classification result with a correct result to obtain a test result of the power grid safety analysis machine learning model.
2. The power grid safety analysis machine learning model testing method according to claim 1, wherein the step of obtaining a fault sample set of power grid operation specifically comprises:
setting a power grid operation mode and fault conditions, and generating a fault sample in a simulation mode; the sample characteristics of the fault sample are electric quantity related to the safety of the power grid, and the label is whether the power grid is stable after the fault;
and carrying out normalization processing on the fault sample to obtain a fault sample set.
3. The power grid safety analysis machine learning model testing method according to claim 1, wherein after the step of generating fault samples by simulation, if the number of first-class samples in the fault samples is lower than a set threshold, a new first-class sample is generated by using a SMOTE method.
4. The power grid security analysis machine learning model testing method according to claim 1, wherein the structure of the power grid security analysis machine learning model comprises: the optical fiber comprises an input layer, three full connection layers, a Dropout layer and an output layer, wherein a BN layer is arranged between every two full connection layers.
5. The power grid safety analysis machine learning model testing method according to claim 1, wherein in the step of iteratively optimizing the first antagonistic sample, the first antagonistic sample is iteratively optimized by using an Adam method.
6. The method according to claim 1, wherein in the step of targeting the minimum difference between the first impedance sample and the original, an objective function is as follows:
min||1/2(tanh(λ)+1)-x|| 2 +c·Θ(1/2(tanh(λ)+1))
wherein λ is a set variable; x is the original sample.
7. The power grid safety analysis machine learning model testing method according to claim 1, wherein the step of comparing the first classification result with a correct result to obtain the testing result of the power grid safety analysis machine learning model specifically comprises:
comparing the first classification result with a correct result to obtain a first evaluation accuracy of the power grid security analysis machine learning model after a final attack sample is input into the power grid security analysis machine learning model;
inputting the original sample into the power grid safety analysis machine learning model to obtain a second evaluation accuracy of the power grid safety analysis machine learning model;
and comparing the first evaluation accuracy with the second evaluation accuracy to obtain an accuracy reduction result of the power grid safety analysis machine learning model as a test result.
8. A power grid safety analysis machine learning model testing device is characterized by comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a fault sample set of power grid operation, and the fault sample set at least comprises original samples which are used as input of a power grid safety analysis machine learning model;
the first sample generation module is used for applying disturbance to the original sample to generate a first antagonizing sample;
the second sample generation module is used for carrying out iterative optimization on the first countermeasure sample by taking the minimum difference between the first countermeasure sample and the original as a target and taking the error classification result output by the power grid security analysis machine learning model as a constraint condition to obtain a final attack sample;
the first result generation module is used for inputting the final attack sample into the power grid security analysis machine learning model to obtain a first classification result;
and the second result generation module is used for comparing the first classification result with a correct result to obtain a test result of the power grid safety analysis machine learning model.
9. An electronic device comprising a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the grid safety analysis machine learning model testing method of any of claims 1 to 7.
10. A computer-readable storage medium storing at least one instruction which, when executed by a processor, implements a power grid safety analysis machine learning model testing method as claimed in any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210849025.3A CN115129607A (en) | 2022-07-19 | 2022-07-19 | Power grid safety analysis machine learning model test method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210849025.3A CN115129607A (en) | 2022-07-19 | 2022-07-19 | Power grid safety analysis machine learning model test method, device, equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115129607A true CN115129607A (en) | 2022-09-30 |
Family
ID=83383621
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210849025.3A Pending CN115129607A (en) | 2022-07-19 | 2022-07-19 | Power grid safety analysis machine learning model test method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115129607A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115544902A (en) * | 2022-11-29 | 2022-12-30 | 四川骏逸富顿科技有限公司 | Pharmacy risk level identification model generation method and pharmacy risk level identification method |
CN115906032A (en) * | 2023-02-20 | 2023-04-04 | 之江实验室 | Recognition model correction method and device and storage medium |
-
2022
- 2022-07-19 CN CN202210849025.3A patent/CN115129607A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115544902A (en) * | 2022-11-29 | 2022-12-30 | 四川骏逸富顿科技有限公司 | Pharmacy risk level identification model generation method and pharmacy risk level identification method |
CN115906032A (en) * | 2023-02-20 | 2023-04-04 | 之江实验室 | Recognition model correction method and device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Xu et al. | A reliable intelligent system for real-time dynamic security assessment of power systems | |
CN115129607A (en) | Power grid safety analysis machine learning model test method, device, equipment and medium | |
CN109800875A (en) | Chemical industry fault detection method based on particle group optimizing and noise reduction sparse coding machine | |
Yu et al. | An automatically tuning intrusion detection system | |
La Cava et al. | Automatic identification of wind turbine models using evolutionary multiobjective optimization | |
CN111523785A (en) | Power system dynamic security assessment method based on generation countermeasure network | |
Whiteson et al. | Machine learning for event selection in high energy physics | |
CN110889111A (en) | Power grid virtual data injection attack detection method based on deep belief network | |
Mohammadi et al. | Machine learning assisted stochastic unit commitment during hurricanes with predictable line outages | |
CN109145516B (en) | Analog circuit fault identification method based on improved extreme learning machine | |
CN111523778A (en) | Power grid operation safety assessment method based on particle swarm algorithm and gradient lifting tree | |
Yan et al. | An improved hybrid backtracking search algorithm based T–S fuzzy model and its implementation to hydroelectric generating units | |
Xiao et al. | Network security situation prediction method based on MEA-BP | |
CN111027697A (en) | Genetic algorithm packaged feature selection power grid intrusion detection method | |
Jiang et al. | A multiagent evolutionary framework based on trust for multiobjective optimization. | |
Barbosa et al. | Piecewise affine identification of a hydraulic pumping system using evolutionary computation | |
Jafarzadeh et al. | Probabilistic dynamic security assessment of large power systems using machine learning algorithms | |
Zhao et al. | A hybrid learning method for constructing compact rule-based fuzzy models | |
Li et al. | Distribution grid topology and parameter estimation using deep-shallow neural network with physical consistency | |
Cao et al. | Fast and explainable warm-start point learning for AC Optimal Power Flow using decision tree | |
Veith et al. | The adversarial resilience learning architecture for ai-based modelling, exploration, and operation of complex cyber-physical systems | |
CN116545764A (en) | Abnormal data detection method, system and equipment of industrial Internet | |
Cui et al. | Using EBGAN for anomaly intrusion detection | |
CN114615042B (en) | Attack defense method for power generator to maliciously attack power grid to gain profit | |
CN116316699A (en) | Large power grid frequency security situation prediction method, device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |