Classification method, apparatus, device, and computer storage medium

By calculating the similarity between the text to be identified and multi-level tags in a preset model, the tags are automatically determined, solving the problem of inaccurate labeling by operators and improving the accuracy and ease of use of labeling.

CN114048802BActive Publication Date: 2025-10-28CCB FINTECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, operators often label user problems and feedback inaccurately, resulting in a heavy workload and inaccurate labeling.

Method used

By inputting the preset primary and secondary labels into the preset model, the corresponding feature array is generated, and the similarity between the text to be identified and the label is calculated using the preset algorithm, thus automatically determining the label corresponding to the text and avoiding manual annotation.

Benefits of technology

It improves the accuracy and ease of use of labeling, reduces errors in manual labeling, and increases labeling efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114048802B_ABST
    Figure CN114048802B_ABST
Patent Text Reader

Abstract

This invention provides a classification method, apparatus, device, and computer storage medium. This invention belongs to the fields of artificial intelligence recognition, artificial intelligence language, and natural language understanding. By inputting multiple primary and secondary labels into a first preset model, a first feature array and a second feature array corresponding to the primary and secondary labels are obtained. The text to be recognized is then input into the first preset model to obtain a third feature array. The primary and secondary labels corresponding to the text to be recognized are then determined by calculating the similarity between the first and second feature arrays and the third feature array, respectively. Therefore, by training a model to automatically label the text to be recognized, the problem of inaccurate labeling caused by manual labeling by operators is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of artificial intelligence recognition, artificial intelligence language and natural language understanding, and particularly relates to a classification method, apparatus, device and computer storage medium. Background Technology

[0002] To improve service levels, various companies, platforms, and government departments have established service hotlines to collect user questions and feedback. During hotline service, operators typically record user questions and feedback manually. To facilitate recording, operators usually label user questions and feedback with different tags. However, due to the large number of tag types and the heavy workload of operators, the labels used for user questions and feedback are often inaccurate. Summary of the Invention

[0003] This invention provides a classification method, apparatus, device, and computer storage medium that can improve the accuracy of labeling user questions and feedback.

[0004] In a first aspect, embodiments of the present invention provide a classification method, the method comprising:

[0005] Multiple preset primary and secondary labels are input into the first preset model to obtain a first feature array corresponding to the primary label and a second feature array corresponding to the secondary label.

[0006] The text to be recognized is input into the first preset model to obtain the third feature array;

[0007] The first feature array and the third feature array are processed based on a preset algorithm to obtain the first operation result; the first operation result represents the similarity between the text to be identified and multiple first-level tags;

[0008] The second feature array and the third feature array are processed based on a preset algorithm to obtain the second operation result; the second operation result represents the similarity between the text to be identified and multiple secondary tags.

[0009] The primary and secondary tags corresponding to the text to be identified are determined based on the similarity between the text to be identified and multiple primary tags and multiple secondary tags.

[0010] As an optional implementation, before inputting the preset primary and secondary labels into the first preset model, the method further includes:

[0011] The second preset model is trained multiple times to obtain the first training result corresponding to the multiple training sessions.

[0012] The accuracy of the training results is evaluated based on the evaluation function, and the target training result corresponding to the first evaluation result with the highest accuracy among multiple evaluation results is obtained.

[0013] The second preset model after training, corresponding to the target training result, is determined as the first preset model.

[0014] As an optional implementation, the method further includes, before training the second preset model multiple times:

[0015] The training samples are input into the third preset model to obtain the second training result;

[0016] The loss function value corresponding to the second training result is determined;

[0017] If the loss function does not meet the preset conditions, the third preset model is optimized according to the preset strategy;

[0018] Repeat the training process for the third preset model until the loss function value meets the preset condition; the third preset model whose loss function value meets the preset condition is determined as the second preset model.

[0019] As an optional implementation, the loss function includes:

[0020]

[0021] Among them, Ω neg Ω represents the primary and secondary labels corresponding to the training samples in the training results. pos S represents the primary or secondary label that does not correspond to the training sample in the training result, S represents the numerical value corresponding to the primary or secondary label in the training result, A represents the weight, K represents the label level, and L represents the loss function value; the weight includes the preset weight determined based on the number of training iterations.

[0022] As an alternative implementation, each primary tag corresponds to at least one secondary tag.

[0023] As an optional implementation, a first operation result is obtained by performing operations on the first feature array and the third feature array based on a preset algorithm, specifically including:

[0024] Perform a dot product between the first feature array and the third feature array to obtain the fourth feature array; use the fourth feature array as the first operation result.

[0025] The second feature array and the third feature array are processed based on a preset algorithm to obtain the second operation result, which specifically includes:

[0026] Perform a dot product between the first feature array and the third feature array to obtain the fifth feature array; use the fifth feature array as the result of the second operation.

[0027] As an optional implementation, the primary and secondary tags corresponding to the text to be identified are determined based on the first and second operation results, specifically including:

[0028] If the data corresponding to the first-level label indicated by the fourth feature array meets the preset threshold, the first-level label corresponding to the data meeting the threshold is determined as the first-level label of the text to be identified.

[0029] If the data corresponding to the secondary label indicated by the fifth feature array meets the preset threshold, the secondary label corresponding to the data that meets the threshold is determined as the secondary label of the text to be identified.

[0030] As an optional implementation, the text to be recognized is input into a first preset model to obtain a third feature array, specifically including: organizing the text to be recognized into a preset format of text to be recognized;

[0031] The text to be recognized in a preset format is input into the first preset model to obtain the third feature array.

[0032] Secondly, embodiments of the present invention provide a classification device, the device comprising: a first input module, configured to input a plurality of preset primary labels and secondary labels into a first preset model respectively, to obtain a first feature array corresponding to the primary labels and a second feature array corresponding to the secondary labels;

[0033] The second input module is used to input the text to be recognized into the first preset model to obtain the third feature array;

[0034] The first calculation module is used to perform calculations on the first feature array and the third feature array based on a preset algorithm to obtain a first calculation result; the first calculation result represents the similarity between the text to be identified and multiple first-level tags;

[0035] The second calculation module is used to perform calculations on the second feature array and the third feature array based on a preset algorithm to obtain the second calculation result; the second calculation result represents the similarity between the text to be identified and multiple secondary tags;

[0036] The determination module is used to determine the primary and secondary labels corresponding to the text to be identified based on the similarity between the text to be identified and multiple primary labels and multiple secondary labels.

[0037] Thirdly, embodiments of this application provide a classification device, which may include: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the classification method as described in any embodiment of the first aspect.

[0038] Fourthly, embodiments of this application provide a computer storage medium on which a computer program is stored, and when executed by a processor, the computer program implements the steps of the classification method as described in any embodiment of the first aspect.

[0039] Compared with the prior art, this application has at least the following beneficial effects:

[0040] In the classification method provided in this application embodiment, multiple primary and secondary labels are input into a first preset model to obtain a first feature array and a second feature array corresponding to the primary and secondary labels. The text to be identified is then input into the first preset model to obtain a third feature array. The primary and secondary labels corresponding to the text to be identified are then determined by calculating the similarity between the first and second feature arrays and the third feature array, respectively. Therefore, by training the model to automatically label the text to be identified, the problem of inaccurate labeling caused by manual labeling by operators is avoided. Furthermore, the labels are editable, improving the ease of use of labeling. Attached Figure Description

[0041] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0042] Figure 1 This is a flowchart illustrating a classification method provided in an embodiment of the present invention;

[0043] Figure 2 This is a flowchart illustrating another classification method provided in an embodiment of the present invention;

[0044] Figure 3 This is a flowchart illustrating another classification method provided in an embodiment of the present invention;

[0045] Figure 4 This is a schematic diagram of the structure of a sorting device provided in an embodiment of the present invention;

[0046] Figure 5 This is a schematic diagram of the structure of a sorting device provided in an embodiment of the present invention. Detailed Implementation

[0047] The features and exemplary embodiments of various aspects of the present invention will now be described in detail. To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely intended to explain the present invention and not to limit the present invention. For those skilled in the art, the present invention can be practiced without some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present invention by illustrating examples of the invention.

[0048] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0049] Currently, several models exist for multi-level label classification. One approach transforms the multi-level label classification model into multiple single-level labels corresponding to the multi-level labels, and then trains each single-level label separately. Another approach uses multiple independent models to train labels at different levels. However, both of these training models disrupt the relationships between labels at different levels, resulting in inaccurate classification results. A third approach preserves the hierarchical relationships between multi-level labels, treating them as a whole for training. This method, however, requires retraining when a label at a particular level is changed to avoid further inaccuracies due to altered relationships. This makes the training process cumbersome and inefficient overall.

[0050] To address the problems of the prior art, this invention provides a classification method 100. Figure 1 This document illustrates a flowchart of a classification method 100 provided in an embodiment of this application. Figure 1 The method shown may include:

[0051] S110. Input multiple preset first-level labels and second-level labels into the first preset model to obtain the first feature array corresponding to the first-level labels and the second feature array corresponding to the second-level labels.

[0052] S120. Input the text to be recognized into the first preset model to obtain the third feature array.

