A text classification method and system

By employing active learning and clustering to select representative samples, combined with PET and SimCSE models, the problem of high text annotation costs in teachers' teaching environments is solved, achieving efficient and low-cost text classification and helping teachers quickly understand student interactions.

CN115345243BActive Publication Date: 2026-01-09HUAZHONG NORMAL UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210992828.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-18
Publication Date
2026-01-09
Estimated Expiration
2042-08-18

AI Technical Summary

Technical Problem

Existing text classification methods have limited built-in labeled text in the teaching environment, resulting in high manual annotation costs and low efficiency, which cannot meet the needs of online education.

Method used

By employing an active learning approach, representative samples are selected through clustering and Euclidean distance. Combining the PET classification model and the SimCSE model, a small number of texts are automatically selected for teacher annotation, forming iterative training, reducing the amount of teacher annotation, and improving classification accuracy.

Benefits of technology

It enables efficient and low-cost text classification in the teaching environment, reducing teachers' workload, allowing them to quickly understand student interactions, and providing timely teaching feedback.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115345243B_ABST
    Figure CN115345243B_ABST
Patent Text Reader

Abstract

The application provides a text classification method and system, comprising: pre-processing and vectorizing text data, actively selecting a small number of text by using an active learning method, marking the text by a teacher, iteratively training, and effectively classifying student text by using a small sample classification model, so as to solve the problems that a supervised classification algorithm needs a large number of labeled samples for training and a standard supervised classification algorithm usually performs very poorly when applied to a small training set. The application provides a classification method which is convenient to implement and meets actual needs for sorting and classifying student interactive text, and can help teachers effectively analyze classroom interactive text, reduce the workload of teachers, and improve the work efficiency of teachers.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of text processing, more particularly, to a text classification method and system. BACKGROUND

[0002] Patent document CN202111503834.0 discloses a kind of small sample invention patent classification method and system of semi-supervised learning, mainly by the text to be classified into pre-training completed look-up table, look-up table is mapped as text representation to the text to be classified;Finally, the text representation is input into multilayer perceptron to obtain text label, and the text label is used as the text classification result.This patent can also achieve good classification effect in the case of text classification of small amount of data, incomplete data label, does not need to manually mark a large amount of text data, saves the cost of artificial marking, and can be flexibly applied in different scenes of various data quantity and data label annotation.

[0003] The invention has the following deficiencies: the invention uses a semi-supervised method to complete the small sample classification task, does not need to be manually marked, and saves the marking cost, but this classification method is not suitable for use in a teacher's teaching environment, and cannot classify the learning text of students according to the expected classification categories of the teacher, which has certain limitations in the online education environment.

[0004] Patent document CN201910565455.0 discloses a machine learning method and device for quickly improving text performance, the main scheme is to first obtain a group of models related to the target task;By reusing existing models, the invention sample needs to be queried, unnecessary queries are filtered out, helping to obtain more accurate active learning model, saving a lot of query cost;Based on the labeled text sample, the importance of the existing model is updated to better filter unnecessary queries.The invention has the characteristics of easy implementation and high efficiency, and can realize the rapid performance improvement of the model based on a small amount of query cost.

[0005] The invention has the following deficiencies: when performing active learning to select samples to be labeled, the invention uses a threshold to automatically divide the text into automatically generated labels and manually generated labels, because of the uncertainty of the threshold, the number of teacher's labeling is inconsistent each time, and there may be a situation that the number of labeling is relatively large, and the number of online learning text of students is generally not very large, which causes a large pressure on the teacher, the number of active learning sampling in the invention is fixed, and the above situation does not occur.

[0006] A method for online collaborative learning text classification based on deep neural network is proposed in the paper Modern Distance Education Research 2020, 32(03), 104-112. Convolutional neural network (CNN), long short-term memory (LSTM), and bidirectional long short-term memory (Bi-LSTM) are used to build a classification model for online collaborative learning interactive text. Word2Vec is used as a word vector, and a method for automatically classifying student online collaborative learning interactive text is proposed, including data collection and processing, text label annotation, data preprocessing, word embedding, data sampling, model training, model parameter tuning, and model evaluation. The classification is divided into knowledge semantic class, regulation class, emotion class, question class, and irrelevant information class, which is convenient for teachers to evaluate knowledge mastery, maintain learning activities, intervene negative learning emotions, and provide learning warning and prompt.

