Multi-level classification model classification method, training method, device, equipment and medium

Through the algorithm framework that integrates multi-classification model and double-tower model, the text of government affairs is classified hierarchically, which solves the problems of low classification accuracy and limited information in the existing technology, and realizes efficient and accurate text classification to meet the needs of online real-time classification.

CN118277556BActive Publication Date: 2025-03-25SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211731484.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-30
Publication Date
2025-03-25
Estimated Expiration
2042-12-30

AI Technical Summary

Technical Problem

The existing technology has problems such as low classification accuracy, weak semantic expression during text classification, and lost word order in government text classification. In the multi-level classification scenario, the classification accuracy needs to be improved.

Method used

The algorithm framework that integrates multi-classification model and double-tagged model is adopted to classify the text of government affairs. By obtaining text classification data, using an encoder for classification, inputting the multi-classification model and matching model in the double-tagged model for multi-level text classification, obtaining the optimal results of each level of classification.

Benefits of technology

It achieves high classification accuracy and processing efficiency, can quickly deal with multi-level classification problems of matters, improves the accuracy and inference speed of text classification, and meets the application requirements of online real-time classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118277556B_ABST
    Figure CN118277556B_ABST
Patent Text Reader

Abstract

The invention discloses a multi-level classification model classification method, training method, device, equipment and medium. The method obtains text classification data, classifies the text classification data using an encoder, obtains a vector of a matter text, inputs the vector of the matter text into a multi-classification model in a twin-tower model for multi-level text classification, obtains a primary classification result, inputs the primary classification result into a matching model in the twin-tower model for text category classification, obtains a classification result of a corresponding category text subset, inputs the encoding vector of the matter text and each corresponding category text vector into a matching model in the twin-tower model for binary classification vector matching, obtains a secondary classification result, until there is no corresponding category text subset, obtains classification paths of multiple text classifications, and finally performs probability calculation through a beam search algorithm to obtain the optimal results of classification at each level, greatly improves the reasoning speed, and achieves a higher classification accuracy and processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of text classification, and in particular to a multi-level classification model classification method, training method, device, equipment and medium. Background Art

[0002] With the rapid development of the Internet and information technology, natural language processing technology has become an important direction in the fields of computer science and artificial intelligence. It can be used to analyze and mine text to obtain more information. In some application scenarios, natural language processing technology can also be used to predict the category of text.

[0003] The text can be a problem ticket submitted by R&D personnel during the process of testing or operating the product, including the title, problem description and solution of the problem ticket. In order to facilitate the subsequent R&D personnel to summarize and analyze various problems that arise, it is necessary to classify the submitted problem tickets to determine the problem category. However, since the content recorded in the problem ticket is relatively complex and mostly unstructured text, it is generally analyzed and sorted manually by specialized business personnel, which consumes a lot of time and manpower costs on the one hand, and may cause low accuracy of text classification due to misoperation on the other hand. Or the text is classified based on non-dynamic word vectors or word vectors, which cannot be changed according to its context, and the information is relatively simple, resulting in insufficient accuracy of text classification. For example, in the 12345 hotline system, an important processing link is to classify the content of the public's demands received at multiple levels so as to archive and distribute them in a fine-grained manner. With the development of technology, NLP classification models are gradually replacing manual classification, assisting the 12345 hotline to process demands better and faster. For multi-level classification scenarios, a solution at this stage is to use a multi-classification model and an NSP matching model based on BERT. Different models are used for different levels of classification. This method has the following disadvantages: 1. Two independent models are required, which is more time-consuming and occupies more video memory resources than a single model for both classification and training; 2. The first-level classification and n (n>1)-level classification are separated, the information learned by the model is limited, and the classification accuracy needs to be improved; 3. NSP matching requires the event text and category name to be concatenated and input into the model for matching. In this way, data construction and encoding are required for each inference, which is time-consuming overall.

[0004] Therefore, there are currently many text-based classification algorithms. The current government text classification process has low classification accuracy, no strict regulations on the classification types of government texts, weak semantic expression, and word order loss in the text classification process. The existing classification algorithms do not take into account the different proportions of each word in the government classification process. How to effectively classify and manage these large amounts of official document data for government affairs has become a huge challenge. Summary of the invention

[0005] In view of this, the embodiment of the present invention provides a multi-level classification model classification method, training method, device, equipment and medium. In order to solve the shortcomings of the prior art, the multi-classification model and the dual-tower model are integrated to hierarchically classify the government affairs text, which has high classification accuracy and processing efficiency.

[0006] In a first aspect, an embodiment of the present invention provides a multi-level classification model classification method, comprising:

[0007] Acquire text classification data, and classify the text classification data using an encoder to obtain a vector of the matter text, wherein the text classification data refers to the matter text classification data;

[0008] Inputting the vector of the matter text into the multi-classification model in the twin-tower model for multi-level text classification to obtain the first-level classification result of the first layer;

[0009] Inputting the primary classification result into the matching model in the twin tower model to perform text category classification, and obtaining a corresponding category text subset classification result, wherein the corresponding category text subset classification result includes each corresponding category text vector;

[0010] The encoding vector of the matter text and the vectors of each corresponding category text are input into the matching model in the twin tower model to perform binary classification vector matching to obtain a secondary classification result; until there is no corresponding category text subset, a classification path of multiple text classifications is obtained;

[0011] Probability calculation is performed based on the classification paths of multiple text classifications to obtain the optimal results for each level of classification.

[0012] In a second aspect, an embodiment of the present invention provides a multi-level classification model training method, wherein the multi-level classification model includes a Bert model, a multi-classification model in a dual-tower model, and a matching model in a dual-tower model, including:

[0013] Acquire data to be trained, wherein the data to be trained includes item text training data and category name training data;

[0014] Encoding the matter text training data and the category name training data based on the Bert model to obtain an encoding vector of the matter text and a corresponding category text vector, wherein the corresponding category text vector includes a plurality of text classification category label information, and the plurality of text classification category labels correspond to different types of text classification training tasks;

[0015] On the multi-classification model in the twin-tower model, the encoding vector extraction of the matter text is trained to obtain the corresponding target text features, and the first-level classification results are predicted according to the target text features;

[0016] On the matching model in the twin-tower model, the target text feature information and the corresponding category text vector are combined to obtain a concatenated text feature, and the second-level classification result is predicted according to the concatenated text feature until all corresponding category text vectors are completed;

[0017] A first loss function corresponding to the first level classification result is obtained, and a second loss function corresponding to the second text classification result is obtained to obtain a target loss function of the multi-level classification model, and the multi-level classification model is trained and adjusted using the target loss function until a training stop condition is reached.

[0018] In a third aspect, an embodiment of the present invention provides a multi-level classification model classification device, comprising:

