Document classification method, device, apparatus and storage medium

By performing graph structuring on the document dataset and semi-supervised training, and injecting the target hierarchical classification relationship as prior knowledge, the problem of poor model performance in fully supervised classification tasks when training data is lacking is solved, thus improving classification accuracy.

CN116522232BActive Publication Date: 2026-07-03LENOVO (BEIJING) LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
LENOVO (BEIJING) LTD
Filing Date
2023-05-31
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

In fully supervised classification tasks, existing technologies struggle to effectively inject prior knowledge into the model, resulting in poor model performance when training data is lacking.

Method used

By performing graph structuring on the document dataset, a graph structure data of the target hierarchical classification relationship is constructed, and a semi-supervised trained document classification model is used for classification prediction, injecting the target hierarchical classification relationship as prior knowledge.

Benefits of technology

It improves the classification accuracy of document datasets, and performs exceptionally well even when training data is scarce.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116522232B_ABST
    Figure CN116522232B_ABST
Patent Text Reader

Abstract

This application discloses a document classification method, apparatus, device, and storage medium. The document classification method includes: acquiring at least one batch of document datasets to be classified; performing graph structuring on each batch of the document datasets based on a target hierarchical classification relationship to obtain first graph structure data; wherein each node in the first graph structure data corresponds to a document; using a document classification model to perform classification prediction on the first graph structure data to obtain a classification result; wherein the document classification model is obtained through semi-supervised training based on second graph structure data corresponding to the sample dataset; the second graph structure data is obtained by performing graph structuring on the sample dataset based on representing the hierarchical classification relationship between samples in the sample dataset.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to, but is not limited to, the field of data processing technology, and in particular to a document classification method, apparatus, device, and storage medium. Background Technology

[0002] In current fully supervised classification tasks, the labels injected into the objective function, such as the cross-entropy loss function, are primarily used to train the model. However, these labels typically come from hierarchical classification methods with more information from larger prior knowledge. How to inject this prior knowledge into the learning algorithm so that the model still performs well when training data is scarce is a problem worthy of in-depth investigation in this field. Summary of the Invention

[0003] In view of this, embodiments of this application provide at least one document classification method, apparatus, system, device, and storage medium.

[0004] The technical solution of this application embodiment is implemented as follows:

[0005] In a first aspect, embodiments of this application provide a document classification method, the method comprising:

[0006] Obtain at least one batch of document datasets to be classified; based on the target hierarchical classification relationship, perform graph structuring on each batch of document datasets to obtain first graph structure data; wherein, each node in the first graph structure data corresponds to a document; use a document classification model to perform classification prediction on the first graph structure data to obtain classification results; wherein, the document classification model is obtained through semi-supervised training based on the second graph structure data corresponding to the sample dataset; the second graph structure data is obtained by performing graph structuring on the sample dataset based on representing the hierarchical classification relationship between samples in the sample dataset.

[0007] Secondly, embodiments of this application provide a document classification device, the device comprising:

[0008] The data acquisition module is used to acquire at least one batch of document datasets to be classified;

[0009] The data transformation module is used to perform graph structuring on each batch of the document dataset based on the target hierarchical classification relationship to obtain first graph structure data; wherein, each node in the first graph structure data corresponds to a document.

[0010] The classification prediction module is used to perform classification prediction on the first graph structure data using a document classification model to obtain a classification result; wherein, the document classification model is obtained by semi-supervised training based on the second graph structure data corresponding to the sample dataset; the second graph structure data is obtained by graph structuring the sample dataset based on representing the hierarchical classification relationship between each sample in the sample dataset.

[0011] Thirdly, embodiments of this application provide an electronic device, including a memory and at least one processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the program to implement the steps in the above-described document classification method.

[0012] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the document classification method described above.

[0013] In this embodiment, firstly, at least one batch of document datasets to be classified is obtained; then, based on the target hierarchical classification relationship, each batch of document datasets is processed into a graph structure to obtain first graph structure data; finally, a document classification model is used to perform classification prediction on the first graph structure data to obtain a classification result. Thus, the first graph structure data after graph structure processing of the document dataset contains prior knowledge of the classification task due to the target hierarchical classification relationship. The representation vector corresponding to the document dataset to be classified obtained by inputting the first graph structure data into the trained document classification model can reflect richer feature information. Therefore, classifying the representation vector can improve the accuracy of classifying the document dataset.

[0014] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of this disclosure. Attached Figure Description

