Multi-label text classification method and system

By reclassifying multi-label texts and using the processed texts for network model training, the problem of poor classification effect in the existing multi-label text classification technology is solved, and the accurate classification of multi-label texts and higher reliability of classification results is achieved.

CN113988194BActive Publication Date: 2025-03-28CISDI ENGINEERING CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111277654.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2025-03-28
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

The existing multi-label text classification technology has problems such as poor classification effect, low accuracy and large error, mainly due to the adverse effects of multi-label text complexity, similarity between labels at the same level and the difference between labels at different levels on model training.

Method used

By reclassifying the labels at all levels in the text of known label categories, more accurate multi-level label categories are obtained, and these texts are input into the network model as training data for training, a network model with higher reliability is obtained. The method includes collecting text information, determining the tag collection sequence, reclassifying the tags, training the network model and classifying the text to be tested.

Benefits of technology

The accurate classification of multi-label text is achieved, the reliability of classification results is improved, and the resulting network model has better classification effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0003330047940000031
    Figure BDA0003330047940000031
  • Figure BDA0003330047940000071
    Figure BDA0003330047940000071
  • Figure FHA0000009799430000011
    Figure FHA0000009799430000011
Patent Text Reader

Abstract

The present invention discloses a multi-label text classification method and system, including: S1. Collecting text information of known label categories; S2. Determining the label set sequence of the text according to the label categories of the text; S3. Reclassifying all labels of the next level of each level of the text labels to obtain processed labels; S4. Inputting the text information corresponding to the processed labels into a network model for network training to obtain a trained network model; S5. Inputting the text information to be tested of unknown label categories into the trained network model, and outputting the label categories of each level of the text to be tested. The present invention can obtain a network model with better classification effect, realizes accurate classification of multi-label text, and the classification result is more reliable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of text classification, and in particular to a multi-label text classification method and system. Background Art

[0002] There are often some multi-label phenomena in people's lives. For example, a person has multiple identities, such as father, son, teacher, etc., and a piece of text may also belong to multiple categories, such as humanities, culture, etc. Therefore, multi-label text classification technology is widely used in news classification, sentiment classification, public opinion analysis, etc.

[0003] Text classification refers to a supervised text classification process. After obtaining the data, the model is trained based on the content of the text and the determined label of the text; then the model is applied to predict the label of the text with unknown labels to obtain the category to which the text may belong.

[0004] However, there are some differences between multi-label text classification and early binary classification and multi-classification. Due to the complexity of multi-label text itself, the difficulty of text classification is increased. There are certain similarities between labels of the same level, which is not conducive to model training. When the differences between labels of different levels reach a certain level, it will also affect the training effect of the model, resulting in poor results of existing multi-label text classification, low classification accuracy and large errors. Summary of the invention

[0005] In view of this, the purpose of the present invention is to overcome the defects in the prior art and provide a multi-label text classification method and system, which can obtain a network model with better classification effect, realize accurate classification of multi-label text, and make the classification result more reliable.

[0006] The multi-label text classification method of the present invention comprises the following steps:

[0007] S1. Collect text information of known label categories;

[0008] S2. According to the label category of the text, determine the label set sequence of the text (L1, L2, ..., L i ,...,L n ), where L i is the i-th level label set, n is the number of label sets;

[0009] S3. reclassify all labels at the next level of each level of text labels to obtain processed labels;

[0010] S4. Input the processed text information corresponding to the label into the network model for network training to obtain a trained network model;

[0011] S5. Input the text information to be tested of unknown label category into the trained network model, and output the label categories of each level of the text to be tested.

[0012] Furthermore, all labels at the next level of the text labels are reclassified, including:

[0013] S21. From the label set L n-1 Get a label L n-1,k , and the label set L n-1 Remove label L n-1,k The remaining tags of Among them, the label L n-1,k The label set L n-1 The label k in

[0014] S22. Calculate label L n-1,k The texts corresponding to all n-level tags are respectively related to the tag set The similarity of each label corresponding to the text in the similarity set S is obtained. n-1,k,n ;

[0015] S23. Calculate label L n-1,k The corresponding texts are respectively associated with the label set The similarity of each label corresponding to the text in the similarity set S is obtained. n-1,k ;