[0007] The paper has the disadvantage of using Word2Vec word vector encoding, which is relatively fixed, and has problems with polysemy and dynamic context conversion of word vectors. Bert, SimCSE and other pre-trained language models generate more accurate semantic vectors. This method divides student text into five fixed categories, which cannot be classified according to the needs of teachers. SUMMARY

[0008] To overcome the defects of the prior art, the purpose of the present application is to provide a text classification method and system, which aims to solve the problem that the existing text classification method has less self-labeled text in the text data, and it is time-consuming and laborious to use artificial labeling of a large number of samples, which does not meet the actual scene requirements.

[0009] To achieve the above purpose, in a first aspect, the present application provides a text classification method, comprising the following steps:

[0010] determining a plurality of text data to be classified;

[0011] clustering the plurality of text data to obtain text data of a plurality of text categories;

[0012] sorting the text data under each category according to the distance from the relative clustering center point from small to large, selecting a plurality of sub-text data with high ranking, and determining the text category to which the plurality of sub-text data belongs according to the text content of the plurality of sub-text data as the label value of the plurality of sub-text data, and taking the plurality of sub-text data under each category as a training data set;

[0013] training the text classification model based on the current training data set, and predicting each piece of text data in the plurality of pieces of text data based on the trained text classification model to obtain a probability value of each piece of text data belonging to each text category; the probability value is multiple, respectively corresponding to multiple text categories;

[0014] determining a probability difference value between the maximum probability value and the second maximum probability value in the prediction result of each piece of text data, and sorting the probability difference values of the plurality of pieces of text data from small to large, and selecting the plurality of pieces of text data with high ranking probability difference values as text data with high classification uncertainty; determining the text category to which the text data with high classification uncertainty belongs according to the content of the text data as the corresponding label value, and adding the corresponding text data to the current training data set, repeating the above training, prediction, finding text data with high classification uncertainty and labeling, and updating the training data set until the prediction result meets the preset text classification requirement;

[0015] the prediction result of each piece of text data in the last time is taken as the text classification result.

[0016] It should be noted that the text classification method provided by the present application can be applied to the field of classroom text classification, but is not limited to this field, and can also be applied to the fields of news text classification, text sentiment classification, etc. Those skilled in the art can understand that the method of the present application can be used in any field that requires text classification. Therefore, the present application does not make any limitation on the specific application field.

[0017] Specifically, the step of "determining the category to which the text data belongs according to the content of the text data" in the present application can be automatically labeled by a machine according to a pre-designed text category judgment, or labeled by a technical expert in the corresponding field. The present application does not make any limitation on this step.

[0018] Alternatively, the preset text classification requirement in the present application is that the classification accuracy rate reaches a threshold value, or the number of predicted text belonging to a certain category meets the standard, etc. Those skilled in the art can set the classification requirement according to actual needs, and the present application does not make any limitation on this.

[0019] In an optional example, the plurality of pieces of text data are clustered to obtain text data of multiple text categories, specifically:

[0020] The plurality of pieces of text data are clustered by using a kmeans clustering algorithm, and the plurality of pieces of text data are divided into k categories, the number k of text categories of clustering is determined according to the preset text classification requirement, and k is a positive integer greater than 1.

[0021] In an optional example, the text data under each category is sorted in ascending order of distance from the cluster centroid, and the top-ranked sub-text data are selected, specifically:

[0022] During the clustering process, Euclidean distance is used to calculate the distance between the vector corresponding to each text data and the center of its cluster, and the text data of different clusters are sorted in ascending order of distance;

[0023] From each cluster, select the top n data samples based on their distance from the cluster center, extracting a total of k*n data samples. Determine the text category of each sub-text data sample based on its text content to label the sub-text data and form the initial training set; n is a positive integer greater than 1.