[0053] S130. The first feature array and the third feature array are operated on based on the preset algorithm to obtain the first operation result; the first operation result represents the similarity between the text to be identified and multiple first-level tags.

[0054] S140. The second feature array and the third feature array are operated on based on the preset algorithm to obtain the second operation result; the second operation result represents the similarity between the text to be identified and multiple secondary tags.

[0055] S150. Determine the primary and secondary labels corresponding to the text to be identified based on the similarity between the text to be identified and multiple primary labels and multiple secondary labels.

[0056] The specific implementation methods of the above steps will be described in detail below.

[0057] First, let's introduce S110. The primary and secondary labels can include key words within the text to be identified for classification. The first feature array can include an array corresponding to the number of primary labels and the number of texts to be identified. The second feature array can include an array corresponding to the number of secondary labels and the number of texts to be identified. Both primary and secondary labels can include user-defined labels.

[0058] As an example, if there are 7 primary labels (maximum 10 characters), 157 secondary labels (maximum 15 characters), and 64 characters of text to be recognized (text longer than 64 characters is truncated, and text shorter than 64 characters is padded), then the primary labels can be 7*10 dimensional vectors, and the secondary labels can be 157*15 dimensional vectors, with zeros used to pad for shorter text. After passing through the first preset model, the first feature array can include a 7*768 array, and the second feature array can include a 157*768 array. As an example, the primary and secondary labels can be treated as two independent types of labels.

[0059] As an example, primary and secondary labels can contain associations. Each primary label corresponds to at least one secondary label. By training the primary labels, secondary labels, and the text to be identified separately, the primary and secondary labels can be matched with the text to be identified without disrupting the association between them. This establishes a correspondence between the text to be identified and the primary and secondary labels, ensuring that even if either the primary or secondary label is changed, the correspondence between the primary and secondary labels is preserved, even without retraining the model. This leads to accurate model classification.

[0060] Similar to S110, in S120, the text to be recognized is also input into the first preset model to obtain the third feature array.

[0061] The text to be recognized may include at least one of speech, text, or text converted from speech. The third feature array may include a feature array corresponding to the number of characters in the text to be recognized.

[0062] As an example, if the text to be recognized has 64 characters, then the corresponding text to be recognized is a 1*64 dimensional vector. The third feature array can include a 768*1 feature array.

[0063] After obtaining the first feature array, the second feature array, and the third feature array, execute S130.

[0064] In S130, the preset algorithm may include the DotProduct vector dot product algorithm, and the first operation result may include the feature array obtained by multiplying the first feature array and the third feature array.

[0065] As an example, S130 may specifically include: using the DotProduct vector dot product algorithm to perform a dot product between the first feature array and the third feature array to obtain a fourth feature array after dot product; and using the fourth feature array as the first operation result.

[0066] As an example, after multiplying the first feature array and the third feature array using the dot product algorithm, the resulting fourth feature can be the dot product of the 7*768 first feature array and the 768*1 third feature array, outputting a 7*1 dimension fourth feature array.

[0067] As an example, the fourth feature array is obtained by multiplying the first and third feature arrays. If the result of the multiplication in the fourth feature array is greater than 0, it means that the data at the corresponding positions in the first and third feature arrays are similar.

[0068] To illustrate with a specific example, the resulting 7*1 dimensional fourth feature array can include [-0.2, 0.33, -0.3, 0.4, -0.15, -0.23, -0.44], and the first-level labels corresponding to the first feature array can include [transportation, education, medical care, insurance, housing, sanitation, safety]. Therefore, it can be determined that the text to be identified corresponding to the third feature array is similar to the education and insurance labels in the first-level labels.

[0069] In S140, similar to S130, S140 may specifically include performing a dot product between the first feature array and the third feature array to obtain a fifth feature array after the dot product; and using the fifth feature array as the second operation result.

[0070] As an example, after multiplying the second and third feature arrays using the dot product algorithm, the resulting fifth feature array can be a 157*768 second feature array multiplied by a 768*1 third feature array, outputting a 157*1 dimension fifth feature array.

[0071] As an example, the fifth feature array is obtained by multiplying the second and third feature arrays. If the result of the multiplication in the fifth feature array is greater than 0, it means that the data at the corresponding positions in the second and third feature arrays are similar.

[0072] After obtaining the fourth feature array and the fifth feature array, step S150 is performed based on the fourth feature array and the fifth feature array.

[0073] In S150, determining the primary and secondary labels corresponding to the text to be identified based on the similarity between the text to be identified and multiple primary labels and multiple secondary labels may include:

