Data augmentation method and device, and training method of target text classification model

By configuring data augmentation types based on the label differences of different initial training data, the text and label vectors are augmented, solving the problem of insufficient training data for text classification models and achieving high-quality data expansion and improved model generalization ability.

CN116226383BActive Publication Date: 2026-04-14MASHANG CONSUMER FINANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-06
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In the field of natural language processing, text classification models suffer from poor generalization ability due to insufficient training data, and existing data augmentation methods are prone to introducing noise that affects the model's prediction performance.

Method used

By configuring different data augmentation types for different label differences in initial training data and adopting corresponding data processing methods, text vectors and label vectors are augmented to avoid noise injection and ensure semantic consistency.

Benefits of technology

It improves the flexibility and quality of data augmentation, expands the amount of training data, increases diversity, and enhances the generalization ability and prediction performance of text classification models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116226383B_ABST
    Figure CN116226383B_ABST
Patent Text Reader

Abstract

The present disclosure provides a data enhancement method and device, and a training method of a target text classification model. The data enhancement method comprises: for each two pieces of initial training data in an initial training data set, obtaining a text vector corresponding to a training text and a label vector corresponding to a real category label in each piece of initial training data; determining a data enhancement type corresponding to the two pieces of initial training data according to the real category labels respectively corresponding to the two pieces of initial training data and the predicted category labels respectively corresponding to the two pieces of initial training data obtained in advance, different data enhancement types corresponding to different data enhancement manners; performing data enhancement processing on the text vectors respectively corresponding to the two pieces of initial training data based on the data enhancement type to obtain enhanced text vectors; and determining enhanced label vectors corresponding to the enhanced text vectors according to the label vectors respectively corresponding to the two pieces of initial training data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data augmentation technology, and in particular to a data augmentation method and apparatus, a training method for a target text classification model, an electronic device, and a computer-readable storage medium. Background Technology

[0002] Text classification is the process of categorizing text according to certain rules. These rules can be defined by humans or automatically derived from labeled data using algorithms. In daily life and work, many tasks can be transformed into classification problems. The same is true in the field of natural language processing; numerous tasks can be solved using text classification, such as spam detection, inappropriate text detection, intent recognition, text matching, and named entity recognition. Text classification is widely used in important information processing systems such as search engines, question-answering systems, and conversational systems; it is virtually ubiquitous.

[0003] The challenge of text classification lies in the limited amount of text data in some domains, leading to poor model generalization ability. Furthermore, the low level of automated annotation necessitates manual annotation or review by domain experts, consuming significant human and material resources. Current industry and academia address these challenges through methods such as: manually constructing, selecting, and annotating samples, which yields good results but requires substantial human and material resources and domain specialists; and data augmentation (DA), a simple and easy-to-operate method that addresses the resource constraints, but improper use can introduce noise that negatively impacts the model's predictive performance.

[0004] Data augmentation methods alleviate the problem of insufficient training data in deep learning. They were first widely used in the image domain and then extended to the field of Natural Language Processing (NLP), achieving excellent results on many tasks. A major direction is to increase the diversity of training data, thereby improving the model's generalization ability. In NLP, data augmentation methods include text representation (vector) augmentation and original text augmentation. Summary of the Invention

[0005] This disclosure provides a data augmentation method and apparatus, a training method for a target text classification model, an electronic device, and a computer-readable storage medium.

[0006] In a first aspect, this disclosure provides a data augmentation method for augmenting every two initial training data pairs in an initial training dataset used for text classification training. The initial training data includes training text and corresponding ground truth class labels. The data augmentation method includes:

[0007] For each pair of initial training data in the initial training dataset, obtain the text vector corresponding to the training text and the label vector corresponding to the real category label in each of the two initial training data.

[0008] Based on the true class labels corresponding to the two initial training data and the predicted class labels corresponding to the two initial training data obtained in advance, the data augmentation type corresponding to the two initial training data is determined, and different data augmentation types correspond to different data augmentation methods.

[0009] Based on the data augmentation type, data augmentation processing is performed on the text vectors corresponding to the two initial training data sets to obtain augmented text vectors; and

[0010] Based on the label vectors corresponding to the two initial training data, the augmented label vector corresponding to the augmented text vector is determined.

[0011] Secondly, this disclosure provides a training method for a target text classification model, the training method comprising:

[0012] The data augmentation method provided in the first aspect above is used to perform data augmentation processing on the initial training data in the initial training dataset to obtain augmented training data, wherein the augmented training data includes the augmented text vector and the augmented label vector corresponding to the augmented text vector.

[0013] The initial training data and the corresponding augmented training data are input into the target text classification model for model training to obtain the trained target text classification model.

[0014] Thirdly, this disclosure provides a data augmentation apparatus for augmenting every two initial training data pairs in an initial training dataset used for text classification training. The initial training data includes training text and corresponding ground truth class labels. The data augmentation apparatus includes:

[0015] The acquisition unit is configured to acquire, for each pair of initial training data in the initial training dataset, the text vector corresponding to the training text and the label vector corresponding to the real category label in each of the two initial training data;

[0016] The determining unit is configured to determine the data augmentation type corresponding to the two initial training data based on the real class labels corresponding to the two initial training data respectively and the predicted class labels corresponding to the two initial training data respectively obtained in advance, and different data augmentation types correspond to different data augmentation methods;

[0017] The data augmentation unit is configured to perform data augmentation processing on the text vectors corresponding to the two initial training data respectively, based on the data augmentation type, to obtain augmented text vectors; and to determine the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data respectively.

[0018] Fourthly, this disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the data augmentation method or training method described above.

[0019] Fifthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described data augmentation method or training method.

[0020] According to the data augmentation method and apparatus, training method for target text classification model, electronic device, and computer-readable storage medium provided in this disclosure, the data augmentation method is applied to text classification training scenarios, especially suitable for binary text classification training scenarios. This data augmentation method configures different data augmentation types for different label differences in different initial training data, and different data augmentation types can be configured with different data augmentation methods. For each pair of initial training data, the corresponding data augmentation type and data processing method are used for data augmentation processing, thereby effectively improving the flexibility and quality of data augmentation. During data augmentation processing, based on each pair of initial training data... The text vectors and corresponding label vectors are used to obtain new text vectors and corresponding new label vectors, thereby achieving data augmentation for each pair of initial training data. This expands the amount of training data used for text classification training and increases the diversity of training data, which in turn helps improve the generalization ability of the text classification model. Furthermore, the data augmentation in this embodiment is based on text vector augmentation for each pair of initial training data and label vector augmentation for any two initial training data, without the need for noise injection. This helps avoid data pollution and prevents changes in the semantics of the text representation, thereby ensuring the prediction effect of text classification training and the generalization effect of the text classification model.

