Electric power data intelligent classification method and system based on hybrid coding mode and textRCNN model
Through the hybrid encoding method and TextRCNN model, the problems of power data classification accuracy and high computing resource consumption are solved, and efficient and accurate power data classification is achieved, which is suitable for the intelligent management of smart grids.
Patent Information
- Application Number
- CN202510798134.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-16
- Publication Date
- 2025-09-26
Smart Images

Figure CN120705733A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of text processing technology, and in particular to a method and system for intelligent classification of power data based on a hybrid coding method and a textRCNN model. Background Art
[0002] With the development of smart grids and the advancement of digital transformation in the power industry, a vast amount of structured data has accumulated. This data includes equipment operating parameters, maintenance records, fault reports, and user electricity usage records. Efficiently processing and utilizing this data to improve the operational efficiency and safety of power systems has become a critical research topic. Power data is characterized by its large volume, diverse types, and rich information. This data includes not only numerical data (such as current and voltage), but also categorical data (such as equipment type and fault type) and date data (such as maintenance time and fault occurrence time). Traditional methods rely primarily on manual rules and expert experience, which are inefficient and error-prone when dealing with large-scale and complex data. Furthermore, many existing methods often struggle to fully capture the correlations between various features when processing multi-dimensional and highly complex structured data, resulting in low classification and grading accuracy. While some complex deep learning models perform well in theory, they often face challenges in practical applications, including training difficulties and high computational resource consumption. In particular, when processing large-scale data, the training time and computational resource requirements of the models increase significantly. Summary of the Invention
[0003] In response to the problems in the existing technology, the present invention provides a method and system for intelligent classification of power data based on a hybrid coding method and a textRCNN model. This method can comprehensively utilize multiple coding technologies to fully capture the key information in power data. With the help of the hybrid coding method, a richer feature representation can be generated, while the TextRCNN model effectively captures the dependencies between features, thereby achieving higher classification accuracy and better model adaptability. The present invention has significant advantages such as accuracy and robustness. The specific technical solution is as follows:
[0004] A method for intelligent classification of power data based on a hybrid coding method and a textRCNN model includes the following steps: Step S1, preprocessing a plurality of original power data and power data to be tested to obtain the preprocessed original power data and power data to be tested;
[0005] Step S2: The pre-processed raw power data and the power data to be measured are respectively encoded using a plurality of encoding methods to generate feature vectors of each encoding method; the plurality of encoding methods include bag-of-words encoding, TF-IDF encoding, word embedding encoding, and one-hot encoding;
[0006] Step S3: Combine the feature vectors generated by all encoding methods in each piece of original power data and the power data to be measured into a one-dimensional feature vector, and label the one-dimensional feature vectors in the original power data with classification labels to obtain a data set;
[0007] Step S4, building a TextRCNN model;
[0008] Step S5: Divide the dataset into a training set and a validation set, use the training set to train the TextRCNN model, and use the validation set to validate the TextRCNN model. Output the TextRCNN model with the highest convergence accuracy as the trained TextRCNN model.
[0009] Step S6: Input the one-dimensional feature vector in the power data to be measured into the trained TextRCNN model to obtain the classification label of the power data to be measured.
[0010] Preferably, the preprocessing in step S1 includes cleaning and standardization processing; the cleaning processing includes removing redundant records, filling missing values and processing abnormal values; the standardization processing is to normalize the numerical data.
[0011] Preferably, the bag-of-words model encoding in step S2 specifically includes the following steps:
[0012] Traverse the text dataset, count all different words, build a global vocabulary, and for each data record, create a feature vector with a length equal to the vocabulary size, where each element represents the number of times the corresponding word appears in the record.
[0013] Preferably, the TF-IDF encoding in step S2 specifically includes the following steps:
[0014] For each data record, calculate the word frequency of each word and calculate the inverse document frequency;
[0015] Multiply the word frequency of each word by the inverse document frequency to get the final TF-IDF value of each word;
[0016] Generate a TF-IDF matrix based on the final TF-IDF value of each word, where rows represent documents and columns represent words.
[0017] Preferably, the word embedding encoding in step S2 specifically includes the following steps:
[0018] Preprocess the data and build a vocabulary;
[0019] Count the frequencies of all different words;
[0020] Assign a unique index to each word to form a word index mapping table;
[0021] Use the Word2Vec model for training. After training, a matrix is obtained, in which each row corresponds to the vector representation of a word.
[0022] Match the vector corresponding to each word to the index.
[0023] Preferably, in step S3, bag-of-words encoding is performed first, followed by TF-ID encoding, then word embedding encoding, and finally one-hot encoding is performed in a fixed order, and the feature vectors generated by all encoding methods are first expanded into one dimension and then concatenated to form a comprehensive one-dimensional feature vector.
[0024] Preferably, the TextRCNN model includes an input layer, a convolutional layer, a pooling layer, and an output layer connected in sequence; the convolutional layer uses a bidirectional RNN network; and the pooling layer uses a maximum pooling layer.
[0025] An intelligent classification system for power data based on a hybrid encoding method and a textRCNN model, applying the method, includes:
[0026] A data preprocessing module is used to preprocess a plurality of pieces of original power data and the power data to be measured to obtain the preprocessed original power data and the power data to be measured;
[0027] A multi-coding generation module is used to generate feature vectors for each encoding method by encoding the pre-processed raw power data and the power data to be measured using multiple encoding methods; the multiple encoding methods include bag-of-words encoding, TF-IDF encoding, word embedding encoding, and one-hot encoding;
[0028] The vector concatenation module combines the feature vectors generated by all encoding methods in each piece of original power data and the power data to be measured into a one-dimensional feature vector, and labels the one-dimensional feature vectors in the original power data with classification labels to obtain a data set;
[0029] Modeling module, building the TextRCNN model;
[0030] The model training module divides the dataset into a training set and a validation set, uses the training set to train the TextRCNN model, and uses the validation set to validate the TextRCNN model. The TextRCNN model with the highest convergence accuracy is output as the trained TextRCNN model.
[0031] The classification module inputs the one-dimensional feature vector in the power data to be tested into the trained TextRCNN model to obtain the classification label of the power data to be tested.
[0032] A computer-readable storage medium includes a stored program, wherein when the program is run, the device where the computer-readable storage medium is located is controlled to execute the intelligent classification method for power data based on a hybrid encoding method and a textRCNN model.
[0033] A processor is used to run a program, wherein when the program is running, the method for intelligent classification of power data based on a hybrid encoding method and a textRCNN model is executed.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] Compared with the traditional single encoding method, the hybrid encoding method can more comprehensively represent the data features and avoid the limitations of the single encoding method. Compared with complex deep learning models, the TextRCNN model reduces the training time and consumption of computing resources while maintaining high accuracy, and is more suitable for processing large-scale data. In addition, this method is not only suitable for the classification and grading of power data, but can also be extended to structured data processing in other fields, with strong adaptability and generalization capabilities. In this way, the present invention can achieve efficient and accurate classification of power data without increasing too many computing resources, providing strong support for the intelligent management and operation and maintenance of power systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly describes the drawings required for the specific embodiments or the description of the prior art. Similar elements or parts are generally identified by similar reference numerals throughout the drawings. Elements or parts in the drawings are not necessarily drawn to scale.
[0037] Figure 1 Flow chart of the method of the present invention.
[0038] Figure 2 Flowchart for coding a bag-of-words model.
[0039] Figure 3 Flowchart for TF-IDF encoding.
[0040] Figure 4 Flowchart for encoding word embeddings.
[0041] Figure 5 Flowchart for vector stitching.
[0042] Figure 6 This is the structural diagram of the TextRCNN model.
[0043] Figure 7 This is a system principle diagram of the present invention. DETAILED DESCRIPTION
[0044] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0045] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0046] It should also be understood that the terms used in the present specification are only for the purpose of describing particular embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0047] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0048] Example 1:
[0049] In the context of smart grid and digital transformation, the power industry faces the problem of classifying a large amount of structured data. The common approach is to improve the model without changing the encoding method. A single encoding method is always used, which cannot represent the rich characteristics of the data. To solve this problem, Figure 1 As shown, this embodiment provides an intelligent classification method for power data based on a hybrid encoding method and a textRCNN model. First, the original power data is cleaned and standardized. Then IF-IDF encoding, one-hot encoding, bags of words encoding and word embedding are used. Through feature selection and fusion technology, multiple feature vectors are spliced or reduced in dimension to generate the final input vector. After the feature vector is generated, the TextRCNN model is used for classification and grading. Power data has certain contextual associations, and the encoding method has strong local features. The TextRCNN model combines the advantages of recurrent neural networks (RNN) and convolutional neural networks (CNN), and can effectively capture the dependencies and local features between features, thereby improving the expression ability and classification accuracy of the model.
[0050] The specific steps include:
[0051] Step S1 : preprocessing a plurality of pieces of original power data and power data to be measured to obtain preprocessed original power data and power data to be measured.
[0052] Preprocessing includes cleaning and standardization. Cleaning involves removing redundant records, filling missing values, and addressing outliers to ensure data consistency and integrity. Standardization normalizes numerical data, such as voltage and current, so that different features are compared on the same scale, thereby improving the efficiency and stability of subsequent model training.
[0053] Step S2: The preprocessed raw power data and the power data to be measured are respectively encoded using a plurality of encoding methods to generate feature vectors of each encoding method; the plurality of encoding methods include bag-of-words encoding, TF-IDF encoding, word embedding encoding, and one-hot encoding.
[0054] This embodiment uses multiple encoding methods to generate feature vectors, combining their strengths to fully exploit the data's potential. First, a bag-of-words encoding model is used. This model converts text into a fixed-length vector by counting the frequency of each word in the text. This method effectively extracts keywords from text data and provides a foundation for subsequent analysis.
[0055] However, the bag-of-words model ignores the order and contextual relationships between words. To address this issue, TF-IDF encoding was introduced. TF-IDF encoding not only considers the importance of a word within a single document but also downweights common words by calculating inverse document frequency, thereby emphasizing words that are more representative in a specific context. This enables the model to better identify key features that influence classification results, enhancing classification accuracy.
[0056] In addition, word embedding technology is used to map words into a dense vector space, placing words with similar semantics closer together in the vector space. This allows the model to capture deep relationships between words, such as synonyms and contextual associations, thereby improving its understanding of complex text data. One-hot encoding is also used. This method assigns each word a separate binary vector, ensuring that each word has a unique representation. This approach not only enables the model to process discrete data but also avoids potential misleading effects caused by sequential relationships between categories.
[0057] By combining multiple encoding methods, we can comprehensively represent power data from multiple dimensions. This comprehensive feature generation strategy not only enriches the data representation but also enhances the model's ability to capture complex data features, laying a solid foundation for subsequent classification tasks.
[0058] When multiple encodings are used, the data is first deduplicated, the formats of various types of data are unified, and then the text is segmented.
[0059] like Figure 2 As shown in the figure, the bag-of-words model encoding specifically includes the following steps:
[0060] Traverse the text dataset, count all different words, build a global vocabulary, and for each data record, create a feature vector with a length equal to the vocabulary size, where each element represents the number of times the corresponding word appears in the record.
[0061] like Figure 3 As shown, TF-IDF encoding specifically includes the following steps:
[0062] (1) For each data record, calculate the term frequency (TF) and inverse document frequency (IDF) of each word;
[0063]
[0064] where n i,j Represents the word t i In the document d j The number of times it appears in , then TF i,j It means word t i In the document d j The frequency of occurrence in .
[0065]
[0066] Where |D| represents the number of all documents, |j:t i ∈d j | indicates that the word t is included i The number of documents is added by 1 to prevent the denominator from being 0.
[0067] (2) Multiply the word frequency of each word by the inverse document frequency to obtain the final TF-IDF value of each word;
[0068] (3) Generate a TF-IDF matrix based on the final TF-IDF value of each word, where rows represent documents and columns represent words.
[0069] The term frequency (TF) of each word is the number of times the word appears in a record divided by the total number of words in the record. A word may have a higher frequency in a long document than in a short document, regardless of its importance. The inverse document frequency (IDF) is then calculated. Some common words don't contribute significantly to a topic, while less frequently occurring words are crucial for categorizing a document. Therefore, simply using TF is inappropriate. Weights must be designed to meet the following criteria: the stronger a word's ability to predict a category, the greater its weight; conversely, the weaker it is, the smaller its weight. Among all the texts counted, some words appear only in a small number of them. These words have a significant impact on the classification of the text, so their weights should be designed higher. IDF accomplishes this task.
[0070] like Figure 4 As shown in Figure 2, word embedding encoding specifically includes the following steps:
[0071] (1) Preprocess the data and build a vocabulary;
[0072] (2) Count the frequencies of all different words;
[0073] (3) assigning a unique index to each word to form a vocabulary index mapping table;
[0074] (4) Use the Word2Vec model to train and obtain a matrix after training, where each row corresponds to the vector representation of a word;
[0075] (5) Match the vector corresponding to each word with the index.
[0076] The present invention uses a pre-trained general Word2Vec model and fine-tunes it on this basis to better meet the needs of the present invention. After the training is completed, all words and their corresponding high-dimensional vector representations are extracted from the model. Next, the vocabulary table created earlier can be used, which contains all the unique words that appear in the training set and their corresponding integer indexes. Through this vocabulary table, this mapping relationship is used to subsequently convert the text into a numerical representation. At the same time, a lookup table is created in which each word corresponds to its high-dimensional vector representation. This lookup table will be used in subsequent steps to quickly obtain word embedding vectors.
[0077] One-hot encoding is similar to bag-of-words encoding. Each element represents whether the corresponding word appears in the record, 1 represents presence and 0 represents absence.
[0078] The encoding parameters are set as follows:
[0079] 1) Bag of Words / TF-IDF: The vocabulary size is 2000 and sparse vectors are generated.
[0080] 2) Word embedding: pre-trained Word2Vec, dimension 500, learning rate 0.001 during fine-tuning.
[0081] 3) One-hot encoding: The number of categories is determined by the data field, which is 2000. Excess categories are padded with 0.
[0082] 4) Comprehensive vector dimension: The total dimension after splicing is 2000+2000+500+2000=6500.
[0083] Step S3, such as Figure 5 As shown, the feature vectors generated by all encoding methods in each original power data and the power data to be measured are concatenated and merged into a one-dimensional feature vector, and the one-dimensional feature vector in the original power data is labeled with a classification label to obtain a data set.
[0084] During the feature vector concatenation process, the vectors generated by all encoding methods are merged into a one-dimensional vector to provide a unified input format for subsequent model training. In this process, the multi-dimensional vectors generated by each encoding method are first processed so that they can be effectively concatenated.
[0085] Specifically, the vectors generated by bag-of-words and TF-IDF encoding are typically sparse vectors of fixed length and can therefore be directly concatenated. The dense vectors generated by word embedding encoding are typically higher dimensional, so they are expanded into one-dimensional vectors and concatenated sequentially. When processing one-hot encoding, the vectors for each category are also one-dimensional, with a length equal to the number of categories. These vectors can also be directly concatenated into the feature vector. Ultimately, all these processed vectors are concatenated sequentially into a single one-dimensional composite vector, forming a feature representation rich in information.
[0086] In a fixed order, bag-of-words encoding is performed first, followed by TF-ID encoding, then word embedding encoding, and finally one-hot encoding. The feature vectors generated by all encoding methods are first expanded into one dimension and then concatenated to form a comprehensive one-dimensional feature vector. This ensures that the order and dimensions of all vectors are consistent to facilitate subsequent model input. Compared to traditional encoding methods, this method produces richer features.
[0087] Step S4: Constructing a TextRCNN model. The present invention uses the TextRCNN model to process the hybrid-encoded power data. The TextRCNN model combines the advantages of convolutional neural networks (CNN) and recurrent neural networks (RNN), and can efficiently extract local features and long-term temporal features from text data.
[0088] The TextRCNN model includes an input layer, a convolutional layer, a pooling layer, and an output layer connected in sequence; the convolutional layer uses a bidirectional RNN network; the pooling layer uses a maximum pooling layer. Figure 6 shown.
[0089] Because power data has a certain degree of contextual relevance and encoding technology can extract rich local features, using TextRCNN for classification is a reasonable choice. The TextRCNN model combines the advantages of convolutional neural networks (CNN) and recurrent neural networks (RNN), and can simultaneously capture local features and long-range dependencies in the data, thereby improving classification accuracy and robustness.
[0090] First, the input layer of the TextRCNN model needs to be constructed. At this stage, the previously generated comprehensive one-dimensional feature vector is input into the model. This vector is spliced together by multiple encoding methods (bag-of-words model, TF-IDF, word embedding, and one-hot encoding) to ensure that the model can fully learn the rich features of power data. In the traditional TextRCNN structure, the input data usually needs to pass through the embedding layer first to convert the discrete text information into a dense vector representation. However, since the encoding method in the previous step has completed this conversion, the original features are already numerical vectors, so no additional embedding layer is required.
[0091] Next, we move on to the RNN layer. The biggest difference between TextRCNN and TextCNN is that it replaces the convolutional layer with an RNN layer. This design allows the model to capture the contextual dependencies of sequence data while extracting local features. We chose to use LSTM (Long Short-Term Memory) instead of the traditional RNN structure because LSTM, through its gating mechanism, effectively addresses the vanishing and exploding gradient problems common during long sequence training, making the model more stable.
[0092] In TextRCNN, the convolutional layer uses a bidirectional RNN. This means that the word vector is fed into the bidirectional RNN to obtain the forward and backward context representations of each word. This approach allows for more contextual information about the word. Note that the RNN used here is not a common RNN. An LSTM is used in its implementation because traditional RNNs are less effective. The word representation is then transformed and activated by a tanh function before being output. The specific formula is as follows:
[0093] c l (w i )=f(W (l) c l (w i-1 )+W (sl) e(w i-1 ));
[0094] c r (w i )=f(W (r) c r (w i+1 )+W (sr) e(w i+1 ));
[0095] x i =[c l (w i );e(w i );c r (w i )];
[0096]
[0097] Among them, w i represents the i-th word, c l (w i ) and c r (w i ) represent w i The left context vector and right context vector, W (l) and W (r) Represents the weight matrices of the left-hand and right-hand RNNs, W (sl) and W (sr) Represents the weight matrix from the input layer to the hidden layer in the left and right directions, e(w i ) represents the original vector representation of the word i, f is the activation function, x i is the comprehensive feature vector of the i-th word, from the left to the context vector c l (w i )+original vector e(w i ) + right context vector c r (w i ) is spliced into, W (1) is the weight matrix of the first fully connected layer, b (1) is the bias term of the first fully connected layer, It is the output of the i-th word after being activated by the tanh activation function of the first fully connected layer.
[0098] The model then passes through a pooling layer (max pooling) to reduce the spatial dimensionality of the data, lower computational costs, and reduce the number of parameters. Pooling helps enhance the model's generalization capabilities. By extracting the maximum value of a local region (i.e., max pooling), it can retain the most significant features and increase the model's focus on important features. Furthermore, max pooling effectively reduces data noise, making the model more stable and preventing overfitting.
[0099] Once all word representations are calculated, the TextRCNN model uses max-pooling on the same bit of all word representations to capture the most important information. The pooling layer converts text of varying lengths into fixed-length vectors. By using a pooling layer, information can be captured across the entire text. There are other types of pooling layers, such as average pooling. This example does not use average pooling because typically only a few words and their combinations are useful for capturing the meaning of the document.
[0100] In the document, a max pooling layer is used to try to find the most important latent semantic factors.
[0101]
[0102] Among them, y (2) yes The output after the maximum pooling layer, n is the length of the text sequence.
[0103] The features output by the pooling layer are integrated through a fully connected layer to generate the classification result. The fully connected layer is responsible for mapping the extracted features to specific class labels. Finally, the Softmax activation function is used to calculate the probability distribution of each class, ensuring that the output values conform to the characteristics of the probability distribution and providing an intuitive understanding of the final classification result. The model's loss function uses cross-entropy loss to evaluate the difference between the predicted result and the true class. During training, the Adam optimizer is used to adjust the model parameters for faster convergence and better performance.
[0104] The output of the pooling layer is linearly transformed and then softmax is used to obtain the probability of classification, as follows:
[0105] y (3) =W (3) y (2) +b (3) ;
[0106]
[0107] Among them, y (3) It is y (2) The output after linear change, W (3) is the weight matrix of the second fully connected layer, b (3) is the bias term of the second fully connected layer, is the weight corresponding to the i-th class, p i is the probability of being classified as i after softmax.
[0108] Among the classification probabilities output by the TextRCNN model, the one with the highest probability is selected as the classification result.
[0109] The TextRCNN architecture parameter settings in this embodiment are as follows:
[0110] 1) Bidirectional LSTM layer: The number of hidden units is set to 256, the activation function is tanh, and the gradient clipping threshold is 0.25.
[0111] 2) Convolutional layer: Use three convolution kernels of different widths (3, 5, 7), each with 128 kernels, and the activation function is ReLU.
[0112] 3) Pooling layer: Global maximum pooling with an output dimension of 256.
[0113] 4) Fully connected layer: The output dimension is consistent with the number of categories, and Softmax activation is used.
[0114] In step S5, the dataset is divided into a training set and a validation set. The training set is used to train the TextRCNN model, and the validation set is used to validate the TextRCNN model. The TextRCNN model with the highest convergence accuracy is output as the trained TextRCNN model.
[0115] The hyperparameters used in this training are as follows:
[0116] 1) Batch size: 128.
[0117] 2) Learning rate: 0.001 (Adam optimizer, decay rates β1 = 0.9, β2 = 0.999).
[0118] 3) Training rounds: 100, early stopping (termination if validation set loss does not decrease after 3 rounds).
[0119] Step S6: Input the one-dimensional feature vector in the power data to be measured into the trained TextRCNN model to obtain the classification label of the power data to be measured.
[0120] This example uses GPU acceleration (NVIDIA 4090), with a single training time of about 2 hours, a training set size of 100,000 items, and a test set size of 20,000 items. The experimental results are shown in Table 1 below.
[0121] Table 1 Experimental results
[0122]
[0123]
[0124] Results Analysis: The hybrid encoding + TextRCNN model achieved an accuracy of 83.5% in the power data classification task, a 2.3% improvement over TF-IDF + TextCNN. This is primarily due to its combination of the temporal modeling capabilities of RNNs and the local feature extraction of CNNs, enabling a more comprehensive understanding of the coupled relationship between temporal and local features in power data. The improvement in precision was only 0.5%, presumably due to feature overlap for some power fault categories and sensor noise interfering with classification boundaries, resulting in limited discrimination for positive class predictions. However, the recall of TextRCNN increased by 1.6%, demonstrating its enhanced ability to capture minority class examples. This is attributed to its ability to reduce missed detections through RNN context modeling. The final F1 score improved by 1.1%, demonstrating that the model achieves a better balance between precision and recall, making it particularly suitable for power safety scenarios sensitive to missed detections.
[0125] Example 2:
[0126] Based on the same inventive concept as Example 1, this embodiment provides an intelligent classification system for power data based on a hybrid encoding method and a textRCNN model, and applies the method described above, including:
[0127] A data preprocessing module is used to preprocess a plurality of pieces of original power data and the power data to be measured to obtain the preprocessed original power data and the power data to be measured;
[0128] A multi-coding generation module is used to generate feature vectors for each encoding method by encoding the pre-processed raw power data and the power data to be measured using multiple encoding methods; the multiple encoding methods include bag-of-words encoding, TF-IDF encoding, word embedding encoding, and one-hot encoding;
[0129] The vector concatenation module combines the feature vectors generated by all encoding methods in each piece of original power data and the power data to be measured into a one-dimensional feature vector, and labels the one-dimensional feature vectors in the original power data with classification labels to obtain a data set;
[0130] Modeling module, building the TextRCNN model;
[0131] The model training module divides the dataset into a training set and a validation set, uses the training set to train the TextRCNN model, and uses the validation set to validate the TextRCNN model. The TextRCNN model with the highest convergence accuracy is output as the trained TextRCNN model.
[0132] The classification module inputs the one-dimensional feature vector in the power data to be tested into the trained TextRCNN model to obtain the classification label of the power data to be tested.
[0133] Example 3:
[0134] Based on the same inventive concept as Example 1, this embodiment provides a computer-readable storage medium, which includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the intelligent classification method for power data based on a hybrid encoding method and a textRCNN model.
[0135] Example 4:
[0136] Based on the same inventive concept as Example 1, this embodiment provides a processor, which is used to run a program, wherein when the program is running, the method for intelligent classification of power data based on a hybrid encoding method and a textRCNN model is executed.
[0137] Those skilled in the art will appreciate that the modules of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition of each example has been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0138] In the embodiments provided by the present invention, it should be understood that the division of modules is merely a logical function division, and there may be other division methods in actual implementation, for example, multiple modules can be combined into one module, one module can be split into multiple modules, or some features can be ignored, etc.
[0139] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or software functional modules.
[0140] If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it 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 all or 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 and includes several instructions for enabling a computer device (which can be a personal computer, server or 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, read-only memory (ROM, Read-0nly Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc., various media that can store program code.
[0141] Finally, 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 above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and description of the present invention.
Claims
1. A method for intelligent classification of power data based on hybrid coding and textRCNN model, characterized in that: The following steps are involved: Step S1, preprocessing a plurality of pieces of original power data and power data to be measured to obtain preprocessed original power data and power data to be measured; Step S2: The pre-processed raw power data and the power data to be measured are respectively encoded using a plurality of encoding methods to generate feature vectors of each encoding method; the plurality of encoding methods include bag-of-words encoding, TF-IDF encoding, word embedding encoding, and one-hot encoding; Step S3: Combine the feature vectors generated by all encoding methods in each piece of original power data and the power data to be measured into a one-dimensional feature vector, and label the one-dimensional feature vectors in the original power data with classification labels to obtain a data set; Step S4, building a TextRCNN model; Step S5: Divide the dataset into a training set and a validation set, use the training set to train the TextRCNN model, and use the validation set to validate the TextRCNN model. Output the TextRCNN model with the highest convergence accuracy as the trained TextRCNN model. Step S6: Input the one-dimensional feature vector in the power data to be measured into the trained TextRCNN model to obtain the classification label of the power data to be measured.
2. The method for intelligent classification of power data based on hybrid coding and textRCNN model according to claim 1 is characterized in that: The preprocessing in step S1 includes cleaning and standardization processing; the cleaning processing includes removing redundant records, filling missing values and processing abnormal values; the standardization processing is to normalize the numerical data.
3. The method for intelligent classification of power data based on hybrid coding and textRCNN model according to claim 1 is characterized in that: The bag-of-words model encoding in step S2 specifically includes the following steps: Traverse the text dataset, count all different words, build a global vocabulary, and for each data record, create a feature vector with a length equal to the vocabulary size, where each element represents the number of times the corresponding word appears in the record.
4. The method for intelligent classification of power data based on hybrid coding and textRCNN model according to claim 1, characterized in that: The TF-IDF encoding in step S2 specifically includes the following steps: For each data record, calculate the word frequency of each word and calculate the inverse document frequency; Multiply the word frequency of each word by the inverse document frequency to get the final TF-IDF value of each word; Generate a TF-IDF matrix based on the final TF-IDF value of each word, where rows represent documents and columns represent words.
5. The method for intelligent classification of power data based on hybrid coding and textRCNN model according to claim 1, characterized in that: The word embedding encoding in step S2 specifically includes the following steps: Preprocess the data and build a vocabulary; Count the frequencies of all different words; Assign a unique index to each word to form a word index mapping table; Use the Word2Vec model for training. After training, a matrix is obtained, in which each row corresponds to the vector representation of a word. Match the vector corresponding to each word to the index.
6. The method for intelligent classification of power data based on hybrid coding and textRCNN model according to claim 1, characterized in that: In step S3, bag-of-words encoding is performed first, followed by TF-ID encoding, then word embedding encoding, and finally one-hot encoding in a fixed order. The feature vectors generated by all encoding methods are first expanded into one dimension and then concatenated to form a comprehensive one-dimensional feature vector.
7. The method for intelligent classification of power data based on hybrid coding and textRCNN model according to claim 1, characterized in that: The TextRCNN model includes an input layer, a convolutional layer, a pooling layer, and an output layer connected in sequence; the convolutional layer uses a bidirectional RNN network; and the pooling layer uses a maximum pooling layer.
8. An intelligent classification system for power data based on hybrid coding and textRCNN model, characterized by: Applying the method according to any one of claims 1 to 7, comprising: A data preprocessing module is used to preprocess a plurality of pieces of original power data and the power data to be measured to obtain the preprocessed original power data and the power data to be measured; A multi-coding generation module is used to generate feature vectors for each encoding method by encoding the pre-processed raw power data and the power data to be measured using multiple encoding methods; the multiple encoding methods include bag-of-words encoding, TF-IDF encoding, word embedding encoding, and one-hot encoding; The vector concatenation module combines the feature vectors generated by all encoding methods in each piece of original power data and the power data to be measured into a one-dimensional feature vector, and labels the one-dimensional feature vectors in the original power data with classification labels to obtain a data set; Modeling module, building the TextRCNN model; The model training module divides the dataset into a training set and a validation set, uses the training set to train the TextRCNN model, and uses the validation set to validate the TextRCNN model. The TextRCNN model with the highest convergence accuracy is output as the trained TextRCNN model. The classification module inputs the one-dimensional feature vector in the power data to be tested into the trained TextRCNN model to obtain the classification label of the power data to be tested.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein, when the program is running, the device where the computer-readable storage medium is located is controlled to execute the power data intelligent classification method based on a hybrid encoding method and a textRCNN model as described in any one of claims 1 to 7.
10. A processor, characterized in that: The processor is used to run a program, wherein when the program is run, the method for intelligent classification of power data based on a hybrid encoding method and a textRCNN model as described in any one of claims 1 to 7 is executed.