[0074] As an example, S150 may specifically include determining the first-level label corresponding to the data that meets the preset threshold as the first-level label of the text to be identified when the data indicated by the fourth feature array meets the preset threshold.

[0075] If the data corresponding to the secondary label indicated by the fifth feature array meets the preset threshold, the secondary label corresponding to the data that meets the threshold is determined as the secondary label of the text to be identified.

[0076] The obtained fourth feature array is a 7*1 dimensional array. For example, the fourth array includes [-0.2, 0.33, -0.3, 0.4, -0.15, -0.23, -0.44]. Each number corresponds to a first-level label. When the number corresponding to the first-level label is less than 0, it means the similarity obtained by multiplying the first and third feature arrays is less than 0. Furthermore, the text to be identified is not similar to the first-level label corresponding to this number. When the number corresponding to the first-level label is greater than 0, it means the similarity obtained by multiplying the first and third feature arrays is greater than 0. Furthermore, the text to be identified is similar to the first-level label corresponding to this number, indicating that the text to be identified corresponds to this first-level label.

[0077] Similarly, the obtained fifth feature array is a 157*1 dimension fourth feature array. For example, the fourth array includes [0.2, -0.2, 0.3, 0.44, 0.5…]. Each number corresponds to a secondary label. When the number corresponding to the secondary label is greater than 0, it means the similarity obtained by multiplying the second and third feature arrays is greater than 0, indicating that the text to be identified is similar to the secondary label corresponding to that number. When the number corresponding to the secondary label is less than 0, it means the similarity obtained by multiplying the second and third feature arrays is less than 0, indicating that the text to be identified is not similar to the secondary label corresponding to that number, meaning the text to be identified does not correspond to that secondary label.

[0078] In the classification method provided in this application, multiple primary and secondary labels are input into a first preset model to obtain a first feature array and a second feature array corresponding to the primary and secondary labels. The text to be identified is then input into the first preset model to obtain a third feature array. The primary and secondary labels corresponding to the text to be identified are then determined by calculating the similarity between the first and second feature arrays and the third feature array, respectively. Therefore, by training the model to automatically label the text to be identified, the problem of inaccurate labeling caused by manual labeling by operators is avoided.

[0079] In some implementations, in order to make the text to be identified easier to be classified by the first preset model, S120 may specifically include: organizing the text to be identified into a preset format.

[0080] The text to be recognized in a preset format is input into the first preset model to obtain the third feature array.

[0081] The format can include a preset number of characters. For example, if the original text to be recognized has 69 characters, the text is organized into a second group consisting of the first 64 characters, with the remaining 5 characters padded with zeros to make a total of 64 characters. Organizing the format of the text to be recognized converts it into a standard format, which helps obtain a third feature array corresponding to the number of characters in the standard format text after model training. Furthermore, it simplifies the subsequent operations involving the first or second feature array and the third feature array.

[0082] To make the classification results of the first preset model more accurate, this application embodiment also provides another classification method 200. Figure 1 A flowchart illustrating another classification method is shown, such as... Figure 2 As shown, the difference between method 200 and 100 is that method 200 may further include:

[0083] S210. Train the second preset model multiple times to obtain the first training result corresponding to the multiple training sessions.

[0084] S220. Evaluate the accuracy of the training results according to the evaluation function, and obtain the target training result corresponding to the first evaluation result with the highest accuracy among multiple evaluation results.

[0085] S230. The second preset model after training corresponding to the target training result is determined as the first preset model.

[0086] The specific implementation methods of the above steps will be described in detail below.

[0087] In S210, the second preset model may include the third preset model after optimization. The first training result corresponding to multiple training sessions may include multiple first training results corresponding to multiple training sessions.

[0088] As an example, S210 may specifically include:

[0089] The second preset model is trained multiple times using training samples; for example, 50 training iterations can be performed. This yields multiple first training results corresponding to the multiple training iterations.

[0090] After obtaining multiple first training results, proceed to step S220.

[0091] In S220, the evaluation function may include a function that evaluates the accuracy of the training results. For example, the evaluation function may include:

[0092]

[0093] Where P is precision, representing the proportion of correctly predicted positive samples out of the actual predicted positive samples; R is recall, representing the proportion of correctly predicted positive samples out of the total positive samples; and F is a comprehensive indicator.

[0094] The first evaluation result can include the evaluation result corresponding to the highest accuracy obtained by the evaluation function. The target training result can include the training result corresponding to the first evaluation result.

[0095] As an example, after obtaining multiple first training results, the classification device inputs the corresponding values ​​of the multiple first results into the above evaluation function to obtain the evaluation results corresponding to the multiple first training results. Then, the evaluation result with the highest accuracy among the multiple evaluation results is taken as the first evaluation result, and the training result corresponding to the first evaluation result is taken as the target training result.