[0015] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.

[0016] Figure 1 A schematic diagram of an optional document classification method provided in an embodiment of this application;

[0017] Figure 2 A schematic diagram of an optional flowchart of the document classification model provided in an embodiment of this application;

[0018] Figure 3 A flowchart illustrating the training method for the document classification model provided in this application embodiment;

[0019] Figure 4 A flowchart illustrating the training method for the document classification model provided in this application embodiment;

[0020] Figure 5 The logical flowchart of the model training process provided in the embodiments of this application;

[0021] Figure 6 This is a schematic diagram of the composition structure of a document classification device provided in an embodiment of this application;

[0022] Figure 7 This is a schematic diagram of the hardware entity of an electronic device provided in an embodiment of this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application are further described in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0024] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0025] The terms “first / second / third” are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that “first / second / third” may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. The terminology used herein is for descriptive purposes only and is not intended to limit the scope of this application.

[0027] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0028] Graph Convolutional Networks (GCNs) are a powerful method for semi-supervised learning on graph-structured data. A GCN model is a model from graph theory that analyzes a topological graph by establishing relationships between vertices and edges. In implementation, a graph-structured data is input into a GCN, and through several layers of the GCN, the features of each node are transformed from X to Z. However, regardless of the number of intermediate layers, the connection relationships between nodes, i.e., the connection matrix, are shared.

[0029] A graph structure is typically represented as G(ν,ε,V,E): where G represents a graph structure, ν is the set of nodes in the graph structure, ε is the set of edges in the graph structure, V is the set of node characteristics of all nodes in the graph structure, and E is the set of edge characteristics of all edges in the graph structure. If an edge connects two nodes in a graph structure, then these two nodes are said to be adjacent, and these two nodes are called the endpoints of this edge. If a node is an endpoint of an edge, then this node is said to be associated with this edge.

[0030] This application provides a document classification method that can be executed by a processor of an electronic device. The electronic device can be a server, laptop, tablet, desktop computer, smart TV, set-top box, mobile device (e.g., mobile phone, portable video player, personal digital assistant, dedicated messaging device, portable gaming device), or any other device with model training capabilities. Figure 1 An optional flowchart illustrating the document classification method provided in the embodiments of this application is shown below. Figure 1 As shown, the method includes the following steps S110 to S130:

[0031] Step S110: Obtain at least one batch of document datasets to be classified.

[0032] Here, there is a hierarchical relationship between the documents in the at least one batch of document dataset. For example, if document 1 references document 2, or if document 1 and document 2 are both referenced by document 3, then document 2 is a first-level document, document 1 is a second-level document, and document 3 is a third-level document.

[0033] Step S120: Based on the target hierarchical classification relationship, perform graph structuring on each batch of the document dataset to obtain the first graph structure data.

[0034] Here, each node in the first graph structure data corresponds to a document. The target hierarchical classification relationship is the multi-level classification information corresponding to the relevant document classification task, which is usually represented as a tree structure, i.e., a hierarchical classification tree. For example, in the hierarchical classification tree, if node L is the parent node, then node M connected to node L is the child node, and node N connected to node M is the leaf node.

[0035] The first graph structure data is a data type that can be directly input into the document classification model, including an adjacency matrix representing the connection relationships between nodes and a feature matrix composed of the features of each node. In implementation, based on the label information and target hierarchical classification relationships of each document in the document dataset, the specific level and corresponding node of each document in the hierarchical classification tree are determined. Connecting each document to the corresponding node in the hierarchical classification tree forms the trunk graph of the classification tree, and then calculating the adjacency matrix and feature matrix to obtain the first graph structure data.

[0036] It should be noted that the same target hierarchical classification relationship is used for graph structuring of each batch of document datasets. In other words, the target hierarchical classification relationship is consistent across different batches of document datasets.

[0037] Step S130: Use a document classification model to classify and predict the first graph structure data to obtain the classification result.

[0038] Here, the document classification model is obtained through semi-supervised training based on the second graph structure data corresponding to the sample dataset; the second graph structure data is obtained by performing graph structuring on the sample dataset to represent the hierarchical classification relationship between each sample in the sample dataset.

[0039] The document classification model is a graph-structured neural network, which can encode each node in the graph-structured data. Thus, the document classification model trained using the second graph-structured data learns the hierarchical classification relationship between samples during the training process, enabling the document classification model to obtain accurate classification results for any graph-structured data with the same classification task.