[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0022] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed description of exemplary embodiments with reference to the accompanying drawings, in which:

[0023] Figure 1 A flowchart illustrating a data augmentation method provided in an embodiment of this disclosure;

[0024] Figure 2 A flowchart illustrating a training method for a target text classification model provided in this embodiment of the disclosure;

[0025] Figure 3 A schematic diagram of the training architecture for a training method of a target text classification model provided in this embodiment of the disclosure;

[0026] Figure 4 A block diagram of a data enhancement device provided in an embodiment of this disclosure;

[0027] Figure 5 A block diagram of a training apparatus for a target text classification model provided in an embodiment of this disclosure;

[0028] Figure 6 This is a block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0029] To enable those skilled in the art to better understand the technical solutions of this disclosure, exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments of this disclosure to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0030] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.

[0031] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.

[0032] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Words such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.

[0033] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.

[0034] In the field of Natural Language Processing (NLP), data augmentation primarily involves text representation augmentation and raw text augmentation. Text representation augmentation injects noise into the text representation using various methods to increase the data volume. Raw text augmentation, on the other hand, modifies the original text before text representation by methods such as synonym replacement, random insertion, and random deletion to increase data volume and improve the model's generalization ability. Common text representation augmentation techniques include: using pre-trained word vectors to find synonyms (e.g., GloVe, Word2Vec) and then replacing the original word vectors or randomly inserting them into the text word vectors; and using both word vectors and semantic frame vectors. However, text representation augmentation techniques are prone to introducing noise, causing data pollution and affecting the model's prediction performance. Furthermore, semantics are difficult to control and easily altered, impacting the model's generalization ability.

[0035] To effectively address the technical problems existing in the aforementioned related technologies, this disclosure provides a data augmentation method. This data augmentation method is applied to text classification training scenarios, particularly suitable for binary text classification training scenarios. This data augmentation method configures different data augmentation types based on the different label differences of different initial training data, and different data augmentation types can be configured with different data augmentation methods. For each pair of initial training data, the corresponding data augmentation type and data processing method are used for data augmentation processing, thereby effectively improving the flexibility and quality of data augmentation. During data augmentation processing, based on the text vectors and corresponding label vectors of each pair of initial training data, new text vectors and corresponding new label vectors are obtained, realizing data augmentation for each pair of initial training data. This expands the amount of training data used for text classification training and increases the diversity of training data, thereby improving the generalization ability of the text classification model. Furthermore, the data augmentation in this disclosure is based on text vector augmentation of each pair of initial training data and label vector augmentation based on any two initial training data, without the need for noise injection. This helps avoid data pollution and prevents changes in the semantics of the text representation, thereby ensuring the prediction effect of text classification training and the generalization effect of the text classification model.

[0036] The data augmentation method or the training method of the target text classification model according to the embodiments of this disclosure can be executed by an electronic device. This electronic device can be a terminal device, such as an in-vehicle device, user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. The electronic device can also be a server, which can be a standalone physical server, a server cluster, or a cloud server capable of cloud computing. Specifically, the data augmentation method or the training method of the target text classification model can be implemented by a processor in the electronic device calling computer-readable program instructions stored in memory.

[0037] Figure 1 This is a flowchart illustrating a data augmentation method provided in an embodiment of the present disclosure, with reference to... Figure 1 This data augmentation method is used to augment every two initial training data pairs in the initial training dataset used for text classification training. The initial training data includes training text and the corresponding ground truth class labels. The data augmentation method includes:

[0038] Step S11: For each pair of initial training data in the initial training dataset, obtain the text vector corresponding to the training text and the label vector corresponding to the true category label in each pair of initial training data.

[0039] The training texts are used for text classification training. The ground truth class labels corresponding to the training texts are the text categories corresponding to the training texts. Text categories can be divided according to the content or semantics of the text. Each training text corresponds to a ground truth class label, which can be obtained through manual annotation. Each training text and its corresponding ground truth class label constitute an initial training dataset. The specific implementation and acquisition method of the training texts can be determined according to the actual application scenario, and this embodiment does not impose any special restrictions on them.

[0040] For example, in a customer service agent quality inspection scenario, it is necessary to determine whether the customer service agent has verified the customer's identity. The text of the call between the customer service agent and the customer is input into a classification model, and the model outputs "yes" or "no". Therefore, there are two text categories in this scenario. When labeling the text, the category label for text that has verified the identity is "yes", and the category label for text that has not verified the identity is "no". In this scenario, the initial training dataset can be obtained by obtaining historical call content text as training text and manually labeling the training text with the true category labels.

[0041] For each of the two initial training data sets, the training text and the ground truth class label in that initial training data set are vectorized to obtain the text vector corresponding to the training text and the label vector corresponding to the ground truth class label. For example, the two initial training data sets include initial training data 1 and initial training data 2. Initial training data 1 includes training text 1 and the corresponding ground truth class label 1, and initial training data 2 includes training text 2 and the corresponding ground truth class label 2. Vectorizing training text 1 and the corresponding ground truth class label 1 yields the text vector w1 of training text 1 and the label vector y1 of the ground truth class label 1 corresponding to training text 1. Similarly, vectorizing training text 2 and the corresponding ground truth class label 2 yields the text vector w and the label vector Y2 of training text 2.

[0042] In this embodiment, no special restrictions are placed on the vectorization method of text and labels. For example, vectorization processing tools such as TF-IDF, Word2vec, Glove, and one-hot can be used to vectorize the training text and the real category labels respectively. TF-IDF (term frequency–inverse document frequency) is a commonly used weighting technique for information retrieval and data mining. TF is Term Frequency and IDF is Inverse Document Frequency. Word2vec is a related model used to generate word vectors. Glove (Global Vectors for Word Representation) is a word representation tool based on global term frequency statistics. One-hot refers to one-hot encoding.

[0043] Step S12: Determine the data augmentation type corresponding to the two initial training data based on the true class labels corresponding to the two initial training data and the predicted class labels corresponding to the two initial training data obtained in advance.

[0044] In this embodiment, the predicted category label is the text category corresponding to the training text in the initial training data that is predicted in advance using the basic text classification model. In this embodiment, the data augmentation type that needs to be performed on the two initial training data can be determined based on the difference between the real category labels corresponding to the two initial training data and the difference between the real category label and the predicted category label corresponding to each initial training data. Different data augmentation types correspond to different data augmentation methods.

