A tree structure-based text classification model training method, device and equipment

By calculating the loss function value of the tree structure node path in the text classification model, the problem of not distinguishing the severity of classification errors is solved, and faster training and more accurate parameter tuning are achieved.

CN115034219BActive Publication Date: 2026-01-06阳光保险集团股份有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210756506.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-29
Publication Date
2026-01-06
Estimated Expiration
2042-06-29

AI Technical Summary

Technical Problem

In existing text classification models, only the lowest-level classification label is classified during training, failing to distinguish the severity of classification errors, resulting in long training times and inaccurate parameter adjustments.

Method used

The tree-based text classification model training method calculates the loss function value by computing the node path of each classification label node, and adjusts the model parameters based on the loss value.

Benefits of technology

It saves model training time, accurately calculates loss values ​​and precisely adjusts parameters, thus improving the training efficiency of text classification models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115034219B_ABST
    Figure CN115034219B_ABST
Patent Text Reader

Abstract

The application provides a tree structure-based text classification model training method, device and equipment, wherein the method comprises: determining an actual node path corresponding to an actual leaf node matched with an actual classification label; determining a label parameter value corresponding to the actual node path; inputting a training text into an initial text classification model to obtain a matching degree vector of the training text under different classification labels; determining a training node path corresponding to a leaf node matched with the classification label in the tree structure; determining a loss function value of the text classification model according to the label parameter value corresponding to the actual node path, the matching degree vector of the training text under different classification labels and a node path parameter vector corresponding to each training node path; and training the initial text classification model according to the loss function value to obtain the text classification model. The effect of accurately calculating the loss value of the text classification model and accurately adjusting the parameters of the text classification model is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of language recognition technology, and more specifically, to a training method, apparatus, and device for a tree-based text classification model. Background Technology

[0002] In recent years, with the rapid development of AI, especially Natural Language Processing (NLP) technology, NLP has found more practical applications. Among these, text classification algorithms are a core component of NLP algorithms, widely used in question-answering systems, comment analysis, sentiment analysis, customer profiling, and search. It models the semantic information of text and matches the text to be classified with category labels.

[0003] Currently, in the training process of text classification models, text types are divided into multi-level labels, and these labels can form a tree structure. However, text classification is currently based only on the lowest-level classification label, and the text classification model is trained only based on the results of the lowest-level classification. As a result, when training the text classification model, it does not distinguish whether misclassified texts are on the same parent node. In other words, it does not differentiate the severity of misclassification, which leads to longer training time for the text classification model and less precise parameter tuning. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a training method, apparatus, and device for a tree-based text classification model, which can calculate the function loss value based on the node path of the node corresponding to each classification label in the tree structure. This solves the problem in the prior art that only distinguishes the classification errors without distinguishing the severity of the classification errors, resulting in longer training time for the text classification model and insufficient precision in adjusting the parameters of the text classification model. The application achieves the effect of saving model training time, accurately calculating the loss value of the text classification model, and precisely adjusting the parameters of the text classification model based on the loss value.

[0005] In a first aspect, embodiments of this application provide a training method for a text classification model based on a tree structure. The method includes: obtaining training text and the actual classification labels corresponding to the training text; determining the actual node path corresponding to the actual leaf node that matches the actual classification label based on the tree structure; determining the label parameter value corresponding to the actual node path; inputting the training text into an initial text classification model to obtain the matching degree vector of the training text under different classification labels; for each classification label, determining the training node path corresponding to the leaf node in the tree structure that matches the classification label; determining the loss function value for the text classification model based on the label parameter value corresponding to the actual node path, the matching degree vector of the training text under different classification labels, and the node path parameter vector corresponding to each training node path; and training the initial text classification model based on the loss function value to obtain a text classification model.