[0019] A data acquisition module, used to acquire text classification data, classify the text classification data using an encoder, and obtain a vector of the event text, wherein the text classification data refers to the event text classification data;

[0020] A data classification module, used for inputting the vector of the matter text into the multi-classification model in the twin-tower model to perform multi-level text classification, and obtaining the first-level classification result of the first layer;

[0021] A data matching module is used to input the primary classification result into the matching model in the twin tower model to perform text category classification, and obtain a corresponding category text subset classification result, wherein the corresponding category text subset classification result includes each corresponding category text vector;

[0022] A data classification path module is used to input the encoding vector of the matter text and the corresponding category text vectors into the matching model in the twin tower model to perform binary classification vector matching to obtain a secondary classification result; until there is no corresponding category text subset, a classification path for multiple text classifications is obtained;

[0023] The data classification result module is used to perform probability calculation based on the classification paths of multiple text classifications to obtain the optimal results for each level of classification.

[0024] In a fourth aspect, an embodiment of the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the multi-level classification model classification method described in the first aspect when executing the computer program.

[0025] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the multi-level classification model classification method described in the first aspect is implemented.

[0026] Compared with the prior art, the present invention has the following beneficial effects:

[0027] The present invention provides a multi-level classification model classification method, training method, device, equipment and medium. When performing the multi-level classification model classification method, by acquiring text classification data, an encoder is used to classify the text classification data to obtain a vector of an event text, wherein the text classification data refers to event text classification data, the vector of the event text is input into a multi-classification model in a twin-tower model for multi-level text classification to obtain a first-level classification result of the first layer, the first-level classification result is input into a matching model in the twin-tower model for text category classification to obtain a corresponding category text subset classification result, wherein the corresponding category text subset classification result includes each corresponding category text vector, the encoding vector of the event text and each corresponding category text vector are input into the matching model in the twin-tower model for binary classification vector matching to obtain a secondary classification result; until there is no corresponding category text subset, a plurality of text classification classification paths are obtained, probability calculation is performed based on the classification paths of the plurality of text classifications, and the optimal results of classification at each level are obtained. In the present invention, an algorithm framework integrating a multi-classification model and a dual-tower model is designed. One of the dual towers is a multi-classification model, which is responsible for processing text input and dividing the first-level categories. The other tower corresponds to the vector matching model in the above process, which is responsible for encoding the category name text, and then combining the matter text vector and the category text vector for binary classification matching, and outputting the matching classification results. Therefore, the multi-level classification problem of matters can be processed quickly, and for the data sparsity problem of multi-layer classification, we retain the first-level classification task, and at the same time convert the nth (n>1) level text classification task into a text and category name matching task, and use the dual-tower model to simultaneously model these two tasks, so that different tasks can learn from each other, and further improve the classification performance at all levels. This method can efficiently and accurately classify the hierarchical text of government affairs, and it can achieve the process from inputting the appeal content to outputting the classification results of each level in about 200ms on the CPU of an ordinary computer, meeting the application requirements of online real-time classification.

[0028] And when performing the multi-level classification model training method, the multi-level classification model includes a Bert model, a multi-classification model in a twin-tower model, and a matching model in a twin-tower model. By obtaining data to be trained, the data to be trained includes matter text training data and category name training data. Based on the Bert model, the matter text training data and the category name training data are encoded to obtain a coding vector of the matter text and a corresponding category text vector, wherein the corresponding category text vector includes multiple text classification category label information, and the multiple text classification category labels correspond to different types of text classification training tasks; on the multi-classification model in the twin-tower model, the coding vector of the matter text is extracted and trained to obtain the corresponding target text feature, and the first-level classification result is predicted according to the target text feature; on the matching model in the twin-tower model, the target text feature information and the corresponding category text vector are combined to obtain a concatenated text feature, and the second-level classification result is predicted according to the concatenated text feature, until all corresponding category text vectors are completed, a corresponding first loss function is obtained according to the first-level classification result, and a corresponding second loss function is obtained according to the second text classification result to obtain a target loss function of the multi-level classification model, and the multi-level classification model is trained and adjusted using the target loss function until the training stop condition is reached. In the present invention, in this way, there is no need to manually classify text, which saves labor costs, and can effectively improve the accuracy of text classification and greatly improve the reasoning speed. Finally, a text can complete 4 levels of classification in only 200ms on the CPU. The present invention has achieved certain gains in the multi-level classification data set of affairs and government affairs, and the F1 index at all levels has been improved. A higher classification accuracy and processing efficiency are achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the description of the embodiments of the present invention are briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor.

[0030] Figure 1 It is a schematic diagram of an application environment of a multi-level classification model classification method provided by an embodiment of the present invention;

[0031] Figure 2 It is a flowchart of a multi-level classification model classification method provided by one embodiment of the present invention;

[0032] Figure 3 It is a schematic diagram of a process of obtaining a classification path by matching a model provided by an embodiment of the present invention;

[0033] Figure 4It is a flowchart of a multi-level classification model training method provided by one embodiment of the present invention;

[0034] Figure 5 It is a structural schematic diagram of a multi-level classification model classification method device provided by an embodiment of the present invention;

[0035] Figure 6 It is a structural schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0036] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.

[0037] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0038] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0039] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]", depending on the context.

[0040] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0041] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0042] It should be understood that the order of execution of the steps in the following embodiments does not imply a precedence of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0043] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.

[0044] A multi-level classification model classification method provided in the first embodiment of the present invention can be applied in the following aspects: Figure 1 In an application environment, the client communicates with the server. The client includes but is not limited to PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud terminal devices, personal digital assistants (PDAs) and other computer devices. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0045] As an implementation method of this embodiment, see Figure 2 , is a flow chart of a multi-level classification model classification method provided in the first embodiment of the present invention. The multi-level classification model classification method can be applied to Figure 1 The server in is used to input text classification data into the corresponding processing model, such as Figure 2 As shown, the multi-level classification model classification method may include the following steps:

[0046] S110: Acquire text classification data, and classify the text classification data using an encoder to obtain a vector of the event text, wherein the text classification data refers to event text classification data;

[0047] In step S110, multi-level classification refers to a multi-classification problem in which the categories themselves have levels. Multi-level classification objects are objects that need to be classified in multiple levels. For example, in the 12345 hotline system, an important processing link is to classify the received public appeals in multiple levels so as to archive and distribute them in a fine-grained manner. The public appeals are a kind of multi-level classification object.

[0048] That is, the historical multi-level classification data of the above-mentioned 12345 matters: including fields such as appeal content, problem classification, first-level classification, second-level classification, third-level classification and fourth-level classification. The examples are as follows:

[0049] The content of the appeal is that Mr. Zhang reported that there are many vehicles parked illegally on the sidewalk at the corner of xx Street in xx District every day, which makes it impossible for him to travel; the problem classification is urban management, street order management, sidewalk management and illegal parking of vehicles on the sidewalk; the first level classification is urban management; the second level classification is street order management; the third level classification is sidewalk management; the fourth level classification is illegal parking of vehicles on the sidewalk. It should be noted that for the sake of ease of understanding, the categories are replaced by numbers. The specific categories can be set according to actual conditions and are not limited here.

[0050] Preferably, the N levels of the classification system include lower levels and higher levels, wherein the categories of each level are subcategories of the previous level. That is, each category of the first level contains a specified number of categories of the second level, each category of the second level contains a specified number of categories of the third level, and so on.

[0051] For example, when the classification system is 4 layers, the first and second layers are selected as the high-level layers, and the third and fourth layers are selected as the low-level layers. The categories of the second layer are subcategories of the first layer, the third layer is a subcategory of the second layer, and the fourth layer is a subcategory of the third layer.

[0052] The multi-level text classification method in the present application is not only applicable to the classification of 12345 matter texts, but also to the classification of multi-level classification tasks based on text understanding in news, documents and other objects, and the text information can be a title sentence or paragraph, etc. It should be noted that there is no specific limitation on this in the embodiments of the present application.

[0053] Specifically, assuming that the text information of a government matter is "Mr. Zhang reported that there are many vehicles illegally parked on the sidewalk at the corner of xx Street in xx District every day, which makes it impossible for him to travel", the text information of the government matter is used as the input of the encoder. Whether the input needs to be segmented or whether it needs to be directly input according to the word granularity depends mainly on the type of encoder. For example, if the encoder adopts the Bidirectional Encoder Representations from Transformers (BERT) model, the word granularity is mainly used.

[0054] Therefore, the BERT model is used to encode and classify the text classification data, and the government affairs text information is input into the BERT model in the form of word granularity, and the text encoding vector is generated after encoding. Taking the semantic vector of each word as 768 dimensions, the first character "CLS" output vector (768 dimensions) is usually taken as the vector representation of the entire government affairs text information. Therefore, the final text encoding vector is also 768 dimensions. That is, l1_emb = BERT (text), where l1_emb represents the text encoding vector and text represents the government affairs text information.

[0055] It should be noted that the multi-level classification model can be deployed on a server, or on a terminal device, or on a system consisting of a terminal device and a server, which is not limited here. It can be seen that in this example, after obtaining the text classification data, the Bert model is used to classify the text classification data to obtain the vector of the event text, which can save human resources and is highly efficient compared to manual text input.

[0056] S120: Inputting the vector of the event text into the multi-classification model in the twin-tower model to perform multi-level text classification, and obtaining the first-level classification result of the first layer;

[0057] In step S120, the vectors of all the matter texts are input into the multi-classification model in the twin-tower model for text encoding classification to obtain the first-level classification results of the first layer;

[0058] The multi-classification model includes a first-layer text classification model, a second-layer text classification model...an n-layer text classification model, where n is the number of layers of the text. Preferably, the N levels of the classification system include low-level and high-level levels, wherein the categories of each level are subcategories of the previous level. Moreover, the categories of each level can be further divided into i secondary categories, and so on. These i secondary categories can be further divided into m associated tertiary categories, thereby forming a category relationship table. It should be noted that, for the sake of ease of understanding, the categories are replaced by numbers, and the specific category classification can be set according to actual conditions and is not limited here.

[0059] It can be seen that in this example, after inputting the vectors of all the texts of the items into the multi-classification model in the dual-tower model for text encoding classification, the first-level classification results of the first layer are obtained. Compared with the sufficient data at this level, multi-classification processing is still used, which is more efficient in reasoning, and the classification accuracy can be improved by integrating low-level and high-level classification information.

[0060] S130: Inputting the primary classification result into the matching model in the twin tower model to perform text category classification, and obtaining a corresponding category text subset classification result, wherein the corresponding category text subset classification result includes each corresponding category text vector;

[0061] In step S130, the first-level classification result is input into the matching model in the twin-tower model for text category classification, and the category name text is first input into the category layer in the matching model for encoding.

[0062] For example, according to the current first-layer primary classification result, the category of the first-layer text of the text is determined, and according to the category of the first-layer text, a corresponding label is set for the first-layer text;

[0063] According to the category of the first layer of text, the category of the second layer of text under the category of the first layer of text is obtained, and so on, and according to the category of the second layer of text, a corresponding label is set for the second layer of text, until the corresponding label is set for the nth layer of text;

[0064] The first layer text, the second layer text, ... the nth layer text are input into the matching model in the twin tower model for text category classification, and the corresponding i first layer category text vectors, the second layer category text vectors, ... the nth layer category text vectors are generated. That is, we can find the i second-level categories under the first-level classification results of the first layer according to the output first-level classification results and the category relationship table, and regard these second-level categories as candidate categories and input them into the other tower in the twin towers - the category encoding model for encoding, and obtain the corresponding i category text vectors E class_1 ,E class_2 ,...,E class_i .

[0065] In one or more embodiments, the multi-level classification model inputs the first-level classification results into the category layer included in the matching model in the double-tower model, obtains the corresponding i category text vectors from the category layer, and obtains the corresponding category text subset classification results.

[0066] It should be noted that the i-category text vectors belong to the next level category (i.e., sub-category) of the first-level category. Typically, for example, there can be 44 first-level categories, including thematic coarse-grained categories such as "sports", "games" and "entertainment", and each first-level category can be subdivided into multiple second-level categories, such as a total of 305 fine-grained second-level categories.

[0067] In one or more embodiments, the multi-level classification model determines the first-level category corresponding to the maximum first element score according to the first distribution vector, and uses the first-level category as the target first-level category. Similarly, the second-level category corresponding to the maximum second element score is determined according to the second distribution vector, and uses the second-level category as the target second-level category.

[0068] It should be noted that this application takes the output of target first-level categories and target second-level categories as an example. In actual applications, more levels of categories can also be output. Accordingly, the multi-level classification model also needs to include classifiers that apply output of different categories, which will not be elaborated here.

[0069] In this embodiment, the first-level classification results are input into the matching model in the twin-tower model for text category classification. The category name text is first encoded into the category layer in the matching model to obtain the classification results of the corresponding category text subset. The output of the next level is predicted based on the output results of the previous level, which can fully and effectively utilize the constraint relationship between the upper and lower levels in the category system, thereby enhancing the effect of category classification and improving the classification accuracy.

[0070] S140: inputting the encoding vector of the matter text and the vectors of each corresponding category text into the matching model in the twin tower model to perform binary classification vector matching to obtain a secondary classification result; until there is no corresponding category text subset, a classification path of multiple text classifications is obtained;

[0071] In step S140, the matter text vector and the category text vector are then combined to perform binary classification matching, and the matching classification result is output to obtain a secondary classification result.