[0024] In an optional example, a text classification model is trained based on the current training dataset, and the trained text classification model is used to predict the probability value of each text data belonging to each text category, specifically:

[0025] The PET classification model is used to learn from the initial training set and to predict the remaining unlabeled text data to obtain the probability value of each text data belonging to each text category.

[0026] In an optional example, repeating the above process of training, prediction, finding text data with high classification uncertainty and labeling it, and updating the training dataset constitutes the active learning process; the active learning iteration begins after the PET classification model makes its first prediction of the text data.

[0027] Secondly, the present invention provides a text classification system, comprising:

[0028] The text data determination unit is used to determine multiple pieces of text data to be classified.

[0029] The training set determination unit is used to cluster the multiple text data to obtain text data of multiple text categories; and to sort the text data under each category according to the distance to the cluster center point from smallest to largest, select the multiple sub-text data with the highest ranking, and determine the text category to which the multiple sub-text data belongs based on the text content of the multiple sub-text data, which is used as the label value of the multiple sub-text data, and use the multiple sub-text data under each category as the training dataset.

[0030] The text category prediction unit is configured to train the text classification model based on the current training data set, and predict each piece of text data in the plurality of pieces of text data based on the trained text classification model to obtain a probability value of each piece of text data belonging to each text category; the probability value is a plurality of probability values, which correspond to a plurality of text categories respectively;

[0031] The active learning iteration unit is configured to determine a probability difference between a maximum probability value and a second maximum probability value in a prediction result of each piece of text data, sort the probability difference of the plurality of pieces of text data from small to large, select a plurality of pieces of text data with a high ranking of the probability difference as text data with high classification uncertainty, determine a text category to which the text data with high classification uncertainty belongs according to the content of the text data as a corresponding label value, and add the corresponding text data to the current training data set; the process of training, predicting, finding text data with high classification uncertainty and labeling the text data, and updating the training data set is repeated until the prediction result meets the preset text classification requirement.

[0032] The classification result determination unit is configured to take the prediction result of each piece of text data in the last time as a text classification result.

[0033] In an optional example, the training set determination unit adopts a kmeans clustering algorithm to cluster the plurality of pieces of text data, divides the plurality of pieces of text data into k categories, determines the number k of text categories of clustering according to the preset text classification requirement, and k is a positive integer greater than 1.

[0034] In an optional example, the training set determination unit uses the Euclidean distance to calculate the distance of each piece of text data corresponding to the vector relative to the cluster center in the clustering process, sorts the text data of different category clusters according to the distance from small to large, and selects n pieces of data samples with a high ranking of the distance from the cluster center point from each category cluster, a total of k*n pieces of data, determines the text category to which the plurality of pieces of subtext data belong according to the text content of the plurality of pieces of subtext data, labels the subtext data, and constitutes an initial training set; n is a positive integer greater than 1.

[0035] In an optional example, the text category prediction unit adopts a PET classification model to learn the initial training set, and predicts the remaining unlabeled text data to obtain a probability value of each piece of text data belonging to each text category.

[0036] In an optional example, the active learning iteration unit repeats the process of training, predicting, finding text data with high classification uncertainty and labeling the text data, and updating the training data set is the process of active learning; the iteration of the active learning starts after the PET classification model first predicts the text data.

[0037] Compared with the prior art, the above technical solutions conceived by the present application have the following beneficial effects in general:

[0038] The present application provides a text classification method and system, according to the situation that there are many student interactive texts, few labeled samples and heavy workload of teachers in real classroom scenes, an online collaborative annotation system is constructed, and a set of student classroom interactive text classification technology is proposed to help teachers organize student interactive texts, which is different from the traditional way of teachers checking student interactive texts one by one, and the present application can more intelligently and efficiently help teachers understand the interactive situation of students.

[0039] The present application provides a text classification method and system, which is different from the current common supervised text classification algorithm, and when classifying student interactive texts, only a small amount of text labeled by teachers is needed to achieve good classification effect, reduces the labeling cost, and quickly helps teachers to classify.

