Text classification method based on improved Tri-training algorithm

By adopting the method of sharing training sets and dynamically updating probability thresholds in the Tri-training algorithm, combined with RemoveOnly and adaptive data editing strategies, the problems of noisy labels and insufficient generalization capabilities in the Tri-training algorithm are solved, and the accuracy of text classification is improved. accuracy and stability.

CN118673143APending Publication Date: 2024-09-20SICHUAN POLICE COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410757736.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

The traditional Tri-training algorithm has the problems of high risk of generating noisy labels and insufficient generalization ability in text classification, especially the imbalance of sample classes in the training set caused by weak initial classifiers and accumulation of classifier errors.

Method used

In the improved Tri-training algorithm, three classifiers are used to share a training set, strict restrictions on the samples entering the labeled data set are added, and the probability threshold is dynamically updated according to the proportion of sample categories after each iteration of training, while combined with RemoveOnly editing Operational and adaptive data editing strategies.

Benefits of technology

It reduces the probability of classifier errors, improves the accuracy and generalization ability of the classifier, reduces the generation of noise labels, and enhances the effect of text classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673143A
    Figure CN118673143A
Patent Text Reader

Abstract

The invention discloses a text classification method based on an improved Tri-training algorithm in the technical field of text data processing. The text classification method comprises the following steps of text preprocessing, text feature selection and classifier training. The text processing comprises the steps of performing standardization processing on the selected text data, and converting the text data into a form of subsequent feature extraction; text feature selection: based on an information gain formula, the importance of features is reflected, and the greater the information gain is, the more important the features are; the classifier training is carried out on the basis of an improved Tri-training algorithm. According to the algorithm, one training set is shared in three classifiers, so that the error probability of the classifiers is reduced. More stringent restrictions are applied to samples entering a tagged data set. In addition, after each iterative training, the probability threshold is dynamically updated according to the change of the sample category proportion. In addition, a RemoveOnly editing operation and a self-adaptive data editing strategy are combined into the learning process of the Tri-training algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of text data processing, and in particular is a text classification method based on an improved Tri-training algorithm. Background Art

[0002] With the continuous advancement of computer technology and network technology, the amount of text data on the Internet is growing rapidly. As the main information carrier with the widest distribution and the largest amount of data, it is imperative to scientifically organize and manage massive data through text classification technology. Therefore, in today's machine learning field, text classification plays a vital role in natural language processing. Traditional supervised learning requires manual labeling of text categories, which leads to high labor costs. Semi-supervised text classification can learn from unlabeled samples, so it has attracted more and more attention. The most common weakly supervised text classification method involves generating pseudo labels and training classifiers to learn the mapping between documents and classes. It is undeniable that the quality of pseudo labels contributes greatly to the accuracy of the final classification. However, they inevitably generate noise. Pseudo labels are usually generated using heuristic methods, such as string matching between user-provided documents and seed words, and the high risk of misprediction of such noisy labels cannot be ignored. Therefore, it is crucial to minimize the noise generated by pseudo labels.

[0003] Ensemble learning, as a machine learning technique, has been shown to effectively reduce noise in classification problems by integrating multiple weakly supervised classifiers. Ensemble learning can combine multiple independent models to improve their overall performance. Deep learning models with multi-layer processing architectures show superior performance compared to shallow or traditional classification models. The main idea behind ensemble learning is to generate multiple learners through specific rules, integrate them using an ensemble strategy, and make a comprehensive decision based on the final result. Usually, many classifiers in ensemble learning are homogeneous and are considered "weak classifiers". Based on this weak classifier, several classifiers can be generated through perturbations such as sample sets, input features, output representations, and algorithm parameter perturbations. By fusing these classifiers together, a "strong classifier" with improved accuracy can be obtained. This approach involves selecting learning methods for multiple groups of learners without distinguishing the nature of the learners. Blum et al. proposed the first ensemble learning method, the collaborative training algorithm. In this method, it is assumed that the dataset has two redundant views, corresponding to each attribute set. The definition of these views must satisfy two sufficient conditions: each attribute set should be able to describe the entire dataset, and each attribute set should be independent of other attribute sets. However, in practice, these conditions are often difficult to meet. For example, many datasets may have multiple views, but not necessarily enough views. Furthermore, these views may not be completely independent.