[0016] S24. Determine the similarity set S n-1,k,n Is the maximum similarity value in less than the similarity set S n-1,k If the minimum similarity is found, then label L n-1,k All n-level labels are changed to n-1-level labels; otherwise, no processing is done;

[0017] S25. Tag set All labels in the n-th level are analogized according to steps S21-S24 to achieve label reclassification of all n-th level labels under the n-1th level;

[0018] S26. By analogy with steps S21-S25, reclassify the labels of all the labels at the next level of each level.

[0019] Furthermore, the text information corresponding to the processed label includes text content, text title and text label level.

[0020] Furthermore, the network model includes n network detection models; the n network detection models correspond one-to-one to n levels of labels respectively; the network detection model is used to extract text features corresponding to the corresponding level labels and perform network training.

[0021] Furthermore, the output of the i-1th network detection model among the n network detection models is connected to the input of the i-th network detection model, and the output of the i-th network detection model is connected to the input of the i+1th network detection model; wherein, 1 <i<n。

[0022] Further, the loss function Loss of the network model is determined according to the following formula:

[0023]

[0024] Among them, Loss j is the loss function of the j-th network detection model; j is the weight value of the loss function of the j-th network detection model.

[0025] Furthermore, the loss function Loss of the j-th network detection model is updated according to the following method: j :

[0026] According to the back propagation of the network, the loss function Loss of the network model is updated to obtain the loss function Loss of the updated network model new ;

[0027] With loss function Loss new As the total function, and according to the loss function Loss j The weight ratio in the total function is used to calculate the new loss function Loss of the j-th network detection model. j-new .

[0028] A multi-label text classification system includes a label reduction unit and a label category inference unit;

[0029] The tag reduction unit is used to obtain text information of known tag categories, calculate the similarity between texts corresponding to each tag according to the set rules, and reclassify all tags at the next level of each level to obtain processed tags;

[0030] The label category inference unit is used to receive the text information corresponding to the label after the label reduction unit outputs the processed text information, and extract text features to train the network model to obtain a trained network model, input the text information to be tested of unknown label category into the trained network model, and output the label categories of each level of the text to be tested.

[0031] Further, the label reduction unit includes a label acquisition module, a text acquisition module, a text similarity calculation module and a label reclassification module;

[0032] The label acquisition module is used to obtain the label category corresponding to the text;

[0033] The text acquisition module is used to acquire text information of known tag categories;

[0034] The text similarity calculation module is used to calculate the similarity between the texts corresponding to each tag;

[0035] The label reclassification module is used to perform label reclassification processing on labels that meet the regulations to obtain processed labels.

[0036] Further, the label category inference unit includes a text receiving module, a network training module and a label category output module;

[0037] The text receiving module is used to receive the text information corresponding to the processed label and the text information to be tested of the unknown label category;

[0038] The network training module is used to extract feature information of the processed label corresponding text and perform network training to obtain a trained network model;

[0039] The label category output module is used to input the text information to be tested of unknown label category into the trained network model, and output the label categories of each level of the text to be tested.

[0040] The beneficial effects of the present invention are as follows: a multi-label text classification method and system disclosed by the present invention obtains text with more accurate multi-level label categories by reclassifying labels at all levels in text with known label categories, and inputs the text as training data into a network model for network training, thereby obtaining a trained network model with higher reliability, and outputs label categories at all levels of the text to be tested by inputting text to be tested with unknown label categories into the trained network model. The present invention can obtain a network model with better classification effect, realizes accurate classification of multi-label text, and the classification result is more reliable. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:

[0042] Figure 1 It is a schematic diagram of the method flow of the present invention. DETAILED DESCRIPTION

[0043] The present invention is further described below in conjunction with the accompanying drawings, as shown in the drawings:

[0044] The multi-label text classification method of the present invention comprises the following steps:

[0045] S1. Collecting text information of known tag categories; wherein the tag categories include tags of different levels;

[0046] S2. According to the label category of the text, determine the label set sequence of the text (L1, L2, ..., L i ,...,L n ), where L i is the i-th level label set, n is the number of label sets; by classifying labels of the same level together, we get the label set of the corresponding level, and then we get the label set sequence (L1, L2, ..., L i ,...,L n );