[0040] The present application provides a text classification method and system, which is different from the current common supervised text classification algorithm, and when classifying student interactive texts, only a small amount of text labeled by teachers is needed to achieve good classification effect, reduces the labeling cost, and quickly helps teachers to classify. BRIEF DESCRIPTION OF DRAWINGS

[0041] Figure 1 is a text classification method flowchart provided by the present application;

[0042] Figure 2 is a text classification method flowchart provided by the present application;

[0043] Figure 3 is a text classification method flowchart provided by the present application;

[0044] Figure 4 is a text classification method flowchart provided by the present application;

[0045] Figure 5A text classification system architecture diagram provided by an embodiment of the present application. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.

[0047] The present application proposes a classroom text classification method based on hybrid intelligent active learning, which mainly uses intelligent technology to efficiently analyze a large amount of classroom interactive text generated by students during online learning, helps teachers quickly master student interaction content, and can timely provide teaching feedback to reduce the workload of teachers and better assist teachers in teaching work. A large amount of interactive text of different themes will be generated by students during online learning in the classroom, but there is little labeled data. For these text data, the present application first pre-processes and vectorizes the data, and then actively selects a small number of text for teachers to label by using the active learning method, iteratively trains, and then uses a small sample classification model to effectively classify student text, solving the problem that a large number of labeled samples are needed for training by a supervised classification algorithm, and the standard supervised classification algorithm usually performs poorly when applied to a small training set. The present application provides a convenient and practical classification method for classifying and sorting student interactive text, which can help teachers effectively analyze classroom interactive text, reduce the workload of teachers, and improve the work efficiency of teachers.

[0048] Figure 1 A text classification method flowchart provided by an embodiment of the present application is shown in FIG. 1. Figure 1 As shown in FIG. 1, the method comprises the following steps:

[0049] S101, determining a plurality of text data to be classified;

[0050] S102, clustering the plurality of text data to obtain text data of a plurality of text categories;

[0051] S103, sorting the text data under each category according to the distance from the relative clustering center point from small to large, selecting a plurality of sub-text data ranked at the front, and determining the text category to which the plurality of sub-text data belongs according to the text content of the plurality of sub-text data as the label value of the plurality of sub-text data, and taking the plurality of sub-text data under each category as a training data set;

[0052] S104, training a text classification model based on the current training data set, and predicting each text data in the plurality of text data based on the trained text classification model to obtain a probability value of each text data belonging to each text category; the probability value is multiple, corresponding to multiple text categories respectively;

[0053] S105, determine the probability difference value between the maximum probability value and the second maximum probability value in each text data prediction result, sort the probability difference values of the multiple pieces of text data from small to large, select the multiple pieces of text data with high ranking probability difference values as text data with high classification uncertainty; determine the text category to which the text data with high classification uncertainty belongs according to the content of the text data as the corresponding label value, and add the corresponding text data to the current training data set, repeat the above training, prediction, finding text data with high classification uncertainty and labeling, and updating the training data set process until the prediction result meets the preset text classification requirement;

[0054] S106, the prediction result of each text data last time is taken as the text classification result.

[0055] The student text classification method based on hybrid intelligent active learning is designed, the online and offline interaction text of students in the classroom is classified and analyzed, and the final classification result is fed back to the teacher, Figure 2 The overall schematic diagram of the present application is shown in the figure. The main process of the present application in classifying the interaction text of students on the online learning platform is as follows:

[0056] 1. Data preprocessing stage

[0057] The text data of students in the classroom on the online learning platform is obtained as the initial data, and the data is cleaned, and some repeated or special symbol data text is processed, and the text is represented by vectorization. The present application takes a comment of a student as a whole, and uses the SimCSE model to train the corresponding sentence vector of each comment. SimCSE is a sentence embedding algorithm based on simple contrast learning proposed by Chen Danqi team, which mainly solves the problem of sentence vector. SimCSE algorithm has been proved to have good sentence level representation performance in experiments.