[0040] In this embodiment, firstly, at least one batch of document datasets to be classified is obtained; then, based on the target hierarchical classification relationship, each batch of document datasets is processed into a graph structure to obtain first graph structure data; finally, a document classification model is used to perform classification prediction on the first graph structure data to obtain a classification result. Thus, the first graph structure data after graph structure processing of the document dataset contains prior knowledge of the classification task due to the target hierarchical classification relationship. The representation vector corresponding to the document dataset to be classified obtained by inputting the first graph structure data into the trained document classification model can reflect richer feature information. Therefore, classifying the representation vector can improve the accuracy of classifying the document dataset.

[0041] In some implementations, the first graph structure data includes an adjacency matrix and a feature matrix; Figure 2 An optional flowchart illustrating the document classification method provided in the embodiments of this application is shown below. Figure 2As shown, step S120, "based on the target hierarchical classification relationship, perform graph structuring processing on each batch of the document dataset to obtain the first graph structure data," may include the following steps S210 to S230:

[0042] Step S210: Based on the target hierarchical classification relationship, construct the graph structure corresponding to each batch of document datasets.

[0043] Here, the graph structure corresponding to each batch of document datasets is understood as a classification tree trunk graph. This graph structure is constructed based on the target hierarchical classification relationship corresponding to the classification task. Therefore, the graph structure is consistent for different batches of document datasets.

[0044] It should be noted that a graph structure includes nodes and edges, consisting of a finite non-empty set of nodes and a set of edges between nodes. Each node has corresponding node features, and each edge has corresponding edge features. The graph structure data includes the relationships between nodes, the node features of each node, and the edge features of each edge.

[0045] In some implementations, the graph structure corresponding to each batch of the document dataset is constructed by: obtaining a classification tree for the task categories corresponding to the at least one batch of document datasets; and connecting each document in each batch of the document dataset to the corresponding node in the classification tree based on the label information of the at least one batch of document datasets and / or the hierarchical information of the classification tree, thereby forming the graph structure.

[0046] In this way, by using the classification tree of the task categories corresponding to the document dataset as the backbone, each batch of document datasets is connected to the corresponding node of the classification tree to obtain the corresponding graph structure. This ensures that the graph structure of all batches of document datasets has a consistent hierarchical classification relationship, thereby forming a batch-based framework by combining graph convolutional networks, without having to encode the entire large-scale graph structured data.

[0047] Step S220: Generate the adjacency matrix based on the connection relationships between the nodes in the graph structure.

[0048] Here, by utilizing the hierarchical information in the graph structure and the semantic relationships between documents in the classified document dataset, we can identify other documents that are related to each document. Thus, we set the connection relationship between related documents to 1 and the connection relationship between unrelated documents to 0, thereby establishing the adjacency matrix of the graph structure.

[0049] Step S230: Determine the feature matrix based on the feature vectors of each node in the graph structure.

[0050] Here, the feature vector of each node is generated based on the attribute data of the document corresponding to the same node. The document's attribute data includes, for example, elements, text, tags, and comments.

[0051] In some implementations, each document's corresponding node is first encoded using one-hot encoding to obtain 256-dimensional features. Then, the features of all nodes in the graph structure are saved as a feature matrix. In other implementations, text feature vectors for each document are generated based on the word vectors of each word in the document; the text feature vectors corresponding to each node in the graph structure are combined to generate the graph structure's feature matrix. The specific method for determining the feature matrix in implementation is not limited here.

[0052] In this embodiment, firstly, a graph structure corresponding to each batch of document datasets is constructed based on the target hierarchical classification relationship; then, the adjacency matrix is ​​generated based on the connection relationship between each node in the graph structure; and finally, the feature matrix is ​​determined based on the feature vector of each node in the graph structure. Thus, the document dataset is processed into a first graph structure data, which can be directly used as input data for a trained document classification model. At the same time, the target hierarchical classification relationship with more information is injected as prior knowledge into the learning algorithm, which can improve the accuracy of the classification task.

[0053] In some implementations, the document classification method further includes a training process for the document classification model. Figure 3 A flowchart illustrating the training method for the document classification model provided in this application embodiment is shown below. Figure 3 As shown, the training method includes the following steps S310 to S330:

[0054] Step S310: Obtain at least one batch of sample datasets.

[0055] Here, at least one sample in each batch of sample datasets carries the document's label information, which means that semi-supervised learning is performed using the sample dataset.