[0045] In some embodiments, a correspondence between the difference between the true class labels and the predicted class labels corresponding to any two initial training data and the data augmentation type can be established in advance. In step S13, the data augmentation type corresponding to any two initial training data can be obtained through this correspondence.

[0046] For example, the initial training dataset is used for text binary classification training. The training texts in the initial training dataset can be divided into two text categories, namely A and B. The true category label of each training text can be A or B, and the predicted category label can also be A or B. Table 1 below shows the correspondence between the differences between the true category labels and the predicted category labels of the training texts in any two initial training datasets and the data augmentation type.

[0047] Table 1

[0048]

[0049] If the true class labels corresponding to the training texts of the two initial training data sets are the same, and the true class label and the predicted class label corresponding to the training text of each of the two initial training data sets are the same, then the data augmentation type corresponding to the two initial training data sets is determined to be the first data augmentation type. For example, as shown in Table 1, the true class labels corresponding to training text 1 and training text 2 of the two initial training data sets are both A, and the true class label and the predicted class label corresponding to training text 1 are both A, and the true class label and the predicted class label corresponding to training text 2 are both A. Therefore, the data augmentation type corresponding to the two initial training data sets is the first data augmentation type 1.

[0050] If the true class labels of the two initial training data sets are different, and the true class label and the predicted class label of each initial training data set are the same, then the data augmentation type corresponding to the two initial training data sets is determined to be the second data augmentation type. For example, as shown in Table 1, the true class label and the predicted class label of training text 1 are both A, and the true class label and the predicted class label of training text 2 are both B. Therefore, the data augmentation type corresponding to the two initial training data sets is the second data augmentation type 2.

[0051] If the true class labels of the two initial training data sets are the same, and one initial training data set has the same true class label and predicted class label, while the other initial training data set has different true class labels and predicted class labels, then the data augmentation type corresponding to these two initial training data sets is determined to be the third data augmentation type. For example, as shown in Table 1, the true class labels of training text 1 and training text 2 of these two initial training data sets are both A, and the true class label and predicted class label of training text 1 are both A, while the true class label of training text 2 is A, and the predicted class label of training text 2 is B. Therefore, the data augmentation type corresponding to these two initial training data sets is the third data augmentation type 3.

[0052] If the true class labels of the two initial training data sets are different, and one initial training data set has the same true class label and predicted class label, while the other initial training data set has a different true class label and predicted class label, then the data augmentation type corresponding to these two initial training data sets is determined to be the fourth data augmentation type. For example, as shown in Table 1, the true class label of training text 1 and training text 2 of these two initial training data sets is A, and the true class label and predicted class label of training text 1 are both A, while the true class label of training text 2 is B, and the predicted class label of training text 2 is A. Therefore, the data augmentation type corresponding to these two initial training data sets is the fourth data augmentation type 4.

[0053] If the true class labels of the two initial training data sets are the same, and the true class label and the predicted class label of each initial training data set are different, then the data augmentation type corresponding to the two initial training data sets is determined to be the fifth data augmentation type. For example, as shown in Table 1, the true class label of training text 1 and training text 2 of the two initial training data sets is A, and the predicted class label of training text 1 and the predicted class label of training text 2 are both B. Therefore, the data augmentation type corresponding to the two initial training data sets is the fifth data augmentation type 5.

[0054] If the true class labels of the two initial training data sets are different, and the true class label and the predicted class label of each initial training data set are different, then the data augmentation type corresponding to the two initial training data sets is determined to be the sixth data augmentation type. For example, as shown in Table 1, the true class label of training text 1 is A, and the predicted class label of training text 1 is B. The true class label of training text 2 is B, and the predicted class label of training text 2 is A. Therefore, the data augmentation type corresponding to the two initial training data sets is the sixth data augmentation type 6.

[0055] Step S13: Based on the data augmentation type, perform data augmentation processing on the text vectors corresponding to the two initial training data to obtain augmented text vectors.

[0056] Step S14: Based on the label vectors corresponding to the two initial training data, determine the augmented label vector corresponding to the augmented text vector.

[0057] In this embodiment of the disclosure, different data augmentation types are configured for different label differences in different initial training data, and different data augmentation types can be configured with different data augmentation methods. For different initial training data, the initial training data is augmented based on the data augmentation type that actually corresponds to the initial training data, which can effectively improve the flexibility and quality of data augmentation, and at the same time help to improve the semantic consistency between the augmented data and the initial training data while effectively expanding the amount of training data.

[0058] In steps S13 and S14, based on the data augmentation type corresponding to the two initial training data, the corresponding data augmentation method can be determined, and the text vectors corresponding to the two initial training data can be augmented using the data augmentation method to obtain augmented text vectors. The corresponding augmented label vectors are determined based on the label vectors corresponding to the two initial training data. The augmented text vectors and the corresponding augmented label vectors constitute the augmented training data.

[0059] According to the technical solution of the data augmentation method provided in this disclosure, the data augmentation method is applied to text classification training scenarios, especially suitable for text binary classification training scenarios. This data augmentation method configures different data augmentation types for different label differences in different initial training data, and different data augmentation types can be configured with different data augmentation methods. For each pair of initial training data, the corresponding data augmentation type and data processing method are used for data augmentation processing, thereby effectively improving the flexibility and quality of data augmentation. During data augmentation processing, based on the text vectors and corresponding label vectors of each pair of initial training data, new text vectors and corresponding new label vectors are obtained, realizing data augmentation for each pair of initial training data. This expands the amount of training data used for text classification training and increases the diversity of training data, thereby improving the generalization ability of the text classification model. Furthermore, the data augmentation in this disclosure is based on text vector augmentation of each pair of initial training data and label vector augmentation based on any two initial training data, without the need for noise injection. This helps avoid data pollution and prevents changes in the semantics of the text representation, thereby ensuring the prediction effect of text classification training and the generalization effect of the text classification model.

[0060] In some embodiments, data augmentation is performed through data fusion. In step S13, data augmentation processing is performed on the text vectors corresponding to the two initial training data to obtain augmented text vectors. This may further include: performing data fusion processing on the text vectors corresponding to the two initial training data to obtain augmented text vectors.

[0061] The data fusion methods include, but are not limited to, weighted summation and weighted average. The appropriate method can be selected for data augmentation based on the type of data augmentation.

[0062] In some embodiments, in step S14, determining the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data sets may further include: using the label vector corresponding to any one of the two initial training data sets as the augmented label vector; or, performing a weighted summation on the label vectors corresponding to the two initial training data sets to obtain the augmented label vector corresponding to the augmented text vector. Specifically, the appropriate method for determining the label vector of the augmented data can be selected according to the data augmentation type.