[0058] 2. Active learning initial training set construction stage

[0059] After we vectorize the students' learning text data, we choose to cluster the text by kmeans method, first determine the k value by the topic of the discussion and the needs of the teacher. Finally, according to the vectorization and clustering of the students' interactive text, we get k categories of text, we regard the text close to the cluster center as more representative samples, so we need to select some samples close to the cluster center from each category as the initial training set. This is the first step of the learning process. In the clustering process, the invention uses the kmeans clustering algorithm to select the most representative samples, which is divided into the following three steps: first, the teacher determines that the students' interactive text is divided into k categories; second, the text vector is clustered, and the Euclidean distance is used to calculate the distance between each text vector and the cluster center during the clustering process, and the data of different clusters are sorted according to the distance; Finally, the n closest data samples to the cluster center are selected from each cluster, a total of k*n data are extracted and labeled by the teacher to form the initial training set.

[0060] 3. Text classification stage

[0061] After constructing the initial data set, we can see that the initial data set contains a small amount of samples of each category. Next, we need to use the text classification model to learn the initial data set and predict the remaining text data. The text classification model used in the invention is Pattern-Exploiting Training. Pattern-Exploiting Training, abbreviated as PET, is a semi-supervised learning algorithm that uses natural language models to reconstruct the input text into a complete form fill-in mode, mainly applied to small sample scenarios. The specific framework of the model is as follows: first, create multiple patterns for input examples to convert input examples into complete form fill-in questions; for different pattern inputs, use pre-trained models for fine-tuning; second, fuse all the above models to label unlabeled data; finally, train the classifier on the obtained pseudo-label dataset. Therefore, the PET model needs to first set the corresponding pattern according to the text classification target, that is, a descriptive sentence, which can be concatenated in front of the student's interactive text as a prefix, or concatenated behind the interactive text as a suffix. In this invention, the pattern set is "The following is a ____ text", which is used to concatenate with the students' text. In different application scenarios, this pattern can be adjusted according to the needs of the teacher.

[0062] 4. Iterative process of active learning

[0063] The iteration of active learning starts after the first prediction of the student interaction text from the above text classification stage. The most important thing in the iteration process of active learning is the query strategy. The application selects the text according to the edge sampling strategy of active learning according to the results of the text classification model. The strategy is based on the sampling principle of uncertainty to select the samples with the minimum difference between the maximum and second maximum probability values predicted by the model. The smaller the difference is, the more uncertain the model is to the text, and the more the teacher needs to confirm the label. Therefore, when selecting, the prediction probability value of the text classification model for each text in the last stage is calculated, the maximum and second maximum probability values are sorted, and the first m data with the minimum difference between the maximum and second maximum probability values are selected to be labeled by the teacher, and the labeled text is added to the initial labeled data set, so as to improve the algorithm effect faster. When the active learning iteration is performed, some most uncertain sample data are selected from the unlabeled data set according to the active learning idea, and are added to the current training set after being labeled and confirmed by the teacher, and then the iteration of the next round is entered. After the iteration is completed, the classification model feeds back the final classification result to the teacher, helps the teacher to select high-quality texts, reduces the workload of the teacher, and better assists the teaching work of the teacher.

[0064] Specifically, there are various forms of text vectorization representation. The traditional sentence vector obtained by adding and summing word vectors does not utilize the mutual information between words. Instead, various models based on Bert are used. Studies have shown that the sentence vector represented by Bert itself has the characteristics of anisotropy and uneven distribution, so the effect of using Bert for text expression tasks is very poor. Therefore, the application uses the SimCSE algorithm to vectorize the cleaned text data when vectorizing. The SimCSE model is divided into an unsupervised part and a supervised part, and the application learns in an unsupervised manner. As shown in the following formula (1), the unsupervised positive and negative example construction method is used. The model uses the dropout in the pre-training model for data enhancement operation. The same sample is input into the pre-training encoder twice, and the dropout is different each time. Therefore, two different sentence vector representations are generated, so that the vector pair obtained from one sentence is used as a positive sample pair, and the embeddings generated from other sentences in the batch are used as negative samples to train the model. Figure 3