[0056] Step S320: Based on the hierarchical classification relationship between samples in the sample dataset, perform graph structuring on each batch of the sample dataset to obtain the second graph structure data.

[0057] Here, each node in the second graph structure corresponds to a sample. The hierarchical classification relationship between samples is multi-level classification information corresponding to the relevant document classification task, usually manifested as a tree structure, i.e., a hierarchical classification tree.

[0058] The second graph structure data and the first graph structure data are of the same data type, including an adjacency matrix showing the connections between sample nodes and a feature matrix composed of the features of each node. The second graph structure data for the training samples can be obtained by referring to the implementation process for obtaining the first graph structure data in the aforementioned embodiments.

[0059] Step S330: Based on the second graph structure data, perform semi-supervised training on the model to be trained to obtain the document classification model.

[0060] Here, the model to be trained is a graph convolutional network model, which is a model in graph theory that uses a topological graph with corresponding relationships established by vertices and edges for analysis.

[0061] It is worth noting that one problem with graph convolutional network models is the memory required to encode each node in large graph structured data. Using graph convolutional network models on the entire graph data does not allow for explicit regularization of the supervised loss function (e.g., cross-entropy loss), meaning it cannot be used as regularization along with the supervised loss function. Therefore, in this embodiment, the sample dataset is divided into multiple batches, and each batch is processed to obtain second graph structured data which is then input into the model to be trained, instead of processing all sample data as a single large graph structured data for encoding.

[0062] In this embodiment, at least one batch of sample datasets is first obtained; then, based on the hierarchical classification relationship between samples in the sample datasets, each batch of sample datasets is processed into graph structure data to obtain second graph structure data; finally, based on the second graph structure data, the training model is semi-supervised to obtain the document classification model; thus, by processing each batch of sample datasets into second graph structure data according to the hierarchical classification relationship and inputting it into the training model, the training model learns the prior domain knowledge in the hierarchical classification relationship during the encoding of the second graph structure data, thereby making the final document classification model more accurate and easier to explain its excellent performance even when training data is lacking.

[0063] Figure 4 A flowchart illustrating the training method for the document classification model provided in this application embodiment is shown below. Figure 4 As shown, step S330, "Based on the second graph structure data, perform semi-supervised training on the model to be trained to obtain the document classification model," includes the following steps S410 to S430:

[0064] Step S410: Input the second graph structure data into the model to be trained to obtain the predicted label corresponding to each node in the second graph structure data.

[0065] Here, for each node in the second graph structure data, the probability prediction value output by the last layer of the model to be trained is used as the predicted label of the corresponding node. The number of message passing layers in the model to be trained and the types of neurons in each layer can be changed according to requirements and are not specifically limited here.

[0066] Step S420: Based on the predicted labels of each node in the second graph structure data, determine the learning loss parameters of the model to be trained.

[0067] Here, the learning loss parameters include two parts: supervised loss and regularization loss. The supervised loss is obtained by calculating the cross-entropy loss for all labeled nodes in the second graph structure data, while the regularization loss is obtained by modeling the prior knowledge of the sample data. The purpose of regularization is to add a penalty term to the loss function of the model to be trained to enhance the model's generalization ability, limit the number of parameters to be too large, and avoid making the model more complex.

[0068] In some implementations, the cross-entropy loss is determined based on the predicted label of each node in the second graph structure data and the true label corresponding to each node; the regularization loss is determined based on the distance between each node in the second graph structure data and the corresponding node output by the last layer of the model to be trained; and the learning loss parameter is obtained by linearly summing the cross-entropy loss and the regularization loss based on the target regularization coefficient.

[0069] Here, the cross-entropy loss is used to fit the difference between the model's predicted labels and the true labels, and the regularization loss is used to prevent the model from overfitting and increase its generalization ability. The target regularization coefficient is usually an empirical value, such as 0.05, but it can also be adjusted according to the actual business type.

[0070] The distance between each node in the second graph structure data and the corresponding node output by the last layer of the model to be trained can be KL (Kullback-Leiblerdivergence) distance, Euclidean distance, Manhattan distance, etc., and this application embodiment does not limit it.

[0071] In this way, the regularization loss is determined by calculating the distance between corresponding nodes in the input and output data, and added to the learning loss parameters to constrain the freedom of model parameters and reduce model complexity. Thus, the regularization loss can be used to suppress errors caused by differences in model encoding.