[0047] S3. reclassify all labels at the next level of each level of text labels to obtain processed labels;

[0048] S4. Inputting the processed text information corresponding to the label into the network model for network training to obtain a trained network model; wherein the network model adopts an existing neural network model;

[0049] S5. Input the text information to be tested of unknown label category into the trained network model, and output the label categories of each level of the text to be tested.

[0050] In this embodiment, all tags at the next level of tags at each level of text are reclassified, specifically including:

[0051] S21. From the label set L n-1 Get a label L n-1,k , and the label set L n-1 Remove label L n-1,k The remaining tags of Among them, the label L n-1,k The label set L n-1 The label k in

[0052] S22. Calculate label L n-1,k The texts corresponding to all n-level tags are respectively related to the tag set The similarity of each label corresponding to the text in the similarity set S is obtained n-1,k,n ; The similarity is text similarity, and the calculation of the text similarity adopts the existing technology, which will not be repeated here;

[0053] S23. Calculate label L n-1,k The corresponding texts are respectively associated with the label set The similarity of each label corresponding to the text in the similarity set S is obtained n-1,k ;

[0054] S24. Determine the similarity set S n-1,k,nIs the maximum similarity value in less than the similarity set S n-1,k If the minimum similarity is found, then label L n-1,k All n-level labels are changed to n-1-level labels; otherwise, no processing is done;

[0055] S25. Tag set All labels in the n-th level are analogized according to steps S21-S24 to achieve label reclassification of all n-th level labels under the n-1th level;

[0056] S26. By analogy with steps S21-S25, reclassify the labels of all the labels at the next level of each level.

[0057] For example, for a Chinese news text with multiple levels of labels, it has a first-level label and a second-level label, and the second-level label is a subdivision of the first-level label. All labels under each level of the Chinese news text are reclassified, including:

[0058] Traverse all the second-level tags under each first-level tag, and calculate the similarity between the text corresponding to each second-level tag and the corresponding text under other first-level tags (not the tags to which the second-level tag belongs); for example, if the existing first-level tags are A, B, and C, and there are three second-level tags A1, A2, and A3 under the first-level tag A, then calculate the similarity between A1, A2, and A3 and B respectively, and record it as S a1b , S a2b , S a3b ; Calculate the similarity between A1, A2, A3 and C respectively, and record it as S a1c , S a2c , S a3c , Similarly, the similarity of the secondary labels under labels B and C can be calculated;

[0059] By traversing each first-level tag, calculate the similarity between all texts of each first-level tag; for example, calculate the similarity between first-level tags A and B respectively, denoted as S ab , the similarity between A and C is denoted as S ac ;

[0060] If the similarity between a second-level tag and the text corresponding to other first-level tags except the first-level tag it is in is less than the similarity between the first-level tag where the second-level tag is located and the files corresponding to other first-level tags, then the second-level tag is changed to a first-level tag. If all second-level tags under the first-level tag where the second-level tag is located and other first-level tags need to be changed, then the change result of the second-level tag is saved, otherwise the fallback method is used to restore to the original tag level. For example: If the similarity between all the files corresponding to the first and second-level tags is S a1b , S a2b , S a3b , S a1c, S a2c , S a3c are all less than the similarity S between the texts corresponding to all first-level tags ab , S ac Then change the second-level tags A1, A2, and A3 to first-level tags. When all second-level tags have been traversed and calculated, the label reclassification operation ends.

[0061] Among them, the higher the similarity, the more similar the overall texts corresponding to these two tags are. And the more similar the texts are, the more difficult it is to classify. If the similarities between all second-level tags under a first-level tag and the texts corresponding to other first-level tags are less than the similarity between their所在的一级标签与其他一级标签对应文本的相似度,则说明这些单独的二级标签与其他一级标签更远,也就更容易分类,那么就把二级标签变为一级标签。通过上述标签的重新分类处理,使得标签类别更加准确、为后续的网络训练提供了可靠的训练用数据,进而使得训练好的网络模型能够输出更加精确的分类结果。