[0065] ​In the present application, the introduction of active learning is one of the key technologies to solve the target problem, which obtains the samples that are more difficult to classify through the classification model, and lets the teacher confirm and audit, through a small amount of labeling cost, improves the effect of the model, forms a human-in-the-loop. Active learning is an iterative interactive training process, the classifier is trained on the screened labeled sample set, and then the unlabeled text is predicted and classified again, the samples are screened, and the iteration is carried out, so as to continuously improve the classification effect of the classifier. The active learning model is modeled by the following five components as shown in Figure 4

[0066] A=(C,Q,S,L,U), wherein C is a classification model, Q is a query strategy, S is an expert, L is a labeled data set, and U is an unlabeled data set.

[0067] In the selection of the initial training set, in order to reduce the influence of edge data, the most representative samples are selected for labeling, which assists the expert to induce and summarize the classification category, and the kmeans clustering algorithm is used for selection. Kmeans algorithm is a very classic clustering algorithm independently proposed by Steinhaus in 1955, Lloyd in 1957, Ball & Hall in 1965 and Mc Queen in 1967 in different scientific research fields, mainly following the idea of "like attracts like, and people are divided into groups", the given data set is clustered into k related clusters according to the distance between samples, so that the similarity of data objects in the same cluster is as large as possible, and the difference of data objects not in the same cluster is as large as possible. The process is clear, simple to operate and fast to converge. The present application considers that the closer the distance between the sample and the cluster center in the clustering result, the more obvious the characteristics and the stronger the representativeness, so the samples close to the cluster center are selected as the initial data set according to the clustering result.

[0068] The classification model used in the active learning process of the present application is Pattern-Exploiting Training, which is a model that uses MLM model to predict the masked label, and converts a classification task into a fill-in-the-blank problem. For example, if a news text classification task is performed, a sentence "bedroom decoration uses light color", then after supplementing, the following fill-in-the-blank can be constructed: "The following is a ____ text: bedroom decoration uses light color", so we convert a news theme classification into a fill-in-the-blank problem, and the goal of the MLM model is to predict the word "home".

[0069] The specific process and situation used in the practical scene of the present application are as follows:

[0070] ​Take 400 student texts collected in a class of international trade in a university in China as an example. These texts are effective evaluation texts of the course, with lengths ranging from 4 to 180, and the quality of the texts varies greatly. They include low-quality evaluation texts that simply evaluate without analysis, such as “not bad, can be”, “good, good, very good”, and high-quality texts that analyze and expand the evaluation of the course, such as “The lecturer introduced the development and changes of international trade in a simple and easy-to-understand language, and through the exercises, I have a deeper understanding of the course of international trade.” For teachers, it is obvious that low-quality review texts are not helpful for teachers to understand students' ideas. The classification goal in this scenario is to divide the texts into high-quality and low-quality categories, and to filter out high-quality evaluation texts for teachers.

[0071] First, the 400 text data is cleaned to remove meaningless special characters, and the text is vectorized. Second, the clustering algorithm is used to cluster the data into two categories, and 20 data are selected from the center of each cluster, a total of 40 data are labeled by the teacher, a total of 13 high-quality texts and 27 low-quality texts are obtained as the initial training set. The Pattern spliced on the classification model is a prefix “The following is a ____ text”, and the space maps to the two categories “high quality” and “low quality”.

[0072] In the active learning process, first, the classification model trained by the initial training set classifies the unannotated data, and according to the margin sampling query strategy, the top 20 samples with the smallest difference between the maximum and second largest probability predicted by the model are selected for labeling by the teacher, and then added to the training set. The classification model is trained again. Each round of active learning is iteratively labeled according to the above process, with 20 samples labeled each time. In this scenario, three rounds of active learning are performed, and a total of 100 labeled samples are obtained. By comparing the prediction results of the classification model with the true high-low quality labels of these samples, the final prediction results are shown in Table 1. After three iterations, the prediction accuracy of the present application is 89%. The results prove that this scheme can help teachers filter out high-quality texts in this learning scenario, reduce the workload of teachers, and better assist teachers in teaching.