[0072] In some implementations, the node representation matrix corresponding to the second graph structure data and the prediction probability matrix output by the last layer of the model to be trained are determined; each node in the node representation matrix is ​​traversed, and the Euclidean distance between the label of each node in the node representation matrix and the prediction label of the corresponding node in the prediction probability matrix is ​​regularized to obtain the regularization loss.

[0073] Here, each element in the node representation matrix represents the embedding vector calculated by the last layer of the model to be trained for each node in the second graph structure data, and each element in the prediction probability matrix represents the probability value of the corresponding node output by the last layer of the model to be trained. In implementation, the L2 norm of the Euclidean distance between corresponding nodes in the node representation matrix and the prediction probability matrix is ​​calculated, i.e., the square root of the sum of the squares of each element, to obtain the regularization loss.

[0074] Step S430: Perform backpropagation training on the model to be trained based on the learning loss parameters until the training stopping condition is met to obtain the document classification model.

[0075] Here, the training stopping conditions include, but are not limited to, reaching a preset number of iterations, meeting a preset training duration, or the learning loss value falling below a preset threshold. The preset number of iterations is an empirical value, such as 300,000 or 50 million iterations.

[0076] In the embodiments of this application, in the forward computation of model training, the cross-entropy loss and regularization loss are calculated based on the labels of each node in the second graph structure data, and the learning loss parameters of the model to be trained are obtained by linearly summing the cross-entropy loss and regularization loss using the target regularization coefficient. Then, the parameters of the model to be trained are updated by backpropagation using the learning loss parameters until the training ends.

[0077] The above model training method will be described below with reference to a specific embodiment. However, it is worth noting that this specific embodiment is only for better illustration of this application and does not constitute an improper limitation of this application.

[0078] In current fully supervised classification tasks, the primary method used to train models in this field is to inject labels into the objective function, such as the cross-entropy loss function. However, these labels typically come from hierarchical classification methods with more information from larger prior knowledge. In this embodiment, such prior knowledge is injected into the DNN learning algorithm. Graph convolutional networks are a powerful method for semi-supervised learning on graph-structured data. One problem with graph convolutional networks is the memory required to encode large graph-structured data to provide a representation for each node. Using graph convolutional networks on the entire graph data does not allow for explicit regularization of another supervised loss function (e.g., cross-entropy).

[0079] This application embodiment uses a batch-based graph convolutional network to inject the hierarchical classification tree corresponding to the categories of the classification task as prior knowledge (domain knowledge) into the loss function of the model to be trained. The specific process is as follows: First, a graph structure (i.e., a classification tree backbone graph) is provided for each batch of sample datasets. This graph structure is consistent across all batches and is generated based on the classification tree of the corresponding task category. One batch of sample datasets includes several documents from the training data; the hierarchical classification tree is used as the backbone of the larger graph structure A during the construction of the graph structure. In fact, graph structure A is generated by connecting the documents of a batch to the corresponding nodes of the classification tree. In this method, it is desirable to consider the prior domain knowledge encoded in the classification tree while simultaneously training the supervised loss function (DNN) algorithm.

[0080] Figure 5 The logical flowchart of the model training process provided in the embodiments of this application is as follows: Figure 5 As shown, the entire workflow of end-to-end training is as follows: Several documents are selected from the training data as a batch of sample datasets 51, such as document d1, document d2, document d3, document d4, document d5, document d6, and document d7. Simultaneously, a hierarchical classification tree 52 is obtained. Each document in the batch of sample datasets 51 is connected to the corresponding node in the classification tree 52 according to the hierarchical relationship, forming a graph structure A. The adjacency matrix and feature matrix corresponding to graph structure A are input into the GCN network model 53. The features of each node in the input layer 531, such as X1, X2, X3, and X4, are transformed into Z1, Z2, Z3, and Z4 respectively after passing through multiple hidden layers 532 and outputting to the output layer 533. In other words, through several layers of the GCN network model 53, the features of each node in graph structure A change from X to Z. However, regardless of the number of intermediate layers, the connection relationship between nodes, i.e., the adjacency matrix, is shared. Regarding the GCN network model 53, it is a graph convolutional network, suitable for semi-supervised learning. Here, Y1 and Y4 correspond to the true labels of the labeled nodes. After classification, all nodes form categories, and the classification prediction results of the labeled nodes are calculated as the supervision loss based on whether they correspond to the true labels.

