Power grid operation violation dictionary construction and automatic classification method and system
By performing text preprocessing and keyword filtering on power grid operation data, and combining it with the LIB-SVM algorithm, the problems of redundant and inefficient word segmentation in the classification of violations in power grid operations were solved, and efficient and accurate automatic classification of violations was achieved.
Patent Information
- Application Number
- CN202311514252.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-14
- Publication Date
- 2026-02-13
AI Technical Summary
Existing methods for classifying violations in power grid operations suffer from inefficiency, inaccuracy, and redundant word segmentation, making it difficult to improve classification accuracy and efficiency.
By preprocessing the power grid operation data to remove irrelevant data, an initial word vector space is constructed using the Jieba word segmentation engine and bag-of-words model. Key words are then selected by combining the relative frequency matrix and uniqueness index to construct a keyword vector space. Finally, a violation classification model is established using the LIB-SVM algorithm that supports soft-interval classification.
It achieves efficient and accurate classification of violations in power grid operations, eliminates redundant word segmentation, improves the classifier's tolerance to noise and anomalies, and enhances the accuracy of automatic classification of violation codes, violation types, and problem types.
Smart Images

Figure CN121524768A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of operational violation classification technology, specifically to a method and system for constructing a dictionary of power grid operational violations and for automatic classification. Background Technology
[0002] Grid operation safety is a crucial aspect of the power industry. With the advancement of national energy transformation and the implementation of the innovation-driven development strategy, smart grids, as a fundamental platform, are playing an increasingly important role. In this context, grid operation safety is particularly critical, directly impacting the safety of personnel and property. Grid operations involve high-voltage electrical equipment and complex power systems; accidents or malfunctions can lead to serious consequences, including personal injury, equipment damage, and power outages. Therefore, ensuring the safety of grid operations is essential for protecting personnel and property interests. Currently, major power grid companies in my country have accumulated a wealth of information on operational violations, such as the working environment, descriptions of on-site violations, and types of violations. This constitutes firsthand data on safe operations and serves as a guiding principle. Comprehensive analysis of violations based on the accumulated violation data of power grid companies can not only effectively curb the occurrence of safety accidents but also further improve the quality of grid operations. This is of great significance for ensuring the safe operation of the power grid and improving overall operational efficiency. By leveraging artificial intelligence technologies such as machine learning and deep learning to deeply analyze the textual data recorded in historical operational violations, typical violations can be extracted. This facilitates the automatic and intelligent classification of subsequent violations, improving safety supervision efficiency and strengthening risk management capabilities. In conclusion, intelligent classification of operational violations is of great significance to the safe construction and operation of the power grid.
[0003] In recent years, text classification has become a research focus. In the context of artificial intelligence, text classification techniques using Natural Language Processing (NPL) can achieve structured processing, categorized display, and dynamic analysis of complex data, thereby improving the efficiency and accuracy of information processing. The application of these techniques has been validated in practice. In practical applications, the primary task of NPL classification techniques is to segment text data and construct a dictionary. The quality of the constructed dictionary directly impacts the classification effect. Li Jing et al. used the TF-IDF (Term Frequency-Inverse Document Frequency) algorithm to extract features from the massive amount of segmented text obtained after segmentation, constructing a basic corpus. However, in practical applications, this method can only select unique segmented words to construct the dictionary. For example, when the text of violation records all contain the keyword "command," according to the TF-IDF calculation formula, the weight of "command" becomes very small, thus it cannot be added to the dictionary (Li Jing, Zhang Zhizhen, Du Xuan, et al. Research on statistical methods for coal mine violations based on text classification technology [J]. Journal of Mining Science, 2022, 7(03): 344-353.). In addition, Cui Lei used the chi-square statistic to extract key words, but this method can only measure whether the word appears in the text data, and cannot count its frequency. This leads to some words appearing only in certain texts and having a high frequency in these samples, while other words appear in most texts but have a low frequency. Using the CHI method, low-frequency words are most likely to be extracted as key words, while high-frequency words with distinguishing characteristics are eliminated (Cui Min. Data processing of electrical equipment monitoring based on text recognition technology [D]. North China Electric Power University, 2020: 23-24.). For the violation data after word vectorization, Bastings et al. used Support Vector Machine (SVM) for text classification. However, the traditional SVM method has low tolerance for noise, outliers and dataset overlap, so its classification performance is poor in harsh environments (Bastings J, Titov I, Aziz W. Graph Conventional Encoders for Syntax-aware Neural Machine Translation[C] / / Proceedings of the 2017 Conference on Empirical Methods in Natural Language Proceeding.2017:1957-1967.).Chen et al. proposed an ensemble neural network model based on CNN-BiLSTM to achieve anomaly classification based on text data in the bearing fault domain. However, this method uses a knowledge graph to assist in anomaly classification, which means that a complete knowledge graph needs to be constructed in advance, and this process may be relatively complex and time-consuming (Chen T, Lu N, Lei X, et al. Text Classification for Fault Knowledge Graph Construction Based on CNN-BiLSTM[C] / / Northeastern University, Professional Committee on Control and Decision of Cyber-Physical Systems of the Chinese Association of Automation. Proceedings of the 35th China Control and Decision Conference. 2023:6.). Summary of the Invention
[0004] In view of the above-mentioned problems, the present invention is proposed.
[0005] Therefore, the technical problem solved by this invention is that existing methods for classifying violations in power grid operations are inefficient, inaccurate, and have redundant word segmentation, and how to optimize the classification accuracy and efficiency.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a method for constructing and automatically classifying a dictionary of violations in power grid operations, comprising:
[0007] For the obtained power grid operation data, text preprocessing is performed to remove data irrelevant to the classification task, retaining the description information of on-site operation violations and their corresponding violation codes, violation types, and problem type labels. An initial word vector space is constructed, and the Jieba word segmentation engine is used for word segmentation. Single characters, punctuation marks, auxiliary words, and other words obviously irrelevant to the violation description are filtered out by stop words to construct an initial violation dictionary. The bag-of-words model is used to build a word vector space based on the constructed initial violation dictionary, initially realizing the description of power grid on-site operation violation information with a high-dimensional numerical structured data matrix. Considering that the initial violation dictionary obtained from the initial word segmentation has many semantically similar or repetitive words with redundancy, skewness and kurtosis are introduced based on the relative frequency matrix to construct uniqueness indicators, select key words, and further construct a classic violation dictionary to form a keyword vector space. Based on SVM, the LIB-SVM algorithm, which supports soft-margin classification, is used to build a violation classification model based on the obtained keyword vector space and its corresponding labels.
[0008] As a preferred embodiment of the power grid operation violation dictionary construction and automatic classification method described in this invention, the text preprocessing includes preprocessing the obtained M power grid operation data, removing data irrelevant to the classification task, retaining complete on-site operation violation descriptions and their corresponding category knowledge, the complete on-site operation violation descriptions and their corresponding category knowledge including violation codes, violation types and problem type tag information, and reorganizing to obtain H power grid operation violation data.
[0009] As a preferred embodiment of the power grid operation violation dictionary construction and automatic classification method described in this invention, the construction of the initial word vector space includes: segmenting the H violation data obtained after text preprocessing using the Jieba word segmentation engine, and filtering out single characters, punctuation marks, auxiliary words, and other words obviously unrelated to the violation description by using stop words; based on the initially obtained m word segments, establishing the word vector space using the bag-of-words model, thereby transforming the initial H unstructured text data into a high-dimensional structured data matrix with variable dimension m and sample size H. Represented as,
[0010]
[0011] Where, x j The value of (i) represents the frequency of the j-th word for the i-th violation data.
[0012] As a preferred embodiment of the power grid operation violation dictionary construction and automatic classification method described in this invention, the formation of the keyword vector space includes, to solve the redundancy problem of segmentation results commonly found in the Jieba word segmentation engine, the initial violation dictionary Φ is constructed. I The m words contained in the text are carefully selected to extract keywords that are beneficial for automatic classification of violations;
[0013] Taking the top K most frequent dominant violation codes in power grid operations as the research object, for the kth dominant violation code, calculate its corresponding n. k The relative frequency vector is obtained by analyzing the relative frequencies of each word in the traffic violation data.
[0014] Among them, f k (j) represents the relative frequency of the j-th word segment relative to the k-th dominant violation code:
[0015]
[0016] Where j = 1, 2, ..., m, k = 1, 2, ..., K, For the n corresponding to the dominant violation code of the kth type kThe frequency of the j-th word in the unstructured text data formed by the description of the violation;
[0017] By combining the top K dominant violation codes, a relative frequency matrix can be obtained.
[0018]
[0019] As a preferred embodiment of the power grid operation violation dictionary construction and automatic classification method described in this invention, the step of removing data irrelevant to the classification task includes removing abnormally unique words before searching for unique words in the constructed initial violation dictionary, and removing abnormally unique words based on the relative frequency matrix. For the j-th word, when g j When the value is 1, the word segment is removed; otherwise, the word segment is retained, as shown below.
[0020] g j =(f j (1)<α)∧(f j (2)<α)∧…∧(f(K)<α)
[0021] Where ∧ represents the logical intersection operation, and α is the lower limit of the relative frequency control;
[0022] Remove abnormal and unique word segments, and utilize the remaining m W Each word segment constructs a cleaned dictionary of violations. W .
[0023] As a preferred embodiment of the power grid operation violation dictionary construction and automatic classification method described in this invention, the relative frequency matrix includes the frequency of violations in the cleaned violation dictionary Φ. W We introduce skewness and kurtosis to construct a uniqueness index I, and then conduct in-depth analysis of the relative frequency data of the remaining word segments. The symmetry and sharpness of the distribution further measure the uniqueness of each word segment, represented as follows:
[0024]
[0025] Where, μ j and σ j These are the relative frequency data f j Mean and standard deviation:
[0026]
[0027]
[0028] Where, N j f j The number of samples, i.e., N j =K;
[0029] From the cleaned dictionary of violations Φ W The first β highly unique words are selected to construct a highly unique violation dictionary Φ. U .
[0030] As a preferred embodiment of the power grid operation violation dictionary construction and automatic classification method described in this invention, the relative frequency matrix further includes selecting the top γ high relative frequency words from various violation codes based on the relative frequency matrix F to obtain a highly applicable violation dictionary Φ. A Based on the obtained highly unique violation dictionary Φ U And Strong Applicability Violation Dictionary Φ A Select m C Key word segmentation to construct a classic violation dictionary. C ,
[0031] Φ C =Φ U ∩Φ A
[0032] Where, m C <<m;
[0033] Based on the extracted key words, a keyword vector space is further constructed, transforming the initial unstructured text data from each violation incident into variables of dimension m. C Keyword vectors.
[0034] Another objective of this invention is to provide a dictionary construction and automatic classification system for power grid operation violations, which solves the problems of redundant word segmentation and inaccurate classification through automated dictionary construction and accurate classification of violation information.
[0035] To address the aforementioned technical problems, this invention provides the following technical solution: a system for constructing and automatically classifying a dictionary of violations in power grid operations, comprising: a data processing module, a dictionary construction module, a classification model training module, and a result output feedback module; the data processing module is used to clean the original power grid operation data, removing irrelevant information and retaining useful violation description information; the dictionary construction module is used to segment the preprocessed data using the Jieba word segmentation engine, select keywords based on various uniqueness indicators, and construct a violation dictionary; the classification model training module is used to train the model using the LIB-SVM algorithm based on the constructed dictionary, and accurately classify new data according to the patterns learned from the training data; the result output and feedback module is used to output the classification results and provide feedback, and perform self-optimization based on the feedback to improve classification accuracy.
[0036] A computer device includes a memory and a processor, the memory storing a computer program, characterized in that the processor executes the computer program to implement the steps of the above-described method for constructing and automatically classifying a dictionary of violations in power grid operations.
[0037] A computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of the above-described method for constructing and automatically classifying a dictionary of violations in power grid operations.
[0038] The beneficial effects of this invention are as follows: The method for constructing and automatically classifying a dictionary of violations in power grid operations provided by this invention firstly preprocesses the power grid operation data to effectively remove data irrelevant to the violation classification task; secondly, it constructs an initial word vector space based on Jieba word segmentation and the bag-of-words model to describe the violation information of power grid operations in a high-dimensional numerical structured data matrix; subsequently, considering the redundancy problem of many semantically similar or repeated words in the initial violation dictionary obtained by preliminary word segmentation, this invention introduces skewness and kurtosis to construct a uniqueness index based on the relative frequency matrix, selects key words that are both unique and highly applicable, and further constructs a classic violation dictionary to form a keyword vector space. The above keyword feature extraction strategy effectively achieves data dimensionality reduction; finally, a violation classifier is established based on the obtained keyword vector space and its corresponding violation type labels. This classifier can intelligently realize the automatic classification of violation codes, violation types, and problem types. Attached Figure Description
[0039] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 The flowchart illustrates a method for constructing and automatically classifying a dictionary of violations in power grid operations, as provided in one embodiment of the present invention.
[0041] Figure 2 This is a classic violation dictionary diagram in a method for constructing and automatically classifying a power grid operation violation dictionary, provided in the second embodiment of the present invention.
[0042] Figure 3 This is a word cloud diagram of key words in a method for constructing and automatically classifying a dictionary of violations in power grid operations, provided in the second embodiment of the present invention.
[0043] Figure 4The diagram shows the violation code label in a method for constructing and automatically classifying a dictionary of violations in power grid operations, as provided in the second embodiment of the present invention.
[0044] Figure 5 The diagram shows the classification results of the automatic classifier for violation codes in a method for constructing and automatically classifying a dictionary of violations in power grid operations, provided in the second embodiment of the present invention.
[0045] Figure 6 The second embodiment of the present invention provides a confusion matrix diagram of the automatic classifier for violation codes in a method for constructing and automatically classifying a dictionary of violations in power grid operations.
[0046] Figure 7 The diagram shows the classification results of the automatic classifier for violation types in a method for constructing and automatically classifying a dictionary of violations in power grid operations, provided in the second embodiment of the present invention.
[0047] Figure 8 The second embodiment of the present invention provides a confusion matrix diagram of the automatic classifier for violation type in a method for constructing and automatically classifying a dictionary of violations in power grid operations.
[0048] Figure 9 The image shows the classification results of the automatic classifier for problem types in a method for constructing and automatically classifying a dictionary of violations in power grid operations, provided in the second embodiment of the present invention.
[0049] Figure 10 The confusion matrix diagram of the automatic classifier for problem types in a method for constructing and automatically classifying a dictionary of violations in power grid operations provided in the second embodiment of the present invention.
[0050] Figure 11 This is an overall structural diagram of a power grid operation violation dictionary construction and automatic classification system provided in the fourth embodiment of the present invention. Detailed Implementation
[0051] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0052] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0053] Example 1
[0054] Reference Figure 1 As an embodiment of the present invention, a method for constructing and automatically classifying a dictionary of violations in power grid operations is provided, including:
[0055] Step 1, Text Preprocessing: For the power grid operation data obtained from the power grid company, perform text preprocessing to remove data that is irrelevant to the classification task, and retain the description information of on-site operation violations and the corresponding violation codes, violation types and problem types, etc.
[0056] Step 2, Initial word vector space construction: Use the Jieba word segmentation engine to segment words, filter out single characters, punctuation marks, auxiliary words and other words that are obviously irrelevant to the description of violations by using stop words, and construct an initial violation dictionary. Then, use the bag-of-words model to build a word vector space based on the constructed initial violation dictionary, and initially realize the description of power grid on-site operation violation information with a high-dimensional numerical structured data matrix.
[0057] Step 3, Keyword Extraction and Keyword Vector Space Construction: To address the word segmentation redundancy problem commonly found in Jieba word segmentation engines, such as the inclusion of many semantically similar or repetitive words in the segmentation results, this invention performs a fine screening of each word in the initial violation dictionary based on uniqueness and applicability, extracting key words that are beneficial for automatic violation classification, and completing the construction of the keyword vector space.
[0058] Step 4, Automatic Classifier Training: Based on the traditional SVM, this invention uses the LIB-SVM algorithm, which supports soft-margin classification, to establish a violation classification model, further improving the violation classifier's tolerance to noise, outliers, and dataset overlap, and more accurately and effectively classifying each violation event by violation code, violation type, and problem type.
[0059] Furthermore, the text preprocessing in step 1 is as follows:
[0060] For the M power grid operation data obtained from the power grid company, text preprocessing is performed to remove data that is irrelevant to the classification task, while retaining complete descriptions of on-site operation violations and their corresponding category knowledge, such as violation codes, violation types, and problem types, and reorganizing to obtain H power grid operation violation data.
[0061] Furthermore, the initial word vector space construction in step 2 is as follows:
[0062] The primary task in classifying violations using natural language processing (NLP) technology is word segmentation of the unstructured text data describing violations at power grid sites. The quality of word segmentation directly impacts the classification effectiveness. Accurately segmenting each word or phrase in the violation description helps to reliably describe the violation; conversely, inaccurate or incomplete segmentation may lead to misunderstandings and misclassifications of the violations. Therefore, for the H violation data points obtained after text preprocessing, this invention uses the Jieba word segmentation engine for segmentation and filters out single characters, punctuation marks, auxiliary words, and other words clearly irrelevant to the violation description by using stop words to improve the segmentation effect and accuracy. Subsequently, based on the initially obtained m words, a word vector space is established using the bag-of-words model, transforming the initial H unstructured text data points into a structured data matrix with m variable dimensions and H sample sizes.
[0063]
[0064] Where, x j The value of (i) represents the frequency of the j-th word for the i-th violation data.
[0065] Furthermore, step 3, key word segmentation extraction and keyword vector space construction, are detailed as follows:
[0066] To address the redundancy issue commonly found in Jieba word segmentation engines, such as the inclusion of semantically similar or repeated words in the segmentation results, this invention modifies the initial violation dictionary Φ. I The m words contained in the data are finely screened to extract keywords that are beneficial for automatic violation classification. Compared with other violation classification attributes, there are hundreds of violation code types, while violation types and problem types generally only include a few. Here, this invention takes the top K most frequent violation codes in power grid operation as the research object, and clearly and completely demonstrates the proposed key word extraction strategy. The specific extraction process is as follows:
[0067] (1) For the top K dominant violation codes, calculate the relative frequency of each word in the corresponding violation data. For example, for the kth dominant violation code, calculate the corresponding n k The relative frequency vector is obtained by analyzing the relative frequencies of each word in the traffic violation data. Among them, f k (j) represents the relative frequency of the j-th word segment relative to the k-th dominant violation code:
[0068]
[0069] Where j = 1, 2, ..., m, k = 1, 2, ..., K, For the n corresponding to the dominant violation code of the kth type k The frequency of the j-th word in the unstructured text data formed by the description of the violation.
[0070] By combining the top K dominant violation codes, a relative frequency matrix can be obtained.
[0071]
[0072] (2) For various violation codes, the more unique the word segmentation used in the violation description, the easier they are to distinguish. However, before searching for unique word segmentation from the constructed initial violation dictionary, it is necessary to remove abnormally unique word segmentation. These types of word segmentation usually appear very infrequently in violation data, possibly due to spelling errors, rare words, or uncommon domain-specific terms, which is not conducive to building a representative and comprehensive violation dictionary. Below, this invention removes abnormally unique word segmentation based on the relative frequency matrix. Specifically, for the j-th word segmentation, when g j When the value is 1, the segmentation is removed; otherwise, the segmentation is retained.
[0073] g j =(f j (1)<α)∧(f j (2)<α)∧…∧(f(K)<α) (4)
[0074] Here, ∧ represents the logical intersection operation, and α is the lower limit for relative frequency control. Based on this strategy, abnormally unique word segments can be eliminated, and the remaining m... W Each word segment constructs a cleaned dictionary of violations. W .
[0075] (3) For the cleaned illegal dictionary Φ W This invention further introduces skewness and kurtosis to construct a uniqueness index I, and conducts in-depth analysis of the relative frequency data of the remaining word segments. The symmetry and sharpness of the distribution further measure the uniqueness of each word segmentation:
[0076]
[0077] Where, μ j and σ j These are the relative frequency data f j Mean and standard deviation:
[0078]
[0079]
[0080] Where, Nj f j The number of samples, i.e., N j =K.
[0081] For the j-th word segment, the absolute value of the skewness |sk j The larger the value of |, the greater the degree of deviation and the stronger the uniqueness of the word segmentation; similarly, ku j A value greater than 0 indicates a steeper relative frequency distribution and stronger word segmentation uniqueness. Comprehensive analysis shows that for the j-th word segment, its uniqueness index I... j The larger the value, the stronger the uniqueness of the word segmentation, and the more beneficial it is for violation classification. Therefore, this invention uses the cleaned violation dictionary Φ W The first β highly unique words are selected to construct a highly unique violation dictionary Φ. U .
[0082] (4) The extracted key words should not only be unique, but also applicable. Specifically, this invention first selects the top γ high-relative-frequency words from various violation codes based on the relative frequency matrix F to obtain a highly applicable violation dictionary Φ. A Subsequently, based on the obtained highly unique violation dictionary Φ U And Strong Applicability Violation Dictionary Φ A Select m that is both unique and highly applicable C Key word segmentation to construct a classic violation dictionary. C :
[0083] Φ C =Φ U ∩Φ A (8)
[0084] Where, m C <<m, that is, through the key word segmentation extraction strategy proposed in this invention, redundancy removal of word segmentation can be effectively achieved while ensuring the uniqueness and applicability of word segmentation.
[0085] (5) Finally, based on the extracted key words, a keyword vector space can be further constructed to transform the initial unstructured text data of each violation event into variables with dimension m. C Keyword vectors enable the description of violations in power grid field operations using low-dimensional numerical structured data.
[0086] Furthermore, the automatic classifier training in step 4 is as follows:
[0087] Support Vector Machine (SVM) has become a classic algorithm in classification models due to its strong model generalization ability and high recognition performance. This invention, based on SVM, utilizes the LIB-SVM algorithm, which supports soft-margin classification, to achieve automatic classification of traffic violations, further improving the classifier's tolerance to noise, outliers, and dataset overlap.
[0088] To verify the effectiveness of the proposed method for constructing and automatically classifying a dictionary of violations in power grid operations, this invention establishes a violation classifier based on the keyword vector space obtained in steps 1 to 3 and its corresponding violation type labels. Let the amount of training data be n. train The test data volume is n test The specific implementation process is as follows:
[0089] (1) Establish an automatic classifier for violation codes: Encode the K dominant violation codes corresponding to the violation data sequentially as 1 to K. Then, use n train The data matrix obtained by vectorizing the text data of on-site operation violations using keywords As input, its corresponding violation code label vector The output is used for training the LIB-SVM model. Specifically, among the various kernel function forms included in the LIB-SVM algorithm, the RBF kernel function, known for its strong stability, is selected to construct the automatic classification model for traffic violation codes using the LIB-SVM kernel. In the algorithm verification phase, n... test The data matrix obtained by vectorizing the text data of on-site operation violations using keywords As input, analyze the corresponding violation code.
[0090] (2) Establish an automatic classifier for violation types: Number the violation types corresponding to the violation data sequentially, and then use n as the classifier. train The data matrix obtained by vectorizing the text data of on-site operation violations using keywords As input, its corresponding violation type label vector The output is used for training the LIB-SVM model. Similarly, the relatively stable RBF kernel function is selected to construct an automatic LIB-SVM classification model for traffic violations. In the algorithm verification phase, n... test The data matrix obtained by vectorizing the text data of on-site operation violations using keywords As input, analyze the type of violation it belongs to.
[0091] (3) Establish an automatic problem type classifier: Number the problem types corresponding to the violation data sequentially, and then use n to represent the types of problems. train The data matrix obtained by vectorizing the text data of on-site operation violations using keywords As input, its corresponding question type label vector The output is used for training the LIB-SVM model. Similarly, the relatively stable RBF kernel function is selected to construct an automatic LIB-SVM classification model for traffic violations. In the algorithm verification phase, n... test The data matrix obtained by vectorizing the text data of on-site operation violations using keywords As input, analyze the type of problem it belongs to.
[0092] It can intelligently classify violation codes, violation types, and problem types based on unstructured text data generated from descriptions of violations during power grid operations. The modeling process for constructing a violation classifier by processing unstructured text data mainly includes: text preprocessing, initial word vector space construction, key word extraction and keyword vector space construction, and automatic classifier training.
[0093] Example 2
[0094] Reference Figures 2-10 As an embodiment of the present invention, a method for constructing and automatically classifying a dictionary of violations in power grid operations is provided. To verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculations and simulation experiments.
[0095] Step 1, Text Preprocessing: For power grid operation data obtained from the power grid company, text preprocessing is first performed to remove data irrelevant to the violation classification task, retaining the recorded on-site operation violation descriptions, their corresponding violation codes, violation types, and problem types. Here, for the 24,001 operation data entries from a power grid company in southern China obtained by this invention, after text preprocessing, 15,183 violation data entries were obtained. The obtained violation data contains complete on-site operation violation descriptions and their corresponding category knowledge. For example, based on the obtained violation data, it can be seen that the 15,183 operation violation events include 169 violation codes, 4 violation types, and 3 problem types. Specifically, for the on-site violation description of "tools placed directly on the ground," the violation code recorded by the power grid worker is "D16," the violation type is "personnel behavior," and the problem type is "behavior (operation) category."
[0096] Step 2, Initial Word Vector Space Construction: Violation classification based on natural language processing technology begins with word segmentation of the unstructured text data describing violations at power grid sites. The quality of word segmentation directly impacts the classification effectiveness. Accurately segmenting each word or phrase in the violation description helps to reliably describe the violation; conversely, inaccurate or incomplete segmentation may lead to deviations in the understanding and classification of violations. Here, for the 15,183 violation data entries obtained after text preprocessing, this invention uses the Jieba word segmentation engine for segmentation and filters out single characters, punctuation marks, auxiliary words, and other words clearly irrelevant to the violation description by using stop words to improve the segmentation effect and accuracy. The final output contains 6,225 filtered segmented words, including key operational description words such as "insulation," "wearing," and "ladder." Subsequently, based on the 6225 initially obtained word segments, a word vector space was established using the bag-of-words model, thereby transforming the initial 15183 unstructured text data into a structured data matrix with a variable dimension of 6225 and a sample size of 15183.
[0097]
[0098] Where, x j The value of (i) represents the frequency of the j-th word for the i-th violation data.
[0099] Step 3, Keyword Extraction and Keyword Vector Space Construction: To address the word segmentation redundancy problem commonly found in Jieba word segmentation engines, such as the inclusion of many semantically similar or repeated words in the segmentation results, this invention constructs an initial violation dictionary Φ I The 6255 words contained in the data were carefully selected to extract key words that are beneficial for automatic violation classification. Compared with other violation classification attributes, there are hundreds of violation code types, while violation types and problem types generally only contain a few. Here, this invention uses the top 20 most frequent dominant violation codes {D16, D25, D06, C18, D07, C53, C02, C46, C98, C57, C27, D04, D18, B25, C05, C13, A, D11, B23, D13} in power grid violation operations as an example to clearly and completely demonstrate the proposed key word extraction strategy. The specific extraction process is as follows:
[0100] (1) For the top 20 dominant violation codes, calculate the relative frequency of each word in the corresponding violation data. For example, for the kth dominant violation code, calculate the corresponding n k The relative frequency vector is obtained by analyzing the relative frequencies of each word in the traffic violation data. Among them, fk (j) represents the relative frequency of the j-th word segment relative to the k-th dominant violation code:
[0101]
[0102] Where j = 1, 2, ..., 6225, k = 1, 2, ..., 20, For the n corresponding to the dominant violation code of the kth type k The frequency of the j-th word in the unstructured text data formed by the description of the violation.
[0103] By combining the top 20 dominant violation codes, a relative frequency matrix can be obtained.
[0104]
[0105] (2) For various violation codes, the more unique the word segmentation used in the violation description, the easier they are to distinguish. However, before searching for unique word segmentation from the constructed initial violation dictionary, it is necessary to remove abnormally unique word segmentation. These types of word segmentation usually appear very infrequently in violation data, possibly due to spelling errors, rare words, or uncommon domain-specific terms, which is not conducive to building a representative and comprehensive violation dictionary. Below, this invention removes abnormally unique word segmentation based on the relative frequency matrix. Specifically, for the j-th word segmentation, when g j When the value is 1, the segmentation is removed; otherwise, the segmentation is retained.
[0106] g j =(f j (1)<α)∧(f j (2)<α)∧…∧(f(20)<α) (4)
[0107] Where ∧ represents the logical intersection operation, and α is the lower limit of relative frequency control. In an embodiment of the present invention, α = 0.05. At this point, according to this strategy, 5952 abnormally unique word segments can be removed, and the remaining 273 word segments are used to construct a cleaned violation dictionary Φ. W .
[0108] (3) For the cleaned illegal dictionary Φ W This invention further introduces skewness and kurtosis to construct a uniqueness index I, and conducts in-depth analysis of the relative frequency data of the remaining word segments. The symmetry and sharpness of the distribution further measure the uniqueness of each word segmentation:
[0109]
[0110] Where, μ j and σ jThese are the relative frequency data f j Mean and standard deviation:
[0111]
[0112]
[0113] Where, N j f j The number of samples, in this embodiment, is N. j =20.
[0114] For the j-th word segment, the absolute value of the skewness |sk j The larger the value of |, the greater the degree of deviation and the stronger the uniqueness of the word segmentation; similarly, ku j A value greater than 0 indicates a steeper relative frequency distribution and stronger word segmentation uniqueness. Comprehensive analysis shows that for the j-th word segment, its uniqueness index I... j The larger the value, the stronger the uniqueness of the word segmentation, and the more beneficial it is for violation classification. Therefore, this invention uses the cleaned violation dictionary Φ W The first β highly unique words are selected to construct a highly unique violation dictionary Φ. U Specifically, in this embodiment, β is set to 250.
[0115] (4) The extracted key words should not only be unique, but also applicable. Specifically, this invention first selects the top γ high-relative-frequency words from various violation codes based on the relative frequency matrix F to obtain a highly applicable violation dictionary Φ. A Subsequently, based on the obtained highly unique violation dictionary Φ U And Strong Applicability Violation Dictionary Φ A To construct a classic traffic violation dictionary that is both unique and highly applicable. C :
[0116] Φ C =Φ U ∩Φ A (8)
[0117] In this embodiment, let γ = 5, such as Figure 2 As shown, the obtained classic traffic violation dictionary Φ C It contains 46 key words, far fewer than the number of words in the initial violation dictionary. This means that the key word extraction strategy proposed in this invention can effectively remove redundancy from word segmentation while ensuring the uniqueness and applicability of the segmented words. Furthermore, as... Figure 3 As shown in the word cloud, for the extracted classic violation dictionary Φ CThe words “work,” “site,” and “violation” appear frequently in descriptions of violations in power grid operations and are core terms in descriptions of violations in on-site operations.
[0118] (5) Finally, based on the extracted key words, a keyword vector space can be further constructed to transform the initial unstructured text data in each violation event into a keyword vector with a variable dimension of 46, so as to realize the description of power grid on-site operation violation information with low-dimensional numerical structured data.
[0119] Step 4, Automatic Classifier Training: Support Vector Machine (SVM) has become a classic algorithm in classification models due to its strong model generalization ability and high recognition performance. This invention, based on SVM, utilizes the LIB-SVM algorithm, which supports soft-margin classification, to achieve automatic classification of traffic violations, further improving the classifier's tolerance to noise, outliers, and dataset overlap.
[0120] To verify the effectiveness of the proposed method for constructing a dictionary of violations in power grid operations and for automatic classification, this invention establishes a violation classifier based on the keyword vector space and its corresponding labels obtained in steps 1 to 3. Specifically, 2750 violation data entries corresponding to the first 20 dominant violation codes are used as an example. 80% of the violation data is randomly selected as the training set to train the LIB-SVM classifier, and the remaining 20% is used as the test set to verify the accuracy of the proposed method. The specific implementation process is as follows:
[0121] (1) Establish an automatic classifier for violation codes: such as Figure 4 As shown, the 2750 violation records are numbered according to the 20 main violation codes; for example, violation code "D16" corresponds to label "1". Subsequently, the 2194 on-site operation violation text data are vectorized using keywords to obtain a data matrix. As input, it corresponds to the violation code label vector. The output is used to train the LIB-SVM model. Specifically, among the various kernel function forms included in the LIB-SVM algorithm, the RBF kernel function, known for its strong stability, is selected to construct the LIB-SVM automatic classification model for traffic violation codes. In the algorithm verification phase, a data matrix is obtained by vectorizing the keywords of 556 on-site operation violation text data. As input, analyze the corresponding violation code.
[0122] (2) Establish an automatic classifier for violation types: The violation types corresponding to the 2750 violation data entries were numbered, with the violation types "two tickets and documents", "personnel behavior", "equipment protection", and "information transmission" corresponding to labels "1" to "4" respectively. Subsequently, the data matrix was obtained by vectorizing the 2194 on-site operation violation text data using keywords. As input, it corresponds to the violation type label vector. The output was used to train the LIB-SVM model. Similarly, the relatively stable RBF kernel function was selected to construct an automatic LIB-SVM classification model for violation types. In the algorithm validation phase, the data matrix obtained by vectorizing the keywords of 556 on-site violation text data was processed. As input, analyze the type of violation it belongs to.
[0123] (3) Establish an automatic problem type classifier: The problem types corresponding to the 2750 violation data were numbered, with the problem types "behavior (operation)", "management", and "equipment" corresponding to labels "1" to "3" respectively. Subsequently, the data matrix obtained by vectorizing the 2194 on-site operation violation text data through keyword processing was processed. As input, it corresponds to the question type label vector. The output was used to train the LIB-SVM model. Similarly, the relatively stable RBF kernel function was selected to construct an automatic LIB-SVM classification model for violation types. In the algorithm validation phase, the data matrix obtained by vectorizing the keywords of 556 on-site violation text data was processed. As input, analyze the type of problem it belongs to.
[0124] (4) Evaluate the performance of each automatic classifier: The classification results and confusion matrix of the violation codes, violation types, and problem types corresponding to the test dataset are shown in the figure below. Figures 5 to 10 As shown.
[0125] like Figures 5 to 6 As shown, the automatic classifier for violation codes performs relatively well in classifying violation codes, achieving an accuracy rate of 85.7914%. This means that based on a given text record of a violation during on-site operations in the power grid, there is an 85.7914% probability that it can correctly classify it into the corresponding violation code. However, for some more complex or easily confused violation codes, this automatic classifier still has room for improvement.
[0126] like Figures 7 to 8As shown, the automatic classifier for violation types exhibits excellent performance in classifying violations into different types, achieving an accuracy of 94.0647%. This means that based on a given text record of a violation during power grid operations, there is a 94.0647% probability that it can be correctly classified into the corresponding violation type. The high classification accuracy demonstrates that the classifier can effectively identify and classify violation types based on unstructured text data, providing a reliable foundation for further processing.
[0127] like Figures 9 to 10 As shown, the automatic problem type classifier performs well in classifying problem types, achieving an accuracy of 81.1151%. This means that based on a given text record of a violation during on-site operations in the power grid, there is an 81.1151% probability of accurately determining the problem type. Although the classifier has a high classification accuracy, it may encounter some difficulties in classifying certain violations with complex or ambiguous descriptions, and its performance needs further improvement.
[0128] Example 3
[0129] One embodiment of the present invention differs from the previous two embodiments in that:
[0130] If the aforementioned functions are implemented as 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 this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0131] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0132] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0133] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0134] Example 4
[0135] Reference Figure 11 As an embodiment of the present invention, a system for constructing and automatically classifying a dictionary of violations in power grid operations is provided, comprising: a data processing module, a dictionary construction module, a classification model training module, and a result output feedback module.
[0136] The data processing module is used to clean the raw power grid operation data, remove irrelevant information, and retain useful violation descriptions.
[0137] The dictionary building module is used to segment preprocessed data using the Jieba word segmentation engine, filter keywords based on various uniqueness indicators, and build a dictionary of violations.
[0138] The classification model training module is used to train the model using the LIB-SVM algorithm based on the constructed dictionary, and to accurately classify new data according to the patterns learned from the training data.
[0139] The results output and feedback module is used to classify the output results and provide feedback, and to optimize itself based on the feedback to improve classification accuracy.
Claims
1. A method for constructing and automatically classifying a dictionary of violations in power grid operations, characterized in that, include: For the obtained power grid operation data, text preprocessing is performed to remove data that is irrelevant to the classification task, and retain the description information of on-site operation violations and their corresponding violation codes, violation types and problem type tags; An initial word vector space is constructed, and the Jieba word segmentation engine is used for word segmentation. Single characters, punctuation marks, auxiliary words, and other words that are obviously irrelevant to the description of violations are filtered out by stop words. An initial violation dictionary is constructed, and the bag-of-words model is used to build a word vector space based on the constructed initial violation dictionary. This initially realizes the description of power grid on-site operation violation information with a high-dimensional numerical structured data matrix. Considering that the initial violation dictionary obtained from preliminary word segmentation has many semantically similar or repeated words with redundant word segmentation, based on the relative frequency matrix, skewness and kurtosis are introduced to construct uniqueness indicators, key words are selected, and a classic violation dictionary is further constructed to form a keyword vector space; Based on SVM, the LIB-SVM algorithm, which supports soft-margin classification, is used to establish a violation classification model based on the obtained keyword vector space and its corresponding labels.
2. The method for constructing and automatically classifying a dictionary of violations in power grid operations as described in claim 1, characterized in that: The text preprocessing includes preprocessing the obtained M power grid operation data, removing data irrelevant to the classification task, retaining complete on-site operation violation descriptions and their corresponding category knowledge, the complete on-site operation violation descriptions and their corresponding category knowledge include violation codes, violation types and problem type tag information, and reorganizing to obtain H power grid operation violation data.
3. The method for constructing and automatically classifying a dictionary of violations in power grid operations as described in claim 2, characterized in that: The construction of the initial word vector space involves segmenting the H traffic violation data obtained after text preprocessing using the Jieba word segmentation engine, and filtering out single characters, punctuation marks, auxiliary words, and other words obviously unrelated to the violation description by using stop words. Based on the initially obtained m word segments, a word vector space is built using the bag-of-words model, thereby transforming the initial H unstructured text data into a high-dimensional structured data matrix with m variable dimensions and H sample sizes. Represented as, Where, x j The value of (i) represents the frequency of the j-th word for the i-th violation data.
4. The method for constructing and automatically classifying a dictionary of violations in power grid operations as described in claim 3, characterized in that: The formation of the keyword vector space includes, to address the redundancy problem in the segmentation results commonly found in the Jieba word segmentation engine, the construction of the initial violation dictionary Φ. I The m words contained in the text are carefully selected to extract keywords that are beneficial for automatic classification of violations; Taking the top K most frequent dominant violation codes in power grid operations as the research object, for the kth dominant violation code, calculate its corresponding n. k The relative frequency vector is obtained by analyzing the relative frequencies of each word in the traffic violation data. Among them, f k (j) represents the relative frequency of the j-th word segment relative to the k-th dominant violation code: Where j = 1, 2, ..., m, k = 1, 2, ..., K, For the n corresponding to the dominant violation code of the kth type k The frequency of the j-th word in the unstructured text data formed by the description of the violation; By combining the top K dominant violation codes, a relative frequency matrix can be obtained.
5. The method for constructing and automatically classifying a dictionary of violations in power grid operations as described in claim 4, characterized in that: The process of removing data irrelevant to the classification task includes removing abnormally unique word segments before searching for unique segments in the constructed initial violation dictionary, and removing abnormally unique word segments based on the relative frequency matrix. For the j-th word, when g j When the value is 1, the word segment is removed; otherwise, the word segment is retained, as shown below. g j =(f j (1)<α)∧(f j (2)<α)∧…∧(f(K)<α) Where ^ represents the logical intersection operation, and α is the lower limit of the relative frequency control; Remove abnormal and unique word segments, and utilize the remaining m W Each word segment constructs a cleaned dictionary of violations. W .
6. The method for constructing and automatically classifying a dictionary of violations in power grid operations as described in claim 5, characterized in that: The relative frequency matrix includes the cleaned violation dictionary Φ W We introduce skewness and kurtosis to construct a uniqueness index I, and then conduct in-depth analysis of the relative frequency data of the remaining word segments. The symmetry and sharpness of the distribution further measure the uniqueness of each word segment, represented as follows: Where, μ j and σ j These are the relative frequency data f j Mean and standard deviation: Where, N j f j The number of samples, i.e., N j =K; From the cleaned dictionary of violations Φ W The first β highly unique words are selected to construct a highly unique violation dictionary Φ. U .
7. The method for constructing and automatically classifying a dictionary of violations in power grid operations as described in claim 6, characterized in that: The relative frequency matrix also includes selecting the top γ high-relative-frequency words from various violation codes based on the relative frequency matrix F to obtain a highly applicable violation dictionary Φ. A Based on the obtained highly unique violation dictionary Φ U And Strong Applicability Violation Dictionary Φ A Select m C Key word segmentation to construct a classic violation dictionary. C , F C =Φ U ∩F A Where, m C <<m; Based on the extracted key words, a keyword vector space is further constructed, transforming the initial unstructured text data from each violation incident into variables of dimension m. C Keyword vectors.
8. A system employing the method for constructing and automatically classifying a dictionary of violations in power grid operations as described in any one of claims 1 to 7, characterized in that, include: The module includes a data processing module, a dictionary construction module, a classification model training module, and a result output feedback module. The data processing module is used to clean the original power grid operation data, remove irrelevant information, and retain useful violation description information. The dictionary building module is used to segment the preprocessed data using the Jieba word segmentation engine, filter keywords based on various uniqueness indicators, and build a violation dictionary; The classification model training module is used to train the model using the LIB-SVM algorithm based on the constructed dictionary, and to accurately classify new data according to the patterns learned from the training data. The result output and feedback module is used to output the classification results and provide feedback, and to perform self-optimization based on the feedback to improve the classification accuracy.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method for constructing and automatically classifying a dictionary of violations of power grid operations as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for constructing and automatically classifying the dictionary of violations of power grid operations as described in any one of claims 1 to 7.