[0062] In this embodiment, the text information corresponding to the processed label includes the text content, text title, and text label level.

[0063] In this embodiment, the network model includes n network detection models; the n network detection models correspond to the n-level tags one by one; the network detection models are used to extract the text features corresponding to the tags of the corresponding levels and perform network training. Among them, the first network detection model corresponds to the first-level tag, the i-th network detection model corresponds to the i-th level tag, and the n-th network detection model corresponds to the n-th level tag; the network structures of the n network detection models can be the same or different; the network structure of the network detection model depends on the characteristics of the text to be extracted, and there will be different network combinations according to different types of texts, but the n network detection models all adopt existing neural network structures, which will not be elaborated here.

[0064] In this embodiment, the output of the (i - 1)-th network detection model among the n network detection models is connected to the input of the i-th network detection model, and the output of the i-th network detection model is connected to the input of the (i + 1)-th network detection model; where 1 < i < n. The (i - 1)-th network detection model extracts the text features corresponding to the (i - 1)-th level tag from the text information corresponding to the processed label, performs network training, and outputs the (i - 1)-th training result. The i-th network detection model extracts the text features corresponding to the i-th level tag from the (i - 1)-th training result, performs network training, and outputs the i-th training result, and so on, to complete the network training of the n network detection models, and use the output of the n-th network detection model as the output of the network model.

[0065] In this embodiment, the loss function Loss of the network model is determined according to the following formula:

[0066]

[0067] Among them, Loss j is the loss function of the j-th network detection model; j is the weight value of the jth network detection model loss function. The weight values ​​of the loss functions of the network detection models can be determined according to the actual working conditions, which will not be described in detail here.

[0068] In this embodiment, the loss function Loss of the j-th network detection model is updated according to the following method: j :

[0069] According to the back propagation of the network, the loss function Loss of the network model is updated to obtain the loss function Loss of the updated network model new ; During the training of the network model, if the error between the actual output result of the training and the predicted result exceeds the threshold, the loss function Loss of the network model is updated according to the back propagation of the network, so that the output of the network model is more accurate and reliable;

[0070] With loss function Loss new As the total function, and according to the loss function Loss j The weight ratio in the total function is used to calculate the new loss function Loss of the j-th network detection model. j-new .

[0071] A multi-label text classification system includes a label reduction unit and a label category inference unit;

[0072] The tag reduction unit is used to obtain text information of known tag categories, calculate the similarity between texts corresponding to each tag according to the set rules, and reclassify all tags at the next level of each level to obtain processed tags;

[0073] The label category inference unit is used to receive the text information corresponding to the label after the label reduction unit outputs the processed text information, and extract text features to train the network model to obtain a trained network model, input the text information to be tested of unknown label category into the trained network model, and output the label categories of each level of the text to be tested.

[0074] In this embodiment, the label reduction unit includes a label acquisition module, a text acquisition module, a text similarity calculation module and a label reclassification module;

[0075] The label acquisition module is used to obtain the label category corresponding to the text;

[0076] The text acquisition module is used to acquire text information of known tag categories;

[0077] The text similarity calculation module is used to calculate the similarity between the texts corresponding to each tag;

[0078] The label reclassification module is used to perform label reclassification processing on labels that meet the specification to obtain processed labels. Wherein, the label acquisition module and the text acquisition module both include a memory; the text similarity calculation module and the label reclassification module both include a processor.

[0079] In this embodiment, the label category inference unit includes a text receiving module, a network training module and a label category output module;

[0080] The text receiving module is used to receive the text information corresponding to the processed label and the text information to be tested of the unknown label category;

[0081] The network training module is used to extract feature information of the processed label corresponding text and perform network training to obtain a trained network model;

[0082] The label category output module is used to input the text information to be tested of unknown label category into the trained network model, and output the label categories of each level of the text to be tested. Among them, the text receiving module includes a memory; the network training module and the label category output module both include a processor. The memory and the processor both adopt the existing technology and will not be repeated here. It should be noted that each of the above modules can execute the operation instructions through a computer and software matching the computer to achieve the operation purpose.

[0083] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.

Claims