[0063] In some embodiments, when the data augmentation type corresponding to the two initial training data is a preset first data augmentation type, the step of performing data fusion processing on the text vectors corresponding to the two initial training data to obtain an augmented text vector may further include: performing a weighted average processing on the text vectors corresponding to the two initial training data to obtain an augmented text vector. When the data augmentation type corresponding to the two initial training data is a preset first data augmentation type, the step of determining the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data, i.e., step S14, may further include: using the text vector corresponding to any one of the two initial training data as the augmented text vector.

[0064] Specifically, when the data augmentation type corresponding to the two initial training data is the preset first data augmentation type, the weights corresponding to the two initial training data are configured as the sum of the confidence scores of the predicted category labels corresponding to the two initial training data.

[0065] In this embodiment of the disclosure, the confidence level of the predicted category label refers to the probability that the basic text classification model outputs the predicted category label for the input training text. For example, for a training text, the probability that the basic text classification model outputs its corresponding predicted category label as category label A is 0.8, and the probability that its corresponding predicted category label is category label B is 0.2. Then the predicted category label of the training text is determined to be A, and the confidence level is 0.8.

[0066] In some embodiments, the predicted class label and corresponding confidence level of each training text in the initial training dataset can be obtained in advance through a basic text classification model.

[0067] Table 2 below exemplifies the true class label, predicted class label, and confidence level of the predicted class label for each training text in the initial training dataset. For example, as shown in Table 2, the true class label for training text 1 is A, the predicted class label is A, and the confidence level of the predicted class label A is γ1 = 0.9.

[0068] Table 2

[0069]

[0070]

[0071] For example, taking training text 1 in initial training data 1 and training text 2 in initial training data 2 as examples, assuming the text vector corresponding to training text 1 is w1 and the label vector corresponding to training text 1 is y1, the text vector corresponding to training text 2 is w2 and the label vector corresponding to training text 2 is y2, when it is determined that the data augmentation type corresponding to initial training data 1 and initial training data 2 is the first data augmentation type 1, then the label vector y1 corresponding to training text 1 or the label vector y2 corresponding to training text 2 is used as the augmented label vector y3, that is, y3 =y2 or y3 = y1, and perform weighted averaging on the text vectors w1 and w2 corresponding to training text 1 and training text 2 respectively to obtain the enhanced text vector w3, that is, (L1*w1+L2*w2) / 2=w3, where L1 is the weight corresponding to initial training data 1 in the two initial training data, L2 is the weight corresponding to initial training data 2 in the two initial training data, L1=L2=γ1+γ2, where γ1 is the confidence of the predicted category label corresponding to training text 1, and γ2 is the confidence of the predicted category label corresponding to training text 2.

[0072] In some embodiments, when the data augmentation type corresponding to the two initial training data sets is a preset second data augmentation type, the step of performing data fusion processing on the text vectors corresponding to the two initial training data sets to obtain augmented text vectors may further include: performing weighted summation processing on the text vectors corresponding to the two initial training data sets to obtain augmented text vectors. When the data augmentation type corresponding to the two initial training data sets is a preset second data augmentation type, the step of determining the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data sets, i.e., step S14, may further include: performing weighted summation processing on the label vectors corresponding to the two initial training data sets to obtain augmented label vectors corresponding to the augmented text vector.

[0073] Specifically, when the data augmentation type corresponding to the two initial training data is the preset second data augmentation type, if γa is greater than or equal to γb, where γa represents the confidence level of the predicted class label corresponding to one of the two initial training data and γb represents the confidence level of the predicted class label corresponding to the other initial training data, then the weight corresponding to the one initial training data is configured as γa, and the weight corresponding to the other initial training data is configured as 1-γb; when the data augmentation type corresponding to the two initial training data is the preset second data augmentation type, if γa is less than γb, then the weight corresponding to the one initial training data is configured as 1-γa, and the weight corresponding to the other initial training data is configured as γb.

[0074] For example, taking training text 1 in initial training data 1 and training text 2 in initial training data 2 as examples, assuming that the text vector corresponding to training text 1 is w1 and the label vector corresponding to training text 1 is y1, the text vector corresponding to training text 2 is w2 and the label vector corresponding to training text 2 is y2, when it is determined that the data augmentation type corresponding to initial training data 1 and initial training data 2 is the second data augmentation type 2, then the label vector y1 corresponding to training text 1 and the label vector y2 corresponding to training text 2 are weighted and summed to obtain the augmented label vector y3, that is, L1*y1+L2*y2=y3, where L1 is the weight corresponding to initial training data 1 in the two initial training data and L2 is the weight corresponding to initial training data 2 in the two initial training data.

[0075] The text vectors w1 and w2 corresponding to training text 1 and training text 2 are weighted and summed to obtain the enhanced text vector w3, i.e., L1*w1+L2*w2=w3.

[0076] Wherein, when γ1 is greater than or equal to γ2, L1 = γ1, L2 = 1 - γ2; when γ1 is less than γ2, L1 = 1 - γ1, L2 = γ2; γ1 is the confidence score of the predicted category label corresponding to training text 1, and γ2 is the confidence score of the predicted category label corresponding to training text 2.

[0077] When the data augmentation type corresponding to initial training data 1 and initial training data 2 is the second data augmentation type, it means that the prediction result of the basic text classification model for each of the two initial training data is the same as the labeled true class label, and the true class labels corresponding to the two initial training data are the same. In this case, when the confidence γ1 of the predicted class label of training text 1 is greater than the confidence γ2 of the predicted class label of training text 2, the confidence of the predicted class label of training text 1 is higher, indicating that the basic text classification model's prediction effect on training text 1 is better than that on training text 2. Therefore, the initial training data 1 should be configured more... The initial training data 1 and initial training data 2 are assigned higher weights, while the initial training data 2 is assigned lower weights, in order to perform the second type of data augmentation on the initial training data 1 and initial training data 2. When the confidence γ1 of the predicted class label of training text 1 is less than the confidence γ2 of the predicted class label of training text 2, the confidence of the predicted class label of training text 1 is even lower, indicating that the basic text classification model is worse at predicting training text 1 than training text 2. Therefore, the initial training data 1 is assigned lower weights, while the initial training data 2 is assigned higher weights, in order to perform the second type of data augmentation on the initial training data 1 and initial training data 2.