[0081] It should be noted that the features of each node in graph structure A form an N×D feature matrix X, and the relationships between the nodes also form an N×N matrix A, also known as the adjacency matrix. X and A are the inputs to the model to be trained.

[0082] Based on the classification tree, a structure graph A is generated to provide a node representation matrix H for a batch of sample datasets in the DNN supervision algorithm.

[0083]

[0084] in, It is the matrix formed by appending self-joins to the adjacency matrix A corresponding to the structural graph A. N It is the identity matrix. H is the matrix after normalizing the adjacency matrix A. (l) W (l) This is equivalent to performing a linear transformation on the embedding vectors of all nodes in layer l, multiplying them on the left by the adjacency matrix. This means that for each node, the feature representation of that node is the sum of the features of its neighboring nodes. W (l) This is a layer-specific trainable weight matrix. σ(.) represents the non-linear activation function (ReLU was used in the experiments). H (l) ∈R N×D These are the features in the l-th layer, where for the input layer H (0) =X (where X is the feature matrix composed of the features of each node in the structure graph A), H (2) =softmax(H (1) ).

[0085] During the forward computation of model training, based on the supervised loss, the distance between each node in graph structure A and the corresponding node of the last layer output of the model to be trained is measured and added to the training loss as a regularization loss. Specifically, the learning loss parameter L can be calculated using the following formulas (2) and (3):

[0086] L=L0+λL reg Formula (2);

[0087]

[0088] Where λ is the objective regularization coefficient, L0 is the cross-entropy loss, and L reg It is the regularization loss, P represents the predicted probability matrix of each node in the output of the last layer of the model to be trained, and H is the node representation matrix calculated by the last layer of the model to be trained for each node in the second graph structure data.

[0089] Table 1 below compares the test results of different training methods when the batch size is set to 32 and the preset regularization coefficient λ is 0.05:

[0090] Table 1 Comparison of test results for different training methods on the GEO dataset

[0091] accuracy Macro parameter F1 Weight parameter F2 conventional methods 74.98 58.49 75.18 Classification tree-based methods 75.90 59.12 76.57

[0092] As can be seen, for the same GEO (GENE EXPRESSION OMNIBUS) dataset, the classification tree-based training method provided in this application significantly improves upon conventional methods in terms of accuracy, macro parameter F1, and weight parameter F2. It should be noted that the training dataset can also be other classification datasets, not limited to the GEO dataset.

[0093] The document classification method provided in this application uses a batch-based graph convolutional network to inject hierarchical classification trees for any classification task as prior knowledge (domain knowledge) into the loss function during model training. On one hand, the classification tree corresponding to the category of the classification task is explicitly injected into the loss function of the training algorithm as a regularization loss. On the other hand, this application proposes a batch-based document classification framework where the trained document classification model is used to encode the classification tree corresponding to a batch of training data, rather than encoding the entire large-scale graph structured data.

[0094] The document classification method provided in this application is scalable to any classification task including hierarchical classification trees of categories; it is also scalable to any structured graphical data that can be used as the backbone of the training batch. Because the training algorithm goes through a conceptual hierarchy of categories, and the graph convolutional network based on the improved loss function learns this prior knowledge, the results of the trained model are more easily explained by its excellent performance even when training data is lacking.

[0095] Based on the foregoing embodiments, this application provides a document classification device, which includes the included modules, as well as the sub-modules and units included in each module. It can be implemented by a processor in an electronic device; of course, it can also be implemented by specific logic circuits. In the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.

[0096] Figure 6 This is a schematic diagram of the composition structure of a document classification device provided in an embodiment of this application, as shown below. Figure 6 As shown, the document classification device 600 includes:

[0097] The data acquisition module 610 is used to acquire at least one batch of document datasets to be classified;

[0098] The data conversion module 620 is used to perform graph structuring on each batch of the document dataset based on the target hierarchical classification relationship to obtain first graph structure data; wherein, each node in the first graph structure data corresponds to a document.

[0099] The classification prediction module 630 is used to perform classification prediction on the first graph structure data using a document classification model to obtain a classification result; wherein, the document classification model is obtained by semi-supervised training based on the second graph structure data corresponding to the sample dataset; the second graph structure data is obtained by graph structuring the sample dataset based on representing the hierarchical classification relationship between each sample in the sample dataset.