[0006] Optionally, the tree structure includes leaf nodes, intermediate nodes, and a root node, wherein the leaf node is the lowest-level node of the tree structure, each leaf node corresponds to a classification label, the parent node of the leaf node is an intermediate node, the parent node of the intermediate node is an intermediate node or a root node, the root node is the highest-level node of the tree structure, the actual node path includes all nodes on the path from the actual leaf node to the root node in the tree structure, and each training node path includes all nodes on the path from the leaf node matching the classification label to the root node in the tree structure.

[0007] Optionally, the step of determining the label parameter value corresponding to the actual node path includes: calculating the node path parameter vector of each node on the actual node path based on the node parameter vector of each node; and determining the label parameter value corresponding to the actual node path based on the actual node path matching degree vector and the node path parameter vector of each node on the actual node path.

[0008] Optionally, the node path parameter vector of each node on the actual node path is calculated in the following way: determine whether the node is a leaf node; if the node is a leaf node, determine the node path parameter vector of the node as the node path parameter vector of the node in the actual node path; if the node is not a leaf node, determine the node path parameter vector of the node in the actual node path based on the node parameter vector of the node and the node parameter vector of the leaf node in the actual node path.

[0009] Optionally, the label parameter value corresponding to the actual node path can be calculated using the following formula:

[0010]

[0011] Where A represents the label parameter value corresponding to the actual node path, e is the natural constant, and P y Indicates the actual node path, v i Let x represent the node path parameter vector of the i-th node in the actual node path, x be the actual node path matching degree vector, and T represent the calculation of the transpose of the vector.

[0012] Optionally, the node path parameter vector corresponding to each training node path is calculated in the following way: For each training node in the training node path, the following processing is performed: Determine whether the training node is a leaf node. If the training node is not a leaf node, determine the node path parameter vector of the training node in the training node path based on the node parameter vector of the training node and the node parameter vector of the parent node of the training node in the training node path. If the training node is a leaf node, determine the node parameter vector of the training node as the node path parameter vector of the training node in the training node path.

[0013] Optionally, the step of determining the loss function value for the text classification model based on the label parameter value corresponding to the actual node path, the matching degree vector of the training text under different classification labels, and the node path parameter vector corresponding to each training node path includes: for each classification label, calculating the training node path parameter value of the training text under that classification label based on the matching degree vector of the training text under that classification label and the node path parameter vector of the training node path corresponding to that classification label; calculating the training parameter value of the training text based on the training node path parameter value of the training text under different classification labels; and determining the loss function value for the text classification model based on the label parameter value and the training parameter value.

[0014] Optionally, the loss function value for the text classification model can be calculated using the following formula:

[0015]

[0016] Where loss represents the loss function value, e is the natural constant, and P y P represents the actual node path. j Let v represent the path to the j-th training node. q Let z represent the node path parameter vector of the q-th node in the training node path, and z represent the training text in P. j The matching degree vector of the classification label corresponding to the leaf node under the training node path, v i Let x represent the node path parameter vector of the i-th node in the actual node path, x be the actual node path matching degree vector, T represent the calculation of the transpose of the vector, and k represent the number of node paths in the tree structure.

[0017] Secondly, embodiments of this application also provide a training device for a tree-based text classification model, the device comprising:

[0018] The training text acquisition module is used to acquire the training text and the actual classification label corresponding to the training text;

[0019] The actual node path determination module is used to determine the actual node path corresponding to the actual leaf node that matches the actual classification label based on the tree structure.

[0020] The label parameter value determination module is used to determine the label parameter value corresponding to the actual node path;

[0021] The matching vector calculation module is used to input the training text into the initial text classification model to obtain the matching degree vector of the training text under different classification labels;

[0022] The training node path determination module is used to determine the training node path corresponding to the leaf node in the tree structure that matches the classification label for each classification label.

[0023] The loss function value determination module is used to determine the loss function value for the text classification model based on the label parameter value corresponding to the actual node path, the matching degree vector of the training text under different classification labels, and the node path parameter vector corresponding to each training node path.