[0078] In some embodiments, when the data augmentation type corresponding to the two initial training data is a preset third data augmentation type, the step of performing data fusion processing on the text vectors corresponding to the two initial training data to obtain an augmented text vector may further include: performing a weighted summation processing on the text vectors corresponding to the two initial training data to obtain an augmented text vector. When the data augmentation type corresponding to the two initial training data is a preset third data augmentation type, the step of determining the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data, i.e., step S14, may further include: using the label vector corresponding to any one of the two initial training data as the augmented label vector.

[0079] In the case where the data augmentation type corresponding to the two initial training data is the preset third data augmentation type, the weight corresponding to one of the two initial training data is configured as 1-γa, and the weight corresponding to the other initial training data is configured as γb. γa represents the confidence level of the predicted class label corresponding to the one initial training data, and γb represents the confidence level of the predicted class label corresponding to the other initial training data.

[0080] For example, taking training text 1 in initial training data 1 and training text 2 in initial training data 2 as examples, assuming the text vector corresponding to training text 1 is w1 and the label vector corresponding to training text 1 is y1, the text vector corresponding to training text 2 is w2 and the label vector corresponding to training text 2 is y2, when it is determined that the data augmentation type corresponding to initial training data 1 and initial training data 2 is the third data augmentation type 3, then the label vector y1 corresponding to training text 1 or the label vector y2 corresponding to training text 2 will be used as the augmented label vector y3, that is, y 3 = y2 or y3 = y1, and perform weighted summation on the text vectors w1 and w2 corresponding to training text 1 and training text 2 respectively to obtain the enhanced text vector w3, that is, L1*w1+L2*w2=w3, where L1 is the weight corresponding to initial training data 1 in the two initial training data, L2 is the weight corresponding to initial training data 2 in the two initial training data, L1 = 1-γ1, L2 = γ2, where γ1 is the confidence of the predicted category label corresponding to training text 1, and γ2 is the confidence of the predicted category label corresponding to training text 2.

[0081] In some embodiments, when the data augmentation type corresponding to the two initial training data sets is a preset fourth data augmentation type, the step of performing data fusion processing on the text vectors corresponding to the two initial training data sets to obtain augmented text vectors may further include: performing weighted summation processing on the text vectors corresponding to the two initial training data sets to obtain augmented text vectors. When the data augmentation type corresponding to the two initial training data sets is a preset fourth data augmentation type, the step of determining the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data sets, i.e., step S14, may further include: performing weighted summation processing on the label vectors corresponding to the two initial training data sets to obtain augmented label vectors corresponding to the augmented text vector.

[0082] In the case where the data augmentation type corresponding to the two initial training data is the preset fourth data augmentation type, the weight corresponding to one of the two initial training data is configured as 1-γa, and the weight corresponding to the other initial training data is configured as γb. γa represents the confidence level of the predicted class label corresponding to the one initial training data, and γb represents the confidence level of the predicted class label corresponding to the other initial training data.

[0083] For example, taking training text 1 in initial training data 1 and training text 2 in initial training data 2 as examples, assuming the text vector corresponding to training text 1 is w1 and the label vector corresponding to training text 1 is y1, the text vector corresponding to training text 2 is w2 and the label vector corresponding to training text 2 is y2, when it is determined that the data augmentation type corresponding to initial training data 1 and initial training data 2 is the fourth data augmentation type 4, then the label vector y1 corresponding to training text 1 and the label vector y2 corresponding to training text 2 are weighted and summed to obtain the augmented label vector y3. That is, L1*y1+L2*y2=y3, and the text vectors w1 and w2 corresponding to training text 1 and training text 2 respectively are weighted and summed to obtain the enhanced text vector w3, that is, L1*w1+L2*w2=w3, where L1 is the weight corresponding to the initial training data 1 in the two initial training data, L2 is the weight corresponding to the initial training data 2 in the two initial training data, L1=1-γ1, L2=γ2, γ1 is the confidence of the predicted category label corresponding to training text 1, and γ2 is the confidence of the predicted category label corresponding to training text 2.

[0084] In some embodiments, when the data augmentation type corresponding to the two initial training data is a preset fifth data augmentation type, the step of performing data fusion processing on the text vectors corresponding to the two initial training data to obtain an augmented text vector may further include: performing a weighted summation processing on the text vectors corresponding to the two initial training data to obtain an augmented text vector. When the data augmentation type corresponding to the two initial training data is the fifth data augmentation type, the step of determining the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data, i.e., step S14, may further include: using the label vector corresponding to any one of the two initial training data as the augmented text vector.

[0085] In the case where the data augmentation type corresponding to the two initial training data is the fifth data augmentation type, the weight corresponding to one of the two initial training data is configured as γa, and the weight corresponding to the other initial training data is configured as γb. γa represents the confidence level of the predicted class label corresponding to the one initial training data, and γb represents the confidence level of the predicted class label corresponding to the other initial training data.

[0086] For example, taking training text 1 in initial training data 1 and training text 2 in initial training data 2 as examples, assuming the text vector corresponding to training text 1 is w1 and the label vector corresponding to training text 1 is y1, the text vector corresponding to training text 2 is w2 and the label vector corresponding to training text 2 is y2, when it is determined that the data augmentation type corresponding to initial training data 1 and initial training data 2 is the fifth data augmentation type 5, then the label vector y1 corresponding to training text 1 or the label vector y2 corresponding to training text 2 will be used as the augmented label vector y3, that is... y3 = y2 or y3 = y1, and perform weighted summation on the text vectors w1 and w2 corresponding to training text 1 and training text 2 respectively to obtain the enhanced text vector w3, that is, L1*w1+L2*w2=w3, where L1 is the weight corresponding to initial training data 1 in the two initial training data, L2 is the weight corresponding to initial training data 2 in the two initial training data, L1 = γ1, L2 = γ2, where γ1 is the confidence of the predicted category label corresponding to training text 1, and γ2 is the confidence of the predicted category label corresponding to training text 2.

[0087] In some embodiments, when the data augmentation type corresponding to the two initial training data sets is a preset sixth data augmentation type, the step of performing data fusion processing on the text vectors corresponding to the two initial training data sets to obtain augmented text vectors may further include: performing weighted summation processing on the text vectors corresponding to the two initial training data sets to obtain augmented text vectors. When the data augmentation type corresponding to the two initial training data sets is a preset sixth data augmentation type, the step of determining the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data sets, i.e., step S14, may further include: performing weighted summation processing on the label vectors corresponding to the two initial training data sets to obtain augmented label vectors corresponding to the augmented text vector.