[0072] In one or more embodiments, the classification results obtained by a high-level model (eg, a first classifier) ​​are generally more accurate, and therefore, the first distribution vector may be input as prior knowledge into a next-level model (eg, a second classifier).

[0073] Specifically, the matching model in the twin tower model combines the encoding vector of the event text and each corresponding category text vector to generate a text fusion vector. That is, the text fusion vector has feature vectors from two dimensions, one is the vector of the event text output by the Bert model, and the other is the i corresponding category text vectors output by the category layer in the matching model in the twin tower model based on the first layer classification result. Therefore, it is necessary to fuse the multi-dimensional feature vectors here, and perform binary matching on the fused multi-dimensional feature vectors to output the matching classification results.

[0074] For example, the encoding vector of the matter text and i corresponding category text vectors are fused with multi-dimensional feature vectors as a pair of text classification matching data pairs, and each text classification matching data pair is input into the matching model in the double tower model for binary classification vector matching, and the similarity between the encoding vector of the matter text and each candidate text corresponding to any corresponding category text vector is determined. After determining the similarity between the encoding vector of the matter text and each candidate text corresponding to any corresponding category text vector, the confidence score of each category text vector is determined accordingly. When the similarity between the encoding vector of the matter text and each candidate text corresponding to any corresponding category text vector is greater than a predetermined first threshold, the confidence score of the category text vector is high; when the similarity between the encoding vector of the matter text and each candidate text corresponding to any corresponding category text vector is less than a predetermined second threshold, the confidence score of the category text vector is low.

[0075] Each text classification matching data pair is input into the model to obtain a first classification result output by the model, and the first classification result includes a first confidence corresponding to each of the multiple preset categories. Each text classification matching data pair is further input into the model to obtain a second classification result output by the model, and the second classification result includes a second confidence corresponding to each of the multiple preset categories. Then, based on the first confidence and the second confidence corresponding to each of the preset categories, until all corresponding category text confidences are obtained, the classification result of the text classification data is determined.

[0076] Then sort the confidence scores and select the secondary classification result with the highest score as the possible secondary category of the current matter text. After obtaining k secondary categories, if there are tertiary categories associated with these secondary categories in the category relationship table, repeat this step for other associated categories until the corresponding category text subset does not exist, and obtain the classification path of multiple text classifications.

[0077] The event text vector and each category text vector E class The vector matching layer of the matching model input into the dual-tower model performs binary matching, with the positive correlation matching score as the confidence score S of each category. 11 ,S 12,...,S 1j , and then sort the confidence scores to select the top k secondary classification results as the possible secondary categories of the current matter text. After obtaining k secondary categories, if there are still tertiary categories associated with these secondary categories in the category relationship table, steps 2) and 3) can be repeated until there are no subcategories, so that multiple candidate classification paths can be obtained.

[0078] It should be noted that the specific value of the above-mentioned preset similarity threshold can be set according to the actual needs of the user, and the embodiment of the present application does not impose any limitation on the specific value of the above-mentioned preset similarity threshold.

[0079] It should be noted that, in the above series of parameters, letters can be replaced by other letters, which are not specifically limited in this embodiment.

[0080] As an optional implementation of an embodiment of the present invention, the use of a matching model in the dual-tower model of an embodiment of the present invention can better reflect the closeness relationship between multi-level classifications, fully explore the hidden information between classes, and achieve good classification effects; by constructing a multi-layer classification model step by step through joint classification, error transmission can be avoided and the classification accuracy of the model can be improved. This does not cause model redundancy during reasoning (the model needs to be loaded twice), and low-level and high-level classification information can be well integrated, and there is still room for improvement in classification accuracy.

[0081] S150: Probability calculation is performed based on the classification paths of multiple text classifications to obtain the optimal results for each level of classification.

[0082] In step S150, this embodiment considers potential factors in hierarchical classification of government affairs texts from multiple aspects, that is, the classification paths of multiple text classifications are probability calculated through a beam search algorithm to obtain the optimal results for each level of classification.

[0083] For example: the first-level classification includes nodes A, B and C. If the node to which the text belongs in the first-level classification is A, when determining the node to which it belongs in the second-level classification, the nodes in the second-level classification associated with node A are filtered, without filtering from the nodes in the second classification level associated with nodes B and C, that is, the associated nodes are filtered layer by layer.

[0084] When determining the node to which the text belongs in the first classification level, the encoding vector of the matter text and i corresponding category text vectors can be combined to determine the target classification path to which the text belongs, and the node probability value that matches the target classification path is determined to be 1, and the node probability value that does not match the target classification path is determined to be 0, where the target classification can be one or more.

[0085] Secondly, according to the nodes to which the first-level classification belongs, determine the nodes to which the text belongs in the second-level classification, and determine the corresponding probability of each node;

[0086] Finally, the process is repeated in the same way until the node to which the text belongs in the final level classification and the corresponding probability of each node are obtained.

[0087] For example, if there are five classification levels and a text belongs to one node in each classification level, then the probabilities corresponding to the five nodes can be obtained in the end.

[0088] It should be noted that the number of nodes to which a text belongs in each classification level may be one or more.

[0089] In this embodiment, the classification paths of multiple text classifications are calculated using the beam search algorithm, and the calculation formula is as follows:

[0090]

[0091] Among them, cls i Represents a category i, p(cls i ) is the predicted probability of the category, L is the path length, that is, the number of levels (if 4 levels are predicted, L is 4), and the parameter α is used as a hyperparameter to adjust the weight of the length penalty to avoid tending to decode a shorter classification path.

[0092] For each level of classification, the probability values ​​corresponding to each node in the level classification are used to determine the probabilities of multiple levels of classification. If the first k nodes are retained for each level of classification and there are n levels, then at most k nodes can be obtained. n-1 We use the joint probability of multiple categories as the overall path probability, add a length penalty, take the path with the maximum probability threshold as the target path, and obtain the classification results at each level. This method has achieved certain gains on the Hengyang government multi-level classification data set, and the F1 index at each level has been improved.

[0093] The specific value of the maximum probability threshold can be flexibly set by those skilled in the art, and is not specifically limited in the embodiments of the present application. Eliminating low probabilities can improve the accuracy of the finally calculated classification level probability.

[0094] In this embodiment, by calculating the classification paths of multiple text classifications using a beam search algorithm, a multi-level classification result with high accuracy can be achieved, thereby improving the classification accuracy and processing efficiency.

[0095] In this embodiment, since multi-level classification often has the problem that the higher the level, the sparser the data, in this case directly using the classification model cannot obtain a good classification result. Therefore, a common practice is to convert the high-level multi-classification into a binary classification match of text and category name. On the one hand, the binary classification task is relatively simple, and on the other hand, the text information of the category name can also be used; for the first-level classification, since there is sufficient data at this level, multi-classification processing is still used, which is more efficient in reasoning.