[0100] In some possible embodiments, the first graph structure data includes an adjacency matrix and a feature matrix; the data conversion module 620 includes: a construction submodule, used to construct a graph structure corresponding to each batch of the document dataset based on the target hierarchical classification relationship; a generation submodule, used to generate the adjacency matrix based on the connection relationship between each node in the graph structure; and a determination submodule, used to determine the feature matrix based on the feature vectors of each node in the graph structure; wherein, the feature vector of each node is generated based on the attribute data of the document corresponding to the same node.

[0101] In some possible embodiments, the construction submodule includes: an acquisition unit, configured to acquire a classification tree for the task categories corresponding to the at least one batch of document datasets; and a construction unit, configured to connect each document in each batch of the document dataset to the corresponding node in the classification tree based on the label information of the at least one batch of document datasets and / or the hierarchical information of the classification tree, to form the graph structure.

[0102] In some possible embodiments, the apparatus further includes: a sample acquisition module for acquiring at least one batch of sample datasets; a sample processing module for performing graph structuring processing on each batch of sample datasets based on the hierarchical classification relationship representing the samples in the sample datasets to obtain second graph structure data; wherein each node in the second graph structure data corresponds to a sample; and a model training module for performing semi-supervised training on the model to be trained based on the second graph structure data to obtain the document classification model.

[0103] In some possible embodiments, the model training module includes: a prediction submodule, used to input the second graph structure data into the model to be trained to obtain a predicted label corresponding to each node in the second graph structure data; a loss determination submodule, used to determine the learning loss parameters of the model to be trained based on the predicted labels of each node in the second graph structure data; and a training submodule, used to perform backpropagation training on the model to be trained based on the learning loss parameters until the training stopping condition is met to obtain the document classification model.

[0104] In some possible embodiments, the loss determination submodule includes: a first determination unit, configured to determine cross-entropy loss based on the predicted label of each node in the second graph structure data and the true label corresponding to each node; a second determination unit, configured to determine regularization loss based on the distance between each node in the second graph structure data and the corresponding node output by the last layer of the model to be trained; and a third determination unit, configured to linearly sum the cross-entropy loss and the regularization loss based on the target regularization coefficient to obtain the learning loss parameter.

[0105] In some possible embodiments, the second determining unit is further configured to determine the node representation matrix corresponding to the second graph structure data and the prediction probability matrix output by the last layer of the model to be trained; traverse each node in the node representation matrix, and perform norm regularization on the Euclidean distance between the label of each node in the node representation matrix and the prediction label of the corresponding node in the prediction probability matrix to obtain the regularization loss.

[0106] The description of the above apparatus embodiments is similar to the description of the above document classification method side embodiments, and has similar beneficial effects as the method embodiments. In some embodiments, the functions or modules included in the apparatus provided in this disclosure can be used to execute the methods described in the above document classification method side embodiments. For technical details not disclosed in the apparatus embodiments of this application, please refer to the description of the document classification method side embodiments of this application for understanding.

[0107] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the user through pop-up information or by asking the user to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.

[0108] It should be noted that, in the embodiments of this application, if the above-described document classification method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the related technology, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part 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), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.

[0109] This application provides an electronic device, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements some or all of the steps in the above-described method.

[0110] This application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements some or all of the steps in the above-described method. The computer-readable storage medium can be transient or non-transient.

[0111] This application provides a computer program including computer-readable code, wherein when the computer-readable code is executed in an electronic device, a processor in the electronic device performs some or all of the steps in the above-described method.

[0112] This application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, it implements some or all of the steps in the above-described method. This computer program product can be implemented specifically through hardware, software, or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium; in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.

[0113] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between them, while their similarities or commonalities can be referred to interchangeably. The descriptions of the above embodiments of the device, storage medium, computer program, and computer program product are similar to the descriptions of the above method embodiments and have similar beneficial effects. For technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0114] It should be noted that, Figure 7 A schematic diagram of a hardware entity of an electronic device provided in an embodiment of this application, such as... Figure 7 As shown, the hardware entity of the electronic device 700 includes: a processor 701, a communication interface 702, and a memory 703, wherein:

[0115] The processor 701 typically controls the overall operation of the electronic device 700.

[0116] Communication interface 702 enables electronic devices to communicate with other terminals or servers via a network.

[0117] The memory 703 is configured to store instructions and applications executable by the processor 701, and can also cache data to be processed or already processed (e.g., image data, audio data, voice communication data, and video communication data) in the processor 701 and various modules in the electronic device 700. It can be implemented using flash memory or random access memory (RAM). Data transfer between the processor 701, the communication interface 702, and the memory 703 can be performed via bus 704.