[0073] Table 1 Prediction results

[0074]

[0075] Figure 5 is a text classification system architecture provided by an embodiment of the present application; as shown in Figure 5 , comprising:

[0076] The text data determination unit 510 is configured to determine a plurality of pieces of text data to be classified.

[0077] The training set determination unit 520 is configured to cluster the plurality of pieces of text data to obtain text data of a plurality of text categories, sort the text data under each category according to the distance from the relative clustering center point from small to large, select a plurality of pieces of sub-text data ranking at the front, determine the text category to which the plurality of pieces of sub-text data belong according to the text content of the plurality of pieces of sub-text data as the label value of the plurality of pieces of sub-text data, and take the plurality of pieces of sub-text data under each category as a training data set.

[0078] The text category prediction unit 530 is configured to train a text classification model based on the current training data set, and predict each piece of text data in the plurality of pieces of text data based on the trained text classification model to obtain a probability value of each piece of text data belonging to each text category. The probability value is common to a plurality of text categories, and corresponds to the plurality of text categories respectively.

[0079] The active learning iteration unit 540 is configured to determine the probability difference between the maximum probability value and the second maximum probability value in the prediction result of each piece of text data, sort the probability difference of the plurality of pieces of text data from small to large, select a plurality of pieces of text data ranking at the front as text data with high classification uncertainty, determine the text category to which the text data with high classification uncertainty belong according to the content of the text data as the corresponding label value, and add the corresponding text data to the current training data set. The process of training, predicting, finding text data with high classification uncertainty and labeling, and updating the training data set is repeated until the prediction result meets the preset text classification requirement.

[0080] The classification result determination unit 550 is configured to take the prediction result of each piece of text data in the last time as the text classification result.

[0081] It can be understood that, Figure 5 The detailed function implementation of each unit in the method embodiment can be referred to the foregoing description, and will not be repeated here.

[0082] It can be understood by those skilled in the art that the above only describes the preferred embodiments of the present application, and is not intended to limit the present application. Any modification, equivalent replacement and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method of text classification, characterized by, The method comprises the following steps: determining a plurality of pieces of text data to be classified; clustering the plurality of pieces of text data to obtain text data of a plurality of text categories; sorting the text data under each category according to the distance from the relative clustering center point from small to large, selecting a plurality of pieces of sub-text data ranking at the front, and determining the text category to which the plurality of pieces of sub-text data belong according to the text content of the plurality of pieces of sub-text data as the label value of the plurality of pieces of sub-text data, and taking the plurality of pieces of sub-text data under each category as a training data set; training a text classification model based on the current training data set, and predicting each piece of text data in the plurality of pieces of text data based on the trained text classification model to obtain a probability value of each piece of text data belonging to each text category; the probability value is a plurality, respectively corresponding to a plurality of text categories; determining the probability difference between the maximum probability value and the second maximum probability value in the prediction result of each piece of text data, and sorting the probability difference of the plurality of pieces of text data from small to large, selecting the plurality of pieces of text data ranking at the front as the text data with high classification uncertainty; determining the text category to which the text data with high classification uncertainty belongs according to the content of the text data as the corresponding label value, and adding the corresponding text data to the current training data set, repeating the process of training, prediction, finding text data with high classification uncertainty and labeling, and updating the training data set until the prediction result meets the preset text classification requirement; taking the prediction result of each piece of text data at the last time as the text classification result.

2. The method of claim 1, wherein, The plurality of pieces of text data are clustered to obtain text data of a plurality of text categories, specifically: using a kmeans clustering algorithm to cluster the plurality of pieces of text data, and dividing the plurality of pieces of text data into k categories; the number k of text categories of clustering is determined according to the preset text classification requirement, and k is a positive integer greater than 1.