[0096] Combining the above process, it can be seen that this approach generally requires two independent models, one for the first-level multi-classification and the other for matching classification. This not only causes model redundancy during inference (the model needs to be loaded twice), but also fails to integrate low-level and high-level classification information well. There is still room for improvement in classification accuracy.

[0097] Therefore, the present invention uses a dual-tower model to unify the modeling of the primary multi-classification and the advanced matching classification, thereby solving the above problems. The core model structure is shown in the figure below, and its abstract representation corresponds to the dotted box part in the flow chart. One of the dual towers is a multi-classification model, which is responsible for processing text input and dividing the primary categories. The other tower corresponds to the vector matching model in the above process, which is responsible for encoding the category name text, and then combining the event text vector and the category text vector for binary classification matching, and outputting the matching classification results. It can effectively improve the classification accuracy and reasoning efficiency.

[0098] The present invention provides a multi-level classification model classification method, training method, device, equipment and medium. When the multi-level classification model classification method is performed, text classification data is obtained, and the text classification data is classified using a Bert model to obtain a vector of an event text, wherein the text classification data refers to event text classification data, the vector of the event text is input into a multi-classification model in a twin-tower model for text coding classification to obtain a primary classification result, the primary classification result is input into a matching model in the twin-tower model for text category classification to obtain a corresponding category text subset classification result, wherein the corresponding category text subset classification result includes each corresponding category text vector, the coding vector of the event text and each corresponding category text vector are input into a matching model in the twin-tower model for binary classification vector matching to obtain a secondary classification result; until there is no corresponding category text subset, a plurality of text classification classification paths are obtained, and probability calculation is performed based on the classification paths of the plurality of text classifications through a beam search algorithm to obtain the optimal results of each level of classification. In the present invention, an algorithm framework integrating a multi-classification model and a dual-tower model is designed. One of the dual towers is a multi-classification model, which is responsible for processing text input and dividing the first-level categories. The other tower corresponds to the vector matching model in the above process, which is responsible for encoding the category name text, and then combining the matter text vector and the category text vector for binary classification matching, and outputting the matching classification results. Therefore, the multi-level classification problem of matters can be processed quickly, and for the data sparsity problem of multi-layer classification, we retain the first-level classification task, and at the same time convert the nth (n>1) level text classification task into a text and category name matching task, and use the dual-tower model to simultaneously model these two tasks, so that different tasks can learn from each other, and further improve the classification performance at all levels. This method can efficiently and accurately classify the hierarchical text of government affairs, and it can achieve the process from inputting the appeal content to outputting the classification results of each level in about 200ms on the CPU of an ordinary computer, meeting the application requirements of online real-time classification.

[0099] And when performing the multi-level classification model training method, the multi-level classification model includes a Bert model, a multi-classification model in a twin-tower model, and a matching model in a twin-tower model. By obtaining data to be trained, the data to be trained includes matter text training data and category name training data. Based on the Bert model, the matter text training data and the category name training data are encoded to obtain a coding vector of the matter text and a corresponding category text vector, wherein the corresponding category text vector includes multiple text classification category label information, and the multiple text classification category labels correspond to different types of text classification training tasks; on the multi-classification model in the twin-tower model, the coding vector of the matter text is extracted and trained to obtain the corresponding target text feature, and the first-level classification result is predicted according to the target text feature; on the matching model in the twin-tower model, the target text feature information and the corresponding category text vector are combined to obtain a spliced ​​text feature, and the second-level classification result is predicted according to the spliced ​​text feature, until all corresponding category text vectors are completed, the corresponding first loss function is obtained according to the first-level classification result, and the corresponding second loss function is obtained according to the second text classification result to obtain the target loss function of the multi-level classification model, and the multi-level classification model is trained and adjusted using the target loss function until the training stop condition is reached. In the present invention, in this way, there is no need to manually classify text, which saves labor costs, and can effectively improve the accuracy of text classification and greatly improve the reasoning speed. Finally, a text can complete 4 levels of classification in only 200ms on the CPU. The present invention has achieved certain gains in the multi-level classification data set of affairs and government affairs, and the F1 index at all levels has been improved. A higher classification accuracy and processing efficiency are achieved.

[0100] It can be understood that in the specific implementation of this application, data related to multi-level classification model classification methods, training methods, devices, equipment and media are involved. When the embodiments in this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0101] As an implementation method of this embodiment, Figure 3 As shown, in step S140, the encoding vector of the matter text and the corresponding category text vectors are input into the matching model in the twin tower model for binary classification vector matching to obtain a secondary classification result; until there is no corresponding category text subset, a classification path of multiple text classifications is obtained, including:

[0102] Step S141, taking the encoding vector of the matter text and the corresponding category text vectors as a pair of text classification matching data pairs;

[0103] Step S142, inputting each of the text classification matching data pairs into the matching model in the twin tower model to perform binary classification vector matching, and determining the similarity between the encoding vector of the matter text and each candidate text corresponding to any corresponding category text vector;

[0104] Step S143, determining the confidence score of each category text vector based on the similarity between the encoding vector of the matter text and each candidate text corresponding to any corresponding category text vector;

[0105] Step S144, sort the confidence scores again, select the secondary classification result with the highest score as the possible secondary category of the current matter text, and after obtaining k secondary categories, if there are tertiary categories associated with these secondary categories in the category relationship table, repeat this step for other associated categories until there is no corresponding category text subset, and obtain the classification path of multiple text classifications.

[0106] In the above steps S141 to S144, the encoding vector of the above-mentioned matter text and each corresponding category text vector are fused to form a text classification matching data pair, and the text classification matching data pair is then input into the matching model in the double tower model for binary classification vector matching to obtain a matching result. Based on the similarity between the encoding vector of the matter text and each candidate text corresponding to any corresponding category text vector, the similarity scores are sorted, and the text classification matching result with the highest similarity score is retained until there is no corresponding category text subset, thereby obtaining a classification path for multiple text classifications. In one embodiment of the present application, before outputting the text classification matching result as the classification path result, the following steps are also included.

[0107] Determine whether the score corresponding to the text classification matching result is greater than a preset similarity threshold;

[0108] If the score corresponding to the text classification matching result is less than the preset similarity threshold, the matching result is rejected;

[0109] If the score corresponding to the text classification matching result is greater than the preset similarity threshold, the classification matching result is output as the classification path result of multiple classifications.

[0110] It should be noted that there is no limit on the classification path results of multiple categories. The number of specific classification paths can be set according to actual conditions and is not limited here.