[0004] To address the limitations of joint training, Zhou Zhihua et al. proposed the Tri-training algorithm to improve efficiency by eliminating the long validation time of using multiple classifiers in the joint training process. The algorithm first bootstrapped the labeled sample set to obtain three labeled training sets, and then generated a classifier from each training set. During the training process, the other two classifiers collaborate to provide new labeled examples obtained by each classifier. If the two classifiers have the same prediction for the same unlabeled example, the example is considered to have high labeling confidence and is added to the labeled training set of the third classifier after labeling. When predicting unseen examples, Tri-training no longer selects a single classifier like previous algorithms; instead, it uses the voting method commonly used in ensemble learning to form an ensemble of three classifiers. Unlike previous joint training algorithms, Tri-training implicitly compares the confidence of different unlabeled samples by judging the consistency of the predictions of the three classifiers. This approach solves the problem of frequently using time-consuming statistical testing techniques.

[0005] However, the Tri-training algorithm also has its shortcomings. The traditional Tri-training algorithm implicitly compares the labeling confidence of different unlabeled examples by determining the consistency of the predictions of the three classifiers. However, implicit processing is usually not as accurate as the explicit estimation of labeling confidence. For example, if the initial classifier is weak, the unlabeled examples may be mislabeled, resulting in noise in the training of the third classifier. In addition, the algorithm does not consider the problem of imbalanced sample classes in the training set due to the accumulation of classifier errors. And because the same learning method is applied to train the data, the obtained classifier has the same classification results even if the training sets are different, regardless of the probability of the data. Therefore, the generalization ability of the Tri-training algorithm is not strong. Summary of the invention

[0006] The present invention provides a text classification method based on an improved Tri-training algorithm to solve the above problems. The proposed algorithm shares a training set among three classifiers, which reduces the probability of classifier errors. It also imposes stricter restrictions on samples entering the labeled data set. In addition, after each iterative training, the probability threshold is dynamically updated according to the change in the sample category ratio. In addition, the RemoveOnly editing operation and the adaptive data editing strategy are combined into the Tri-training algorithm learning process.

[0007] In order to achieve the above object, the technical solution of the present invention is as follows: a text classification method based on an improved Tri-training algorithm, comprising the following steps: text preprocessing, text feature selection and classifier training;

[0008] Text processing includes standardizing the selected text data and converting it into a form for subsequent feature extraction;

[0009] Text feature selection is based on the information gain formula to reflect the importance of the feature. The greater the information gain, the more important the feature.

[0010] Classifier training is based on the improved Tri-training algorithm. The specific method is as follows:

[0011] Input data: original labeled balanced training set unlabeled training set D U , validation set D V and the test set D t , the number of unlabeled training set subsets n, the number of iterations t0, the upper limit of the sample category ratio P h ,,lower limit P l and fine-tune step;

[0012] Training: Preprocess the labeled balanced training set H1; reduce the dimension of the preprocessed set to obtain the feature vector, and then train the feature vector using naive Bayes, support vector machine and K nearest neighbor algorithm to obtain three initial classifiers h1, h2 and h3;

[0013] (1) Use h1, h2 and h3 to preliminarily determine D U , and get L 0 ;

[0014] (2) Calculate L for m categories 0 The frequency in

[0015]

[0016] (3) D U Randomly divide into several subsets, and use h1, h2 and h3 to determine D U ,get

[0017]

[0018] (4) For Each text in

[0019]

[0020] (5) If i(D i Category in)>P h ,but otherwise

[0021] (6) Repeat steps (3) to (5); traverse All text in;

[0022] (7) Use RemoveOnly to cut D i and calculate performance;

[0023] (8) Use the updated D i Retrain h1, h2 and h3; use D v Verify and record the results;

[0024] (9) Repeat steps (2) to (8) until the number of iterations equals t0;

[0025] Output data: The one with the best verification result among the initial classifiers h1, h2 and h3 is used as the final classifier H. t Test it on and output F1.

[0026] Further, the information gain formula is:

[0027] k is the number of text types; P(C i ) is the probability that a specific type of text appears in the total number of all types of text, is the number of certain types of text, N is the total number of texts; P(t) is the probability that a text containing feature t appears in all texts, N t is the number of texts containing feature t; P(C i |t) is when feature t appears, the text belongs to C i The conditional probability of It is C i The number of texts with feature t in is the probability that a text without feature t appears in the total text, is the number of texts without feature t; When the feature does not appear, the text belongs to C i The conditional probability of It is C i The number of texts that do not have a feature.