[0096] After obtaining training results for multiple targets, proceed to step S230.

[0097] S230 may specifically include:

[0098] The classification device determines the second preset model after training corresponding to the obtained target training result as the first preset model.

[0099] In the classification method provided in this application embodiment, by training the second preset model multiple times, and then determining the trained second preset model corresponding to the training result with the highest accuracy as the first preset model, the classification result of the first preset model can be more accurate when classifying the text to be recognized.

[0100] To obtain the second preset model, this application embodiment also provides another classification method 300. Figure 3 A flowchart illustrating another classification method is shown, such as... Figure 3 As shown, the difference between method 300 and 200 is that method 300 may further include:

[0101] S310. Input the training samples into the third preset model to obtain the second training result.

[0102] S320. Determine the loss function value corresponding to the loss function based on the second training result.

[0103] S330. If the loss function does not meet the preset conditions, optimize the third preset model according to the preset strategy.

[0104] S340. Repeat the training process of the third preset model until the loss function value meets the preset condition; determine the third preset model whose loss function value meets the preset condition as the second preset model.

[0105] The specific implementation methods of the above steps will be described in detail below.

[0106] First, let's introduce S310. The third preset model can include the BERT model. Essentially, the BERT model learns a good feature representation for words by running a self-supervised learning method on massive corpora. Self-supervised learning refers to supervised learning running on unlabeled data. In specific Natural Language Processing (NLP) tasks, we can directly use BERT's feature representations as word embedding features for that task. Therefore, BERT provides a model for transfer learning in other tasks; this model can be fine-tuned or fixed as a feature extractor depending on the task. BERT's biggest feature is that it abandons traditional Recurrent Neural Networks (RNNs) and Convolutional Neural Networks (CNNs), using an attention mechanism to convert the distance between two words at any position to 1, effectively solving the thorny long-term dependency problem in NLP. In S310, training samples can include positive and negative samples. Positive samples can include the first-level and second-level labels corresponding to the text to be recognized. Negative samples can include the first-level and second-level labels that do not correspond to the text to be recognized. The second training result can be the training result obtained by inputting the above first-level and second-level labels into the third preset model. The third preset model may include the untrained first preset model.

[0107] As an example, the training module takes training samples, including both positive and negative samples, as input to a third preset model and then obtains the training results, which serve as the second training result.

[0108] After obtaining the second training result, step S320 is executed based on the second training result.

[0109] In S320, the loss function includes:

[0110]

[0111] Among them, Ω neg Ω represents the primary and secondary labels corresponding to the training samples in the training results. pos S represents the primary or secondary label that does not correspond to the training sample in the training result, S represents the numerical value corresponding to the primary or secondary label in the training result, A represents the weight, K represents the label level, and L represents the loss function value; the weight includes the preset weight determined based on the number of training iterations.

[0112] In this model training process, a branch training strategy is introduced. The weight A of the branch loss function changes with Epoch, with an initial weight of [0.8, 0.2], [0.1, 0.9] at Epoch 20, and [0, 1] at Epoch 40, where Epoch represents the total number of training iterations. The weight changes are shown in Table 1 below.

[0113] Epoch First-level tag weight Secondary label weight 0 0.8 0.2 20 0.1 0.9 40 0 1

[0114] Table 1

[0115] Specifically, S320 may include: after obtaining the training results, inputting the corresponding values ​​of the training results into the above loss function to obtain the corresponding loss function value.

[0116] After obtaining the corresponding loss function value, the classification device executes step S330.

[0117] In S330, preset conditions may include preset thresholds, which are not specifically limited here. Preset strategies may include adjusting the parameters of a third preset model, and adjusting the parameters of the third preset model may include various methods, which are not specifically limited here.

[0118] As an example, S330 may specifically include the classification device inputting the corresponding numbers from the training results into the aforementioned loss function, and adjusting the parameters of the third preset model if the obtained loss function value does not meet a preset threshold, thereby obtaining the adjusted third preset model.

[0119] After obtaining the adjusted third preset model, proceed to step S340.

[0120] S340 may specifically include:

[0121] The training samples are input into the adjusted third preset model to obtain the training results output by the adjusted third preset model. The corresponding values ​​of the training results are then input into the aforementioned loss function to obtain the loss function value corresponding to the adjusted third preset model. The loss function value corresponding to the adjusted third preset model is then compared with preset conditions. If the obtained loss function value does not meet the preset conditions, the above training and optimization processes are repeated. The training and optimization processes are stopped until the obtained loss function value meets the preset conditions.