[0111] In this embodiment, the text classification matching result with the highest degree score is selected as the classification path result. When classifying a multi-level classified government affairs text, the multi-level classified government affairs text can be first converted into a vector of the affairs text, and then the feature vector of the word unit sequence can be extracted by different feature extraction methods, so that the extracted feature vector can reflect information from different aspects and levels. In addition, different classification models are used to predict the classification results respectively, and then the classification results are compared to determine the final classification results. Through this classification prediction method, there is no need for manual corpus classification, which saves labor costs and can effectively improve the accuracy of corpus classification. The present application adopts a multi-level classification algorithm for government affairs that integrates a classification model and a dual-tower model. The algorithm adopts the idea of ​​level-by-level classification and configures different classifiers at each level, which solves the problem of inaccurate classification results caused by imbalanced sample data in a targeted manner, and effectively improves the accuracy of news text information classification and the efficiency of news text information classification. By setting this step, a more reasonable multi-level classification method can be implemented based on the irregular behavior of the text information itself. It is accurate, has intuitive features, and is direct in method. It can achieve good recommendation results while greatly improving the accuracy and efficiency of text classification.

[0112] As an implementation method of this embodiment, see Figure 4 , Figure 4 is a flowchart of a multi-level classification model training method provided by an embodiment of the present invention. The multi-level classification model training method can be applied to Figure 1 The server in is used to input the text classification training data into the corresponding processing model. The multi-level classification model includes the Bert model, the multi-classification model in the twin tower model, and the matching model in the twin tower model, such as Figure 4 As shown, the multi-level classification model training method may include the following steps:

[0113] S210: Acquire data to be trained, wherein the data to be trained includes event text training data and category name training data;

[0114] In this embodiment, the training data includes the text content of government affairs matters received from the 12345 hotline system or the legal text input from the terminal. Of course, it can also be any multi-level classification task file that requires text understanding. That is, the training data includes the matter text training data and the category name training data.

[0115] S220: Encode the matter text training data and the category name training data based on the Bert model to obtain an encoding vector of the matter text and a corresponding category text vector, wherein the corresponding category text vector includes a plurality of text classification category label information, and the plurality of text classification category labels correspond to different types of text classification training tasks;

[0116] In the process of training the BERT model, specifically, the event text training data and the category name training data are input into the model to obtain the encoding vector of the event text and the corresponding category text vector

[0117] Optionally, the multi-level classification model also includes: a first module, a second module and a third module.

[0118] Among them, the first module can be a BERT (Bidirectional Encoder Representations from Transformers) model. The event text training data and the category name training data are input into the first module to obtain the encoding vector of the event text and the corresponding category text vector, wherein the corresponding category text vector includes multiple text classification category label information, and the multiple text classification category labels correspond to different types of text classification training tasks. That is, according to the category of the first layer of text, the category of the second layer of text under the category of the first layer of text is obtained, and so on, and according to the category of the second layer of text, the corresponding label is set for the second layer of text, until the corresponding label is set for the nth layer of text.

[0119] In this embodiment, the BERT pre-trained model is used as the initialization model for multi-text classification. On the one hand, it can accelerate the convergence speed of the model, thereby reducing the time required for model training; on the other hand, it can make the text richer in information at the sentence level.

[0120] S230: On the multi-classification model in the dual-tower model, extract and train the encoding vector of the matter text to obtain corresponding target text features, and predict the first-level classification result according to the target text features;

[0121] The encoding vector of the matter text is input into the second module, the encoding vector of the matter text is extracted and trained to obtain the corresponding target text features, and the first-level classification results are predicted based on the target text features, wherein the second module can be a multi-classification model in the twin-tower model. Specifically, the outputs in the BERT model are respectively input into the multi-classification model in the twin-tower model.

[0122] A corresponding target text feature is obtained for each of the item text training data to form a text classification task training data pair corresponding to the item text training data, and a model task control parameter corresponding to each text classification task training data pair is set to a preset text classification task control parameter. The text classification model is trained for the text classification task based on each text classification task training data pair and the model task control parameter corresponding to each text classification task training data pair. A first training set is obtained by training through a second module, and in the process of the first training set, mining of first sample data is realized.

[0123] In this embodiment, the multi-classification model in the twin tower model is used to train the encoding vector extraction of the matter text. This method can further improve the classification performance at all levels. The government affairs text can be classified hierarchically efficiently and accurately to achieve a high classification accuracy.

[0124] S240: On the matching model in the dual-tower model, the target text feature information and the corresponding category text vector are combined to obtain a concatenated text feature, and the second-level classification result is predicted according to the concatenated text feature until all corresponding category text vectors are completed;

[0125] The target text feature information and the corresponding category text vector are input into the third module to obtain the fused spliced ​​text features, and the second-level classification results are predicted based on the fused spliced ​​text features, wherein the third module can be a matching model in the twin-tower model. Specifically, the outputs in the BERT model are respectively input into the matching models in the twin-tower model.

[0126] Optionally, the encoding vector of the matter text and the corresponding category text vectors are used as a pair of text classification matching task training data pairs, and the model task control parameters corresponding to each text classification matching task training data pair are set to preset text classification matching task control parameters. Based on each text classification matching task training data pair and the model task control parameter pair corresponding to the text classification matching task training data pair, the text matching task is trained through the matching model in the double tower model, and the second training set is obtained by training through the third module. In the process of the second training set, the mining of the second sample data is realized.

[0127] In this embodiment, the matching model in the twin tower model is used to train the target text feature information and the corresponding category text vector to obtain the spliced ​​text feature. This makes it possible to achieve certain gains in the multi-level classification data set of government affairs, and the F1 index at all levels has been improved, greatly integrating low-level and high-level classification information, improving the accuracy and processing rate of the classification space, thereby ensuring that it takes about 200ms on the CPU of an ordinary computer to achieve the process from inputting the appeal content to outputting the classification results at all levels, meeting the application requirements of online real-time classification.

[0128] S250: Obtain a target loss function of the multi-level classification model based on a first loss function corresponding to the first-level classification result and a second loss function corresponding to the second text classification result, and use the target loss function to train and adjust the multi-level classification model until a training stop condition is reached.

[0129] The so-called loss function, also known as the cost function, is a function that maps the value of a random event or its related random variables into a non-negative real number to represent the "risk" or "loss" of the random event.

[0130] After the text data is trained by the BERT model, specifically, the event text training data and the category name training data can be input into the multi-classification model and matching model in the twin tower model, and the probability distribution of the predicted label can be obtained, and the predicted label of the text can be determined according to the probability distribution of the predicted label. The predicted label is the judgment result of the category of the text output by the text classification model. When the text classification model is trained, after the text is input into the text multi-classification model, the predicted label obtained may be the same as or different from the true label. If the predicted label is different from the true label, the loss value is calculated according to the predicted label and the true label corresponding to the text, and the parameters of the text multi-classification model are adjusted according to the loss value.

