Power grid operation violation code automatic identification method and system
By pre-processing and physical annotation of power grid operation data, combined with the BERT-BiLSTM-CRF Chinese NER model and Bayesian principle, the automatic identification of power grid operation violation codes is realized, solving the problems of low identification efficiency and insufficient accuracy in the existing technology, and improving the intelligence and automation level of power grid operation safety management.
Patent Information
- Application Number
- CN202411618795.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-11-13
AI Technical Summary
The prior art is difficult to efficiently and accurately identify violation codes at the power grid operation site, resulting in a low level of safety management and the risk of identification errors and omissions.
By collecting power grid operation data for text preprocessing, the YEDDA labeling tool and the BERT-BiLSTM-CRF Chinese NER model are used for entity annotation and training, the feature keywords of the violation code are extracted, the feature vector is constructed, and the probability of the violation type is calculated based on Bayesian principle, and the automatic identification of the violation code is realized.
It improves the intelligence and automation level of power grid operation safety management, reduces the burden of manual review, enhances the accuracy and efficiency of identification, and reduces the risk of identification errors and omissions.
Smart Images

Figure CN119721030A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of operation violation identification, and in particular to a method and system for automatically identifying power grid operation violation codes. Background Art
[0002] The power system is a key national infrastructure, and the stability of the power grid is crucial to national security and economic development. Power grid operation safety is a vital part of the power industry. The occurrence of power grid operation accidents has a serious adverse impact on the safety and stability of the entire society. Therefore, managing and controlling the risks of illegal distribution network operations is the key to ensuring the safety of distribution work.
[0003] In this context, the safety of power grid operations is particularly important, as it directly affects the life and property safety of operators. On-site operations of power grids usually require handling high-voltage power equipment and complex power systems. Any accidents or failures may lead to serious consequences, such as casualties, equipment damage and power outages. Therefore, ensuring the safety of power grid operations is crucial to protecting the interests of personnel and property. At present, major power grid companies in my country have accumulated a large amount of historical operation plans and violation records, such as operation conditions, operation content, description of on-site operation violations, and violation types. These are first-hand information for safe operations and the guiding basis for safe operations. Risk factor analysis of violations based on the violation data accumulated by power grid companies can not only effectively curb the occurrence of safety accidents, but also further improve the quality of power grid operations, which is of great significance for ensuring the safe operation of the power grid and improving the overall operational efficiency. Using artificial intelligence technologies such as machine learning and deep learning to deeply mine the text data recorded by historical operation violations can extract typical operation violation codes and their corresponding typical violation behaviors, which is convenient for automatic and intelligent identification of subsequent violation descriptions, and helps to improve the efficiency of safety supervision and strengthen risk management capabilities. In summary, intelligent identification of operational violations is of great significance to the safe construction and operation of power grids. Summary of the invention
[0004] In view of the above-mentioned problems, the present invention is proposed.
[0005] Therefore, the technical problem solved by the present invention is: how to efficiently and accurately identify the violation behavior codes at the power grid operation site to improve the safety management level of power grid operation and reduce the burden of manual review. At present, since most of the violation records at the power grid operation site are unstructured text data, the identification and management work needs to rely on manual interpretation and annotation, which is inefficient and has the risk of identification errors and omissions.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions: a method for automatically identifying power grid operation violation codes, which comprises the following steps:
[0007] Collect power grid operation data and perform text preprocessing;
[0008] The YEDDA annotation tool was used to annotate the preprocessed on-site operation violation description text data and put it into the BERT-BiLSTM-CRF Chinese NER model for training;
[0009] Based on the trained NER model, the violation description text is recognized and the characteristic keywords of the violation code are extracted;
[0010] The feature vector of the violation code is constructed, and the probability of the violation type is calculated based on the Bayesian principle. The violation code with the highest posterior probability is selected as the recognition result.
[0011] As a preferred solution of the method for automatically identifying power grid operation violation codes described in the present invention, the collecting of power grid operation data and performing text preprocessing includes:
[0012] Obtain historical operation data from the power grid company, filter out the descriptive text data related to the violation, and remove the content irrelevant to the recognition task, retaining the complete operation violation description text and its violation code label information.
[0013] As a preferred solution of the method for automatically identifying power grid operation violation codes described in the present invention, the method comprises: using the YEDDA annotation tool to perform entity annotation on the pre-processed on-site operation violation description text data, and putting it into the BERT-BiLSTM-CRF Chinese NER model for training,
[0014] For the power grid field operation violation text data obtained after text preprocessing, the unstructured text data formed by the description of the power grid field operation violation is annotated with BIO entities, and BIO ternary entity annotation is performed based on the YEDDA entity annotation tool;
[0015] Annotation categories include Object, Person, File, Action, and Surrounding;
[0016] The unstructured text data of the description of violations of power grid field operations annotated by BIO is put into the BERT-BiLSTM-CRF Chinese NER model for training to obtain the trained model weights.
[0017] As a preferred solution of the method for automatically identifying power grid operation violation codes described in the present invention, the training of the BERT-BiLSTM-CRF Chinese NER model includes:
[0018] During the model training process, the best experimental parameters are obtained by adjusting the learning rate, number of iterations, number of batches, and optimizer. When evaluating the model, precision, recall, and F1 value are selected as indicators for evaluating the performance of the recognition model. The expression is:
[0019]
[0020] Among them, TP is the number of instances predicted by the model as positive samples and are actually positive samples, FP is the number of instances predicted by the model as positive samples but are actually negative samples, FN is the number of instances predicted by the model as negative samples but are actually positive samples, P represents the proportion of samples predicted to belong to a certain category that actually belong to that category, R represents the proportion of samples that actually belong to a certain category that are correctly predicted to belong to that category, and F1 represents the harmonic mean of precision P and recall R.
[0021] As a preferred solution of the method for automatically identifying power grid operation violation codes described in the present invention, the method of identifying the violation description text based on the trained NER model and extracting the characteristic keywords of the violation code includes:
[0022] The on-site operation violation description text data is converted into vector form, and entity recognition is performed on the on-site operation violation description text data of the power grid through the weights of the trained Chinese NER model. The words obtained by entity recognition are sorted according to each violation code, and the word frequency is counted;
[0023] According to the TF-IDF algorithm, X keywords corresponding to each violation code are selected and organized into a key dictionary, expressed as follows:
[0024]
[0025] Among them, tf x,y is the number of times word x appears in the on-site operation violation description text data corresponding to violation code y; df x represents the number of violation codes containing word x; N is the number of all violation codes.
[0026] As a preferred solution of the method for automatically identifying a power grid operation violation code described in the present invention, the method of identifying the violation description text based on the trained NER model and extracting the characteristic keywords of the violation code also includes:
[0027] The obtained key dictionary has a total of S words, and the classic vector of each violation code is constructed. The dimension of the classic vector is S dimensions, and the position of each dimension corresponds to the corresponding word in the key dictionary;
[0028] For each violation code, the classic vector is constructed based on X key words selected by the TF-IDF algorithm;
[0029] Based on the BOW model, the corresponding positions of the X key words in the S-dimensional vector are assigned 1, and the other positions are assigned 0 to obtain the classic vector of each violation code. According to the preprocessed power grid on-site operation violation description text data, the power grid operation site violation description data corresponding to some violation codes are randomly selected, and the proportion of each violation code in the data is calculated as the prior probability.
[0030] As a preferred solution of the method for automatically identifying a power grid operation violation code described in the present invention, wherein: the feature vector of the violation code is constructed, and the probability of the violation type is calculated based on the Bayesian principle, and the violation code with the highest posterior probability is selected as the recognition result, including:
[0031] For new descriptions of on-site operation violations, the BERT-BiLSTM-CRF Chinese NER model is used to identify entities, and the corresponding feature vector form is obtained according to the BOW algorithm. The posterior probability of the corresponding on-site operation violation description text data corresponding to different violation types is calculated, and the violation code with the largest posterior probability is used as the prediction result to realize intelligent and automatic recognition of violation codes.
[0032] Another object of the present invention is to provide an automatic identification system for power grid operation violation codes, which can realize intelligent identification of power grid operation violation descriptions through data preprocessing, entity labeling, feature vector construction and Bayesian inference, thereby solving the problems of low efficiency and insufficient accuracy in the existing manual processing mode; automatically identifying key entities in the violation description through the NER model, and realizing automatic determination of the violation code in combination with Bayesian classification, thereby solving the shortcomings of the existing technology that relies on manual review and improving the intelligence and automation level of power grid operation safety management.
[0033] In order to solve the above technical problems, the present invention provides the following technical solutions: a system for automatically identifying power grid operation violation codes, comprising: a data collection and preprocessing module, an entity annotation and NER model training module, a feature keyword extraction and feature vector generation module, and a violation identification module based on the Bayesian principle;
[0034] The data collection and preprocessing module is responsible for obtaining historical operation data from the power grid company and performing preliminary processing to filter out text data related to violations, and only retain the description text of the operation violation and the corresponding violation code label by eliminating irrelevant information;
[0035] The entity annotation and NER model training module uses the YEDDA annotation tool to perform BIO annotation on the preprocessed data, marks the illegal behaviors and scene elements in the text as specific categories, and inputs the annotated text data into the BERT-BiLSTM-CRF Chinese NER model for training;
[0036] The feature keyword extraction and feature vector generation module is to identify the feature words in the violation description text based on the trained NER model, generate a key dictionary through the TF-IDF algorithm, and use the BOW model to construct the classic vector of the violation code, vectorize the text data, and calculate the prior probability of each violation code in the data;
[0037] The violation recognition module based on the Bayesian principle constructs a feature vector based on the NER model and the BOW algorithm for the input new violation description text, calculates the posterior probability corresponding to each violation type through the Bayesian principle, selects the violation code with the highest posterior probability as the final recognition result, and realizes automatic recognition and intelligent analysis of the violation code.
[0038] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned method for automatically identifying power grid operation violation codes when executing the computer program.
[0039] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for automatically identifying power grid operation violation codes.
[0040] Beneficial effects of the present invention: the present invention performs text preprocessing on power grid operation data, effectively eliminating data irrelevant to the violation behavior identification task; secondly, the BIO entity annotation is performed on the obtained on-site operation violation description text and the weight of the Chinese NER model is trained; then, based on the obtained Chinese NER model weight, entity recognition is performed on the on-site operation violation description text corresponding to some violation codes randomly selected for testing, and the words and their word frequencies of each violation code entity recognition are statistically sorted, and the key dictionary is selected by using the TF-IDF algorithm, and the classic vector corresponding to the violation code is obtained based on the BOW model; Then, the prior probability is calculated according to the ratio of each violation code in the historical records; finally, based on the obtained prior probability and classical vector space of the violation code, for a new description of on-site operation violation, the weights trained by the BERT-BiLSTM-CRF Chinese NER model and the BOW model are used to obtain its corresponding feature vector, and the Bayesian principle is used to calculate the posterior probability of the corresponding on-site operation violation description text data corresponding to different violation types. The violation code with the largest posterior probability is used as the prediction result, which can intelligently complete the violation code recognition task and improve the efficiency and accuracy of power grid management. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0042] Figure 1 A flowchart of automatic identification of violation codes for power grid operation violation description entities of a method for automatic identification of power grid operation violation codes provided by the first embodiment of the present invention;
[0043] Figure 2 A YEDDA-annotated BIO process diagram in a method for automatically identifying power grid operation violation codes provided in a third embodiment of the present invention;
[0044] Figure 3 A diagram showing the number of entity labels and entity types in a data set of a method for automatically identifying power grid operation violation codes provided by a third embodiment of the present invention;
[0045] Figure 4 A diagram showing the recognition accuracy of entity type labels by a BERT-BiLSTM-CRF Chinese NER model of a method for automatically identifying power grid operation violation codes provided in a third embodiment of the present invention;
[0046] Figure 5 A word cloud diagram of a key dictionary in a method for automatically identifying power grid operation violation codes provided by a third embodiment of the present invention;
[0047] Figure 6 A priori probability map of violation codes in a method for automatically identifying violation codes of power grid operations provided by a third embodiment of the present invention;
[0048] Figure 7 This is a diagram of the recognition results of an automatic violation type identifier in a method for automatically identifying violation codes of power grid operations provided in the third embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0050] Example 1, reference Figure 1 According to an embodiment of the present invention, a method for automatically identifying power grid operation violation codes is provided, comprising:
[0051] The present invention aims to process the unstructured text data formed by the description of the violation of the on-site operation of the power grid, use the YEDDA annotation tool to complete the BIO entity type annotation of the description text of the violation of the on-site operation of the power grid, train the BERT-BiLSTM-CRF Chinese NER model, and obtain the trained model weight of the Chinese NER model. Randomly select the power grid data corresponding to some violation codes, use the trained Chinese NER model weight to perform entity recognition on the corresponding on-site operation violation description text, and obtain the words corresponding to each violation code. First, calculate the proportion of each violation code in the test data as the prior probability. Then, through the TF-IDF algorithm, obtain the key word segmentation of each violation code to form a keyword dictionary. After that, obtain the classic vector of each violation code, and use the BOW model to convert the text data of the test data into the form of a feature vector. Then, according to the Bayesian principle, calculate the posterior probability of the corresponding on-site operation violation description text data corresponding to different violation types, and use the violation code with the largest posterior probability as its prediction result, which can intelligently complete the recognition task of the violation code and improve the efficiency and accuracy of power grid management. The technical scheme is as follows:
[0052] like Figure 1 As shown in the figure, the recognition method constructs a violation identifier by processing unstructured text data. Its modeling process mainly includes: text preprocessing, BIO entity labeling and Chinese NER model training, selecting key dictionaries and obtaining classic vectors and prior probabilities of violation codes, and a recognition model based on the Bayesian principle.
[0053] Step 1, text preprocessing: Perform text preprocessing on the power grid operation data obtained from the power grid company, remove data irrelevant to the recognition task, and retain the text data information describing the on-site operation violations and their corresponding violation codes;
[0054] Step 2, BIO entity labeling and Chinese NER model training: Use the YEDDA labeling tool to label the preprocessed on-site operation violation description text data, and use the BIO ternary labeling method to label the entity. After analyzing the text data, determine the five entity categories Object, Person, File, Action, and Surrounding. Put the on-site operation violation description data with BIO entity labeling into the BERT-BiLSTM-CRF Chinese NER model for training to obtain the trained Chinese NER model weights;
[0055] Step 3, select key dictionaries and obtain the classic vectors and prior probabilities of violation codes: Using the weights of the Chinese NER model trained in the previous step, randomly select part of the sorted text data of the power grid site violation description for entity recognition, and obtain the words corresponding to each violation code and their frequency of occurrence. Use the TF-IDF algorithm to select the key word segmentation that best represents each violation code to form a key dictionary. After that, obtain the classic vector of each violation code, and use the BOW model to convert the text data of the test data into a feature vector form. Calculate the proportion of each violation code in the test data as the prior probability.
[0056] Step 4, recognition model based on Bayesian principle: Based on the Bayesian principle, for a new description of a field operation violation, the present invention first uses the BERT-BiLSTM-CRF Chinese NER model to identify the entity, then obtains the corresponding feature vector form according to the BOW algorithm, calculates the posterior probability of the corresponding field operation violation description text data corresponding to different violation types, and uses the violation code with the largest posterior probability as the prediction result, thereby realizing intelligent automatic recognition of the violation code.
[0057] Furthermore, the text preprocessing in step 1 is as follows:
[0058] The M power grid operation data obtained from the power grid company were preprocessed to remove data irrelevant to the recognition task, retaining the complete on-site operation violation description text data and its corresponding category knowledge, such as violation code label information, and reorganizing to obtain H power grid operation violation data.
[0059] Furthermore, the BIO entity annotation and Chinese NER model training in step 2 are as follows:
[0060] Based on the named entity recognition technology, the violation identification is performed. The first task is to perform BIO entity annotation on the unstructured text data formed by the description of the violation of the power grid field operation. The quality of entity annotation has a direct impact on the violation identification effect. Accurately and carefully marking each entity in the violation description segment helps to reliably describe the violation phenomenon; on the contrary, if the entity annotation is inaccurate or incomplete, it may lead to deviations in the understanding and identification of the operation violation. Here, for the H pieces of power grid field operation violation text data obtained after text preprocessing, the present invention performs BIO ternary entity annotation based on the YEDDA entity annotation tool: B-begin, I-inside, O-outside. BX represents the beginning of entity X, IX represents the inside of entity X, and O represents an entity that does not belong to any type. Through the research and analysis of the power grid field operation violation text data, it is determined that there are 5 entity categories, including Object, Person, File, Action and Surrounding. The H pieces of unstructured text data of the power grid field operation violation description completed by BIO are put into the BERT-BiLSTM-CRF Chinese NER model for training to obtain the trained model weights.
[0061] The BERT-BiLSTM-CRF Chinese NER model training and evaluation process is as follows:
[0062] The labeled BIO power grid field operation violation description text data has a total of B characters, among which the number of entity types is Person: p, Object: o, Surrounding: s, Action: a, File: f, and the training data volume is set to B. train , the amount of test data is B test During the model training process, the best experimental parameters are obtained by adjusting the learning rate, number of iterations, number of batches, and optimizer.
[0063] When evaluating the model, we select precision (P), recall (R), and F1 value as indicators for evaluating the performance of the recognition model. The calculation formulas for the three indicators are:
[0064]
[0065] Among them, TP is the number of instances predicted by the model as positive samples and are actually positive samples, FP is the number of instances predicted by the model as positive samples but are actually negative samples, FN is the number of instances predicted by the model as negative samples but are actually positive samples, P represents the proportion of samples predicted to be in a certain category that actually belong to that category, R represents the proportion of samples that actually belong to a certain category that are correctly predicted to be in that category, and F1 represents the harmonic mean of precision P and recall R, which is used to comprehensively evaluate the performance of the model.
[0066] Furthermore, the key dictionary selected in step 3 and the classical vector and prior probability of the violation code are obtained as follows:
[0067] In order to realize intelligent automatic identification of violation codes, the first preparation is to convert the on-site operation violation description text data into vector form. First, use the Chinese NER model training weights obtained in step 2 to perform entity recognition on the power grid on-site operation violation description text data, organize the words obtained by entity recognition according to each violation code, and count the word frequency. Then, according to the TF-IDF algorithm, select X keywords corresponding to each violation code, and organize these keywords into a dictionary, namely the key dictionary. The TF-IDF formula is:
[0068]
[0069] Among them, tf x,y is the number of times word x appears in the on-site operation violation description text data corresponding to violation code y; df x represents the number of violation codes containing word x; N is the number of all violation codes.
[0070] The key dictionary is obtained, with a total of S words, and the classic vector of each violation code is constructed. The dimension of the classic vector is S, and the position of each dimension corresponds to the corresponding word in the key dictionary. The classic vector of each violation code is constructed based on the X key word segmentations selected by the TF-IDF algorithm. Based on the BOW model, the corresponding positions corresponding to the X key word segmentations in the S-dimensional vector are assigned 1, and the other positions are assigned 0 to obtain the classic vector of each violation code. According to the pre-processed power grid field operation violation description text data, the power grid operation field violation description data corresponding to some violation codes are randomly selected, and the proportion of each violation code in the data is obtained as the prior probability.
[0071] Furthermore, the recognition model based on the Bayesian principle in step 4 is as follows:
[0072] The Bayesian Principle, or Bayesian theorem, is a mathematical method for updating probabilities. The Bayesian Principle has important applications in statistics, machine learning, data analysis, and other fields. Based on the Bayesian Principle, the present invention realizes automatic violation identification and further improves the tolerance of the violation identifier to noise, outliers, and overlapping data sets.
[0073] In order to verify the effectiveness of the proposed method for automatic identification of power grid operation violation codes based on the Chinese NER model and Bayesian principle, the present invention tests the proposed method based on the key dictionary obtained from step 1 to step 3, the classical vector and prior probability of the violation code, and the trained Chinese NER model weight. The data volume of the test sample is N test The specific implementation process is as follows:
[0074] The K-type dominant violation codes corresponding to the grid field operation violation data are used as the labels of the test data. test The text data describing the violations of the on-site operation of the power grid is used to identify the entities through the BERT-BiLSTM-CRF Chinese NER model, and then converted into an S-dimensional feature vector through the BOW model. The classical vector matrix dimension of the K-type dominant violation code is The prior probability of the K-type dominant violation code is Based on the Bayesian principle, firstly, the cosine similarity between the feature vector of a power grid field operation violation description text data and the classical vector of K types of dominant violation codes is calculated by formula (3):
[0075]
[0076] Among them, v1 and v2 are two vectors, · represents the dot product of the vectors, and ||v1|| and ||v2|| are the norms of the two vectors respectively.
[0077] Calculate the posterior probability, that is, calculate the probability that the feature vector of the given power grid field operation violation description text data belongs to a certain category. The formula is as follows:
[0078]
[0079] Among them, 1≤i≤K,1≤j≤N test , P(X j |C i ) indicates that in category C i Next, given the feature vector X j The likelihood is calculated here by cosine similarity:
[0080] P(X j |C i ) = cosine_similarity(X j ,C i )(5)
[0081] P r (C i ) is Category C i The prior probability of .
[0082] P(Xj ) is a given eigenvector X j The evidence probability is the weighted sum of the likelihood and prior probability under all violation code categories:
[0083]
[0084] Among them, C i is the standard vector of the corresponding violation code category.
[0085] Finally, the predicted violation code category is the category with the largest posterior probability, as shown below:
[0086]
[0087] in, is the predicted violation code category, P(C i |X j ) is the posterior probability calculated by the above formula.
[0088] Determine the predicted violation code category based on the one with the maximum posterior probability Then, compare it with the real label in the power grid violation data A comparison is made to verify the recognition effect of the proposed method on violation codes.
[0089] Embodiment 2 is an embodiment of the present invention, which provides a system for automatic identification of power grid operation violation codes, including: a data collection and preprocessing module, an entity labeling and NER model training module, a feature keyword extraction and feature vector generation module, and a violation identification module based on the Bayesian principle;
[0090] The data collection and preprocessing module is responsible for obtaining historical operation data from the power grid company and performing preliminary processing to filter out text data related to violations. By eliminating irrelevant information, only the description text of the operation violation and the corresponding violation code label are retained;
[0091] The entity annotation and NER model training module uses the YEDDA annotation tool to perform BIO annotation on the preprocessed data, mark the illegal behaviors and scene elements in the text as specific categories, and input the annotated text data into the BERT-BiLSTM-CRF Chinese NER model for training;
[0092] The feature keyword extraction and feature vector generation module is based on the trained NER model to identify the feature words in the violation description text, generate a key dictionary through the TF-IDF algorithm, and use the BOW model to build the classic vector of the violation code, vectorize the text data, and calculate the prior probability of each violation code in the data;
[0093] The violation recognition module based on the Bayesian principle constructs a feature vector based on the NER model and BOW algorithm for the input new violation description text, and calculates the posterior probability corresponding to each violation type through the Bayesian principle, and selects the violation code with the highest posterior probability as the final recognition result, realizing automatic recognition and intelligent analysis of the violation code.
[0094] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program code.
[0095] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0096] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0097] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0098] Example 3, reference Figure 2 to Figure 7 This is another embodiment of the present invention. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments. This embodiment experiments the existing traditional method and the method of this embodiment respectively.
[0099] Step 1, text preprocessing: For the power grid operation data obtained from the power grid company, text preprocessing is first performed to remove data irrelevant to the violation identification task, and the recorded on-site operation violation description information and its corresponding violation code and other contents are retained. Here, for the 24001 operation data of a southern power grid company obtained by the present invention, 15183 violation data are obtained after text preprocessing, and the obtained violation data contain complete on-site operation violation descriptions and their corresponding category knowledge. For example, according to the obtained violation data, it can be known that the 15183 operation violation events that occurred include A, B, C, and D violation codes. Specifically, for the on-site operation violation description of "tools are directly placed on the ground", the violation code recorded by the power grid staff is "D16"; for the on-site operation violation description of "no safety fence and vehicle warning signs are installed on the roadside construction", the violation code recorded by the power grid staff is "D25".
[0100] Step 2, BIO entity labeling and Chinese NER model training: Based on named entity recognition technology, violation identification is performed. Its primary task is to perform entity labeling on the unstructured text data formed by the description of violations in power grid field operations. The quality of entity labeling has a direct impact on the effect of violation identification. Accurately and carefully labeling each entity in the violation description segment helps to reliably describe the violation phenomenon; conversely, if the entity labeling is inaccurate or incomplete, it may lead to deviations in the understanding and identification of operational violations. Here, for the H violation data obtained after text preprocessing, the present invention performs BIO entity labeling based on the YEDDA entity labeling tool: B-begin, I-inside, O-outside. BX represents the beginning of entity X, IX represents the inside of entity X, and O represents an entity that does not belong to any type. Through the study and analysis of the on-site operation violation text data, it is determined that there are 5 entity categories: Object, Person, File, Action and Surrounding, among which the data labeling process is as follows: Figure 2 As shown, the final data for the character marking result is as follows Figure 3 As shown. The 15183 pieces of unstructured text data of on-site operation violations of power grids marked by BIO, with a total of 427940 characters, 9224 entity categories of Object, 3237 entity categories of Person, 4003 entity categories of File, 9792 entity categories of Action, and 4858 entity categories of Surrounding, are put into the BERT-BiLSTM-CRF Chinese NER model for training to obtain the trained Chinese NER model weights. In this embodiment, the amount of training data is set to B train is 342351 characters, and the test data volume is B test The number of characters is 85590. During the model training process, the relevant parameters are learning rate lr = 0.0001, iteration number epochs = 128, batch number batchsize = 128, and the optimizer selects Adam to obtain the best experimental parameters. The final experimental results of the BERT-BiLSTM-CRF Chinese NER model are as follows: Figure 4 As shown, save the model weights.
[0101] P (precision) indicates the proportion of samples predicted to belong to a certain category that actually belong to that category, R (recall) indicates the proportion of samples actually belonging to a certain category that are correctly predicted to belong to that category, and F1 indicates the harmonic mean of precision P and recall R, which is used to comprehensively evaluate the performance of the model. The final three indicators of the model are P = 94%, R = 94%, and F1 = 94%.
[0102] Step 3, select key dictionaries and obtain the classical vector and prior probability of the violation code: In order to verify the effectiveness of the method proposed in the present invention, it can realize intelligent automatic recognition of violation codes, randomly select 7 dominant violation codes (C13, C18, C27, C46, C57, C98, D18) and a total of 1899 power grid field operation violation data for testing. The violation phenomenon descriptions corresponding to these violation codes are "C13: Passing or staying vertically below the high-altitude work site and where falling objects may fall; workers at high altitudes throw tools, appliances and materials up and down at will; C18: When working in urban areas, densely populated areas, on thoroughfares or at traffic intersections, there are no barriers (fences) or other safety measures around the workplace; C27: Workers wear or cross safety fences or exceed safety warning lines without authorization; C46: Work on a ladder that is not supported by a dedicated person or is not tied firmly, or the ladder is set up on an unstable support, or the ladder has no anti-slip measures, or the ladder has no rope with a limited opening; C57: Safety helmets are not worn as required or are not worn correctly; C98: Goggles or protective masks are not worn during low-voltage non-stop work; D18: Insulated tools are not placed in protective devices after use or during transportation. The first preparation is to convert the text data describing violations of on-site operations into vector form.
[0103] Use the Chinese NER model training weights obtained in step 2 to perform entity recognition on the on-site operation violation description text data, sort the words and their frequency obtained by entity recognition according to each violation code, and select 5 keywords corresponding to each violation code according to the TF-IDF algorithm:
[0104]
[0105] Among them, tf x,y is the number of times word x appears in the on-site operation violation description text data corresponding to violation code y; df x represents the number of violation codes containing word x; N is the number of all violation codes, and in this embodiment, N is 7.
[0106] After selecting all the keywords of the violation codes, we removed the duplicate words and got 33 words. We sorted these keywords into a dictionary, namely the key dictionary. The word cloud is shown in the figure below: Figure 5 shown.
[0107] The key dictionary is obtained, which has a total of 33 words. The classic vector of each violation code is constructed. The dimension of the classic vector is 33 dimensions, and the position of each dimension corresponds to the corresponding word in the key dictionary. For the classic vector of each violation code, it is constructed according to the 5 key word segmentations selected by the TF-IDF algorithm. Based on the BOW model, the corresponding positions corresponding to the X key word segmentations in the 33-dimensional vector are assigned 1, and the other positions are assigned 0 to obtain the classic vector of each violation code. According to the pre-processed power grid field operation violation description text data, corresponding to 7 violation codes (C13, C18, C27, C46, C57, C98, D18), a total of 1798 field operation violation descriptions are obtained, and the proportion of each violation code (8.91%, 27.13%, 11.81%, 18.83%, 13.20%, 10.31%, 9.81%) is calculated as the prior probability. Among them, the picture of the proportion of each violation code in the data is as follows Figure 6 shown.
[0108] Step 4, recognition model based on Bayesian principle: Bayesian principle, also known as Bayesian theorem, is a mathematical method for updating probability. Bayesian principle has important applications in statistics, machine learning, data analysis and other fields. Based on Bayesian principle, the present invention realizes automatic violation recognition and further improves the tolerance of violation identifier to noise, abnormal points and data set overlap.
[0109] In order to verify the effectiveness of the proposed method for automatic identification of power grid operation violation codes based on the Chinese NER model and Bayesian principle, the present invention tests the proposed method based on the classical vector and prior probability of the violation code obtained from step 1 to step 3 and the trained BERT-BiLSTM-CRF Chinese NER model weights. The data volume of the test sample is N test In this embodiment, N test =1899, the specific implementation process is as follows:
[0110] The 7 major violation codes corresponding to the violation data were used as labels for the test data. Subsequently, the BERT-BiLSTM-CRF Chinese NER model was used to identify the entities using the 1,899 power grid field operation violation description text data, and then converted into a 33-dimensional feature vector using the BOW model. The classical vector matrix dimension of the K-type dominant violation code is The prior probability of the K-type dominant violation code is Based on the Bayesian principle, firstly, the cosine similarity between the feature vector of a power grid field operation violation description text data and the classic vectors of the seven dominant violation codes is calculated using formula (3):
[0111]
[0112] Among them, v1 and v2 are two vectors, representing the dot product of vectors, and ||v1|| and ||v2|| are the norms of the two vectors respectively.
[0113] Calculate the posterior probability, that is, calculate the probability that the feature vector of the given power grid field operation violation description text data belongs to a certain category. The formula is as follows:
[0114]
[0115] Among them, 1≤i≤7,1≤j≤1899,P(X j |C i ) indicates that in category C i Next, given the feature vector X j The likelihood is calculated here by cosine similarity:
[0116] P(X j |C i ) = cosine_similarity(X j ,C i ) (5)
[0117] P r (C i ) is Category C i The prior probability of .
[0118] P(X j ) is a given eigenvector X j The evidence probability is the weighted sum of the likelihood and prior probability under all violation code categories:
[0119]
[0120] Among them, C i is the standard vector of the corresponding violation code category.
[0121] Finally, the predicted violation code category is the category with the largest posterior probability, as shown below:
[0122]
[0123] in, is the predicted violation code category, P(C i |X j ) is the posterior probability calculated by the above formula.
[0124] Get the predicted violation code category matrix Then, compare it with the real label in the power grid violation data Comparison is performed to verify the recognition effect of the proposed method on violation codes. The confusion matrix of the final recognition result is as follows: Figure 7 As shown in the figure. For the violation code automatic identifier, the identifier performs relatively well in identifying the violation code, with an accuracy rate of 88.52%. This means that based on the given power grid field operation violation text record, there is an 88.52% probability that it can correctly identify the corresponding violation code. However, for some more complex or confusing violation codes, the automatic identifier still has room for improvement.
[0125] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for automatically identifying power grid operation violation codes, characterized in that: include: Collect power grid operation data and perform text preprocessing; The YEDDA annotation tool was used to annotate the preprocessed on-site operation violation description text data and put it into the BERT-BiLSTM-CRF Chinese NER model for training; Based on the trained NER model, the violation description text is recognized and the characteristic keywords of the violation code are extracted; The feature vector of the violation code is constructed, and the probability of the violation type is calculated based on the Bayesian principle. The violation code with the highest posterior probability is selected as the recognition result.
2. A method for automatically identifying power grid operation violation codes according to claim 1, characterized in that: The collecting of power grid operation data and text preprocessing includes: Obtain historical operation data from the power grid company, filter out the descriptive text data related to the violation, and remove the content irrelevant to the recognition task, retaining the complete operation violation description text and its violation code label information.
3. A method for automatically identifying power grid operation violation codes according to claim 2, characterized in that: The method of using the YEDDA annotation tool to perform entity annotation on the pre-processed on-site operation violation description text data and putting it into the BERT-BiLSTM-CRF Chinese NER model for training includes: For the power grid field operation violation text data obtained after text preprocessing, the unstructured text data formed by the description of the power grid field operation violation is annotated with BIO entities, and BIO ternary entity annotation is performed based on the YEDDA entity annotation tool; Annotation categories include Object, Person, File, Action, and Surrounding; The unstructured text data of the description of violations of power grid field operations annotated by BIO is put into the BERT-BiLSTM-CRF Chinese NER model for training to obtain the trained model weights.
4. A method for automatically identifying power grid operation violation codes as claimed in claim 3, characterized in that: The training of the BERT-BiLSTM-CRF Chinese NER model includes: During the model training process, the best experimental parameters are obtained by adjusting the learning rate, number of iterations, number of batches, and optimizer. When evaluating the model, precision, recall, and F1 value are selected as indicators for evaluating the performance of the recognition model. The expression is: Among them, TP is the number of instances predicted by the model as positive samples and are actually positive samples, FP is the number of instances predicted by the model as positive samples but are actually negative samples, FN is the number of instances predicted by the model as negative samples but are actually positive samples, P represents the proportion of samples predicted to belong to a certain category that actually belong to that category, R represents the proportion of samples that actually belong to a certain category that are correctly predicted to belong to that category, and F1 represents the harmonic mean of precision P and recall R.
5. A method for automatically identifying power grid operation violation codes as claimed in claim 4, characterized in that: Based on the trained NER model, the violation description text is recognized and the characteristic keywords of the violation code are extracted, including: The on-site operation violation description text data is converted into vector form, and entity recognition is performed on the on-site operation violation description text data of the power grid through the weights of the trained Chinese NER model. The words obtained by entity recognition are sorted according to each violation code, and the word frequency is counted; According to the TF-IDF algorithm, X keywords corresponding to each violation code are selected and organized into a key dictionary, expressed as follows: Among them, tf x,y is the number of times word x appears in the on-site operation violation description text data corresponding to violation code y; df x represents the number of violation codes containing word x; N is the number of all violation codes.
6. A method for automatically identifying power grid operation violation codes according to claim 5, characterized in that: The method of identifying the violation description text based on the trained NER model and extracting the characteristic keywords of the violation code also includes: The obtained key dictionary has a total of S words, and the classic vector of each violation code is constructed. The dimension of the classic vector is S dimensions, and the position of each dimension corresponds to the corresponding word in the key dictionary; For each violation code, the classic vector is constructed based on X key words selected by the TF-IDF algorithm; Based on the BOW model, the corresponding positions of the X key words in the S-dimensional vector are assigned 1, and the other positions are assigned 0 to obtain the classic vector of each violation code. According to the preprocessed power grid on-site operation violation description text data, the power grid operation site violation description data corresponding to some violation codes are randomly selected, and the proportion of each violation code in the data is calculated as the prior probability.
7. A method for automatically identifying power grid operation violation codes according to claim 6, characterized in that: The feature vector of the violation code is constructed, and the probability of the violation type is calculated based on the Bayesian principle, and the violation code with the highest posterior probability is selected as the recognition result, including: For new descriptions of on-site operation violations, the BERT-BiLSTM-CRF Chinese NER model is used to identify entities, and the corresponding feature vector form is obtained according to the BOW algorithm. The posterior probability of the corresponding on-site operation violation description text data corresponding to different violation types is calculated, and the violation code with the largest posterior probability is used as the prediction result to realize intelligent and automatic recognition of violation codes.
8. A system using the method for automatically identifying power grid operation violation codes as claimed in any one of claims 1 to 7, characterized in that: It includes data collection and preprocessing module, entity labeling and NER model training module, feature keyword extraction and feature vector generation module, and violation recognition module based on Bayesian principle; The data collection and preprocessing module is responsible for obtaining historical operation data from the power grid company and performing preliminary processing to filter out text data related to violations, and only retain the description text of the operation violation and the corresponding violation code label by eliminating irrelevant information; The entity annotation and NER model training module uses the YEDDA annotation tool to perform BIO annotation on the preprocessed data, marks the illegal behaviors and scene elements in the text as specific categories, and inputs the annotated text data into the BERT-BiLSTM-CRF Chinese NER model for training; The feature keyword extraction and feature vector generation module is to identify the feature words in the violation description text based on the trained NER model, generate a key dictionary through the TF-IDF algorithm, and use the BOW model to construct the classic vector of the violation code, vectorize the text data, and calculate the prior probability of each violation code in the data; The violation recognition module based on the Bayesian principle constructs a feature vector based on the NER model and the BOW algorithm for the input new violation description text, calculates the posterior probability corresponding to each violation type through the Bayesian principle, selects the violation code with the highest posterior probability as the final recognition result, and realizes automatic recognition and intelligent analysis of the violation code.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for automatically identifying power grid operation violation codes described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for automatically identifying power grid operation violation codes as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and device for judging classification to which article belongs based on word segmentation weight, and storage medium
CN110674289A
Power violation semantic generation method based on scene graph technology
CN117292379A
Named entity identification method based on ELCTRA and electric power safety regulation data
CN117807998A
Text classification method and device, electronic equipment and readable storage medium
CN118170902A