[0024] The text classification model acquisition module is used to train the initial text classification model based on the loss function value to obtain the text classification model.

[0025] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the training method for the tree-based text classification model described above are performed.

[0026] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the training method for the tree-based text classification model described above.

[0027] The training method, apparatus, and device for a tree-based text classification model provided in this application solve the problems in the prior art that only distinguish between classification errors without distinguishing the severity of the errors, resulting in longer training times for the text classification model and less precise parameter adjustment. The method saves model training time, accurately calculates the loss value of the text classification model, and precisely adjusts the parameters of the text classification model based on the loss value.

[0028] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0029] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 A flowchart illustrating a training method for a tree-based text classification model provided in this application embodiment;

[0031] Figure 2 This is a schematic diagram of the tree structure provided in the embodiments of this application;

[0032] Figure 3 A schematic diagram of the structure of a training device for a tree-based text classification model provided in an embodiment of this application;

[0033] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.

[0035] First, the applicable application scenarios of this application will be introduced. This application can be applied to the field of speech recognition technology.

[0036] Research has revealed that currently, in the training process of text classification models, text types are divided into multi-level labels, and these labels can form a tree structure. However, text classification is currently based only on the lowest-level classification label, and the text classification model is trained solely on the results of this lowest-level classification. Consequently, during the training of the text classification model, there is no distinction made between misclassified texts and those on the same higher-level node. In other words, the severity of the misclassification is not differentiated, resulting in longer training times and less precise parameter tuning for the text classification model.

[0037] Based on this, embodiments of this application provide a training method, apparatus, and device for a tree-structured text classification model to solve the problems in the prior art that only distinguish between classification errors without distinguishing the severity of the classification errors, resulting in longer training time for the text classification model and insufficient precision in adjusting the parameters of the text classification model. This achieves the effects of saving model training time, accurately calculating the loss value of the text classification model, and precisely adjusting the parameters of the text classification model based on the loss value.

[0038] Please see Figure 1 , Figure 1 This is a flowchart illustrating a training method for a tree-based text classification model provided in an embodiment of this application. Figure 1 As shown in the embodiments of this application, the training method for a tree-based text classification model includes:

[0039] S101. Obtain the training text and the actual classification label corresponding to the training text.

[0040] Here, the first step is to determine the training text for the input text classification model and the actual classification labels of the training text.

[0041] S102. Based on the tree structure, determine the actual node path corresponding to the actual leaf node that matches the actual classification label.

[0042] For example, please refer to the tree structure for classifying insurance policy text. Figure 2 , Figure 2 This is a schematic diagram of the tree structure provided in the embodiments of this application, such as... Figure 2 The diagram shown is a schematic of the tree structure provided in this application embodiment. The tree structure includes leaf node 201, leaf node 202, intermediate node 203 and root node 204.

[0043] Among them, leaf node 201 and leaf node 202 are the lowest level nodes of the tree structure. Each leaf node corresponds to a category label. The parent node of leaf node 201 and leaf node 202 is intermediate node 203. The parent node of intermediate node 203 is either intermediate node 203 or root node 204. Root node 204 is the highest level node of the tree structure.

[0044] The actual node path includes all nodes on the path from the actual leaf node to the root node in the tree structure, and each training node path includes all nodes on the path from the leaf node that matches the classification label to the root node in the tree structure.

[0045] For example, if the actual leaf node is "Change Beneficiary 201", then the actual node path corresponding to this actual node is ("Change Beneficiary 201", "Policy Information Change 203", "Amendment to Policy Maintenance Business 204"). The relationship between the training node path and the training leaf node is the same as the relationship between the actual leaf node and the actual node path, and will not be elaborated here.

[0046] S103. Determine the label parameter value corresponding to the actual node path.

[0047] Specifically, the steps for determining the label parameter values ​​corresponding to the actual node path include: calculating the node path parameter vector of each node on the actual node path based on the node parameter vector of each node; and determining the label parameter values ​​corresponding to the actual node path based on the actual node path matching degree vector and the node path parameter vector of each node on the actual node path.