[0131] In terms of specific implementation, the two models share a basic Bert model for vector encoding. Therefore, whether in the training or inference phase, the model only needs to be loaded once, avoiding model redundancy and reducing video memory usage.

[0132] During the training phase, we provide the model with both the event text and the possible category names. The two towers receive the corresponding text at the same time and perform joint training. The corresponding loss function is:

[0133] loss = α * loss multi-classifier +β*loss match

[0134] Among them, loss_(multi-classifier) ​​is the multi-classification loss, loss_match is the matching binary classification loss, and α and β are respective hyperparameters used to adjust the classification direction that the model focuses on. In addition to the joint loss function, the shared Bert model can also realize the interaction of classification information. Experiments show that compared with two independent models, our joint model has improved accuracy at all levels.

[0135] In this embodiment, the Bert model, the multi-classification model in the twin-tower model, and the matching model in the twin-tower model are fused to form a multi-classification model. In the process of model training, the embodiment of the present application uses the first model to update the second training set for obtaining the second model, and uses the second model to update the first training set for obtaining the first model. In the process of completing the training information interaction between the first model and the second model, the classification accuracy of the first model and the second model can be continuously improved, thereby improving the classification accuracy of the overall multi-classification model. At the same time, in the process of updating the first training set by the second model in the embodiment of the present application, the mining of the first sample data is realized, which greatly reduces the workload of manual labeling and improves the overall efficiency of data classification; at the same time, the embodiment of the present application can accelerate the convergence speed of the multi-classification model and improve the model training efficiency by mutually updating the training set of the first model and the second model.

[0136] See also Figure 5 , Figure 5 Schematic diagram of a multi-level classification model classification device provided by an embodiment of the present invention. In this embodiment, the terminal includes various units for executing Figure 2 For details, please refer to the steps in the corresponding embodiment. Figure 2 For the convenience of explanation, only the parts related to this embodiment are shown. Figure 5 The multi-level classification model classification device 30 includes: a data acquisition module 31, a data classification module 32, a data matching module 33, a data classification path module 34, and a data classification result module 35.

[0137] The data acquisition module 31 is used to acquire text classification data, classify the text classification data using an encoder, and obtain a vector of the event text, wherein the text classification data refers to the event text classification data;

[0138] A data classification module 32 is used to input the vector of the matter text into the multi-classification model in the twin-tower model to perform multi-level text classification to obtain a first-level classification result of the first layer;

[0139] A data matching module 33 is used to input the primary classification result into the matching model in the twin tower model to perform text category classification, and obtain a corresponding category text subset classification result, wherein the corresponding category text subset classification result includes each corresponding category text vector;

[0140] The data classification path module 34 is used to input the encoding vector of the matter text and the corresponding category text vectors into the matching model in the twin tower model to perform binary classification vector matching to obtain a secondary classification result; until there is no corresponding category text subset, a classification path for multiple text classifications is obtained;

[0141] The data classification result module 35 is used to perform probability calculation based on the classification paths of multiple text classifications to obtain the optimal results for each level of classification.

[0142] Optionally, the data acquisition module 31 includes:

[0143] The text classification data unit is used to classify the text classification data using an encoder to obtain a vector of the matter text, wherein the text classification data refers to the matter text classification data.

[0144] Optionally, the data classification module 32 includes:

[0145] The classification unit is used to input the vector of the event text into the multi-classification model in the twin-tower model for text encoding classification to obtain the first-level classification result of the first layer;

[0146] Optionally, the above classification units include:

[0147] The multi-classification model subunit includes a first-level text classification model, a second-level text classification model...an n-th-level text classification model, where n is the level of the text.

[0148] Optionally, the data matching module 33 includes:

[0149] The category classification unit is used to input the first-level classification results into the matching model in the dual-tower model for text category classification;

[0150] The first-layer text sets a corresponding label unit, which is used to determine the category of the first-layer text of the text according to the current first-level classification result, and set a corresponding label for the first-layer text according to the category of the first-layer text;

[0151] The multiple texts are provided with corresponding label units, which are used to obtain the category of the second layer of text under the category of the first layer of text according to the category of the first layer of text, and so on, and set the corresponding label for the second layer of text according to the category of the second layer of text, until the corresponding label is set for the nth layer of text;

[0152] The category text vector unit is used to utilize the first layer text, the second layer text ... the nth layer text, and input the matching model in the twin tower model to perform text category classification, and generate the corresponding first layer category text vector, the second layer category text vector ... the nth layer category text vector.

[0153] Optionally, the data classification path module 34 includes:

[0154] The classification matching data pair unit is used to take the encoding vector of the event text and each corresponding category text vector as a pair of text classification matching data pairs.

[0155] A similarity determination unit is used to input each text classification matching data pair into the matching model in the twin tower model for binary classification vector matching, and determine the similarity between the encoding vector of the matter text and each candidate text corresponding to any corresponding category text vector;

[0156] A confidence score determination unit is used to determine the confidence score of each category text vector according to the similarity between the encoding vector of the determined event text and each candidate text corresponding to any corresponding category text vector;

[0157] The classification path unit of text classification is used to sort the confidence scores and select the second-level classification result with the highest score as the possible second-level category of the current matter text. After obtaining k second-level categories, if there are third-level categories associated with these second-level categories in the category relationship table, repeat this step for other associated categories until there is no corresponding category text subset, and obtain the classification path of multiple text classifications;

[0158] Optionally, the above-mentioned confidence score determination unit includes:

[0159] A high confidence score subunit, used for determining that when the similarity between the encoding vector of the event text and each candidate text corresponding to any corresponding category text vector is greater than a predetermined first threshold, the confidence score of the category text vector is high;

[0160] The low confidence score subunit is used to determine that when the similarity between the encoding vector of the event text and each candidate text corresponding to any corresponding category text vector is less than a predetermined second threshold, the confidence score of the category text vector is low.

[0161] Optionally, the data classification result module 35 includes:

[0162] The probability calculation unit is used to calculate the probability of the classification path of multiple text classifications through the beam search algorithm;

[0163] Each level of classification result unit is used to retain the first k results at each level of classification, and if there are n levels, a maximum of k results can be obtained. n-1 classification paths, then for the k n-1 The probability of each classification path is calculated, and the path with the largest probability value is taken as the optimal target path to obtain the classification results at all levels.

[0164] It should be noted that the information interaction, execution process, etc. between the above-mentioned modules, units, and sub-units are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0165] Figure 6 This is a schematic diagram of the structure of a computer device provided in Embodiment 4 of the present invention. Figure 6 As shown, the computer device of this embodiment includes: at least one processor ( Figure 6 Only one is shown), a memory, and a computer program stored in the memory and executable on at least one processor, and when the processor executes the computer program, the steps in the above-mentioned multi-level classification model classification method embodiment are implemented.