[0122] In the classification method provided in this application embodiment, the third preset model is repeatedly trained and optimized until the loss function value corresponding to the optimized training model meets the preset conditions, at which point training stops. This makes the classification of the third preset model more accurate, further improving the accuracy of the text labeling.

[0123] Based on the same inventive concept, embodiments of this application also provide a sorting device. Figure 4 This paper shows a schematic diagram of the structure of a sorting device 400 provided in an embodiment of this application, as shown below. Figure 4 The device shown may include:

[0124] The first input module 410 can be used to input multiple preset first-level labels and second-level labels into the first preset model respectively, so as to obtain a first feature array corresponding to the first-level labels and a second feature array corresponding to the second-level labels;

[0125] The second input module 420 can be used to input the text to be recognized into the first preset model to obtain the third feature array;

[0126] The first calculation module 430 can be used to perform calculations on the first feature array and the third feature array based on a preset algorithm to obtain a first calculation result; the first calculation result represents the similarity between the text to be identified and multiple first-level tags;

[0127] The second operation module 440 can be used to perform operations on the second feature array and the third feature array based on a preset algorithm to obtain a second operation result; the second operation result represents the similarity between the text to be identified and multiple secondary tags;

[0128] The determination module 450 can be used to determine the primary and secondary labels corresponding to the text to be identified based on the similarity between the text to be identified and multiple primary labels and multiple secondary labels.

[0129] In the classification device provided in this application embodiment, multiple primary and secondary labels are input into a first preset model to obtain a first feature array and a second feature array corresponding to the primary and secondary labels. The text to be identified is then input into the first preset model to obtain a third feature array. The primary and secondary labels corresponding to the text to be identified are then determined by calculating the similarity between the first and second feature arrays and the third feature array, respectively. Therefore, by training the model to automatically label the text to be identified, the problem of inaccurate labeling caused by manual labeling by operators is avoided.

[0130] In some embodiments, the loss function may include:

[0131]

[0132] Among them, Ω neg Ω represents the primary and secondary labels corresponding to the training samples in the training results. posS represents the primary or secondary label that does not correspond to the training sample in the training result, S represents the numerical value corresponding to the primary or secondary label in the training result, A represents the weight, K represents the label level, and L represents the loss function value; the weight includes the preset weight determined based on the number of training iterations.

[0133] As an example, each first-level tag corresponds to at least one second-level tag.

[0134] By training the primary labels, secondary labels, and the text to be identified separately, the model can match the primary and secondary labels with the text to be identified without disrupting the association between them. This establishes a correspondence between the text to be identified and the primary and secondary labels, ensuring that even if either the primary or secondary label is changed, the correspondence between the primary and secondary labels is preserved, even without retraining the model. This results in accurate model classification.

[0135] As an example, the first arithmetic module 430 can specifically be used for:

[0136] Perform a dot product between the first feature array and the third feature array to obtain the fourth feature array; use the fourth feature array as the first operation result.

[0137] As an example, the second arithmetic module 440 can specifically be used for:

[0138] Perform a dot product between the first feature array and the third feature array to obtain the fifth feature array; use the fifth feature array as the result of the second operation.

[0139] As an example, module 450 can be specifically used for:

[0140] If the data corresponding to the first-level label indicated by the fourth feature array meets the preset threshold, the first-level label corresponding to the data meeting the threshold is determined as the first-level label of the text to be identified.

[0141] If the data corresponding to the secondary label indicated by the fifth feature array meets the preset threshold, the secondary label corresponding to the data that meets the threshold is determined as the secondary label of the text to be identified.

[0142] In some embodiments, the apparatus may further include:

[0143] The first training module 460 can be used to train the second preset model multiple times to obtain the first training result corresponding to the multiple training sessions.

[0144] The evaluation module 470 can be used to evaluate the accuracy of the training results according to the evaluation function, and obtain the target training result corresponding to the first evaluation result with the highest accuracy among multiple evaluation results.

[0145] The second determining module 480 can be used to determine the trained second preset model corresponding to the target training result as the first preset model.

[0146] In the classification device provided in this application embodiment, by training the second preset model multiple times, and then determining the trained second preset model corresponding to the training result with the highest accuracy as the first preset model, the classification result of the first preset model can be more accurate when classifying the text to be recognized.

[0147] In some embodiments, the apparatus may further include:

[0148] The second training module 490 can be used to input training samples into the third preset model to obtain the second training result.

[0149] The third determination module 4100 can be used to determine the loss function value corresponding to the loss function based on the second training result.

[0150] The optimization module 4110 can be used to optimize the third preset model according to the prediction strategy when the loss function does not meet the preset conditions.