[0048] In this context, the node parameter vector for each node is pre-set, and the actual node path matching degree vector is also pre-set.

[0049] The node path parameter vector of each node on the actual node path can be calculated in the following way: determine whether the node is a leaf node; if the node is a leaf node, then determine the node path parameter vector of the node in the actual node path; if the node is not a leaf node, then determine the node path parameter vector of the node in the actual node path based on the node parameter vector of the node and the node parameter vector of the leaf node in the actual node path.

[0050] For example, in the actual node path (Change Beneficiary 201, Policy Information Change 203, Policy Modification 204), the node parameter vector for Change Beneficiary 201 is a, the node parameter vector for Policy Information Change 203 is b, and the node parameter vector for Policy Modification 204 is c. Then, in this actual node path, the node path parameter vector for Change Beneficiary 201 is a, the node path parameter vector for Policy Information Change 203 is ba, and the node parameter vector for Policy Modification 204 is ca.

[0051] Specifically, the label parameter value corresponding to the actual node path can be calculated using the following formula:

[0052]

[0053] Where A represents the label parameter value corresponding to the actual node path, e is the natural constant, and P y Indicates the actual node path, v i Let x represent the node path parameter vector of the i-th node in the actual node path, x be the actual node path matching degree vector, and T represent the calculation of the transpose of the vector.

[0054] In this way, the label parameter values ​​corresponding to the actual node path can be calculated.

[0055] S104. Input the training text into the initial text classification model to obtain the matching degree vector of the training text under different classification labels.

[0056] S105. For each classification label, determine the training node path corresponding to the leaf node in the tree structure that matches the classification label.

[0057] For example, after training text inputs to the initial text classification model, the matching degree vector with the change of beneficiary label is d, and the matching degree vector with the change of policyholder label is f. Then, in the tree structure, the matching degree vector between the training text and the training node path (change of beneficiary 201, policy information change 203, policy modification 204) is d; and the matching degree vector between the training text and the training node path (change of policyholder 202, policy information change 203, policy modification 204) is f.

[0058] S106. Determine the loss function value for the text classification model based on the label parameter values ​​corresponding to the actual node paths, the matching degree vector of the training text under different classification labels, and the node path parameter vectors corresponding to each training node path.

[0059] Specifically, the node path parameter vector corresponding to each training node path can be calculated in the following way: For each training node in the training node path, perform the following processing: Determine whether the training node is a leaf node. If the training node is not a leaf node, determine the node path parameter vector of the training node in the training node path based on the node parameter vector of the training node and the node parameter vector of the parent node of the training node in the training node path. If the training node is a leaf node, determine the node parameter vector of the training node as the node path parameter vector of the training node in the training node path.

[0060] The step of determining the loss function value for the text classification model based on the label parameter values ​​corresponding to the actual node paths, the matching degree vectors of the training text under different classification labels, and the node path parameter vectors corresponding to each training node path includes: for each classification label, calculating the training node path parameter value of the training text under that classification label based on the matching degree vector of the training text under that classification label and the node path parameter vector of the training node path corresponding to that classification label; calculating the training parameter value of the training text based on the training node path parameter values ​​of the training text under different classification labels; and determining the loss function value for the text classification model based on the label parameter values ​​and the training parameter values.

[0061] Specifically, the loss function value for a text classification model can be calculated using the following formula:

[0062]

[0063] Where loss represents the loss function value, e is the natural constant, and P y P represents the actual node path. j Let v represent the path to the j-th training node. q Let z represent the node path parameter vector of the q-th node in the training node path, and z represent the training text in P. j The matching degree vector of the classification label corresponding to the leaf node under the training node path, v i Let x represent the node path parameter vector of the i-th node in the actual node path, x be the actual node path matching degree vector, T represent the calculation of the transpose of the vector, and k represent the number of node paths in the tree structure.