3. The method of claim 1, wherein, Sort the text data under each category according to the distance from the relative clustering center point from small to large, and select a plurality of pieces of sub-text data ranking at the front, specifically: use Euclidean distance to calculate the distance of each text data corresponding to the vector relative to the cluster center in the clustering process, and sort the text data of different category clusters according to the distance from small to large; selecting n pieces of data samples ranking at the front relative to the clustering center point from each category cluster, a total of k*n pieces of data, determining the text category to which the plurality of pieces of sub-text data belong according to the text content of the plurality of pieces of sub-text data, and labeling the sub-text data to form an initial training set; n is a positive integer greater than 1.

4. The method of claim 1, wherein, training a text classification model based on the current training data set, and predicting each piece of text data in the plurality of pieces of text data based on the trained text classification model to obtain a probability value of each piece of text data belonging to each text category, specifically: using a PET classification model to learn the initial training set, and predicting the remaining unlabeled text data to obtain a probability value of each piece of text data belonging to each text category.

5. The method of claim 1, wherein, The process of repeating the above training, prediction, finding text data with high classification uncertainty and labeling, and updating the training data set is the process of active learning; the iteration of the active learning starts after the PET classification model first predicts the text data.

6. A text classification system characterized by, Comprise: A text data determination unit for determining a plurality of text data to be classified; A training set determination unit for clustering the plurality of text data to obtain text data of a plurality of text categories; and sorting the text data under each category according to the distance from the relative clustering center point from small to large, selecting the top-ranked plurality of sub-text data, and determining the text category to which the plurality of sub-text data belongs according to the text content of the plurality of sub-text data as the label value of the plurality of sub-text data, and the plurality of sub-text data under each category as the training data set; A text category prediction unit for training a text classification model based on the current training data set, and predicting each text data in the plurality of text data based on the trained text classification model to obtain a probability value of each text data belonging to each text category; the probability value is multiple, corresponding to multiple text categories respectively; An active learning iteration unit for determining the probability difference between the maximum probability value and the second maximum probability value in the prediction result of each text data, and sorting the probability difference of the plurality of text data from small to large, selecting the plurality of text data with high classification uncertainty, and determining the text category to which the text data belongs according to the content of the text data as the corresponding label value, and adding the corresponding text data to the current training data set, repeating the above training, prediction, finding text data with high classification uncertainty and labeling, and updating the training data set until the prediction result meets the preset text classification requirement; A classification result determination unit for determining the last prediction result of each text data as the text classification result.

7. The system of claim 6, wherein, The training set determination unit uses the kmeans clustering algorithm to cluster the plurality of text data, divides the plurality of text data into k categories, determines the number of text categories k of clustering according to the preset text classification requirement, and k is a positive integer greater than 1.

8. The system of claim 6, wherein, The training set determination unit uses the Euclidean distance to calculate the distance of each text data corresponding to the vector relative to the cluster center in the clustering process, and sorts the text data of different class clusters according to the distance from small to large; and selects n data samples with high ranking relative to the clustering center point distance from each class cluster, a total of k*n data, determines the text category to which the plurality of sub-text data belongs according to the text content of the plurality of sub-text data, labels the sub-text data, and constitutes the initial training set; n is a positive integer greater than 1.

9. The system of claim 6, wherein, The text category prediction unit uses the PET classification model to learn the initial training set and predict the remaining unlabeled text data to obtain the probability value of each text data belonging to each text category.

10. The system of claim 6, wherein, The active learning iteration unit repeats the processes of the above training, prediction, finding text data with higher classification uncertainty, labeling the text data, and updating the training data set, which is the process of active learning; the iteration of the active learning starts after the PET classification model first predicts the text data.

Citation Information

Patent Citations

  • Machine learning method and device for quickly improving text classification performance

    CN110263173A

  • A Semi-Supervised Learning Method and System for Few-Sample Text Classification

    CN114036947B

  • Text classification model training method and device, storage medium and computer equipment

    CN111522942A

  • Automated workflows for identification of reading order from text segments using probabilistic language models

    US20180373952A1