[0151] The third training module 4120 can be used to repeat the training process of the third preset model until the loss function value meets the preset conditions.

[0152] In this embodiment, the third preset model is repeatedly trained and optimized until the loss function value corresponding to the optimized training model meets a preset condition, at which point training stops. This makes the classification of the third preset model more accurate, further improving the accuracy of the text labeling.

[0153] Figure 5 A schematic diagram of the hardware structure of the classification device provided in an embodiment of the present invention is shown.

[0154] The sorting device may include a processor 501 and a memory 502 storing computer program instructions.

[0155] Specifically, the processor 501 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of the present invention.

[0156] Memory 502 may include a large-capacity storage device that can be used for data or instructions. For example, and not limitingly, memory 502 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, memory 502 may include removable or non-removable (or fixed) media, or memory 502 may be a non-volatile solid-state storage device. Memory 502 may be internal or external to the integrated gateway disaster recovery device.

[0157] In one instance, memory 502 may be read-only memory (ROM). In one instance, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.

[0158] Memory 502 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Therefore, generally, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this disclosure.

[0159] The processor 501 reads and executes computer program instructions stored in the memory 502 to achieve... Figure 1 The method / steps S110 to S150 in the illustrated embodiment are completed, and the desired outcome is achieved. Figure 1-3 The technical effects achieved by executing the methods / steps shown in the examples are not elaborated here for the sake of brevity.

[0160] In one example, the classification device may also include a communication interface 505 and a bus 510. Wherein, as Figure 5 As shown, the processor 501, memory 502, and communication interface 505 are connected through bus 510 and complete communication with each other.

[0161] The communication interface 505 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of the present invention.

[0162] Bus 510 includes hardware, software, or both, that couples components of a classified device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 510 may include one or more buses. Although specific buses are described and illustrated in embodiments of the invention, the invention contemplates any suitable bus or interconnect.

[0163] Furthermore, in conjunction with the classification methods described in the above embodiments, this invention can be implemented using a computer storage medium. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the classification methods described in the above embodiments.

[0164] It should be understood that the present invention is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted. In the above embodiments, several specific steps are described and illustrated as examples. However, the method of the present invention is not limited to the specific steps described and illustrated. Those skilled in the art may make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present invention.

[0165] The functional blocks shown in the above structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this invention are programs or code segments that can be used to perform desired tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0166] It should also be noted that the exemplary embodiments described herein describe methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the steps described above. In other words, the steps may be performed in the order described in the embodiments, or in a different order, or several steps may be performed simultaneously.

[0167] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0168] The above are merely specific embodiments of the present invention. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the protection scope of the present invention.

Claims

1. A classification method, characterized in that, The method includes: Multiple preset primary and secondary labels are input into a first preset model to obtain a first feature array corresponding to the primary label and a second feature array corresponding to the secondary label. The primary and secondary labels include key words for classification and identification in the text to be identified. The primary and secondary labels contain an association relationship, and each primary label corresponds to at least one secondary label. The text to be recognized is input into the first preset model to obtain the third feature array; The first feature array and the third feature array are processed based on a preset algorithm to obtain a first operation result; the first operation result represents the similarity between the text to be identified and the multiple first-level tags; The second feature array and the third feature array are processed based on a preset algorithm to obtain a second operation result; the second operation result represents the similarity between the text to be identified and the multiple secondary tags; The primary and secondary tags corresponding to the text to be identified are determined based on the similarity between the text to be identified and the multiple primary tags and multiple secondary tags; The step of performing operations on the first feature array and the third feature array based on a preset algorithm to obtain a first operation result specifically includes: Perform a dot product between the first feature array and the third feature array to obtain a fourth feature array; use the fourth feature array as the first operation result. The second feature array and the third feature array are processed based on a preset algorithm to obtain a second processing result, which specifically includes: Perform a dot product between the first feature array and the third feature array to obtain a fifth feature array; use the fifth feature array as the second operation result. The step of determining the primary and secondary tags corresponding to the text to be identified based on the first and second calculation results specifically includes: When the fourth feature array indicates that the data corresponding to the first-level label meets a preset threshold, the first-level label corresponding to the data meeting the threshold is determined as the first-level label corresponding to the text to be identified. If the data corresponding to the secondary label, as indicated by the fifth feature array, meets a preset threshold, the secondary label corresponding to the data meeting the threshold is determined as the secondary label corresponding to the text to be identified. The first preset model is obtained by training the preset model based on positive samples, negative samples and a preset loss function. The positive samples include first-level labels and second-level labels corresponding to the text to be identified, and the negative samples include first-level labels and second-level labels that do not correspond to the text to be identified. The loss function includes: Among them, Ω neg For the training samples in the training results, corresponding to the primary and secondary labels, Ω pos The first-level label or second-level label that does not correspond to the training sample in the training result is defined as S, where S is the numerical value corresponding to the first-level label or second-level label in the training result, A is the weight, K is the label level, and L is the loss function value. The weight includes a preset weight determined based on the number of training iterations. The weight of the first-level label decreases as the number of training iterations increases, while the weight of the second-level label increases as the number of training iterations increases.