[0064] S107. Based on the loss function value, train the initial text classification model to obtain the text classification model.

[0065] Specifically, the model parameters are adjusted based on the loss function value until the loss function value of the initial detection model converges to the minimum value. The initial detection model at which the loss function value converges to the minimum value is determined as the trained target detection model.

[0066] The training method for a tree-based text classification model provided in this application can calculate the function loss value based on the node path of the node corresponding to each classification label in the tree structure. This solves the problem in the prior art that only distinguishes between classification errors without distinguishing the severity of the errors, which leads to longer training time for the text classification model and less precise parameter adjustment. The method saves model training time, accurately calculates the loss value of the text classification model, and precisely adjusts the parameters of the text classification model based on the loss value.

[0067] Based on the same inventive concept, this application also provides a training device for a tree-based text classification model corresponding to the training method of the tree-based text classification model. Since the principle of the device in this application is similar to the training method of the tree-based text classification model described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0068] Please see Figure 3 , Figure 3 This is a schematic diagram of the structure of a training device for a tree-based text classification model provided in an embodiment of this application. Figure 3 As shown, the training device 300 for the tree-based text classification model includes:

[0069] The training text acquisition module 301 is used to acquire training text and the actual classification label corresponding to the training text.

[0070] The actual node path determination module 302 is used to determine the actual node path corresponding to the actual leaf node that matches the actual classification label based on the tree structure.

[0071] The label parameter value determination module 303 is used to determine the label parameter value corresponding to the actual node path.

[0072] The matching vector calculation module 304 is used to input the training text into the initial text classification model to obtain the matching degree vector of the training text under different classification labels.

[0073] The training node path determination module 305 is used to determine the training node path corresponding to the leaf node in the tree structure that matches the classification label for each classification label.

[0074] The loss function value determination module 306 is used to determine the loss function value for the text classification model based on the label parameter value corresponding to the actual node path, the matching degree vector of the training text under different classification labels, and the node path parameter vector corresponding to each training node path.

[0075] The text classification model acquisition module 307 is used to train the initial text classification model based on the loss function value to obtain the text classification model.

[0076] This application provides a training device for a tree-based text classification model. This device calculates the function loss value based on the node path of each classification label in the tree structure. This solves the problem in existing technologies where only classification errors are distinguished without considering their severity, leading to longer training times and less precise parameter adjustments. The device saves training time, accurately calculates the text classification model loss value, and precisely adjusts the model parameters based on the loss value.

[0077] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 4 As shown, the electronic device 400 includes a processor 410, a memory 420, and a bus 430.

[0078] The memory 420 stores machine-readable instructions executable by the processor 410. When the electronic device 400 is running, the processor 410 communicates with the memory 420 via the bus 430. When the machine-readable instructions are executed by the processor 410, they can perform the operations described above. Figure 1 The steps of the training method for the tree-based text classification model in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.

[0079] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 1 The steps of the training method for the tree-based text classification model in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.

[0080] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0081] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

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

[0083] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0084] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0085] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for training a tree structure-based text classification model, characterized in that, The method comprises: obtaining training text and actual classification labels corresponding to the training text; determining an actual node path corresponding to an actual leaf node matching the actual classification labels based on the tree structure; determining a label parameter value corresponding to the actual node path; inputting the training text into an initial text classification model to obtain a matching degree vector of the training text under different classification labels; for each classification label, determining a training node path corresponding to a leaf node matching the classification label in the tree structure; for each classification label, calculating a training node path parameter value of the training text under the classification label according to the matching degree vector of the training text under the classification label and the node path parameter vector of the training node path corresponding to the classification label; calculating a training parameter value of the training text according to the training node path parameter values of the training text under different classification labels; and determining a loss function value of the text classification model according to the label parameter value and the training parameter value; training the initial text classification model according to the loss function value to obtain a text classification model.