1. A multi-label text classification method, characterized by: The steps include: S1. Collect text information of known label categories; S2. According to the label category of the text, determine the label set sequence of the text (L1, L2, ..., L i ,...,L n ), where L i is the i-th level label set, n is the number of label sets; S3. reclassify all labels at the next level of each level of text labels to obtain processed labels; Reclassify all tags at the next level of the text tags, including: S31. From the label set L n-1 Get a label L n-1,k , and the label set L n-1 Remove label L n-1,k The remaining tags of Among them, the label L n-1,k The label set L n-1 The label k in S32. Calculate label L n-1,k The texts corresponding to all n-level tags are respectively related to the tag set The similarity of each label corresponding to the text in the similarity set S is obtained n-1,k,n ; S33. Calculate label L n-1,k The corresponding texts are respectively associated with the label set The similarity of each label corresponding to the text in the similarity set S is obtained n-1,k ; S34. Determine the similarity set S n-1,k,n Is the maximum similarity value in less than the similarity set S n-1,k If the minimum similarity is found, then label L n-1,k All n-level labels are changed to n-1-level labels; otherwise, no processing is done; S35. Tag set All labels in are analogized according to steps S31-S34 respectively, so as to achieve label reclassification of all n-level labels under the n-1-th level; S36. By analogy with steps S31-S35, the labels of all labels at the next level are reclassified; S4. Input the processed text information corresponding to the label into the network model for network training to obtain a trained network model; S5. Input the text information to be tested of unknown label category into the trained network model, and output the label categories of each level of the text to be tested.

2. The multi-label text classification method according to claim 1, characterized in that: The text information corresponding to the processed label includes text content, text title and text label level.

3. The multi-label text classification method according to claim 1, characterized in that: The network model includes n network detection models; the n network detection models correspond to n levels of labels respectively; the network detection models are used to extract text features corresponding to the corresponding level labels and perform network training.

4. The multi-label text classification method according to claim 3, characterized in that: The output of the i-1th network detection model among the n network detection models is connected to the input of the i-th network detection model, and the output of the i-th network detection model is connected to the input of the i+1th network detection model; wherein 1<i<n.

5. The multi-label text classification method according to claim 3, characterized in that: The loss function Loss of the network model is determined according to the following formula: Among them, Loss j is the loss function of the j-th network detection model; j is the weight value of the loss function of the j-th network detection model.

6. The multi-label text classification method according to claim 5, characterized in that: Update the loss function Loss of the j-th network detection model according to the following method j : According to the back propagation of the network, the loss function Loss of the network model is updated to obtain the loss function Loss of the updated network model new ; With loss function Loss new As the total function, and according to the loss function Loss j The weight ratio in the total function is used to calculate the new loss function Loss of the j-th network detection model. j-new .

7. A multi-label text classification system, characterized by: It includes a label specification unit and a label category inference unit; The tag reduction unit is used to obtain text information of known tag categories, calculate the similarity between texts corresponding to each tag according to the set rules, and reclassify all tags at the next level of each level to obtain processed tags; The label category inference unit is used to receive the text information corresponding to the label after the label reduction unit outputs the processed label, and extract the text features to train the network model to obtain a trained network model, input the text information to be tested of unknown label category into the trained network model, and output the label categories of each level of the text to be tested; The label reduction unit includes a label acquisition module, a text acquisition module, a text similarity calculation module and a label reclassification module; The label acquisition module is used to obtain the label category corresponding to the text; The text acquisition module is used to acquire text information of known tag categories; The text similarity calculation module is used to calculate the similarity between the texts corresponding to each tag; The label reclassification module is used to perform label reclassification processing on labels that meet the specification to obtain processed labels; The label category inference unit includes a text receiving module, a network training module and a label category output module; The text receiving module is used to receive the text information corresponding to the processed label and the text information to be tested of the unknown label category; The network training module is used to extract feature information of the processed label corresponding text and perform network training to obtain a trained network model; The label category output module is used to input the text information to be tested of unknown label category into the trained network model, and output the label categories of each level of the text to be tested.

Citation Information

Patent Citations

  • Multi-level classification model training method and device and multi-level classification method and device

    CN111177385A

  • Multi-label text classification and model training method and device, apparatus and storage medium

    CN113076426A