[0118] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above steps / processes do not imply a sequential order of execution; the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above embodiments of this application are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0119] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0120] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device 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, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0121] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0122] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0123] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0124] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence or the part that contributes to related technologies, 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 an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part 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 mobile storage devices, ROM, magnetic disks, or optical disks.

[0125] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A document classification method, the method comprising: Obtain at least one batch of document datasets to be classified; Obtain the classification tree for the task categories corresponding to the at least one batch of document datasets; Based on the label information of the at least one batch of document datasets and / or the hierarchical information of the classification tree, each document in each batch of document datasets is connected to the corresponding node in the classification tree to form a first graph structure data; wherein, each node in the first graph structure data corresponds to a document; The first graph structure data is classified and predicted using a document classification model to obtain a classification result; wherein, the document classification model is obtained by semi-supervised training based on the second graph structure data corresponding to the sample dataset; the second graph structure data is obtained by graph structuring the sample dataset based on representing the hierarchical classification relationship between samples in the sample dataset.

2. The method according to claim 1, wherein the first graph structure data includes an adjacency matrix and a feature matrix; The method further includes: The adjacency matrix is ​​generated based on the connection relationships between the nodes in the graph structure. The feature matrix is ​​determined based on the feature vectors of each node in the graph structure; wherein the feature vector of each node is generated based on the attribute data of the document corresponding to the same node.

3. The document classification method according to claim 1, further comprising a training process for the document classification model, including: Obtain at least one batch of sample datasets; Based on the hierarchical classification relationship between samples in the sample dataset, each batch of the sample dataset is subjected to graph structuring to obtain a second graph structure data; wherein, each node in the second graph structure data corresponds to a sample; Based on the second graph structure data, the model to be trained is semi-supervised to obtain the document classification model.

4. The method according to claim 3, wherein the step of performing semi-supervised training on the model to be trained based on the second graph structure data to obtain the document classification model includes: The second graph structure data is input into the model to be trained to obtain the predicted label corresponding to each node in the second graph structure data; Based on the predicted labels of each node in the second graph structure data, the learning loss parameters of the model to be trained are determined. The training model is backpropagated based on the learning loss parameters until the training stopping condition is met to obtain the document classification model.

5. The method according to claim 4, wherein determining the learning loss parameters of the model to be trained based on the predicted labels of each node in the second graph structure data includes: Based on the predicted label of each node in the second graph structure data and the true label corresponding to each node, the cross-entropy loss is determined; Based on the distance between each node in the second graph structure data and the corresponding node in the output of the last layer of the model to be trained, the regularization loss is determined. Based on the target regularization coefficient, the cross-entropy loss and the regularization loss are linearly summed to obtain the learning loss parameters.

6. The method according to claim 5, wherein determining the regularization loss based on the distance between each node in the second graph structure data and the corresponding node of the output of the last layer of the model to be trained includes: Determine the node representation matrix corresponding to the second graph structure data and the prediction probability matrix output by the last layer of the model to be trained; Traverse each node in the node representation matrix, and perform norm regularization on the Euclidean distance between the label of each node in the node representation matrix and the predicted label of the corresponding node in the prediction probability matrix to obtain the regularization loss.

7. A document classification device, the device comprising: The data acquisition module is used to acquire at least one batch of document datasets to be classified; The sample acquisition module is used to acquire the classification tree of the task category corresponding to the at least one batch of document datasets; The data conversion module is used to connect each document in each batch of the document dataset to a corresponding node in the classification tree based on the label information of the at least one batch of document datasets and / or the hierarchical information of the classification tree, to form a first graph structure data; wherein each node in the first graph structure data corresponds to a document; The classification prediction module is used to perform classification prediction on the first graph structure data using a document classification model to obtain a classification result; wherein, the document classification model is obtained by semi-supervised training based on the second graph structure data corresponding to the sample dataset; the second graph structure data is obtained by graph structuring the sample dataset based on representing the hierarchical classification relationship between each sample in the sample dataset.

8. An electronic device comprising a memory and at least one processor; the memory for storing a computer program, and the processor for calling and running the computer program from the memory, such that the processor runs the computer program to perform the document classification method as described in any one of claims 1 to 6.

9. A storage medium comprising a computer program for implementing the document classification method as described in any one of claims 1 to 6.