[0166] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Figure 6 This is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, it may also include a network interface, a display screen, and an input device.

[0167] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0168] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0169] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory may be the memory of a computer device, and the internal memory provides an environment for the operation of an operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments may also be an external storage device of a computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on a computer device. Further, the memory may also include both an internal storage unit of a computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of computer programs, etc. The memory may also be used to temporarily store data that has been output or is to be output.

[0170] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiment can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0171] The present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing.

[0172] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0173] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0174] In the embodiments provided by the present invention, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0175] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0176] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.

Claims

1. A multi-level classification model classification method, characterized in that: include: Acquire text classification data, and classify the text classification data using an encoder to obtain an event text vector, wherein the text classification data refers to event text classification data; Input the event text vector into the multi-classification model in the twin tower model to perform multi-level text classification, and obtain the first-level classification result of the first layer; Inputting the primary classification result into the matching model in the twin tower model to perform text category classification, and obtaining a corresponding category text subset classification result, wherein the corresponding category text subset classification result includes each corresponding category text vector; The event text vector and the corresponding category text vectors are input into the matching model in the twin tower model to perform binary classification vector matching to obtain a secondary classification result, until all corresponding category text subsets are gone, thereby obtaining classification paths for multiple text classifications; Probability calculation is performed based on the classification paths of multiple text classifications to obtain the optimal results for each level of classification.

2. A multi-level classification model classification method as claimed in claim 1, characterized in that: The step of inputting the event text vector into the multi-classification model in the twin-tower model for multi-level text classification to obtain the first-level classification result of the first layer includes: Input the item text vector into the multi-classification model in the twin tower model for text encoding classification to obtain the first-level classification result of the first layer; The multi-classification model includes a first-layer text classification model, a second-layer text classification model, ... an n-th-layer text classification model, where n is the number of layers of the text.

3. A multi-level classification model classification method as claimed in claim 1, characterized in that: The first-level classification result is input into the matching model in the twin-tower model to perform text category classification to obtain the classification result of the corresponding category text subset, including: Inputting the primary classification result into the matching model in the twin tower model to perform text category classification; Determine the category of the first layer of text according to the current first-level classification result, and set a corresponding label for the first layer of text according to the category of the first layer of text; According to the category of the first layer of text, the category of the second layer of text under the category of the first layer of text is obtained, and so on, and according to the category of the second layer of text, a corresponding label is set for the second layer of text, until the corresponding label is set for the nth layer of text; The first layer text, the second layer text, ... the nth layer text are used to input into the matching model in the twin tower model for text category classification, and the corresponding first layer category text vector, the second layer category text vector, ... the nth layer category text vector are generated.

4. A multi-level classification model classification method as claimed in claim 1, characterized in that: The event text vector and the corresponding category text vectors are input into the matching model in the twin tower model for binary classification vector matching to obtain a secondary classification result until there is no corresponding category text subset, and a classification path of multiple text classifications is obtained, including: a. taking the item text vector and the corresponding category text vectors as a pair of text classification matching data pairs; b. Input each of the text classification matching data pairs into the matching model in the twin tower model to perform binary classification vector matching, and determine the similarity between the item text vector and each candidate text corresponding to each corresponding category text vector; c. determining the confidence score of each category text vector based on the similarity between the item text vector and each candidate text corresponding to each corresponding category text vector; d. Sort the confidence scores again, select the secondary classification result with the highest score as the possible secondary category of the current matter text, and after obtaining k secondary categories, if there are tertiary categories associated with these secondary categories in the category relationship table, repeat steps ad for other associated categories until there is no corresponding category text subset, and obtain the classification path of multiple text classifications.

5. A multi-level classification model classification method as claimed in claim 4, characterized in that: Determining the confidence score of each category text vector based on the similarity between the item text vector and each candidate text corresponding to each corresponding category text vector includes: When the similarity between the item text vector and each candidate text corresponding to each corresponding category text vector is greater than a predetermined first threshold, the confidence score of the category text vector is high; And / or, when the similarity between the matter text vector and each candidate text corresponding to each corresponding category text vector is less than a predetermined second threshold, the confidence score of the category text vector is low.

6. A multi-level classification model classification method as claimed in claim 1, characterized in that: The classification paths based on multiple text classifications perform probability calculations to obtain optimal results for each level of classification, including: For the classification paths of multiple text categories, probability calculation is performed through the beam search algorithm; If the first k items are retained for each level of classification, and there are n levels, then The probability of each classification path is calculated, and the path with the largest probability value is taken as the optimal target path to obtain classification results at all levels.

7. A multi-level classification model training method, characterized in that: The multi-class classification model includes the Bert model, the multi-classification model in the twin tower model, and the matching model in the twin tower model. The multi-level classification model training method comprises: Acquire data to be trained, wherein the data to be trained includes item text training data and category name training data; Encoding the matter text training data and the category name training data based on the Bert model to obtain a matter text vector and a corresponding category text vector, wherein the corresponding category text vector includes a plurality of text classification category label information, and the plurality of text classification category labels correspond to different types of text classification training tasks; On the multi-classification model in the twin-tower model, the matter text vector extraction is trained to obtain the corresponding target text features, and the first-level classification results are predicted according to the target text features; On the matching model in the twin-tower model, the target text feature information and the corresponding category text vector are combined to obtain a concatenated text feature, and a second-level classification result is predicted based on the concatenated text feature until all corresponding category text vectors are completed; A target loss function of the multi-class classification model is obtained by obtaining a corresponding first loss function according to the first layer classification result, and a corresponding second loss function is obtained according to the second layer classification result. The multi-class classification model is trained and adjusted using the target loss function until a training stop condition is reached.

8. A multi-level classification model classification device, characterized in that: include: A data acquisition module, used to acquire text classification data, classify the text classification data using an encoder, and obtain an event text vector, wherein the text classification data refers to event text classification data; A data classification module is used to input the event text vector into the multi-classification model in the twin tower model to perform multi-level text classification to obtain a first-level classification result of the first layer; A data matching module is used to input the primary classification result into the matching model in the twin tower model to perform text category classification, and obtain a corresponding category text subset classification result, wherein the corresponding category text subset classification result includes each corresponding category text vector; A data classification path module is used to input the item text vector and the corresponding category text vector into the matching model in the twin tower model to perform binary classification vector matching to obtain a secondary classification result; until there is no corresponding category text subset, a classification path of multiple text classifications is obtained; The data classification result module is used to perform probability calculation based on the classification paths of multiple text classifications to obtain the optimal results for each level of classification.

9. A computer device, characterized in that: The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the multi-level classification model classification method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the multi-level classification model classification method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Multi-feature interaction network recruitment text classification method of similar double-tower model

    CN113342933A

  • Deep learning based text classification

    US20220138423A1