[0088] Specifically, when the data augmentation type corresponding to the two initial training data is the preset sixth data augmentation type, if γa is greater than or equal to γb, where γa represents the confidence level of the predicted class label corresponding to one of the two initial training data and γb represents the confidence level of the predicted class label corresponding to the other initial training data, then the weight corresponding to the one initial training data is configured as (1-γa) / 2, and the weight corresponding to the other initial training data is configured as γb; when the data augmentation type corresponding to the two initial training data is the preset sixth data augmentation type, if γa is less than γb, then the weight corresponding to the one initial training data is configured as γa, and the weight corresponding to the other initial training data is configured as (1-γb) / 2.

[0089] For example, taking training text 1 in initial training data 1 and training text 2 in initial training data 2 as examples, assuming that the text vector corresponding to training text 1 is w1 and the label vector corresponding to training text 1 is y1, the text vector corresponding to training text 2 is w2 and the label vector corresponding to training text 2 is y2, when it is determined that the data augmentation type corresponding to initial training data 1 and initial training data 2 is the sixth data augmentation type 6, then the label vector y1 corresponding to training text 1 and the label vector y2 corresponding to training text 2 are weighted and summed to obtain the augmented label vector y3, that is, L1*y1+L2*y2=y3, where L1 is the weight corresponding to initial training data 1 in the two initial training data and L2 is the weight corresponding to initial training data 2 in the two initial training data.

[0090] The text vectors w1 and w2 corresponding to training text 1 and training text 2 are weighted and summed to obtain the enhanced text vector w3, i.e., L1*w1+L2*w2=w3.

[0091] Wherein, when γ1 is greater than or equal to γ2, L1 = (1-γ1) / 2, L2 = γ2; when γ1 is less than γ2, L1 = γ1, L2 = (1-γ2) / 2; γ1 is the confidence score of the predicted category label corresponding to training text 1, and γ2 is the confidence score of the predicted category label corresponding to training text 2.

[0092] When the data augmentation type for initial training data 1 and initial training data 2 is the sixth data augmentation type, it means that the prediction result of the basic text classification model for each of the two initial training data is different from the labeled true class label, and the true class labels corresponding to the two initial training data are different. In this case, when the confidence score γ1 of the predicted class label of training text 1 is greater than the confidence score γ2 of the predicted class label of training text 2, the higher confidence score of the predicted class label of training text 1 indicates that the basic text classification model's prediction effect on training text 1 is worse than that on training text 2. Therefore, the initial training data 1 should be configured... The initial training data 1 and initial training data 2 are assigned lower weights and higher weights respectively to perform data augmentation of the second type. When the confidence γ1 of the predicted class label of training text 1 is less than the confidence γ2 of the predicted class label of training text 2, the confidence of the predicted class label of training text 1 is lower, indicating that the basic text classification model has a better prediction effect on training text 1 than on training text 2. Therefore, the initial training data 1 is assigned higher weights and the initial training data 2 is assigned lower weights to perform data augmentation of the second type.

[0093] In some embodiments, before the step of selecting two initial training data from the initial training dataset used for text classification training, i.e. before step S11, the data augmentation method further includes: using a basic text classification model to obtain the predicted class label and the corresponding confidence level for each initial training data in the initial training dataset.

[0094] Assume there are n initial training data points, i.e., n training texts, with two class labels, A and B. Each training text corresponds to a true class label obtained by manual annotation. Using a basic text classification model combined with K-Fold (K-fold cross-validation), the predicted class labels and corresponding confidence scores of the n initial training data points are obtained, as shown in Table 2 above. n =0.6 means that the confidence level of the predicted class label B for the nth training text is 0.6.

[0095] If K in K-Fold equals 10, i.e., 10-fold cross-validation, the base text classification model can be either LR (Logistic Regression) or SVM (Support Vector Machines). First, the initial training dataset is divided into 10 parts. Each time, 9 parts are selected as the training dataset for training the base text classification model, and the remaining part is used as the test dataset for model testing. This yields the predicted class label and its confidence score for each training text in the test dataset. This process is repeated 10 times, ensuring that each of the 10 data parts has served as a test dataset, thus obtaining the predicted class labels and their confidence scores for all training texts in the initial dataset.

[0096] Figure 2 A flowchart illustrating a training method for a target text classification model provided in this disclosure embodiment is shown below. Figure 2 The training method includes:

[0097] Step S21: Use data augmentation methods to perform data augmentation processing on the initial training data in the initial training dataset to obtain augmented training data. The augmented training data includes augmented text vectors and augmented label vectors corresponding to the augmented text vectors.

[0098] The data augmentation method can be any of the data augmentation methods provided in the above embodiments. For specific implementation methods of obtaining augmented training data corresponding to any two initial training data in the initial training dataset, please refer to the relevant descriptions of the data augmentation methods in the above embodiments, which will not be repeated here.

[0099] Step S22: Input the initial training data and the corresponding augmented training data into the target text classification model to train the model and obtain the trained target text classification model.

[0100] In some embodiments, before inputting the initial training data and the corresponding augmented training data into the target text classification model for model training, the method further includes: concatenating the text vectors and label vectors corresponding to the training texts in the initial training data, and concatenating the augmented text vectors and augmented label vectors in the augmented training data. Inputting the initial training data and the corresponding augmented training data into the target text classification model for model training includes: inputting each concatenated text vector and label vector into the target text classification model for model training.

[0101] Figure 3 A schematic diagram of the training architecture for a training method of a target text classification model provided in this disclosure embodiment is shown below. Figure 3 As shown, for each pair of initial training data in the initial training dataset, for example, taking training text 1 in initial training data 1 and training text 2 in initial training data 2 as examples, based on... Figure 3The data augmentation architecture shown first vectorizes training text 1 and its ground truth class label 1, and training text 2 and its ground truth class label 2, respectively, to obtain text vector w1 for training text 1, label vector y1 for ground truth class label 1, text vector w2 for training text 2, and label vector y2 for ground truth class label 2. Then, data augmentation is performed on text vectors w1 and w2 to obtain augmented text vector w3. Augmented label vector y3 is obtained from label vectors y1 and y2. Next, text vector w1 for training text 1 and label vector y1 for ground truth class label 1 are concatenated; text vector w2 for training text 2 and label vector y2 for ground truth class label 2 are concatenated; and augmented text vector w3 and augmented label vector y3 are concatenated. The concatenated data are then sequentially input into the target text classification model for training. The target text classification model can be based on LSTM (Long Short-Term Memory). The model is constructed using a Long Short-Term Memory (LSTM) structure and a Softmax (logistic regression) model, or based on a BERT model and a Softmax model. The LSTM or BERT model is used to process the input data to obtain the corresponding sentence vectors. The Softmax model is used to perform text classification processing on the sentence vectors to obtain the corresponding predicted class labels. For example, the text vector w1 corresponding to training text 1 and the label vector y1 corresponding to the true class label 1 are concatenated and then input into the LSTM or BERT model to obtain sentence vector 1. Sentence vector 1 is then input into the Softmax model to obtain the predicted class label 1. Similarly, the text vector w2 corresponding to training text 2 and the label vector y2 corresponding to the true class label 2 are concatenated and then input into the LSTM or BERT model to obtain sentence vector 2. Sentence vector 2 is then input into the Softmax model to obtain the predicted class label 2. Finally, the augmented text vector w3 and the augmented label vector y3 are concatenated and then input into the LSTM or BERT model to obtain sentence vector 3. Sentence vector 3 is then input into the Softmax model to obtain the predicted class label 3.