2. The method according to claim 1, characterized in that, Before inputting the multiple preset primary and secondary labels into the first preset model, the method further includes: The second preset model is trained multiple times to obtain the first training result corresponding to the multiple training sessions. The accuracy of the training results is evaluated according to the evaluation function, and the target training result corresponding to the first evaluation result with the highest accuracy among multiple evaluation results is obtained. The second preset model after training corresponding to the target training result is determined as the first preset model.

3. The method according to claim 2, characterized in that, Before training the second preset model multiple times, the method further includes: The training samples are input into the third preset model to obtain the second training result; The loss function value corresponding to the second training result is determined; If the loss function does not meet the preset conditions, the third preset model is optimized according to the preset strategy; The training process of the third preset model is repeated until the loss function value satisfies the preset condition; the third preset model whose loss function value satisfies the preset condition is determined as the second preset model.

4. The method according to claim 1, characterized in that, The step of inputting the text to be recognized into the first preset model to obtain the third feature array specifically includes: organizing the text to be recognized into a preset format; The text to be recognized in the preset format is input into the first preset model to obtain the third feature array.

5. A sorting device, characterized in that, The device includes: The first input module is used to input multiple preset primary labels and secondary labels into the first preset model to obtain a first feature array corresponding to the primary label and a second feature array corresponding to the secondary label; the primary label and the secondary label include key words for classification and identification in the text to be identified, the primary label and the secondary label contain an association relationship, and each primary label corresponds to at least one secondary label; The second input module is used to input the text to be recognized into the first preset model to obtain the third feature array; The first calculation module is used to perform calculations on the first feature array and the third feature array based on a preset algorithm to obtain a first calculation result; the first calculation result represents the similarity between the text to be identified and the multiple first-level tags; The second calculation module is used to perform calculations on the second feature array and the third feature array based on a preset algorithm to obtain a second calculation result; the second calculation result represents the similarity between the text to be identified and the multiple secondary tags; The determination module is used to determine the primary and secondary tags corresponding to the text to be identified based on the similarity between the text to be identified and the plurality of primary tags and the plurality of secondary tags; The step of performing operations on the first feature array and the third feature array based on a preset algorithm to obtain a first operation result specifically includes: Perform a dot product between the first feature array and the third feature array to obtain a fourth feature array; use the fourth feature array as the first operation result. The second feature array and the third feature array are processed based on a preset algorithm to obtain a second processing result, which specifically includes: Perform a dot product between the first feature array and the third feature array to obtain a fifth feature array; use the fifth feature array as the second operation result. The step of determining the primary and secondary tags corresponding to the text to be identified based on the first and second calculation results specifically includes: When the fourth feature array indicates that the data corresponding to the first-level label meets a preset threshold, the first-level label corresponding to the data meeting the threshold is determined as the first-level label corresponding to the text to be identified. If the data corresponding to the secondary label indicated by the fifth feature array meets a preset threshold, the secondary label corresponding to the data meeting the threshold is determined as the secondary label corresponding to the text to be identified. The first preset model is obtained by training the preset model based on positive samples, negative samples and a preset loss function. The positive samples include first-level labels and second-level labels corresponding to the text to be identified, and the negative samples include first-level labels and second-level labels that do not correspond to the text to be identified. The loss function includes: Among them, Ω neg For the training samples in the training results, corresponding to the primary and secondary labels, Ω pos The first-level label or second-level label that does not correspond to the training sample in the training result is defined as S, where S is the numerical value corresponding to the first-level label or second-level label in the training result, A is the weight, K is the label level, and L is the loss function value. The weight includes a preset weight determined based on the number of training iterations. The weight of the first-level label decreases as the number of training iterations increases, while the weight of the second-level label increases as the number of training iterations increases.

6. A sorting device, characterized in that, The device includes: a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the classification method as described in any one of claims 1-4.

7. A computer storage medium, characterized in that, The computer storage medium stores computer program instructions, which, when executed by a processor, implement the classification method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Method for determining user tag and self-coding network training method and device

    CN109753608A

  • Text label mining method, device and equipment and storage medium

    CN112328655A