2. The method of claim 1, wherein, The tree structure comprises leaf nodes, intermediate nodes and a root node, wherein the leaf nodes are the lowest level nodes of the tree structure, each leaf node corresponds to a classification label, the upper level node of the leaf node is an intermediate node, the upper level node of the intermediate node is an intermediate node or a root node, and the root node is the highest level node of the tree structure, the actual node path comprises all nodes on the path from the actual leaf node to the root node in the tree structure, and each training node path comprises all nodes on the path from the leaf node matching the classification label to the root node in the tree structure.

3. The method of claim 1, wherein, The step of determining the label parameter value corresponding to the actual node path comprises: calculating a node path parameter vector of each node on the actual node path according to the node parameter vector of each node; determining the label parameter value corresponding to the actual node path according to the actual node path matching degree vector and the node path parameter vector of each node on the actual node path.

4. The method of claim 3, wherein, The node path parameter vector of each node on the actual node path is calculated in the following manner: determining whether the node is a leaf node; if the node is a leaf node, determining the node parameter vector of the node as the node path parameter vector of the node in the actual node path; if the node is not a leaf node, determining the node path parameter vector of the node in the actual node path according to the node parameter vector of the node and the node parameter vector of the leaf node in the actual node path.

5. The method of claim 3, wherein, The label parameter value corresponding to the actual node path is calculated in the following formula: A= wherein A represents a label parameter value corresponding to the actual node path, e is a natural constant, represents the actual node path, represents a node path parameter vector of the i-th node in the actual node path, x is an actual node path matching degree vector, and T represents a transposed calculation of a vector.

6. The method of claim 1, wherein, The node path parameter vector corresponding to each training node path is calculated in the following manner: The following processing is performed for each training node in the training node path: it is determined whether the training node is a leaf node, if the training node is not a leaf node, a node path parameter vector of the training node in the training node path is determined according to the node parameter vector of the training node and the node parameter vector of a node in the training node path which is a parent node of the training node, if the training node is a leaf node, the node parameter vector of the training node is determined as the node path parameter vector of the training node in the training node path.

7. The method of claim 1, wherein, The loss function value for the text classification model is calculated by the following formula: wherein, represents a loss function value, e is a natural constant, represents an actual node path, represents a jth training node path, represents a node path parameter vector of a qth node in a training node path, z represents a matching degree vector of a classification label corresponding to a leaf node of a training text under a training node path, represents a matching degree vector of a classification label corresponding to a leaf node of a training text under a training node path, represents a node path parameter vector of an ith node in an actual node path, x is an actual node path matching degree vector, T represents a transpose calculation of a vector, and k represents a number of node paths in a tree structure.

8. A training device for a text classification model based on a tree structure, characterized in that, The device comprises: A training text acquisition module configured to acquire a training text and an actual classification label corresponding to the training text; An actual node path determination module configured to determine, based on the tree structure, an actual node path corresponding to an actual leaf node matched with the actual classification label; A label parameter value determination module configured to determine a label parameter value corresponding to the actual node path; A matched vector calculation module configured to input the training text into an initial text classification model to obtain a matching degree vector of the training text under different classification labels; A training node path determination module configured to determine, for each classification label, a training node path corresponding to a leaf node matched with the classification label in the tree structure; A loss function value determination module configured to calculate, for each classification label, a training node path parameter value of the training text under the classification label according to the matching degree vector of the training text under the classification label and a node path parameter vector of the training node path corresponding to the classification label; calculate a training parameter value of the training text according to the training node path parameter values of the training text under different classification labels; and determine a loss function value for the text classification model according to the label parameter value and the training parameter value; A text classification model acquisition module configured to train the initial text classification model according to the loss function value to obtain a text classification model.

9. An electronic device, comprising: It comprises: A processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, the processor executes the machine readable instructions to perform the steps of the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for training business model and determining text classification categories

    CN111737474A

  • Lable tree-based model training and text label determining method and device

    CN112015898A