Data processing method and device, equipment, storage medium and program product
By obtaining updated candidate category description information and reference examples, we use feature extraction and multi-task classification models to determine the target classification category, which solves the problem of time-consuming updates when the classification category changes, and improves the classification flexibility and efficiency in large traffic scenarios .
Patent Information
- Application Number
- CN202411273470.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-11-29
AI Technical Summary
When the classification category changes, the existing technology requires data cleaning and retraining the model on the training data, which makes the classification model updated for a long time, especially in large traffic scenarios.
By obtaining the text to be classified, the updated candidate category description information and reference examples, using the feature extraction model and the multi-task classification model, the target classification category is determined based on the correlation between the text and the candidate category, and avoiding retraining of the original model. Change the new category description information and add reference examples to adapt to the new category.
It significantly improves the adaptation efficiency after the classification category changes, enhances the classification flexibility in large traffic scenarios, reduces model update time, and reduces resource consumption.
Smart Images

Figure CN119046467A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method, apparatus, device, storage medium and program product. Background Art
[0002] In content classification modeling, there is usually a problem of category changes. To address this problem, the main method used in related technologies is to clean the training data and retrain the original classification model based on the cleaned training data, so that the retrained classification model can adapt to the changes in the classification category. However, this method of retraining the model, whether it is data cleaning or retraining the model, takes a lot of time, which results in a long time to update the classification model when the classification category changes. Summary of the invention
[0003] In view of this, the present disclosure provides a data processing method, apparatus, device, storage medium and program product to solve the problem that it takes a long time to update the classification model when the classification category changes.
[0004] In a first aspect, the present disclosure provides a data processing method, the method comprising:
[0005] Acquire a text to be classified, first category information, and second category information, wherein the first category information includes first description information of at least one first candidate category and a corresponding reference case, and the second category information includes second description information of at least one second candidate category and a corresponding reference case, wherein the at least one second candidate category is obtained by updating the at least one first candidate category;
[0006] Classifying the text to be classified based on the first description information and the second description information respectively to obtain at least one third candidate category of the text to be classified;
[0007] Based on the correlation between the text to be classified and the reference case corresponding to the at least one third candidate category, a target classification category of the text to be classified is determined in the at least one third candidate category.
[0008] In a second aspect, the present disclosure provides a data processing device, the device comprising:
[0009] A data acquisition module, used to acquire a text to be classified, first category information and second category information, wherein the first category information includes first description information of at least one first candidate category and a corresponding reference case, and the second category information includes second description information of at least one second candidate category and a corresponding reference case, wherein the at least one second candidate category is obtained by updating the at least one first candidate category;
[0010] A first classification module, used for classifying the text to be classified based on the first description information and the second description information, respectively, to obtain at least one third candidate category of the text to be classified;
[0011] The second classification module is used to determine a target classification category of the text to be classified in the at least one third candidate category based on the correlation between the text to be classified and the reference case corresponding to the at least one third candidate category.
[0012] In a third aspect, the present disclosure provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the data processing method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0013] In a fourth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the data processing method of the first aspect or any corresponding embodiment thereof.
[0014] In a fifth aspect, the present disclosure provides a computer program product, including computer instructions, which are used to enable a computer to execute the data processing method of the first aspect or any corresponding embodiment thereof.
[0015] The data processing method provided by the embodiment of the present disclosure adds the corresponding first description information and the first reference case for the first candidate category. Therefore, when the first candidate category changes, the second description information and the second reference case of the updated second candidate category can be synchronously configured. Then, the text to be classified is classified based on the first description information and the second description information, respectively, to obtain at least one third candidate category of the text to be classified. Furthermore, based on the correlation between the text to be classified and the reference case corresponding to at least one third candidate category, the target classification category of the text to be classified is determined in at least one third candidate category. Therefore, when the classification category changes, it is only necessary to modify the description information of the changed classification category and add the corresponding reference case to quickly adapt to the changed classification category without retraining the original classification model. Therefore, it is possible to greatly improve the adaptation efficiency of the changed classification category and improve the flexibility of classification in high-traffic scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 is a flowchart of a data processing method according to an embodiment of the present disclosure;
[0018] Figure 2 is a flowchart of a method for screening a third candidate category according to an embodiment of the present disclosure;
[0019] Figure 3 is a flowchart of a method for screening target classification categories according to an embodiment of the present disclosure;
[0020] Figure 4 is a flowchart of a method for determining second category information according to an embodiment of the present disclosure;
[0021] Figure 5 is a schematic diagram of a process for updating category information according to an embodiment of the present disclosure;
[0022] Figure 6 is a flowchart of a method for determining a second feature extraction model according to an embodiment of the present disclosure;
[0023] Figure 7 is a flowchart of a training process of a second feature extraction model according to an embodiment of the present disclosure;
[0024] Figure 8 is a flowchart of a method for determining a target multi-task classification model according to an embodiment of the present disclosure;
[0025] Fig. 9 is a flowchart of a case restoration task according to an embodiment of the present disclosure;
[0026] Fig.10 is a flowchart of another method for determining a target multi-task classification model according to an embodiment of the present disclosure;
[0027] Fig.11 is a flow chart of a category conversion task according to an embodiment of the present disclosure;
[0028] Fig.12 is a structural block diagram of a data processing device according to an embodiment of the present disclosure;
[0029] Fig.13is a structural block diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0031] The main process of content classification modeling includes: selecting a base model, training the base model with a large amount of data, and obtaining a pre-trained model. Then, in each downstream business scenario, according to different classification goals, use different types of business data to fine-tune the classification head and pre-trained model to obtain a classification model suitable for the business scenario, and deploy the fine-tuned classification model online.
[0032] In content classification modeling, there is usually a problem of category changes. To address this problem, the relevant technology mainly uses a method of data cleaning for training data, and retraining the original classification model based on the training data after data cleaning, so that the retrained classification model can adapt to the changes in classification categories. For example, if the original category Type1 is changed to the new category Type2, it is necessary to clean the training data of the original category Type1 to obtain the training data corresponding to the new category Type2. And based on the training data corresponding to the new category Type2 and the training data of other unchanged categories, the original classification model is retrained to obtain a new classification model. However, this method of retraining the model requires that the training data be corrected one by one according to the categories that have changed, and data cleaning, model training and evaluation all take a lot of time. When the classification model is applied online, the classification model replacement time is relatively long.
[0033] Although with the development of large model technology, this problem can be alleviated to a large extent by modifying the category description and providing a small number of samples for prompt learning. However, due to the large number of parameters and high resource consumption of large models, the cost of applying them to scenes with large traffic is high.
[0034] In view of this, according to an embodiment of the present disclosure, a data processing method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0035] In this embodiment, a data processing method is provided, which can be used in electronic equipment. Figure 1 is a flow chart of a data processing method according to an embodiment of the present disclosure, such as Figure 1 As shown, the process includes the following steps:
[0036] Step S101, obtaining the text to be classified, the first category information and the second category information, wherein the first category information includes the first description information of at least one first candidate category and the corresponding reference case, and the second category information includes the second description information of at least one second candidate category and the corresponding reference case, and the at least one second candidate category is obtained by updating at least one first candidate category.
[0037] Specifically, the second candidate category is obtained by performing a target operation on the first candidate category, and the target operation includes at least one of deletion, creation, and modification. In addition, the target operation may also include other operations, which are not limited here.
[0038] Exemplarily, if the first candidate category or its first description information is modified, a modified reference case may be provided to obtain the second category information.
[0039] It should be noted that the text to be classified, the first category information and the second category information belong to the same scene.
[0040] It should be noted that the second description information includes not only the candidate categories that have changed, but also the candidate categories that have not changed. Therefore, there are the same candidate categories that have not changed between the first description information and the second description information.
[0041] Step S102: classify the text to be classified based on the first description information and the second description information to obtain at least one third candidate category of the text to be classified.
[0042] Specifically, feature extraction is performed on the text to be classified by the first text feature extraction model to obtain a target text feature vector. Feature extraction is performed on the second description information by the first feature extraction model applicable to general scenarios to obtain a first target category feature vector. And, feature extraction is performed on the first description information by the second feature extraction model applicable to the corresponding scenario of the text to be classified to obtain a second target category feature vector. Then, based on the correlation between the target text feature vector and the first target category feature vector, the text to be classified is classified, and the second candidate category related to the text to be classified is determined in the second candidate category. And, based on the correlation between the target text feature vector and the second target category feature vector, the text to be classified is classified, and the first candidate category related to the text to be classified is determined in the first candidate category. Finally, all the first candidate categories and second candidate categories related to the text to be classified are used as the third candidate category.
[0043] In addition, the text to be classified can be classified by the first classification model applicable to general scenarios and the second description information to obtain a second candidate category related to the text to be classified. And the text to be classified can be classified by the second classification model applicable to the scene corresponding to the text to be classified and the first description information to obtain the first candidate category related to the text to be classified. Finally, all the first candidate categories and second candidate categories related to the text to be classified are used as the third candidate category. Among them, the first classification model is trained based on sample text and corresponding description information in an open source scenario (the open source scenario includes multiple scenarios). The second classification model is trained based on sample text and corresponding description information of the scene corresponding to the text to be classified, and the description information of the scene corresponding to the text to be classified includes the first description information.
[0044] It should be noted that the first classification model and the second classification model may adopt a lightweight large model, or a classification model obtained by using the large model to perform classification modeling using category descriptions.
[0045] Step S103: determining a target classification category of the text to be classified in at least one third candidate category based on the correlation between the text to be classified and a reference case corresponding to at least one third candidate category.
[0046] Specifically, feature extraction is performed on the reference case corresponding to the third candidate category to obtain the corresponding first case feature vector. The first case feature vector and the text to be classified are input into the multi-task classification model, and the correlation between the first case feature vector and the text feature vector of the text to be classified is calculated to obtain the first classification probability corresponding to each first case feature vector. And based on the first classification probability, the target classification category of the text to be classified is determined in at least one third candidate category.
[0047] It can be understood that the more the third candidate category matches the text to be classified, the greater the first classification probability corresponding to the first case feature vector.
[0048] The data processing method provided in this embodiment adds the corresponding first description information and the first reference case for the first candidate category. Therefore, when the first candidate category changes, the second description information and the second reference case of the updated second candidate category can be synchronously configured. Then, the text to be classified is classified based on the first description information and the second description information, respectively, to obtain at least one third candidate category of the text to be classified. Furthermore, based on the correlation between the text to be classified and the reference case corresponding to at least one third candidate category, the target classification category of the text to be classified is determined in at least one third candidate category. Therefore, when the classification category changes, it is only necessary to modify the description information of the changed classification category and add the corresponding reference case to quickly adapt to the changed classification category without retraining the original classification model. Therefore, it can greatly improve the adaptation efficiency of the changed classification category and improve the flexibility of classification in high-traffic scenarios.
[0049] In some optional implementations, the step S102 of classifying the text to be classified based on the first description information and the second description information to obtain at least one third candidate category of the text to be classified includes:
[0050] Step a1: extract features from the text to be classified to obtain a target text feature vector.
[0051] Specifically, the first text feature extraction model is used to extract features from the text to be classified to obtain a target text feature vector, wherein the first text feature extraction model is a text encoder.
[0052] Step a2: extract features from the second description information based on the first feature extraction model to obtain a first target category feature vector. The first feature extraction model is used to extract features from description information in multiple scenarios.
[0053] It should be noted that the first feature extraction model is a general semantic encoder. The first feature extraction model is trained based on description information in an open source scenario or multiple scenarios.
[0054] Step a3: extract features from the first description information based on a second feature extraction model to obtain a second target category feature vector. The second feature extraction model is used to extract features from the description information in the corresponding scene of the text to be classified.
[0055] Specifically, the second feature extraction model is obtained by updating the parameters of the preset feature extraction model based on the alignment loss of the sample text feature vector of the sample text in the corresponding scene of the to-be-classified text and the output data of the preset feature extraction model, the alignment loss of the sample text feature vector and the output data of the first feature extraction model, and the error loss of the output data of the first feature extraction model and the preset feature extraction model. In the process of updating the parameters of the preset feature extraction model, the input data of the preset feature extraction model and the first feature extraction model are the category description information of different categories in the corresponding scene of the to-be-classified text.
[0056] It should be noted that the category description information of the scene corresponding to the text to be classified includes the first description information.
[0057] Step a4: classify the text to be classified based on the correlation between the first target category feature vector and the target text feature vector to obtain a first target classification result.
[0058] Specifically, based on the correlation between the first target category feature vector and the target text feature vector, the second candidate categories are sorted, and a first preset number of second candidate categories with top correlation rankings are selected as the first target classification result.
[0059] Step a5: classify the text to be classified based on the correlation between the second target category feature vector and the target text feature vector to obtain a second target classification result.
[0060] Specifically, based on the correlation between the second target category feature vector and the target text feature vector, the first candidate categories are sorted, and a second preset number of first candidate categories with top correlation rankings are selected as the second target classification result.
[0061] Step a6: fusing the first target classification result and the second target classification result to obtain at least one third candidate category of the text to be classified.
[0062] Specifically, if the first target classification result includes a second candidate category that is the same as the first candidate category in the second target classification result, the second candidate category is deleted from the first target classification result. Then, the first target classification result is merged with the second target classification result, and at least one third candidate category of the text to be classified is obtained according to the merged result.
[0063] Specifically, a third preset number of candidate categories with higher relevance to the text to be classified in the merged result are used as the third candidate categories.
[0064] In the data processing method provided by this embodiment, since the second category information is obtained by updating the first category information, the second feature extraction model has a better feature extraction effect on the original first description information. However, the second feature extraction model may not have learned the knowledge of the second description information. The first feature extraction model has learned the knowledge of description information of multiple scenes, which may contain the second description information or knowledge similar to the second description information. Therefore, a general first feature extraction model is used to extract features from the second description information to obtain a first target category feature vector. And a second feature extraction model is used to extract features from the first description information to obtain a second target category feature vector. Furthermore, the first target classification result and the second target classification result obtained based on the classification of the first target category feature vector and the second target category feature vector are fused to obtain at least one third candidate category of the text to be classified. Therefore, the accuracy of classification can be further improved.
[0065] For example, Figure 2 As shown, for the updated second description information, the first feature extraction model trained based on the description information in the general scenario is used to extract features from the second description information to obtain the first target feature extraction vector, so as to obtain a feature vector library. For the original first description information, the second feature extraction model trained based on the description information in the corresponding scenario of the text to be classified is used to extract features from the first description information to obtain the second target feature extraction vector, so as to obtain a feature vector library. Then, based on the correlation between the first target feature extraction vector and the target text feature vector, the top Y second candidate categories ranked in correlation are selected from the second candidate categories as the first target classification result. And based on the correlation between the second target feature extraction vector and the target text feature vector, the top X first candidate categories ranked in correlation are selected from the first candidate categories as the second target classification result. The second candidate categories in the first target classification result that are the same as the first candidate categories are deleted, and then the second target classification result is merged with the first target classification result finally obtained, and the top M candidate categories are selected as the third candidate categories.
[0066] In some optional implementations, the step S103 of determining a target classification category of the text to be classified in at least one third candidate category based on the correlation between the text to be classified and the reference case corresponding to at least one third candidate category includes:
[0067] Step b1: extracting features from at least one reference case corresponding to a third candidate category based on a target text feature extraction model to obtain a first case feature vector corresponding to the third candidate category.
[0068] Specifically, the target text feature extraction model is a sample encoder.
[0069] Step b2, inputting the text to be classified, at least one third candidate category and the first case feature vector into the target multi-task classification model, determining the first classification probability corresponding to the first case feature vector, and the first classification probability is used to characterize the correlation between the text to be classified and the first case feature vector.
[0070] Specifically, the target multi-task classification model extracts features from the text to be classified to obtain a text feature vector of the text to be classified. Then, the text feature vector of the text to be classified is subjected to correlation analysis with the first case feature vector of the third candidate category, and the probability of the third candidate category being selected corresponding to each first case feature vector (i.e., the first classification probability) is output.
[0071] Specifically, the target multi-task classification model is a target UniMC model. The classification task of the target UniMC model is pre-configured in the target UniMC model to determine the category of the text hit.
[0072] Step b3: determining a target classification category from at least one third candidate category based on the first classification probability.
[0073] Specifically, the third candidate category corresponding to the first case feature vector having the largest first classification probability is selected as the target classification category.
[0074] The data processing method provided in this embodiment extracts features from reference cases corresponding to at least one third candidate category based on the target text feature extraction model to obtain a first case feature vector corresponding to the third candidate category. Then, the text to be classified, at least one third candidate category, and the first case feature vector are input into the target multi-task classification model to determine the first classification probability corresponding to the first case feature vector, so as to determine the target classification category in at least one third candidate category. Therefore, the third candidate category can be secondary classified according to the reference case of the third candidate category to further improve the accuracy of classification.
[0075] For example, Figure 3As shown, taking the target multi-task classification model as the target UniMC model as an example, the target UniMC model is configured to determine the category hit by the text (i.e., the input text). Assuming that the text to be classified corresponds to three third candidate categories Rule1, Rule2, and Rule3, the reference cases of the three third candidate categories are input into the target text feature extraction model for feature extraction, and the corresponding feature extraction results are input into the linear layer (also known as Linear) to obtain the first case feature vectors corresponding to the three third candidate categories. The target UniMC model is configured with the third candidate categories corresponding to each first case feature vector and the corresponding specific mask (MASK). Among them, the specific mask is used to determine whether to select the corresponding third candidate category. In addition, the text to be classified Text is input into the target UniMC model, and the feature extraction of Text is performed to obtain the text feature vector of Text. Furthermore, the target UniMC model determines the correlation between the first case feature vectors of the three third candidate categories and the text feature vector of Text, so as to output the first classification probability of the three third candidate categories. Finally, the third candidate category with the largest first classification probability is selected as the target classification category.
[0076] In some optional embodiments, the data processing method of the present disclosure also includes: obtaining feedback information of the target classification category; if the feedback information indicates that the text to be classified matches the target classification category, then based on the target classification category, adding the text to be classified to the reference case of at least one corresponding second candidate category.
[0077] The data processing method provided in this embodiment, when receiving feedback information of a target classification category, if the feedback information indicates that the text to be classified matches the target classification category, the text to be classified is used as a reference case of the target classification category, and the classification model is iterated in real time using the target classification category and the text to be classified, so as to make the classification model applicable in the current scenario.
[0078] In some optional embodiments, such as Figure 4 As shown, the second category of information is determined by:
[0079] Step S401, obtaining category information to be updated, a first sample text, and a first sample category of the first sample text, wherein the category information to be updated includes initial description information of at least one target update category and a corresponding initial case, and the target update category is obtained by updating the first candidate category.
[0080] Specifically, the target update category is obtained by performing a target operation on the first candidate category, and the target operation includes at least one of deletion, creation, and modification. In addition, the target operation may also include other operations, which are not limited here.
[0081] It should be noted that the category information to be updated includes not only the candidate categories that have been changed, but also the candidate categories that have not been changed. Therefore, there are the same candidate categories that have not been changed between the first description information and the category information to be updated.
[0082] Step S402: Classify the first sample text based on the first description information and the initial description information to obtain at least one sample candidate category of the first sample text.
[0083] Specifically, feature extraction is performed on the first sample text through a first text feature extraction model to obtain a first sample text feature vector. Feature extraction is performed on the initial description information through a first feature extraction model applicable to general scenarios to obtain a first sample category feature vector. And, feature extraction is performed on the first description information through a second feature extraction model applicable to the corresponding scenario of the text to be classified to obtain a second sample category feature vector. Then, based on the correlation between the first sample category feature vector and the first sample text feature vector, the first sample text is classified, and the target update category related to the first sample text is determined in the target update category. And, based on the correlation between the second sample category feature vector and the first sample text feature vector, the first sample text is classified, and the first candidate category related to the first sample text is determined in the first candidate category. Finally, all first candidate categories and target update categories related to the first sample text are used as sample candidate categories.
[0084] In addition, different classification models may be used to classify the first sample text based on the first description information and the initial description information to obtain at least one sample candidate category of the first sample text. For details, see the relevant description of step S102.
[0085] Step S403: determining a predicted classification category of the first sample text in at least one sample candidate category based on the correlation between the first sample text and the initial case corresponding to at least one sample candidate category.
[0086] Specifically, feature extraction is performed on the initial case corresponding to the sample candidate category to obtain the corresponding second case feature vector. The second case feature vector and the first sample text are input into the multi-task classification model, and the correlation between the second case feature vector and the text feature vector of the first sample text is calculated to obtain the second classification probability corresponding to each second case feature vector. And based on the second classification probability, the predicted classification category of the first sample text is determined in at least one sample candidate category.
[0087] It can be understood that the more the sample candidate category matches the first sample text, the greater the second classification probability corresponding to the second case feature vector.
[0088] Step S404: If the predicted classification category matches the first sample category, the category information to be updated is used as the second category information.
[0089] Specifically, if the predicted classification category matches the first sample category, the category information to be updated is used as the second category information. Then, the second category information is synchronized online so that the classification model deployed online (such as the second feature extraction model deployed online and the target multi-task classification model, etc.) performs classification based on the second category information.
[0090] The data processing method provided in this embodiment configures the initial description information and the corresponding initial precedent of the target updated category when the category needs to be updated. Then, the first sample text is classified based on the first description information and the initial description information to obtain at least one sample candidate category of the first sample text. And based on the correlation between the first sample text and the initial precedent corresponding to the at least one sample candidate category, the predicted classification category of the first sample text is determined in the at least one sample candidate category. If the predicted classification category matches the first sample category of the target updated category, the category information to be updated is used as the second category information. Therefore, when the category changes, it is only necessary to update the description information of the category and provide a small number of precedents to quickly modify the classification basis of the online classification model, avoiding the data cleaning and data training processes in the related technology, and significantly reducing the model iteration cost in the current scenario.
[0091] In some optional embodiments, such as Figure 4 As shown, the method for determining the second category of information also includes:
[0092] Step S405: if the predicted classification category does not match the first sample category, then obtaining adjustment information for at least one target update category, the adjustment information includes newly added description information and / or newly added cases.
[0093] Specifically, if the predicted classification category does not match the first sample category, the description information of the target update category may be described in more detail, or a new case may be added to provide more information related to the target update category.
[0094] Step S406: updating the initial description information corresponding to at least one target update category based on the newly added description information.
[0095] Specifically, the newly added description information may be selected to replace the initial description information corresponding to at least one target update category according to actual conditions, or the newly added description information may be added to the initial description information of the corresponding target update category.
[0096] Step S407: updating the initial case corresponding to at least one target update category based on the newly added case.
[0097] Specifically, the newly added case may be selected to replace the initial case corresponding to at least one target update category according to actual conditions, or the newly added case may be added to the initial case of the corresponding target update category.
[0098] In the data processing method provided in this embodiment, if the predicted classification category does not match the first sample category, newly added description information and / or newly added precedents for at least one target update category are obtained to update the initial description information and / or initial precedents of at least one target update category. Therefore, more information related to the target update category can be provided to improve the accuracy of the classification of the target update category.
[0099] It should be noted that after the initial description information and / or initial precedent of the target update category is updated, the process returns to the above step S402 until the predicted classification category matches the first sample category.
[0100] In some optional implementations, the step S402 of classifying the first sample text based on the first description information and the initial description information to obtain at least one sample candidate category of the first sample text includes:
[0101] Step c1, extracting features from the first sample text to obtain a first sample text feature vector.
[0102] Specifically, feature extraction is performed on the first sample text using a first text feature extraction model to obtain a first sample text feature vector.
[0103] Step c2: extracting features from the initial description information based on a first feature extraction model to obtain a first sample category feature vector. The first feature extraction model is used to extract features from description information in multiple scenarios.
[0104] It should be noted that the first feature extraction model is a general semantic encoder. The first feature extraction model is trained based on description information in an open source scenario or multiple scenarios.
[0105] Step c3, extracting features from the first description information based on a second feature extraction model to obtain a second sample category feature vector, wherein the second feature extraction model is used to extract features from the description information in the corresponding scene of the text to be classified.
[0106] Specifically, the second feature extraction model is obtained by updating the parameters of the preset feature extraction model based on the alignment loss of the sample text feature vector of the sample text in the corresponding scene of the to-be-classified text and the output data of the preset feature extraction model, the alignment loss of the sample text feature vector and the output data of the first feature extraction model, and the error loss of the output data of the first feature extraction model and the preset feature extraction model. In the process of updating the parameters of the preset feature extraction model, the input data of the preset feature extraction model and the first feature extraction model are the category description information of different categories in the corresponding scene of the to-be-classified text.
[0107] Step c4: classify the first sample text based on the correlation between the first sample category feature vector and the first sample text feature vector to obtain a first sample classification result.
[0108] Specifically, based on the correlation between the first sample category feature vector and the first sample text feature vector, each target update category is sorted, and a first preset number of target update categories with top correlation rankings are selected as the first sample classification result.
[0109] Step c5: classify the first sample text based on the correlation between the second sample category feature vector and the first sample text feature vector to obtain a second sample classification result.
[0110] Specifically, based on the correlation between the second sample category feature vector and the first sample text feature vector, the first candidate categories are sorted, and a second preset number of first candidate categories with top correlation rankings are selected as the second sample classification result.
[0111] Step c6: fusing the first sample classification result and the second sample classification result to obtain at least one sample candidate category of the first sample text.
[0112] Specifically, if the first sample classification result includes a target update category that is the same as the first candidate category in the second sample classification result, the target update category is deleted from the first sample classification result. Then, the first sample classification result is merged with the second sample classification result, and at least one sample candidate category of the first sample text is obtained according to the merged result.
[0113] In the data processing method provided in this embodiment, since the category information to be updated is obtained by updating the first category information, the second feature extraction model has a better feature extraction effect on the original first description information, but the second feature extraction model may not have learned the knowledge of the initial description information. The first feature extraction model has learned the knowledge of description information of multiple scenes, which may contain the initial description information or knowledge similar to the initial description information. Therefore, a general first feature extraction model is used to extract features from the initial description information to obtain a first sample category feature vector. And a second feature extraction model is used to extract features from the first description information to obtain a second sample category feature vector. Furthermore, the first sample classification result and the second sample classification result obtained based on the first sample category feature vector and the second sample category feature vector are fused to obtain at least one sample candidate category of the first sample text. Therefore, the accuracy of classification can be further improved.
[0114] In some optional implementations, the step S403 of determining a predicted classification category of the first sample text in at least one sample candidate category based on the correlation between the first sample text and the initial case corresponding to at least one sample candidate category includes:
[0115] Step d1, extracting features from an initial case corresponding to at least one sample candidate category based on a target text feature extraction model to obtain a second case feature vector.
[0116] Specifically, the target text feature extraction model is a sample encoder.
[0117] Step d2, inputting the first sample text, at least one sample candidate category and the second case feature vector into the target multi-task classification model, determining the second classification probability corresponding to the second case feature vector, and the second classification probability is used to characterize the correlation between the first sample text and the second case feature vector.
[0118] Specifically, the target multi-task classification model extracts features from the first sample text to obtain a text feature vector of the first sample text. Then, the text feature vector of the first sample text is subjected to correlation analysis with the second case feature vector, and the probability of the sample candidate category corresponding to each second case feature vector being selected (i.e., the second classification probability) is output.
[0119] Step d3: determining a predicted classification category from at least one sample candidate category based on the second classification probability.
[0120] Specifically, the sample candidate category corresponding to the second case feature vector with the largest second classification probability is selected as the predicted classification category.
[0121] The data processing method provided in this embodiment extracts features from the initial case corresponding to at least one sample candidate category based on the target text feature extraction model to obtain a second case feature vector. Then, the first sample text, at least one sample candidate category, and the second case feature vector are input into the target multi-task classification model to determine the second classification probability corresponding to the second case feature vector, so as to determine the predicted classification category in at least one sample candidate category. Therefore, the sample candidate category can be secondary classified according to the initial case of the sample candidate category to further improve the accuracy of classification.
[0122] For example, Figure 5 As shown, the overall process of updating the classification category is as follows: in the case of category changes, configure the category information to be updated; wherein the category information to be updated includes the initial description information and the corresponding initial precedent of at least one target update category. Then, the first sample text and the category information to be updated are used to recall the reordering link, that is, the first sample text is classified based on the first description information and the initial description information respectively to obtain at least one sample candidate category of the first sample text, and based on the correlation between the first sample text and the initial precedent corresponding to the at least one sample candidate category, the predicted classification category of the first sample text is determined in at least one sample candidate category. Then, according to the recall reordering of the recall reordering link, it is judged whether the category information to be updated meets the expectations. If so, the category information to be updated is used as the second category information, and the second category information is configured and deployed online. If not, return to reconfigure the category information to be updated. After the second category information is deployed online, the text to be classified is classified based on the second category information. The third candidate category related to the text to be classified is recalled, and the third candidate category is reordered based on the reference precedent of the third candidate category to obtain the target classification category.
[0123] It should be noted that the ordering of the recall reordering link on the new category is based on the description information of the modified target update category and the initial case, and determines whether to classify the first sample text into the new target update category.
[0124] In some optional embodiments, such as Figure 6 As shown, the method for determining the second feature extraction model includes:
[0125] Step S601, obtaining a second sample text in a scene corresponding to the text to be classified and at least one category description information.
[0126] For example, if the text to be classified is related to toys, then sample text in a toy scene and category description information of each toy category in the toy scene can be obtained.
[0127] Step S602: extract features from the second sample text to obtain a feature vector of the second sample text.
[0128] Specifically, feature extraction is performed on the second sample text based on the first text feature extraction model to obtain a second sample text feature vector.
[0129] Step S603: extract features from at least one category description information based on a preset feature extraction model to obtain a third sample category feature vector.
[0130] Specifically, the preset feature extraction model is a category description encoder.
[0131] Step S604: extract features from at least one category description information based on the first feature extraction model to obtain a fourth sample category feature vector.
[0132] Specifically, the first feature extraction model is a category description encoder. In the process of updating the parameters of the preset feature extraction model, the parameters of the first feature extraction model are not updated.
[0133] Step S605, based on the alignment loss between the second sample text feature vector and the third sample category feature vector, the alignment loss between the second sample text feature vector and the fourth sample category feature vector, and the error loss between the third sample category feature vector and the fourth sample category feature vector, the parameters of the preset feature extraction model are updated to obtain a second feature extraction model.
[0134] Specifically, the parameter update target of the preset feature extraction model is to align the text feature vector output by the first text feature extraction model with the category feature vector output by the preset feature extraction model and the first feature extraction model. At the same time, the difference between the description information of the same category in the preset feature extraction model and the first feature extraction model is limited. In this way, the category feature vector output by the second feature extraction model finally obtained by training is correlated with the text feature vector output by the first text feature extraction model, while ensuring the generalization ability of the second feature extraction model.
[0135] The data processing method provided in this embodiment performs feature extraction on the second sample text to obtain a second sample text feature vector. And, based on the first feature extraction model, feature extraction is performed on at least one category description information to obtain a fourth sample category feature vector. Then, based on the alignment loss between the second sample text feature vector and the third sample category feature vector, the alignment loss between the second sample text feature vector and the fourth sample category feature vector, and the error loss between the third sample category feature vector and the fourth sample category feature vector, the parameters of the preset feature extraction model are updated to obtain a second feature extraction model. Therefore, it is possible to construct a correlation between the category feature vector output by the second feature extraction model and the text feature vector output by the first text feature extraction model, while ensuring the generalization ability of the second feature extraction model.
[0136] In some optional implementations, the parameters of the preset feature extraction model are updated based on the alignment loss between the second sample text feature vector and the third sample category feature vector, the alignment loss between the second sample text feature vector and the fourth sample category feature vector, and the error loss between the third sample category feature vector and the fourth sample category feature vector in the above step S605 to obtain the second feature extraction model, including:
[0137] Step e1, obtaining a second sample category corresponding to the second sample text.
[0138] Step e2: determining a first alignment loss based on the second sample text feature vector, the third sample category feature vector and the second sample category.
[0139] Specifically, the first alignment loss is calculated based on the information noise contrast estimation loss (InfoNCE for short), the second sample text feature vector, the third sample category feature vector and the second sample category.
[0140] Step e3: determining a second alignment loss based on the second sample text feature vector, the fourth sample category feature vector and the second sample category.
[0141] Specifically, based on the information-noise contrast estimation loss, the second sample text feature vector, the fourth sample category feature vector, and the second sample category, the second alignment loss is calculated.
[0142] Step e4: determining the error loss based on the third sample category feature vector and the fourth sample category feature vector.
[0143] Specifically, the error loss is calculated based on the mean square error loss (MSE), the third sample category feature vector, and the fourth sample category feature vector. In addition, the error loss can also be calculated using the mean absolute error loss or other regularization losses.
[0144] Step e5: based on the first alignment loss, the second alignment loss and the error loss, update the parameters of the preset feature extraction model to obtain a second feature extraction model.
[0145] The data processing method provided in this embodiment can align the output data of the first text feature extraction model with the preset feature extraction model based on the first alignment loss, and align the output data of the first text feature extraction model with the first feature extraction model based on the second alignment loss. At the same time, the loss error is used to constrain the parameter update of the preset feature extraction model. Therefore, the first feature extraction model and the second feature extraction model can be used to recall the candidate category that is most relevant to the text to be classified.
[0146] For example, Figure 7 As shown, the method for determining the second feature extraction model includes the following process: inputting the second sample text into the first text feature extraction model to extract the second sample text feature vector. And, inputting the category description information into the preset feature extraction model and the first feature extraction model respectively, extracting the third sample category feature vector and the fourth sample category feature vector respectively. Thus, the first alignment loss between the second sample text feature vector and the third sample category feature vector, the second alignment loss between the second sample text feature vector and the fourth sample category feature vector, and the error loss between the third sample category feature vector and the fourth sample category feature vector are calculated. Thus, according to the first alignment loss, the second alignment loss and the error loss, the parameters of the preset feature extraction model are updated to obtain the second feature extraction model.
[0147] In some optional embodiments, such as Figure 8 As shown, the target multi-task classification model is determined by:
[0148] Step S801, obtaining sample cases.
[0149] It should be noted that the sample case may be an initial case, and steps S801-S806 are performed in the process of determining the second category information. It may also be a case of other description information, and the target multi-task classification model is determined separately. The sample case is not limited here.
[0150] Step S802: segment the sample case to obtain a first segmentation result.
[0151] Specifically, a word segmentation technique in natural language processing, such as a dictionary-based word segmentation method or a statistics-based word segmentation method, may be used to segment the sample case to obtain a first word segmentation result.
[0152] Step S803, masking the target position in the first word segmentation result to obtain a second word segmentation result.
[0153] Specifically, the first word segmentation result may be masked (also called MASK) using the first preset probability to obtain the second word segmentation result. The target position may be determined randomly, and is not limited here.
[0154] Optionally, the first preset probability is 70%, which can be adjusted according to actual conditions.
[0155] Step S804: extract features from the first word segmentation result based on the target text feature extraction model to obtain a third case feature vector.
[0156] Specifically, the target text feature extraction model is a sample encoder.
[0157] Step S805: input the second word segmentation result and the third case feature vector into a preset multi-task classification model to obtain a mask prediction result.
[0158] Specifically, the preset multi-task classification model is a preset UniMC model. The preset UniMC model restores the masked text in the second word segmentation result through a pre-training task (Masked Language Model, MLM for short).
[0159] Step S806: based on the prediction result and the first word segmentation result, update the parameters of the preset multi-task classification model to obtain a target multi-task classification model.
[0160] Specifically, according to the difference between the word-units at the corresponding positions of the preset result and the first word segmentation result, the parameters of the preset multi-task classification model are updated.
[0161] It can be understood that the purpose of updating the parameters of the preset multi-task classification model is to align the feature vectors of the pre-set target text feature extraction model with the preset UniMC model. Therefore, the case can be output in the form of an embedding vector (also known as embedding), which improves the classification performance of the UniMC model.
[0162] The data processing method provided in this embodiment performs word segmentation on the sample case to obtain a first word segmentation result. The target position in the first word segmentation result is masked to obtain a second word segmentation result. Then, the second word segmentation result and the third case feature vector are input into the preset multi-task classification model to obtain a masked prediction result. And according to the prediction result and the first word segmentation result, the parameters of the preset multi-task classification model are updated to obtain a target multi-task classification model. Therefore, the output data of the target text feature extraction model can be aligned with the input data of the preset multi-task classification model to improve the target multi-task classification model's understanding of the case, and to improve the correlation between the category prediction results of the target multi-task classification model and the input case.
[0163] For example, Fig. 9 As shown, the first word segmentation result of the sample case is input into the target text feature extraction model for feature extraction, and the third case feature vector is obtained through a linear layer (also called Linear). Also, the first word segmentation result is randomly masked, and the second word segmentation result is obtained. For example, the first word segmentation result is token1, token2, token3, token4, token5. Assume that token1, token3, and token4 are masked, and the second word segmentation result is MASK, token2, MASK, MASK, and token5. Then the preset UniMC model restores token1, token3, and token4 through the MLM task. Then, the parameters of the preset UniMC model are updated according to the restoration situation to obtain the target UniMC model.
[0164] In some optional embodiments, such as Fig.10 As shown, the method for determining the target multi-task classification model also includes:
[0165] Step S1001, obtaining a third sample text and a corresponding third sample category.
[0166] Specifically, in actual operation, the first sample text is used as the third sample text, and the target sample candidate category in at least one sample candidate category is used as the third sample category. In addition, other texts can also be used as the third sample text, and other categories can be used as the third sample category, which is not limited here.
[0167] Step S1002: Obtain a third sample text feature vector of the third sample text.
[0168] Specifically, the second text feature extraction model may be used to extract features from the third sample text to obtain a feature vector of the third sample text.
[0169] It should be noted that, if the first sample text is used as the third sample text, the first sample text feature vector corresponding to the first sample text is directly used as the third sample text feature vector.
[0170] Step S1003: Mark the third sample text feature vector as a case of the third sample category.
[0171] Specifically, the third sample text feature vector may be used as a case for the third sample category according to the second preset probability.
[0172] Optionally, the second preset probability ranges from 1% to 5%.
[0173] Step S1004: input the third sample text, the third sample category and the third sample text feature vector into a preset multi-task classification model to obtain a third classification probability of the third sample category.
[0174] Specifically, the third sample text and the third sample category are input into the preset multi-task classification model, and the third sample text feature vector is input into the preset multi-task classification model as a case of the third sample category to obtain a third classification probability corresponding to the third sample category. The third sample text feature vector can refer to the input method of the second case feature vector of the sample candidate category mentioned above.
[0175] Step S1005 , updating the parameters of the preset multi-task classification model based on the third classification probability to obtain a target multi-task classification model.
[0176] The data processing method provided in this embodiment uses the encoding vector of the input sample of the preset multi-task classification model (i.e., the third sample text feature vector) as the case of the third sample category with a certain probability, so that the category of the input sample is converted into the third sample category. Therefore, the sensitivity of the target multi-task classification model to the case can be improved.
[0177] For example, Fig.11 As shown, the label of the third sample text is pass, and the third sample text corresponds to three candidate labels: "pass", Rule1, and Rule2. Assuming that the third sample category is Rule1, the third sample text feature vector of the third sample text can be used as the case of Rule1 according to the second preset probability, and the third sample text label is converted from "pass" to Rule1. Therefore, the parameters of the preset multi-task classification model are updated according to the third sample text, Rule1, and the third sample text feature vector to improve the sensitivity of the preset multi-task classification model to the case.
[0178] It should be noted that Figure 3 and Fig. 9The UniMC model shown is a BERT structure. In actual situations, a GPT structure can also be used instead.
[0179] It is worth noting that the data processing method disclosed in the present invention constructs a process of category recall and reordering to address the problem of category changes. The rapid adaptation of the classification model to new categories or category modifications can be accomplished by modifying the category description information and adding cases. At the same time, in order to improve the UniMC model's understanding of precedents and the correlation between category prediction results and precedents, case restoration tasks and category conversion tasks are introduced during the training process of UniMC. Therefore, through the process of recall and reordering, the category description information and configured precedents can be modified, and classification scenarios with frequent changes in category definitions can be adapted. And in UniMC, the precedents of each category are input in the form of representations (i.e., feature vectors), so that multiple cases can be added to each category with less increase in resource consumption.
[0180] As one of the specific applications, a target application for executing the data processing method of the present invention can be configured on the deployment platform of the classification model. Whenever there is a need to change the category on which the classification model is based, the existing category can be deleted, added, modified, etc. in the target application, and the description information of the changed category can be configured and the corresponding reference cases can be added. The description information and reference cases of the configured category are verified by the data processing method of the present invention. If it does not meet expectations, the description information of the category is modified to provide a more detailed description, or reference cases of the category are added. If it meets expectations, the modified description information and reference cases of the category are put online, so that the online deployed classification model can classify the text to be classified based on the modified description information and reference cases of the category.
[0181] In the present embodiment, a data processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0182] This embodiment provides a data processing device, such as Fig.12 As shown, including:
[0183] The data acquisition module 1201 is used to acquire the text to be classified, the first category information and the second category information, wherein the first category information includes the first description information of at least one first candidate category and the corresponding reference case, and the second category information includes the second description information of at least one second candidate category and the corresponding reference case, and the at least one second candidate category is obtained by updating the at least one first candidate category;
[0184] A first classification module 1202, configured to classify the text to be classified based on the first description information and the second description information, respectively, to obtain at least one third candidate category of the text to be classified;
[0185] The second classification module 1203 is used to determine a target classification category of the text to be classified in at least one third candidate category based on the correlation between the text to be classified and a reference case corresponding to at least one third candidate category.
[0186] In some optional implementations, the first classification module 1202 includes:
[0187] A first target feature extraction unit is used to extract features of the text to be classified to obtain a target text feature vector;
[0188] A second target feature extraction unit is used to extract features from the second description information based on the first feature extraction model to obtain a first target category feature vector, wherein the first feature extraction model is used to extract features from description information in multiple scenarios;
[0189] A third target feature extraction unit is used to extract features from the first description information based on a second feature extraction model to obtain a second target category feature vector, wherein the second feature extraction model is used to extract features from the description information in the scene corresponding to the to-be-classified text;
[0190] A first target text classification unit is used to classify the text to be classified based on the correlation between the first target category feature vector and the target text feature vector to obtain a first target classification result;
[0191] A second target text classification unit is used to classify the text to be classified based on the correlation between the second target category feature vector and the target text feature vector to obtain a second target classification result;
[0192] The target classification result fusion unit is used to fuse the first target classification result with the second target classification result to obtain at least one third candidate category of the text to be classified.
[0193] In some optional implementations, the second classification module 1203 includes:
[0194] a fourth target feature extraction unit, configured to extract features from at least one reference case corresponding to a third candidate category based on a target text feature extraction model, and obtain a first case feature vector corresponding to the third candidate category;
[0195] A target classification probability acquisition unit, used to input the text to be classified, at least one third candidate category and the first case feature vector into the target multi-task classification model, and determine a first classification probability corresponding to the first case feature vector, wherein the first classification probability is used to characterize the correlation between the text to be classified and the first case feature vector;
[0196] The target classification category determination unit is used to determine the target classification category in at least one third candidate category based on the first classification probability.
[0197] In some optional implementations, the data processing device of the present disclosure further includes:
[0198] A feedback information acquisition module is used to obtain feedback information of target classification categories;
[0199] The reference case updating module is used to add the text to be classified to the reference case of at least one corresponding second candidate category based on the target classification category if the feedback information indicates that the text to be classified matches the target classification category.
[0200] In some optional implementations, the data processing device of the present disclosure further includes: a category information updating module, which is used to determine the second category information. The category information updating module includes:
[0201] An update information acquisition unit, configured to acquire category information to be updated, a first sample text, and a first sample category of the first sample text, wherein the category information to be updated includes initial description information of at least one target update category and a corresponding initial case, and the target update category is obtained by updating the first candidate category;
[0202] A primary category classification unit, used to classify the first sample text based on the first description information and the initial description information, so as to obtain at least one sample candidate category of the first sample text;
[0203] A secondary category classification unit, configured to determine a predicted classification category of the first sample text in at least one sample candidate category based on a correlation between the first sample text and an initial case corresponding to at least one sample candidate category;
[0204] The category information updating unit is used to use the category information to be updated as the second category information if the predicted classification category matches the first sample category.
[0205] In some optional implementations, the category information updating module further includes:
[0206] A newly added information acquisition unit, configured to acquire adjustment information for at least one target update category if the predicted classification category does not match the first sample category, the adjustment information including newly added description information and / or newly added precedents;
[0207] A description information updating unit, configured to update initial description information corresponding to at least one target update category based on the newly added description information;
[0208] The initial case updating unit is used to update the initial case corresponding to at least one target update category based on the newly added case.
[0209] In some optional embodiments, the primary classification unit includes:
[0210] A first feature extraction subunit is used to extract features from the first sample text to obtain a first sample text feature vector;
[0211] A second feature extraction subunit is used to extract features from the initial description information based on a first feature extraction model to obtain a first sample category feature vector, wherein the first feature extraction model is used to extract features from description information in multiple scenarios;
[0212] A third feature extraction subunit is used to extract features from the first description information based on a second feature extraction model to obtain a second sample category feature vector, wherein the second feature extraction model is used to extract features from the description information in the scene corresponding to the to-be-classified text;
[0213] A first text classification subunit is used to classify the first sample text based on the first sample category feature vector and the correlation of the first sample text feature vector to obtain a first sample classification result;
[0214] A second text classification subunit is used to classify the first sample text based on the correlation between the second sample category feature vector and the first sample text feature vector to obtain a second sample classification result;
[0215] The classification result fusion subunit is used to fuse the first sample classification result with the second sample classification result to obtain at least one sample candidate category of the first sample text.
[0216] In some optional embodiments, the secondary category classification unit includes:
[0217] A fourth feature extraction subunit is used to extract features from an initial case corresponding to at least one sample candidate category based on a target text feature extraction model to obtain a second case feature vector;
[0218] A classification probability acquisition subunit, used to input the first sample text, at least one sample candidate category and the second case feature vector into the target multi-task classification model, and determine a second classification probability corresponding to the second case feature vector, where the second classification probability is used to characterize the correlation between the first sample text and the second case feature vector;
[0219] The classification category determination subunit is used to determine a predicted classification category from at least one sample candidate category based on the second classification probability.
[0220] In some optional implementations, the data processing device of the present disclosure further includes a first model updating module, which is used to determine the second feature extraction model. The first model updating module includes:
[0221] A first sample information acquisition unit, used to acquire a second sample text and at least one category description information in a scene corresponding to the text to be classified;
[0222] A first sample feature extraction unit is used to extract features from the second sample text to obtain a second sample text feature vector;
[0223] A second sample feature extraction unit is used to extract features from at least one category description information based on a preset feature extraction model to obtain a third sample category feature vector;
[0224] A third sample feature extraction unit is used to extract features from at least one category description information based on the first feature extraction model to obtain a fourth sample category feature vector;
[0225] The first model parameter updating unit is used to update the parameters of the preset feature extraction model based on the alignment loss between the second sample text feature vector and the third sample category feature vector, the alignment loss between the second sample text feature vector and the fourth sample category feature vector, and the error loss between the third sample category feature vector and the fourth sample category feature vector to obtain a second feature extraction model.
[0226] In some optional implementations, the first model parameter updating unit includes:
[0227] A sample category acquisition subunit, used to acquire a second sample category corresponding to the second sample text;
[0228] A first loss calculation subunit, used for determining a first alignment loss based on the second sample text feature vector, the third sample category feature vector and the second sample category;
[0229] A second loss calculation subunit, used to determine a second alignment loss based on the second sample text feature vector, the fourth sample category feature vector and the second sample category;
[0230] A third loss operation subunit, used to determine the error loss based on the third sample category feature vector and the fourth sample category feature vector;
[0231] The model parameter updating subunit is used to update the parameters of the preset feature extraction model based on the first alignment loss, the second alignment loss and the error loss to obtain a second feature extraction model.
[0232] In some optional implementations, the data processing device of the present disclosure further includes a second model updating module for determining a target multi-task classification model. The second model updating module includes:
[0233] A sample case obtaining unit, used for obtaining sample cases;
[0234] A sample case word segmentation unit is used to segment the sample case to obtain a first word segmentation result;
[0235] A sample case masking unit, used to mask the target position in the first word segmentation result to obtain a second word segmentation result;
[0236] A first case feature extraction unit, configured to extract features from the first word segmentation result based on a target text feature extraction model to obtain a third case feature vector;
[0237] A case mask prediction unit, used for inputting the second word segmentation result and the third case feature vector into a preset multi-task classification model to obtain a mask prediction result;
[0238] The second model parameter updating unit is used to update the parameters of the preset multi-task classification model based on the prediction result and the first word segmentation result to obtain a target multi-task classification model.
[0239] In some optional implementations, the second model updating module further includes:
[0240] A second sample information acquisition unit, used to acquire a third sample text and a corresponding third sample category;
[0241] A fourth sample feature extraction unit, used to obtain a third sample text feature vector of the third sample text;
[0242] A sample case replacement unit, used for marking the third sample text feature vector as a case of a third sample category;
[0243] A classification probability calculation unit, used for inputting the third sample text, the third sample category and the third sample text feature vector into a preset multi-task classification model to obtain a third classification probability of the third sample category;
[0244] The third model parameter updating unit is used to update the parameters of the preset multi-task classification model based on the third classification probability to obtain a target multi-task classification model.
[0245] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0246] The data processing device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0247] The present disclosure also provides an electronic device having the above Fig.12 The data processing device shown.
[0248] See also Fig.13 , Fig.13 is a structural block diagram of an electronic device provided by an optional embodiment of the present disclosure, such as Fig.13 As shown, the electronic device includes: one or more processors 1301, memory 1302, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.13 A processor 1301 is taken as an example.
[0249] The processor 1301 may be a central processing unit, a network processor or a combination thereof. The processor 1301 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.
[0250] The memory 1302 stores instructions executable by at least one processor 1301 , so that the at least one processor 1301 executes the method shown in the above embodiment.
[0251] The memory 1302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 1302 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 1302 may optionally include a memory remotely arranged relative to the processor 1301, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0252] The memory 1302 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 1302 may also include a combination of the above types of memory.
[0253] The electronic device also includes an input device 1303 and an output device 1304. The processor 1301, the memory 1302, the input device 1303 and the output device 1304 may be connected via a bus or other means. Fig.13 The example of connecting through bus is taken in the following.
[0254] The input device 1303 can receive input digital or character information, and generate key signal input related to the user settings and function control of the electronic device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick, etc. The output device 1304 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0255] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0256] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0257] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A data processing method, characterized in that: The method comprises: Acquire a text to be classified, first category information, and second category information, wherein the first category information includes first description information of at least one first candidate category and a corresponding reference case, and the second category information includes second description information of at least one second candidate category and a corresponding reference case, wherein the at least one second candidate category is obtained by updating the at least one first candidate category; Classifying the text to be classified based on the first description information and the second description information respectively to obtain at least one third candidate category of the text to be classified; Based on the correlation between the text to be classified and the reference case corresponding to the at least one third candidate category, a target classification category of the text to be classified is determined in the at least one third candidate category.
2. The data processing method according to claim 1, characterized in that: The classifying the text to be classified based on the first description information and the second description information respectively to obtain at least one third candidate category of the text to be classified includes: Extracting features of the text to be classified to obtain a target text feature vector; Performing feature extraction on the second description information based on a first feature extraction model to obtain a first target category feature vector, wherein the first feature extraction model is used to perform feature extraction on description information in multiple scenarios; Performing feature extraction on the first description information based on a second feature extraction model to obtain a second target category feature vector, wherein the second feature extraction model is used to perform feature extraction on the description information in the scene corresponding to the text to be classified; Based on the correlation between the first target category feature vector and the target text feature vector, classify the text to be classified to obtain a first target classification result; Based on the correlation between the second target category feature vector and the target text feature vector, classify the text to be classified to obtain a second target classification result; The first target classification result and the second target classification result are fused to obtain at least one third candidate category of the text to be classified.
3. The data processing method according to claim 1, characterized in that: The step of determining a target classification category of the text to be classified in the at least one third candidate category based on the correlation between the text to be classified and the reference case corresponding to the at least one third candidate category includes: Extracting features of the reference case corresponding to the at least one third candidate category based on the target text feature extraction model to obtain a first case feature vector corresponding to the third candidate category; Inputting the text to be classified, the at least one third candidate category, and the first case feature vector into a target multi-task classification model, and determining a first classification probability corresponding to the first case feature vector, wherein the first classification probability is used to characterize the correlation between the text to be classified and the first case feature vector; The target classification category is determined from among the at least one third candidate category based on the first classification probability.
4. The data processing method according to claim 1, characterized in that: The method further comprises: Obtaining feedback information of the target classification category; If the feedback information indicates that the text to be classified matches the target classification category, then based on the target classification category, the text to be classified is added to the reference case of the corresponding at least one second candidate category.
5. The data processing method according to claim 1, characterized in that: The second type of information is determined by: Acquire category information to be updated, a first sample text, and a first sample category of the first sample text, wherein the category information to be updated includes initial description information of at least one target update category and a corresponding initial case, and the target update category is obtained by updating the first candidate category; Classifying the first sample text based on the first description information and the initial description information to obtain at least one sample candidate category of the first sample text; Determining a predicted classification category of the first sample text in the at least one sample candidate category based on the correlation between the first sample text and the initial case corresponding to the at least one sample candidate category; If the predicted classification category matches the first sample category, the category information to be updated is used as the second category information.
6. The data processing method according to claim 5, characterized in that: The method for determining the second category of information also includes: If the predicted classification category does not match the first sample category, obtaining adjustment information for the at least one target update category, the adjustment information including newly added description information and / or newly added precedents; Updating the initial description information corresponding to the at least one target update category based on the newly added description information; An initial case corresponding to the at least one target update category is updated based on the newly added case.
7. The data processing method according to claim 5, characterized in that: The classifying the first sample text based on the first description information and the initial description information to obtain at least one sample candidate category of the first sample text includes: Performing feature extraction on the first sample text to obtain a first sample text feature vector; Extracting features from the initial description information based on a first feature extraction model to obtain a first sample category feature vector, wherein the first feature extraction model is used to extract features from description information in multiple scenarios; Performing feature extraction on the first description information based on a second feature extraction model to obtain a second sample category feature vector, wherein the second feature extraction model is used to perform feature extraction on the description information in the scene corresponding to the text to be classified; Based on the correlation between the first sample category feature vector and the first sample text feature vector, classifying the first sample text to obtain a first sample classification result; Based on the correlation between the second sample category feature vector and the first sample text feature vector, classifying the first sample text to obtain a second sample classification result; The first sample classification result and the second sample classification result are fused to obtain at least one sample candidate category of the first sample text.
8. The data processing method according to claim 5, characterized in that: The step of determining the predicted classification category of the first sample text in the at least one sample candidate category based on the correlation between the first sample text and the initial case corresponding to the at least one sample candidate category includes: Extracting features from the initial case corresponding to the at least one sample candidate category based on the target text feature extraction model to obtain a second case feature vector; Inputting the first sample text, the at least one sample candidate category, and the second case feature vector into a target multi-task classification model, determining a second classification probability corresponding to the second case feature vector, wherein the second classification probability is used to characterize the correlation between the first sample text and the second case feature vector; The predicted classification category is determined from among the at least one sample candidate category based on the second classification probability.
9. The data processing method according to claim 2 or 7, characterized in that: The second feature extraction model is determined in the following manner: Obtaining a second sample text and at least one category description information in a scene corresponding to the text to be classified; Performing feature extraction on the second sample text to obtain a second sample text feature vector; Performing feature extraction on the at least one category description information based on a preset feature extraction model to obtain a third sample category feature vector; Performing feature extraction on the at least one category description information based on the first feature extraction model to obtain a fourth sample category feature vector; Based on the alignment loss between the second sample text feature vector and the third sample category feature vector, the alignment loss between the second sample text feature vector and the fourth sample category feature vector, and the error loss between the third sample category feature vector and the fourth sample category feature vector, the parameters of the preset feature extraction model are updated to obtain the second feature extraction model.
10. The data processing method according to claim 9, characterized in that: The method updates the parameters of the preset feature extraction model based on the alignment loss between the second sample text feature vector and the third sample category feature vector, the alignment loss between the second sample text feature vector and the fourth sample category feature vector, and the error loss between the third sample category feature vector and the fourth sample category feature vector to obtain the second feature extraction model, including: Obtaining a second sample category corresponding to the second sample text; Determine a first alignment loss based on the second sample text feature vector, the third sample category feature vector, and the second sample category; Determine a second alignment loss based on the second sample text feature vector, the fourth sample category feature vector, and the second sample category; Determining an error loss based on the third sample category feature vector and the fourth sample category feature vector; Based on the first alignment loss, the second alignment loss and the error loss, the parameters of the preset feature extraction model are updated to obtain the second feature extraction model.
11. The data processing method according to claim 3 or 8, characterized in that: The target multi-task classification model is determined by: Obtain sample cases; Performing word segmentation on the sample case to obtain a first word segmentation result; Masking the target position in the first word segmentation result to obtain a second word segmentation result; Performing feature extraction on the first word segmentation result based on the target text feature extraction model to obtain a third case feature vector; Inputting the second word segmentation result and the third case feature vector into a preset multi-task classification model to obtain a prediction result of the mask; Based on the prediction result and the first word segmentation result, the parameters of the preset multi-task classification model are updated to obtain the target multi-task classification model.
12. The data processing method according to claim 3 or 8, characterized in that: The method for determining the target multi-task classification model also includes: Obtaining a third sample text and a corresponding third sample category; Obtaining a third sample text feature vector of the third sample text; Marking the third sample text feature vector as a case of the third sample category; Inputting the third sample text, the third sample category and the third sample text feature vector into a preset multi-task classification model to obtain a third classification probability of the third sample category; The parameters of the preset multi-task classification model are updated based on the third classification probability to obtain the target multi-task classification model.
13. A data processing device, characterized in that: The device comprises: A data acquisition module, used to acquire a text to be classified, first category information and second category information, wherein the first category information includes first description information of at least one first candidate category and a corresponding reference case, and the second category information includes second description information of at least one second candidate category and a corresponding reference case, wherein the at least one second candidate category is obtained by updating the at least one first candidate category; A first classification module, used for classifying the text to be classified based on the first description information and the second description information, respectively, to obtain at least one third candidate category of the text to be classified; The second classification module is used to determine a target classification category of the text to be classified in the at least one third candidate category based on the correlation between the text to be classified and the reference case corresponding to the at least one third candidate category.
14. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the data processing method according to any one of claims 1 to 12 by executing the computer instructions.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the data processing method according to any one of claims 1 to 12.
16. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the data processing method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Image feature extraction model training method, image retrieval method and related equipment
CN115131570A
Classification method and related equipment
CN117421645A
Large language model auxiliary classification method and device, equipment and medium
CN117851598A