[0102] In each training process, the model output loss error is calculated based on the input label vector and the predicted category label output by the target text classification model. Backpropagation is then performed based on the model output loss error to calculate the model gradient. The model parameters are updated based on the model gradient. The model training is completed when the model output loss error reaches convergence or the number of training iterations reaches a threshold, and the trained target text classification model is obtained.

[0103] Once trained, the target text classification model can be used for text classification and to predict the category label of the text. It can be applied to various text classification scenarios, such as spam text recognition, uncivilized text recognition, text intent recognition, text matching, named entity recognition, and agent quality inspection.

[0104] According to the technical solution of the training method for the target text classification model provided in the embodiments of this disclosure, the training method uses data augmentation methods to augment the initial training dataset, so as to expand the amount of training data used for text classification training and increase the diversity of training data, thereby improving the generalization ability of the target text classification model.

[0105] It is understood that the various method embodiments mentioned above in this disclosure can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this disclosure will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.

[0106] In addition, this disclosure also provides a data augmentation device, a training device for a target text classification model, an electronic device, and a computer-readable storage medium. The data augmentation device can be used to implement the data augmentation method provided by this disclosure, the training device can be used to implement the training method for the target text classification model provided by this disclosure, and the electronic device and computer-readable storage medium can be used to implement any data augmentation method or training method provided by this disclosure. The corresponding technical solutions and descriptions are described in the corresponding descriptions in the method section, and will not be repeated here.

[0107] Figure 4 This is a block diagram of a data enhancement device provided in an embodiment of the present disclosure.

[0108] Reference Figure 4 This disclosure provides a data augmentation device 400, which is used to augment every two initial training data in an initial training dataset for text classification training. The initial training data includes training text and the real category label corresponding to the training text. The data augmentation device 400 includes: an acquisition unit 401, a determination unit 402 and a data augmentation unit 403.

[0109] The acquisition unit 401 is configured to acquire, for each pair of initial training data in the initial training dataset, the text vector corresponding to the training text and the label vector corresponding to the real category label in each of the two initial training data.

[0110] The determining unit 402 is configured to determine the data augmentation type corresponding to the two initial training data based on the real class labels corresponding to the two initial training data and the predicted class labels corresponding to the two initial training data obtained in advance. Different data augmentation types correspond to different data augmentation methods.

[0111] The data augmentation unit 403 is configured to perform data augmentation processing on the text vectors corresponding to the two initial training data respectively based on a determined data augmentation type to obtain augmented text vectors; and to determine the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data respectively.

[0112] The data enhancement apparatus 400 provided in this disclosure is used to implement the data enhancement method provided in any of the above embodiments. For specific related descriptions, please refer to the descriptions in the data enhancement methods of any of the above embodiments, which will not be repeated here.

[0113] Figure 5 A block diagram of a training apparatus for a target text classification model provided in an embodiment of this disclosure.

[0114] Reference Figure 5 This disclosure provides a training device 500 for a target text classification model, which includes a data augmentation unit 501 and a training unit 502.

[0115] The data augmentation unit 501 is configured to perform data augmentation processing on the initial training data in the initial training dataset using data augmentation methods to obtain augmented training data, which includes augmented text vectors and augmented label vectors corresponding to the augmented text vectors.

[0116] The data augmentation method can be any of the data augmentation methods provided in the above embodiments. For specific implementation methods of obtaining augmented training data corresponding to any two initial training data in the initial training dataset, please refer to the relevant descriptions of the data augmentation methods in the above embodiments, which will not be repeated here.

[0117] Training unit 502 is configured to input initial training data and corresponding augmented training data into the target text classification model for model training, thereby obtaining the trained target text classification model.

[0118] The training device 500 provided in this embodiment is used to implement the training method provided in any of the above embodiments. For specific related descriptions, please refer to the descriptions in the training methods of any of the above embodiments, which will not be repeated here.

[0119] Figure 6 This is a block diagram of an electronic device provided in an embodiment of the present disclosure.

[0120] Reference Figure 6This disclosure provides an electronic device 600, which includes: at least one processor 601; at least one memory 602; and one or more I / O interfaces 603 connected between the processor 601 and the memory 602; wherein the memory 602 stores one or more computer programs that can be executed by the at least one processor 601, and the one or more computer programs are executed by the at least one processor 601 to enable the at least one processor 601 to perform the above-described data augmentation method or training method.

[0121] This disclosure also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the data augmentation method or training method described above. The computer-readable storage medium may be volatile or non-volatile.

[0122] This disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device executes the above-described data augmentation method or training method.

[0123] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).

[0124] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0125] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0126] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.

[0127] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0128] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0129] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0130] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0131] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0132] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.

Claims

1. A data augmentation method, characterized in that, The data augmentation method is used to augment every two initial training data pairs in the initial training dataset used for text classification training. The initial training data includes training text and the true class labels corresponding to the training text. The data augmentation method includes: For each pair of initial training data in the initial training dataset, obtain the text vector corresponding to the training text and the label vector corresponding to the real category label in each pair of initial training data; Based on whether the true class labels corresponding to the two initial training data are the same and whether the true class label corresponding to each of the two initial training data is the same as the pre-obtained predicted class label, the data augmentation type corresponding to the two initial training data is determined, and different data augmentation types correspond to different data augmentation methods. Based on the data augmentation type, the text vectors corresponding to the two initial training data sets are subjected to data fusion processing to obtain augmented text vectors; the data fusion processing includes weighted summation or weighted averaging; and The label vector corresponding to either of the two initial training data sets is used as the enhanced label vector; or, the label vectors corresponding to the two initial training data sets are weighted and summed to obtain the enhanced label vector corresponding to the enhanced text vector.