[0028] The technical principle and beneficial effects of the above scheme are as follows: The algorithm of the present invention shares a training set among three classifiers, which reduces the probability of classifier errors. It also imposes stricter restrictions on samples entering the labeled data set. In addition, after each iterative training, the probability threshold is dynamically updated according to the change in the sample category ratio. In addition, the RemoveOnly editing operation and the adaptive data editing strategy are combined into the Tri-training algorithm learning process.

[0029] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 Schematic diagram of the flow of a text classification method based on an improved Tri-training algorithm in an embodiment of the present invention. DETAILED DESCRIPTION

[0031] The following is further described in detail through specific implementation methods:

[0032] The present invention provides a text classification method based on an improved Tri-training algorithm, comprising the following steps: text preprocessing, text feature selection and classifier training;

[0033] Text processing includes standardizing the selected text data and converting it into a form for subsequent feature extraction; in this embodiment, the processing tasks of the text preprocessing stage include standardizing the selected text data and converting it into a form for subsequent feature extraction, including word segmentation, stop word removal, special character removal, and root reduction of English words. Word segmentation includes using English spaces and punctuation marks as delimiters to separate words into meaningful units. Stop words are words that have no important meaning and can be deleted using commonly used English stop words. Special characters, such as non-English characters, numbers, and punctuation marks, can be filtered using regular expressions. Root reduction is the process of simplifying English words by removing affixes to obtain the basic form of the word;

[0034] Text feature selection is based on the information gain formula to reflect the importance of the feature. The greater the information gain, the more important the feature. The total information gain formula is as follows:

[0035]

[0036] k is the number of text types; P(C i ) is the probability that a specific type of text appears in the total number of all types of text, is the number of certain types of text, N is the total number of texts; P(t) is the probability that a text containing feature t appears in all texts, N t is the number of texts containing feature t; P(C i |t) is when feature t appears, the text belongs to C i The conditional probability of It is C i The number of texts with feature t in is the probability that a text without feature t appears in the total text, is the number of texts without feature t; When the feature does not appear, the text belongs to C i The conditional probability of It is C i The number of texts without features in

[0037] Classifier training is based on the improved Tri-training algorithm. The specific method is as follows:

[0038] Input data: original labeled balanced training set unlabeled training set D U , validation set D V and the test set D t , the number of unlabeled training set subsets n, the number of iterations t0, the upper limit of the sample category ratio P h ,,lower limit P l and fine-tune step;

[0039] Basically as attached Figure 1 As shown, training: preprocess the labeled balanced training set H1; reduce the dimension of the preprocessed set to obtain a feature vector, and then use the naive Bayes, support vector machine and K nearest neighbor algorithm to train the feature vector to obtain three initial classifiers h1, h2 and h3;

[0040] (1) Use h1, h2 and h3 to preliminarily determine D U , we get L 0 ;

[0041] (2) Calculate L for m categories 0 The frequency in

[0042]

[0043] (3) D U Randomly divide into several subsets, and use h1, h2 and h3 to determine D U ,get

[0044]

[0045] (4) For Each text in

[0046]

[0047] (5) If i(D i Category in)>P h ,but otherwise

[0048] (6) Repeat steps (3) to (5); traverse All text in;

[0049] (7) Use RemoveOnly to cut D i and calculate performance;

[0050] (8) Use the updated D i Retrain h1, h2 and h3; use D v Verify and record the results;

[0051] (9) Repeat steps (2) to (8) until the number of iterations equals t0;

[0052] Output data: The one with the best verification result among the initial classifiers h1, h2 and h3 is used as the final classifier H. t Test it on and output F1.

[0053] In this embodiment, for the convenience of description, it is assumed that D i is a labeled balanced training set containing |D i | samples, given a label set C = {c1,c2,c3,…,c m}; D U is an unlabeled training set containing D U Samples: The validation set and test set are D v and D t . D i ,D v and D tFollow the same data distribution. Let the three initial classifiers h1, h2 and h3 be trained by the original labeled balanced training set, and use these three classifiers to predict and judge the unknown sample set. Only samples that meet the above conditions (that is, the prediction results of the three classifiers for the same unlabeled sample are the same, and the prediction probabilities given by the three classifiers are greater than their respective probability thresholds) can be added to the original training set. The prediction probability is calculated by the classification algorithm of the classifier. For D U Any sample in All three classifiers can obtain a probability distribution set |C| with a sum of 1, which is expressed as:

[0054]

[0055] The maximum probability is the predicted probability, that is

[0056]

[0057] The probability threshold will be dynamically updated according to the change in the sample category ratio after each iteration of training, so the initial probability threshold set of the three classifiers must be obtained first. First, use h1, h2 and h3 to determine the unlabeled data set D U , and then use formula (4) to calculate the label frequency of the three classifiers of the m categories in L, and get the D predicted by the three classifiers U The initial "pseudo-label" set of , that is, the initial value set of the probability threshold, can be defined as:

[0058]

[0059] Among them, when , F(·)=1, otherwise F(·) is 0.

[0060] The adaptive pruning strategy of RemoveOnly is as follows: Let D t represents the sample set newly labeled by h1 in the tth round, that is, the t-1th round of iteration; represents the remaining training set after pruning; ε t Represents D i ∪D t and Train more hypothetical classification error rates for h1. If RemoveOnly is not triggered in the t-1^th iteration and |D^t|>|D^(t-1)|, then |D t |>|D t-1 | triggers RemoveOnly; if RemoveOnly is not triggered in the t-1th iteration, and |D t |>|D t-1 |, then in ε t <ε t-1and RemoveOnly is triggered if ; if RemoveOnly is triggered in the t-1th iteration, and Then RemoveOnly will be is triggered under the condition of; if RemoveOnly has been triggered in the t-1^"th" iteration and In and In the case of RemoveOnly, RemoveOnly is triggered; except for the above cases, RemoveOnly will not be triggered.

[0061] The above is only an embodiment of the present invention. The common sense such as the known specific structure and characteristics in the scheme is not described in detail here. The ordinary technicians in the relevant field know all the common technical knowledge in the technical field of the invention before the application date or priority date, can obtain all the existing technologies in the field, and have the ability to apply the conventional experimental means before that date. The ordinary technicians in the relevant field can improve and implement this scheme in combination with their own abilities under the enlightenment given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the relevant field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several deformations and improvements can be made, which should also be regarded as the protection scope of the present invention, which will not affect the effect of the implementation of the present invention and the practicality of the patent. The protection scope required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.

Claims

1. A text classification method based on improved Tri-training algorithm, Features: The steps include: text preprocessing, text feature selection and classifier training; Text processing includes standardizing the selected text data and converting it into a form for subsequent feature extraction; Text feature selection is based on the information gain formula to reflect the importance of the feature. The greater the information gain, the more important the feature is. Classifier training is based on the improved Tri-training algorithm. The specific method is as follows: Input data: original labeled balanced training set unlabeled training set D U , validation set D V and the test set D t , number of unlabeled training set subsets n, number of iterations t 0 , upper limit of sample category proportion P h ,, lower limit P l and fine-tune step; Training: Preprocess the labeled balanced training set H 1 ; Reduce the dimension of the preprocessed set to obtain the feature vector, and then use the naive Bayes, support vector machine and K nearest neighbor algorithm to train the feature vector to obtain three initial classifiers h 1 ,h 2 and h 3 ; (1) Use h 1 ,h 2 and h 3 Preliminary determination of D U , we get L 0 ; (2) Calculate L for m categories 0 The frequency in (3) D U Randomly divide into several subsets, using h 1 ,h 2 and h 3 Determine D U ,get (4) For Each text in (5) If i(D i Category in)>P h ,but otherwise (6) Repeat steps (3) to (5); traverse All text in; (7) Use RemoveOnly to cut D i and calculate performance; (8) Use the updated D i Retrain h 1 ,h 2 and h 3 ; Use D v Verify and record the results; (9) Repeat steps (2) to (8) until the number of iterations equals t 0 ; Output data: The initial classifier h 1 ,h 2 and h 3 The one with the best verification result is used as the final classifier H. t Test it on the 1 .

2. The text classification method based on the improved Tri-training algorithm according to claim 1, Features: Information gain formula: k is the number of text types; P(C i ) is the probability that a specific type of text appears in the total number of all types of text, is the number of certain types of text, N is the total number of texts; P(t) is the probability that a text containing feature t appears in all texts, N t is the number of texts containing feature t; P(C i |t) is when feature t appears, the text belongs to C i The conditional probability of It is C i The number of texts with feature t in is the probability that a text without feature t appears in the total text, is the number of texts without feature t; When the feature does not appear, the text belongs to C i The conditional probability of It is C i The number of texts that do not have a feature.