2. The data augmentation method according to claim 1, characterized in that, If the true class labels corresponding to the two initial training data are the same, and the true class label and the predicted class label corresponding to each of the two initial training data are the same, then the data augmentation type corresponding to the two initial training data is the first data augmentation type. When the true class labels corresponding to the two initial training data are different, and the true class label and the predicted class label corresponding to each of the two initial training data are the same, the data augmentation type corresponding to the two initial training data is the second data augmentation type. If the true class labels corresponding to the two initial training data are the same, and the true class label and the predicted class label of one initial training data are the same, while the true class label and the predicted class label of the other initial training data are different, then the data augmentation type corresponding to the two initial training data is the third data augmentation type. When the true class labels corresponding to the two initial training data are different, and the true class label and the corresponding predicted class label of one initial training data are the same, while the true class label and the corresponding predicted class label of the other initial training data are different, the data augmentation type corresponding to the two initial training data is the fourth data augmentation type. When the true class labels corresponding to the two initial training data are the same, and the true class label and the predicted class label corresponding to each of the two initial training data are different, the data augmentation type corresponding to the two initial training data is the fifth data augmentation type. When the true class labels corresponding to the two initial training data are different, and the true class label and the predicted class label corresponding to each of the two initial training data are different, the data augmentation type corresponding to the two initial training data is the sixth data augmentation type.

3. The data augmentation method according to claim 1, characterized in that, When the data augmentation type is a preset first data augmentation type, the step of performing data fusion processing on the text vectors corresponding to the two initial training data to obtain the augmented text vector includes: performing weighted averaging processing on the text vectors corresponding to the two initial training data to obtain the augmented text vector. The step of determining the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data includes: taking the label vector corresponding to any one of the two initial training data as the augmented label vector.

4. The data augmentation method according to claim 3, characterized in that, When the data augmentation type is a preset first data augmentation type, the weights corresponding to the two initial training data are each configured as the sum of the confidence scores of the predicted class labels corresponding to the two initial training data.

5. The data augmentation method according to claim 1, characterized in that, When the data augmentation type is a preset second data augmentation type, fourth data augmentation type, or sixth data augmentation type, the step of performing data fusion processing on the text vectors corresponding to the two initial training data to obtain the augmented text vector includes: performing weighted summation processing on the text vectors corresponding to the two initial training data to obtain the augmented text vector. The step of determining the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data includes: performing a weighted summation on the label vectors corresponding to the two initial training data to obtain the augmented label vector corresponding to the augmented text vector.

6. The data augmentation method according to claim 5, characterized in that, When the data augmentation type is a preset second data augmentation type, if γa is greater than or equal to γb, where γa represents the confidence level of the predicted class label corresponding to one of the two initial training data sets, and γb represents the confidence level of the predicted class label corresponding to the other initial training data set, then the weight configuration for the one initial training data set is γa, and the weight configuration for the other initial training data set is 1-γb; when the data augmentation type is a preset second data augmentation type, if γa is less than γb, then the weight configuration for the one initial training data set is 1-γa, and the weight configuration for the other initial training data set is γb. When the data augmentation type is the preset fourth data augmentation type, the weight configuration for one of the two initial training data is 1-γa, and the weight configuration for the other initial training data is γb. When the data augmentation type is the preset sixth data augmentation type, if γa is greater than or equal to γb, then the weight configuration corresponding to one initial training data is (1-γa) / 2, and the weight configuration corresponding to the other initial training data is γb; when the data augmentation type is the preset sixth data augmentation type, if γa is less than γb, then the weight configuration corresponding to one initial training data is γa, and the weight configuration corresponding to the other initial training data is (1-γb) / 2.

7. The data augmentation method according to claim 1, characterized in that, When the data augmentation type is a preset third data augmentation type or a fifth data augmentation type, the step of performing data fusion processing on the text vectors corresponding to the two initial training data to obtain the augmented text vector includes: performing weighted summation processing on the text vectors corresponding to the two initial training data to obtain the augmented text vector; The step of determining the augmented label vector corresponding to the augmented text vector based on the label vectors corresponding to the two initial training data includes: taking the label vector corresponding to any one of the two initial training data as the augmented label vector.

8. The data augmentation method according to claim 7, characterized in that, When the data augmentation type is the preset third data augmentation type, the weight configuration for one of the two initial training data is 1-γa, and the weight configuration for the other initial training data is γb, where γa represents the confidence level of the predicted class label corresponding to the one initial training data, and γb represents the confidence level of the predicted class label corresponding to the other initial training data. When the data augmentation type is the preset fifth data augmentation type, the weight configuration for one of the two initial training data is γa, and the weight configuration for the other initial training data is γb.

9. A training method for a target text classification model, characterized in that, include: The data augmentation method as described in any one of claims 1-8 is used to perform data augmentation processing on the initial training data in the initial training dataset to obtain augmented training data, wherein the augmented training data includes the augmented text vector and the augmented label vector corresponding to the augmented text vector; The initial training data and the corresponding augmented training data are input into the target text classification model for model training to obtain the trained target text classification model.

10. A data augmentation device, characterized in that, The data augmentation device is used to augment every two initial training data pairs in the initial training dataset used for text classification training. The initial training data includes training text and the true class labels corresponding to the training text. The data augmentation device includes: The acquisition unit is configured to acquire, for each pair of initial training data in the initial training dataset, the text vector corresponding to the training text and the label vector corresponding to the real category label in each of the two initial training data; The determining unit is configured to determine the data augmentation type corresponding to the two initial training data based on whether the true class labels corresponding to the two initial training data are the same and whether the true class label corresponding to each of the two initial training data is the same as the pre-acquired predicted class label. Different data augmentation types correspond to different data augmentation methods. The data augmentation unit is configured to perform data fusion processing on the text vectors corresponding to the two initial training data sets respectively, based on the data augmentation type, to obtain an augmented text vector; the data fusion processing includes weighted summation processing or weighted average processing; and taking the label vector corresponding to any one of the two initial training data sets as the augmented label vector; or, performing weighted summation processing on the label vectors corresponding to the two initial training data sets respectively, to obtain an augmented label vector corresponding to the augmented text vector.

11. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the data augmentation method as described in any one of claims 1-8, or to perform the training method as described in claim 9.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the data augmentation method as described in any one of claims 1-8, or the training method as described in claim 9.

Citation Information

Patent Citations

  • Short text classification method based on semantic enhancement and multi-level label embedding

    CN110866117A

  • NER-oriented Chinese clinical text data enhancement method and device

    CN114861600A