Method and apparatus for training label prediction models

By constructing a Markov random field model with a multi-chain undirected graph, the problem of corpus label classification relying on manual annotation is solved, and more efficient and accurate corpus label classification is achieved.

CN115470349BActive Publication Date: 2026-04-03HUNDSUN TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-13
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In existing technologies, corpus labeling relies on manual annotation, which leads to wasted resources and difficulty in guaranteeing accuracy.

Method used

By constructing a multi-chain undirected graph, using a Markov random field model, feature label nodes are generated and an objective function is constructed. Parameter tuning is then used to obtain a label prediction model that meets the training conditions.

Benefits of technology

It improves the accuracy and efficiency of corpus label classification and reduces the waste of resources from manual annotation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115470349B_ABST
    Figure CN115470349B_ABST
Patent Text Reader

Abstract

This specification provides a method and apparatus for training a label prediction model. The method includes: determining the text features contained in the text corpus and the feature labels corresponding to the text features; generating feature label nodes based on the text features and the feature labels, and constructing a multi-chain undirected graph with a chain-like structure based on the feature label nodes, wherein each node in the multi-chain undirected graph corresponds to at least two edges; determining at least one subgraph in the multi-chain undirected graph, and constructing an objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph; and tuning the initial label prediction model based on the objective function, the text features, and the feature labels until a target label prediction model that meets the training conditions is obtained. This method improves the accuracy of label prediction for text by using the contextual relationships between feature labels as a reference condition for label prediction during model training based on a multi-chain undirected graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and in particular to a method for training a label prediction model. This specification also relates to a label prediction model training apparatus, a computing device, and a computer-readable storage medium. Background Technology

[0002] In the field of Natural Language Processing (NLP), corpus labeling is an important application. Corpus labeling refers to classifying text into a specific class from several existing classes. Current technologies typically employ manual annotation methods for text corpus labeling, where labelers assign labels to text based on experience. However, this method is extremely resource-intensive, and due to variations in the experience of different labelers, the accuracy of the labeling cannot be guaranteed. Therefore, a label prediction model training method is urgently needed to address these issues. Summary of the Invention

[0003] In view of this, embodiments of this specification provide a method for training a label prediction model. This specification also relates to a label prediction model training apparatus, a label prediction method, a label prediction device, a computing device, and a computer-readable storage medium, to address the technical deficiencies existing in the prior art.

[0004] According to a first aspect of the embodiments of this specification, a method for training a label prediction model is provided, comprising:

[0005] Determine the text features contained in the text corpus, and the feature labels corresponding to the text features;

[0006] Feature label nodes are generated based on the text features and the feature labels, and a multi-chain undirected graph with a chain structure is constructed based on the feature label nodes, wherein each node in the multi-chain undirected graph corresponds to at least two edges;

[0007] In the multi-chain undirected graph, at least one subgraph is determined, and an objective function is constructed based on the distribution relationship between each subgraph and the multi-chain undirected graph.

[0008] Based on the objective function, the text features, and the feature labels, the parameters of the initial label prediction model are tuned until a target label prediction model that meets the training conditions is obtained.

[0009] Optionally, the step of generating feature label nodes based on the text features and the feature labels, and constructing a chain-like multi-chain undirected graph based on the feature label nodes, includes:

[0010] The text features and each feature label are combined to obtain at least one feature label pair;

[0011] A feature label set is generated based on the at least one feature label pair, and the feature label set is used as a feature label node;

[0012] The textual relationships between the textual features are used as node association edges, wherein the textual relationships are the relationships between textual features that have word unit connection relationships in the text corpus;

[0013] Construct a multi-chain undirected graph based on the feature-labeled nodes and the edges associated with those nodes.

[0014] Optionally, constructing the objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph includes:

[0015] Construct the subgraph function corresponding to each subgraph;

[0016] Construct a joint subgraph function based on the distribution relationship between each subgraph and the multi-chain undirected graph, and the subgraph function corresponding to each subgraph;

[0017] Based on the graph structure corresponding to the multi-chain undirected graph, the feature label pairs contained in the feature label nodes of the multi-chain undirected graph are subjected to full permutation processing, and the full permutation function is determined based on the processing result;

[0018] Construct the objective function based on the joint subgraph function and the permutation function.

[0019] Optionally, the subgraph function corresponding to each subgraph is constructed using the following method:

[0020] Determine the subgraph text features corresponding to each subgraph feature label node in the subgraph;

[0021] Based on the feature association relationships between the subgraph text features corresponding to each subgraph feature label node, determine the node association relationships between the subgraph feature label nodes;

[0022] The subgraph function corresponding to the subgraph is constructed based on the node association relationship.

[0023] Optionally, the expression for the subgraph function is formula (1):

[0024] Ψ(t)=e∑ k ω k *f k (Y t-n …Y t-1 Y t (1)

[0025] Where ψ(t) represents the probability of a subgraph appearing relative to a multi-chain undirected graph; f k Denotes the characteristic function, ω k Let X represent the k unknown parameters, representing the weights of the k feature functions; X represent the text feature set; Y represent the feature label node; t represents the t-th feature label node in the multi-chain undirected graph; n represents the number of chains in the multi-chain undirected graph; Y... t Y represents the target feature label node in the subgraph. t-n This represents the nth feature label node that has an indirect relationship with the target feature label node.

[0026] Optionally, the expression for the permutation function is formula (2), and the expression for the objective function is formula (3):

[0027] Z(X) = ∑Ye∑ t ∑ k ω k *f k (Y t-n …Y t-1 Y t ,X,t) (2)

[0028]

[0029] Where Z(X) represents the sum of the objective function values ​​of all undirected graphs obtained by connecting the feature label pairs contained in the feature label nodes according to the full permutation strategy; P ω (Y|X) represents the probability of a multi-chain undirected graph formed by specific feature label pairs among all feature label nodes, relative to the probability of an undirected graph obtained by permuting all feature label pairs contained in all feature label nodes.

[0030] Optionally, any subgraph in the multi-chain undirected graph is determined by the following method:

[0031] Determine the number of chains contained in the multi-chain undirected graph, and determine the initial feature label nodes in the multi-chain undirected graph;

[0032] In the multi-chain undirected graph, a first feature label node that has a direct connection with the initial feature label node is determined, and a second feature label node that has an indirect connection with the initial feature label node is determined in the multi-chain undirected graph based on the number of chains.

[0033] A subgraph containing text feature nodes, the first feature label node, and the second feature label node is determined in the multi-chain undirected graph.

[0034] Optionally, the step of tuning the initial label prediction model based on the objective function, the text features, and the feature labels until a target label prediction model that meets the training conditions is obtained includes:

[0035] Based on the text features, the feature labels, and the i-th model parameters corresponding to the current calculation cycle, the calculation parameters determine the Li-th function value corresponding to the function, where i is a positive integer;

[0036] Calculate the difference based on the Li-th function value and the Li-1-th function value;

[0037] If the difference is greater than a preset difference threshold, i+1 is incremented, and the step of calculating the value of the Li function corresponding to the function is performed based on the text features, the feature labels, and the i-th model parameters corresponding to the current calculation cycle.

[0038] If the difference is less than or equal to the preset difference threshold, the i-th model parameter is used as the target model parameter, and the model parameters of the initial label prediction model are updated based on the target model parameter. The target label prediction model is obtained based on the update result.

[0039] Optionally, the determination of the i-th model parameter corresponding to the current calculation cycle includes:

[0040] Determine the i-1th model parameters corresponding to the previous calculation cycle, and the gradient value corresponding to the previous calculation cycle;

[0041] Calculate the i-th model parameters corresponding to the current calculation cycle based on the i-1th model parameters and the gradient value corresponding to the previous calculation cycle.

[0042] Optionally, the parameter determination function is determined by the following formula (4):

[0043] L(ω)=log∏X,YP ω (Y|X)P^(X,Y)=∑ X,Y P^(X,Y)P^(X,Y)logP ω (Y|X) (4)

[0044] Among them, P ω (Y|X) represents the probability of a multi-chain undirected graph formed by specific feature label pairs among all feature label nodes, relative to the probability of an undirected graph obtained by permuting all feature label pairs contained in all feature label nodes; P^(X,Y) represents the joint probability of text feature X and feature label Y; L(ω) is the function value corresponding to the parameter determination function; ω represents the unknown parameter; X represents the text feature set; Y represents the feature label node.

[0045] Optionally, determining the text features contained in the text corpus and the feature labels corresponding to the text features includes:

[0046] Obtain text corpus;

[0047] The text corpus is segmented to obtain multiple word units, and the target word unit is selected from the multiple word units as the text feature corresponding to the text corpus.

[0048] The word unit label corresponding to the target word unit is used as the feature label corresponding to the text feature.

[0049] According to a second aspect of the embodiments of this specification, a label prediction method is provided, comprising:

[0050] Obtain the text to be predicted;

[0051] The text to be predicted is input into the target label prediction model to obtain the predicted label corresponding to the text to be predicted, which is output by the target label prediction model.

[0052] According to a third aspect of the embodiments of this specification, a label prediction model training apparatus is provided, comprising:

[0053] The determination module is configured to determine the text features contained in the text corpus, and the feature labels corresponding to the text features;

[0054] The construction module is configured to generate feature label nodes based on the text features and the feature labels, and to construct a multi-chain undirected graph with a chain-like structure based on the feature label nodes, wherein each node in the multi-chain undirected graph corresponds to at least two edges;

[0055] The processing module is configured to determine at least one subgraph in the multi-chain undirected graph and construct an objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph.

[0056] The training module is configured to tune the parameters of the initial label prediction model based on the objective function, the text features, and the feature labels until a target label prediction model that meets the training conditions is obtained.

[0057] According to a fourth aspect of the embodiments of this specification, a tag prediction apparatus is provided, comprising:

[0058] The acquisition module is configured to acquire the text to be predicted.

[0059] The prediction module is configured to input the text to be predicted into the target label prediction model and obtain the predicted label corresponding to the text to be predicted output by the target label prediction model.

[0060] According to a fifth aspect of the embodiments of this specification, a computing device is provided, comprising:

[0061] Memory and processor;

[0062] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions.

[0063] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the label prediction model training method.

[0064] The label prediction model training method provided in this specification involves: determining the text features contained in the text corpus and the corresponding feature labels; generating feature label nodes based on the text features and feature labels, and constructing a multi-chain undirected graph with a chain-like structure based on the feature label nodes, wherein each node in the multi-chain undirected graph corresponds to at least two edges; determining at least one subgraph in the multi-chain undirected graph, and constructing an objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph; and tuning the initial label prediction model based on the objective function, text features, and feature labels until a target label prediction model that meets the training conditions is obtained. This method improves the accuracy of text label prediction by using the contextual relationships between feature labels as a reference condition for label prediction during model training based on multi-chain undirected graphs. Attached Figure Description

[0065] Figure 1 This is an architecture diagram of a label prediction model training method provided in one embodiment of this specification;

[0066] Figure 2 This is a structural diagram of a label prediction model training method provided in one embodiment of this specification;

[0067] Figure 3 This is a flowchart of a label prediction model training method provided in one embodiment of this specification;

[0068] Figure 4 This is a model structure diagram of a label prediction model training method provided in one embodiment of this specification;

[0069] Figure 5 This is a subgraph structure diagram of a label prediction model training method provided in one embodiment of this specification;

[0070] Figure 6 This is a flowchart of a label prediction method provided in one embodiment of this specification;

[0071] Figure 7This is a flowchart illustrating a tag prediction model training method for financial text tag prediction, provided in one embodiment of this specification.

[0072] Figure 8 This is a schematic diagram of the model structure of a label prediction model training method provided in one embodiment of this specification;

[0073] Figure 9 This is a schematic diagram of the structure of a label prediction model training device provided in one embodiment of this specification;

[0074] Figure 10 This is a schematic diagram of the structure of a tag prediction device provided in one embodiment of this specification;

[0075] Figure 11 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0076] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0077] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0078] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0079] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0080] NLP: Natural Language Processing.

[0081] Markov property: For a stochastic process, given the present state and all past states, the conditional probability distribution of its future states depends only on the properties of the current state.

[0082] Markov Chain: A stochastic process in probability theory and mathematical statistics that possesses Markov properties and exists within a discrete exponent set and state space.

[0083] Markov Random Field: A discriminative probabilistic model based on the Markov chain model structure.

[0084] Undirected graph: A graph consisting of nodes and undirected edges between nodes is called an undirected graph.

[0085] Hammersley-Clifford theorem: The joint probability distribution of a probabilistic undirected graphical model is expressed as a product of the potential functions of random variables on its maximal clique.

[0086] Maximum clique: A clique is called a maximum clique of graph G if it is not contained in any other clique, that is, it is not a proper subset of any other clique.

[0087] Potential energy function: An abstract function for building a model. In the process of solving a specific problem, the specific expression of the potential energy function will be designed according to the characteristic function of the specific problem.

[0088] like Figure 1 As shown, in the corpus label classification scenario, the classification of corpus labels can rely on machine learning. Before training the label prediction model, the text used for model training is preprocessed, splitting the text into multiple word units. Word units that can serve as text features are selected from these units, and the feature labels corresponding to these word units are determined. The text corpus used for model training consists of the text features and their corresponding feature labels. When constructing the label prediction model, a multi-chain model structure can be built based on Markov random fields. Taking a two-chain Markov chain as an example, the following can be constructed: Figure 1 The model structure shown is in the form of a doubly linked undirected graph, which still possesses the Markov property, where node X... 1-T This represents the feature set corresponding to the text corpus, where the text features contained in the set are related to nodes Y1-Y1. T There is a mapping relationship between nodes Y1 and Y2. TThis means that each text feature in the text corpus is combined with a feature label to generate a feature label pair. The feature label set is composed of the feature label pairs corresponding to the text features, and the feature label node is the corresponding feature label set.

[0089] The node Y contained within the dashed box t Node Y t-1 Node Y t-2 Form a maximal clique in a doubly linked undirected graph such that node Y t Compared to the first two label nodes: node Y t-1 Node Y t-2 Correlation. According to the Hammersley-Clifford theorem, the objective function of a doubly linked undirected graph can be represented by the product of the probabilities of all maximal cliques contained in the graph, where the probability is the potential function. During model training, a likelihood function is constructed based on the maximum likelihood estimation principle, and its gradient is calculated. The gradient descent method is then used to solve for the model parameters when the likelihood function reaches its maximum value, thus completing model training. When predicting corpora based on the trained label prediction model, the corpora to be predicted are input into the label prediction model for training, obtaining the target label prediction model.

[0090] In existing technologies, label prediction models are typically built based on Markov random fields, such as... Figure 2 The single-chain model structure shown in (a) is an undirected graph constructed based on the CRF (Conditional Random Field) model. Each Y in the label prediction model... t The corresponding feature labels are all derived from node X 1-T The corresponding feature labels are determined. The label prediction model method provided in this specification can be constructed based on Markov random fields, such as... Figure 2 The double-chain structure shown in (b) is as follows: Figure 2 The three-chain structure shown in (c) can be used to construct an n-chain model structure. Figure 2 From (b), we can see that Y t Determining the corresponding feature label requires combining node Y t-1 Node Y t-2 The corresponding feature labels. (From) Figure 2 From (c), we can see that Y t Determining the corresponding feature label requires combining node Y t-1 Node Y t-2 Node Y t-3 The corresponding feature labels. This, in turn, makes Y t The determination of the corresponding feature labels is related to the feature labels of nodes that have a direct relationship with them, as well as the feature labels of nodes that have an indirect relationship with them, thereby improving the accuracy of label prediction.

[0091] In this specification, a method for training a label prediction model is provided. This specification also relates to a device for training a label prediction model, a label prediction method, a label prediction device, a computing device, and a computer-readable storage medium, which will be described in detail one by one in the following embodiments.

[0092] Figure 3 The flowchart of a method for training a label prediction model according to an embodiment of this specification is shown, which specifically includes the following steps:

[0093] Step S302, determine the text features included in the text corpus and the feature labels corresponding to the text features.

[0094] Specifically, the text corpus refers to the text content recorded in text form, including but not limited to news, comments, novels, chats, articles, etc. corresponding to fields such as finance, sports, and technology. The text corpus includes text features and the feature labels corresponding to the text features. Among them, the text feature refers to splitting the text content into multiple word units, filtering out word units such as modal particles and conjunctions, and obtaining the word units. Each obtained word unit corresponds to a feature word in the text content. Correspondingly, the feature label is the label obtained by performing semantic analysis on the text feature and conforming to the semantic meaning of the text feature. For example, for the text feature "Hello", the corresponding feature label is "Greeting".

[0095] Based on this, before training the label prediction model, first determine the training samples for model training, that is, the text corpus. When the text corpus is a complete sentence containing multiple features, the text corpus will be preprocessed, the text features included in the text corpus will be extracted, and a feature label will be determined for each text feature through manual annotation or the annotation of a machine learning model for subsequent model training.

[0096] Furthermore, after obtaining the text corpus, since the text corpus can be a complete sentence, in the case where there are many feature words such as nouns and verbs in the sentence, it is necessary to perform word segmentation on the text corpus, and then determine a feature label for each text feature included in the word segmentation result. The specific implementation is as follows:

[0097] Obtain the text corpus; perform word segmentation on the text corpus to obtain multiple word units, select a target word unit in the multiple word units as the text feature corresponding to the text corpus; use the word unit label corresponding to the target word unit as the feature label corresponding to the text feature.

[0098] Specifically, word segmentation refers to the process of splitting words in a text corpus according to features such as semantics, part of speech, and word structure. Word segmentation methods include, but are not limited to, manual word segmentation and word segmentation using algorithms. Correspondingly, a word unit refers to all word units obtained after word segmentation of the text corpus. A word unit can be a single word or composed of multiple words. The target word unit refers to the word unit selected from all word units. The selection rules can be to filter out word units such as "ah" and "then" that have no actual meaning, such as modal particles and conjunctions. Correspondingly, word unit labels refer to the labels assigned to the selected word units that can represent the attribute category of the word unit, that is, the feature labels corresponding to the text features.

[0099] Based on this, a text corpus is obtained for model training, containing multiple text features. The text corpus is segmented using any word segmentation method to obtain multiple word units corresponding to the text corpus. From these word units, target word units (excluding conjunctions and modal particles) are selected as the corresponding text features. Feature labels are assigned to each word unit within the determined target word unit, and the word unit labels corresponding to the target word unit are used as the feature labels corresponding to the text features.

[0100] For example, the text corpus can be a complete sentence containing multiple nouns, verbs, and adjectives, including a subject, predicate, and object. For the text corpus "I spent 3,000 yuan on a membership card at a gym that just opened at my friend's place," word segmentation is performed to obtain word units such as "I," "at," "friend," "just opened," "gym," "spend," "3,000 yuan," "got," and "membership card." From these word units, target word units such as "I," "friend," "gym," "3,000 yuan," and "membership card" are selected as text features. The labels corresponding to the target word units are: "buyer," "seller," "place," "amount," and "product," respectively. Correspondingly, the labels corresponding to the target word units are the feature labels corresponding to the text features.

[0101] In summary, by segmenting the text corpus and filtering the obtained word units, irrelevant text features in the text corpus are removed, making the text corpus used for model training more targeted and thus improving the model training effect.

[0102] Step S304: Generate feature label nodes based on the text features and the feature labels, and construct a multi-chain undirected graph with a chain-like structure based on the feature label nodes, wherein each node in the multi-chain undirected graph corresponds to at least two edges.

[0103] Specifically, after identifying the text corpus containing text features and corresponding feature labels, a multi-chain undirected graph can be constructed based on the text features and feature labels. This multi-chain undirected graph is a chain-like undirected graph created based on Markov random fields, consisting of nodes and undirected edges. The feature label nodes in the multi-chain undirected graph are arranged according to the order of the text features in the text corpus, and therefore, the feature label nodes are connected according to the order of the text features in the text corpus. When constructing the multi-chain undirected graph, a multi-chain undirected graph with a chain number of greater than or equal to 2 and possessing the properties of an undirected graph is constructed based on the text features and feature labels.

[0104] In the case of a multi-chain undirected graph being a bi-chain undirected graph, each label node corresponds to at least two edges. A bi-chain undirected graph includes T label nodes. The first label node and the Tth label node each correspond to two edges, the second label node and the (T-1)th label node each correspond to three edges, and the other label nodes each correspond to four edges. When the number of chains is n, the first label node and the Tth label node each correspond to n edges, the second label node and the (T-1)th label node each correspond to n+1 edges, and the other nodes each correspond to 2n edges.

[0105] Based on this, feature label nodes are generated according to the text features and the corresponding feature labels. The feature label nodes are arranged according to the order of the text features in the text corpus. A multi-chain undirected graph is constructed based on the arrangement of the feature label nodes. Each node in the multi-chain undirected graph corresponds to at least two edges.

[0106] In practical applications, when constructing a multi-chain undirected graph, the number of chains corresponding to the multi-chain undirected graph is first determined according to the requirements. Based on the number of chains, it can be determined whether there are edges between the generated feature label nodes. Connecting the feature label nodes with edges forms a multi-chain undirected graph.

[0107] Furthermore, after determining the text corpus containing text features and corresponding feature labels, in order to represent the relationships between text features, nodes and edges can be determined based on the text features and feature labels respectively, and a multi-chain undirected graph can be constructed. The specific implementation is as follows:

[0108] The text features and each feature label are combined to obtain at least one feature label pair; a feature label set is generated based on the at least one feature label pair, and the feature label set is used as a feature label node; the text association relationship between the text features is used as a node association edge, wherein the text association relationship is the relationship between text features with word unit connection relationship in the text corpus; a multi-chain undirected graph is constructed based on the feature label node and the node association edge.

[0109] Specifically, a feature label pair consists of text features and feature labels. A text corpus contains multiple text features, each of which can correspond to a different feature label. Any number of text features can also share the same feature label. Therefore, each text feature in the corpus can be combined with each feature label to form a feature label pair. For example, if a text corpus contains four text features and three corresponding feature labels, then one text feature can be combined with three feature labels to form a feature label pair. Thus, four text features and three feature labels can be combined to obtain twelve feature label pairs. The feature label is composed of the feature label pairs corresponding to each text feature. The set, i.e., the number of text features, is equal to the number of feature label sets; correspondingly, the feature label node is the feature label set, and each feature label set is determined as a node in a multi-link undirected graph; since text features are extracted from text sentences, there is a text feature order relative to the text sentences. Taking each text feature as a word unit, the connection relationship between word units in the text corpus can represent the text feature order. Arranging text features according to the text feature order, the corresponding text feature order is the text association relationship between text features. Based on the text association relationship, undirected edges between feature label nodes can be generated, i.e., node association edges.

[0110] Based on this, each text feature in the text corpus is processed individually to determine the number of feature labels corresponding to the text corpus. When generating feature label pairs for each text feature, the text feature is combined with each feature label to obtain the feature label pair corresponding to the current text feature. For the current text feature, the number of obtained feature label pairs is equal to the number of feature labels. The obtained feature label pairs constitute a feature label set, which can be used as a graph node to construct a multi-chain undirected graph. Each text feature is processed individually to obtain the feature label set corresponding to each text feature, thus obtaining all the feature label nodes used to construct the multi-chain undirected graph. Each text feature is treated as a word unit, and the word unit connection relationship of the text feature in the text corpus is used as the text association relationship between text features. The text association relationship is then used as the node association edge to construct the multi-chain undirected graph. The multi-chain undirected graph is constructed based on the determined node association edges and feature label nodes.

[0111] Following the previous example, after determining the text features "I", "friend", "gym", "3,000 yuan", and "membership card", and their corresponding labels: "buyer", "seller", "location", "amount", and "product", each text feature is processed. The text feature "I" is combined with each label to form feature label pairs such as "I"-"buyer", "I"-"seller", "I"-"location", "I"-"amount", and "I"-"product". These feature label pairs constitute the set of feature label pairs corresponding to the text feature "I". This set of feature label pairs corresponding to the text feature "I" can be considered as a node. Using the above combination method, the set of feature label pairs corresponding to each text feature can be obtained, that is, the nodes corresponding to the text features "I", "friend", "gym", "3,000 yuan", and "membership card" are obtained respectively. The word order of the text features in the text corpus is used as the relationship between nodes, that is, the edges between nodes can be constructed as follows: Figure 4 The multi-chain undirected graph shown is a doubly-chain undirected graph where nodes are arranged according to the order of text features in the text corpus, i.e., the text features corresponding to the labels have contextual connections.

[0112] In summary, by using feature label pairs (composed of text features and feature labels) as nodes and textual relationships between text features as edges to construct a multi-chain undirected graph, the multi-chain undirected graph can represent the contextual relationships between text features, thereby improving the degree of association between feature label nodes.

[0113] Step S306: Determine at least one subgraph in the multi-chain undirected graph, and construct an objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph.

[0114] Specifically, after constructing a chain-like undirected graph with text features and feature labels as nodes, at least one subgraph can be determined within the undirected graph. Then, an objective function is constructed based on the distribution relationship between each subgraph and the undirected graph. Here, a subgraph refers to an undirected graph composed of multiple interconnected nodes selected based on the connection relationships between nodes. A subgraph can also be represented as a maximal clique, where each node in the maximal clique has a direct undirected edge connecting it to any other node in the maximal clique. The distribution relationship refers to the positional arrangement of the multiple subgraphs determined based on the undirected graph within the undirected graph. The objective function is the function corresponding to the undirected graph, determined based on the initial function corresponding to each subgraph. The calculated function value represents the probability of the undirected graph appearing.

[0115] Based on this, after constructing a chain-like multi-chain undirected graph using text features and feature labels as nodes, at least one subgraph is determined within the multi-chain undirected graph according to its graph structure and the rules for determining subgraphs. The rules for determining subgraphs are: each node in a subgraph is directly connected to other nodes in the subgraph via undirected edges. Each subgraph is determined sequentially within the multi-chain undirected graph, and an objective function corresponding to the multi-chain undirected graph is constructed based on the distribution relationship between each subgraph and the multi-chain undirected graph.

[0116] Furthermore, when constructing the objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph, in order to reduce the difficulty of constructing the objective function, the function corresponding to each subgraph can be determined separately, and then the objective function can be constructed based on the function corresponding to each subgraph. The specific implementation is as follows:

[0117] Construct a subgraph function corresponding to each subgraph; construct a joint subgraph function based on the distribution relationship between each subgraph and the multi-chain undirected graph, and the subgraph function corresponding to each subgraph; perform full permutation processing on the feature label pairs contained in the feature label nodes of the multi-chain undirected graph according to the graph structure corresponding to the multi-chain undirected graph, and determine the full permutation function based on the processing result; construct a target function based on the joint subgraph function and the full permutation function.

[0118] Specifically, the subgraph function represents the probability of a subgraph appearing relative to the multi-chain undirected graph; the joint subgraph function is a function constructed based on each subgraph contained in the multi-chain undirected graph; the full permutation function is a function determined by performing a full permutation of the feature label pairs contained in all feature label nodes, representing the number of undirected graphs obtained after connecting the feature label pairs contained in each feature label node according to the full permutation strategy; correspondingly, the objective function constructed by the joint subgraph function and the full permutation function represents the probability of the multi-chain undirected graph combining the feature function set appearing relative to the undirected graph obtained by performing a full permutation of the feature label pairs contained in all feature label nodes.

[0119] Based on this, according to the preset subgraph function construction rules, a subgraph function is constructed for each subgraph according to the feature label nodes corresponding to each subgraph. A joint subgraph function is constructed based on the determined distribution relationship between each subgraph and the multi-chain undirected graph, and the subgraph function corresponding to each subgraph. The distribution relationship between the subgraph and the multi-chain undirected graph includes the positional relationship between the subgraphs and the positional relationship of the subgraph relative to the multi-chain undirected graph. Based on the graph structure corresponding to the multi-chain undirected graph, a full permutation of the feature label pairs contained in the feature label nodes of the multi-chain undirected graph is performed, and the full permutation function is determined based on the processing result. The objective function is constructed from the joint subgraph function and the full permutation function. The expression for the subgraph function is formula (1), the expression for the full permutation function is formula (2), and the expression for the objective function is formula (3).

[0120] Ψ(t)=e∑ k ω k *f k (Y t-n …Y t-1 Y t (1)

[0121] Z(X) = ∑Ye∑ t ∑ k ω k *f k (Y t-n …Y t-1 Y t ,X,t) (2)

[0122]

[0123] Where ψ(t) represents the probability of a subgraph appearing relative to a multi-chain undirected graph; f k Denotes the characteristic function, ω k Let X represent the k unknown parameters, representing the weights of the k feature functions; X represent the text feature set; Y represent the feature label node; t represents the t-th feature label node in the multi-chain undirected graph; n represents the number of chains in the multi-chain undirected graph; Y... t Y represents the target feature label node in the subgraph. t-n Let Z(X) represent the nth feature label node that has an indirect association with the target feature label node. Z(X) represents the sum of the objective function values ​​of all undirected graphs obtained by connecting the feature label pairs contained in the feature label node according to the full permutation strategy; P ω (Y|X) represents the probability of a multi-chain undirected graph formed by specific feature label pairs among all feature label nodes, relative to the probability of an undirected graph obtained by permuting all feature label pairs contained in all feature label nodes.

[0124] Continuing with the previous example, such as Figure 4 As shown in (a), the "Seller" node, "Location" node, and "Amount" node contained within the dashed box constitute a subgraph, which is a maximal clique corresponding to a multi-chain undirected graph. The potential function corresponding to the maximal clique can be constructed based on each node contained in the subgraph; that is, the subgraph function corresponding to the subgraph. For example... Figure 4As shown in (b), the text features "I", "friend", "gym", "3,000 yuan", "membership card" and the tags "buyer", "seller", "place", "amount", "product" are subjected to full permutation processing to obtain the full permutation function. That is, undirected edges are determined between the feature tag pairs corresponding to the text features to construct an undirected graph. The full permutation function value represents the number of undirected graphs obtained after connecting the feature tag pairs according to the full permutation strategy. The joint subgraph function can be constructed based on the product of the potential functions corresponding to each subgraph. The objective function is constructed by the joint subgraph function and the full permutation function.

[0125] In summary, by constructing the subgraph function corresponding to each subgraph separately, and then constructing the objective function corresponding to the multi-chain undirected graph, the difficulty of constructing the objective function is reduced.

[0126] Furthermore, when constructing the subgraph function corresponding to each subgraph in a multi-linked undirected graph, since the structures of each subgraph are similar, the construction method of the subgraph function corresponding to each subgraph is the same, as specifically implemented as follows:

[0127] Determine the subgraph text features corresponding to each subgraph feature label node in the subgraph; determine the node association relationships between subgraph feature label nodes based on the feature association relationships between the subgraph text features corresponding to each subgraph feature label node; construct the subgraph function corresponding to the subgraph based on the node association relationships.

[0128] Specifically, a subgraph feature label node refers to a node contained in a subgraph after the subgraph has been determined in a multi-chain undirected graph. Correspondingly, a subgraph text feature refers to the text feature corresponding to the subgraph feature label node in the subgraph after the subgraph has been determined in a multi-chain undirected graph. Feature association refers to the connection relationship between the subgraph text features contained in the subgraph feature label node, that is, the contextual connection relationship of text features in the text corpus. Correspondingly, node association refers to the relationship between each subgraph feature label node contained in the subgraph. Since each subgraph feature label node corresponds to a text feature, the node association actually represents the relationship between text features, that is, the contextual relationship of text features in the text corpus.

[0129] Based on this, when constructing the subgraph function corresponding to the subgraph, the subgraph feature label nodes contained in the subgraph are determined according to the position of the subgraph in the multi-chain undirected graph. Based on the connection relationships between the subgraph feature label pairs contained in the subgraph feature label nodes, the feature association relationships between text features can be obtained. Furthermore, based on the determined feature association relationships, the node association relationships between the subgraph feature label nodes can be determined. Thus, the subgraph function corresponding to the subgraph is constructed based on the determined node association relationships.

[0130] Continuing with the previous example, such as Figure 4As shown in Figure (a), the feature label nodes such as "Seller," "Location," and "Amount" contained within the dashed box constitute a subgraph. Each feature label node in the subgraph has a corresponding text feature: "Friends," "Gym," and "Three Thousand Yuan." As can be seen from the figure, the feature label node "Amount" is connected to both the feature label nodes "Location" and "Seller." Each feature label node in the subgraph is also associated with a text feature in the feature set. Therefore, a potential function, i.e., a subgraph function, can be constructed corresponding to the subgraph.

[0131] In summary, based on the connection relationships between the feature label pairs contained in each feature label node of the subgraph, the association relationships between the feature label nodes of the subgraph can be deduced, thereby constructing a subgraph function that can more accurately express the occurrence probability of the subgraph relative to a multi-linked undirected graph.

[0132] Furthermore, after constructing the multi-chain undirected graph, in order to reduce the difficulty of constructing the objective function corresponding to the multi-chain undirected graph, the objective function can be decomposed into the product of functions corresponding to each subgraph in the multi-chain undirected graph. The subgraphs are determined according to the number of chains. The specific implementation is as follows:

[0133] The number of chains contained in the multi-chain undirected graph is determined, and an initial feature label node is determined in the multi-chain undirected graph; a first feature label node with a direct connection to the initial feature label node is determined in the multi-chain undirected graph, and a second feature label node with an indirect connection to the initial feature label node is determined in the multi-chain undirected graph based on the number of chains; a subgraph containing the text feature node, the first feature label node, and the second feature label node is determined in the multi-chain undirected graph.

[0134] Specifically, the number of chains refers to the number of chains corresponding to the graph structure of the multi-chain undirected graph, which is predetermined before construction. The number of chains is a positive integer, and the minimum value is 2. When the number of chains is n, the relationship between the number of chains and the number of nodes in the subgraph is n+1. That is, when the number of chains is 2, the number of nodes in the subgraph determined in the multi-chain undirected graph is 3. When the number of chains is 2, the constructed multi-chain undirected graph is a bi-chain undirected graph, meaning that each node in the bi-chain undirected graph corresponds to at least two edges. The initial feature label node can be any feature label node in the multi-chain undirected graph except for the first and the second feature label node connected to the first. Correspondingly, the first feature label node is the feature label node that has an upward relationship with the initial feature label node and is directly connected to it, and the second feature label node is the feature label node that has an upward relationship with the initial feature label node and is indirectly connected to it, and the second feature label node has an undirected edge directly connected to the initial feature label node. It should be noted that the number of second feature label nodes will vary depending on the chain data corresponding to the multi-chain undirected graph.

[0135] It should be noted that there must be at least one second feature label node. The relationship between the number of chains and the number of second feature label nodes in a multi-chain undirected graph is n-1, that is, when there are 2 chains, there is 1 second feature label node; when there are 3 chains, there are 2 second feature label nodes. When the initial feature label node is the first feature label in the multi-chain undirected graph, a subgraph cannot be formed because the first feature label node does not have a corresponding first feature node; similarly, when the initial feature label node is the second feature label connected to the first feature label in the multi-chain undirected graph, a subgraph cannot be formed because this feature label node does not have a corresponding second feature node.

[0136] Based on this, the number of chains in the multi-chain undirected graph is determined by the number of edges corresponding to each feature label. Any feature label node in the multi-chain undirected graph is then chosen as the initial feature label node. Based on the upstream feature label nodes of the initial feature label node, a first feature label node with a direct connection to the initial feature label node is determined in the multi-chain undirected graph. Then, based on the number of chains in the multi-chain undirected graph and the upstream feature label nodes of the initial feature label node, a second feature label node with an indirect connection to the initial feature label node is determined in the multi-chain undirected graph. A subgraph containing the text feature node, the first feature label node, and the second feature label node is then determined in the multi-chain undirected graph. It should be noted that if the initial feature label node is the first and second feature label node in the multi-chain undirected graph, and the next feature label node associated with the first and second feature label node is also present, a subgraph cannot be formed.

[0137] Following the previous example, in the case of Figure 5In the multi-chain undirected graph shown in (a), when constructing a subgraph using the label node "Location" as the initial node, the label node "Seller" with only a direct connection to the label node "Location" is determined as the first label node, and the label node "Buyer" with both direct and indirect connections to the label node "Location" is determined as the second label node. The subgraph is constructed as follows: Figure 5 The subgraph shown in (b) is an example. Correspondingly, a subgraph can be constructed using the label node "Amount" as the initial node, as shown in (b). Figure 5 The subgraph shown in (c) can be constructed using the label node "product" as the initial node, as shown in [the diagram]. Figure 5 The subgraph shown in (d) is as follows. In particular, for the label nodes "buyer" and "seller", since there is no first label node corresponding to the label node "buyer" and no second label node corresponding to it, and since there is no second label node corresponding to the label node "seller", a subgraph cannot be formed when the label nodes "buyer" and "seller" are the initial label nodes.

[0138] In summary, by determining the initial feature label node in a multi-chain undirected graph, and then determining the first and second feature label nodes in the multi-chain undirected graph based on the initial feature label node, the method realizes the determination of feature label nodes that are related to the initial feature label node based on the multi-chain undirected graph, thereby forming a subgraph and improving the association between feature label nodes in the subgraph.

[0139] Step S308: Based on the objective function, the text features, and the feature labels, the parameters of the initial label prediction model are tuned until a target label prediction model that meets the training conditions is obtained.

[0140] Specifically, after determining at least one subgraph in the multi-chain undirected graph and constructing an objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph, the initial label prediction model can be tuned according to the constructed objective function, text features, and feature labels to obtain the target label prediction model. The initial label prediction model refers to the model constructed to perform label prediction on the text corpus. At this time, the model parameters contained in the initial label prediction model are initial values, which need to be adjusted according to the text features and feature labels until the training stopping condition is met to obtain the trained target label prediction model.

[0141] Based on this, an initial label prediction model containing model parameters is determined. The model parameters contained in the initial label prediction model are adjusted according to the objective function, feature labels, and text features. That is, the parameters are iterated during the model training process until the label prediction model meets the training conditions and training is stopped. The obtained label prediction model is the target label prediction model.

[0142] Furthermore, after identifying at least one subgraph in the multi-chain undirected graph and constructing an objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph, considering that the initial model label prediction model still needs to be trained to obtain the target label prediction model, gradient descent can be used to determine the parameters of the target model, thereby obtaining the target label prediction model. The specific implementation is as follows:

[0143] Based on the text features, the feature labels, and the i-th model parameters corresponding to the current calculation cycle, calculate the Li-th function value corresponding to the parameter determination function, where i is a positive integer; calculate the difference between the Li-th function value and the Li-1-th function value; if the difference is greater than a preset difference threshold, increment i by 1, and execute the step of calculating the Li-th function value corresponding to the parameter determination function based on the text features, the feature labels, and the i-th model parameters corresponding to the current calculation cycle; if the difference is less than or equal to the preset difference threshold, use the i-th model parameters as the target model parameters, and update the model parameters of the initial label prediction model based on the target model parameters, and obtain the target label prediction model based on the update result.

[0144] Specifically, in this embodiment, a calculation cycle refers to the process of determining the i-th model parameter, calculating the function value corresponding to the parameter determination function based on the i-th model parameter, and then calculating the difference between the function value of the current calculation cycle and the function value of the previous calculation cycle. This calculation process constitutes one calculation cycle. The parameter calculation function is used to calculate the model parameters of the label prediction model during model training. In this embodiment, the parameter determination function can be a likelihood function constructed based on the maximum likelihood estimation principle, combined with text features, feature labels, and unknown model parameters. Correspondingly, the function value is the function value corresponding to the parameter determination function calculated based on the given text features, feature labels, and model parameters. i The function value is the function value obtained from the previous calculation cycle corresponding to the current calculation cycle; the difference refers to the Lth... i function value and Lth i-1 The difference between function values, that is, with respect to the Lth... i The function value is the minuend, with the Lth... i-1 The function value is a subtrahend, for the Lth... i function value and Lth i-1 The calculation result obtained by subtracting the function values, and the corresponding preset difference threshold is the pre-determined difference value, which is used to compare with the calculated difference value; the target model parameters refer to the model parameters determined through iterative calculation to generate the trained label prediction model, and the target label prediction model is the trained label prediction model.

[0145] Based on this, a text corpus set for model training is determined, which includes multiple pairs of text features and corresponding feature labels. A parameter determination function is constructed based on the text features, feature labels, and model parameters. The Lth parameter corresponding to the parameter determination function is calculated based on the text features, feature labels, and the i-th model parameters for the current computation cycle. i Function value (i is a positive integer). Based on the Lth... i The function value and the Lth value corresponding to the previous calculation cycle corresponding to the current calculation cycle. i-1 Calculate the difference of function values, that is, find the Lth... i function value and Lth i-1 The difference between function values. A preset difference threshold is determined. If the calculated difference is greater than the preset difference threshold, in step i+1, the text features corresponding to the next calculation cycle and the feature labels corresponding to the text features are selected from the text corpus. The parameters corresponding to the Lth function are then calculated based on the (i+1)th model parameters. i+1 The function value is used until the difference in a certain calculation cycle is less than or equal to the preset difference threshold. Then, the i+1th model parameter is used as the target model parameter, and the model parameters of the initial label prediction model are updated based on the target model parameter. The trained label prediction model, i.e., the target label prediction model, is obtained based on the update result. The expression of the parameter determination function is formula (4):

[0146] L(ω)=log∏X,YP ω (Y|X)P^(X,Y)=∑ X,Y P^(X,Y)P^(X,Y)logP ω (Y|X) (4)

[0147] Among them, P ω (Y|X) represents the probability of a multi-chain undirected graph formed by specific feature label pairs among all feature label nodes, relative to the probability of an undirected graph obtained by permuting all feature label pairs contained in all feature label nodes; P^(x, y) represents the joint probability of text feature X and feature label Y; L(ω) is the function value corresponding to the parameter determination function; ω represents the unknown parameter; X represents the text feature set; Y represents the feature label node.

[0148] Following the previous example, after determining the objective function corresponding to the multi-chain undirected graph, we can construct a likelihood function based on the principle of maximum likelihood estimation, combining text features, feature labels, and the objective function. This is the parameter determination function, where the parameter value ω of the objective function is obtained when the likelihood function corresponding to the objective function reaches its maximum value. kConstruct an expression for the parameter-determining function, and calculate the gradient of the parameter-determining function based on text features and feature labels according to the following expression (5). Calculate ω when L(ω) reaches its maximum value using the gradient descent method. The calculation method is as follows: determine the initial ω value i, and calculate the function value L according to formula (4). i Based on the function value L of the current calculation period i The function value L of the previous calculation cycle i-1 The difference is calculated to be 4. Since the difference is greater than the preset difference threshold of 2, i+1 is obtained, and the ω value i+1 is obtained. Using the ω value i+1 as the parameter value, combined with the unused text features in the text corpus and the feature labels corresponding to the text features, and the ω value i+1, the function value L is calculated based on the parameter. i+1 And calculate the function value L. i+1 The corresponding difference is 1, at which point the function value L is determined. i+1 The corresponding difference 1 is less than the preset difference threshold 2, so the ω value i+1 is the parameter value in the target label prediction model.

[0149]

[0150] In summary, by constructing a parameter determination function to calculate the target model parameters used to construct the target label prediction model, the efficiency of model training and the accuracy of target model parameter determination are improved.

[0151] Furthermore, when calculating the i-th model parameter corresponding to the current calculation cycle, considering the correlation between cycles, the i-th model parameter corresponding to the current calculation cycle can be calculated based on the (i-1)-th model parameter and the gradient value of the parameter determination function corresponding to the previous calculation cycle. The specific implementation is as follows:

[0152] Determine the (i-1)th model parameter corresponding to the previous calculation cycle, and the gradient value corresponding to the previous calculation cycle; calculate the i-th model parameter corresponding to the current calculation cycle based on the (i-1)th model parameter and the gradient value corresponding to the previous calculation cycle.

[0153] Specifically, the previous calculation cycle refers to the upstream calculation cycle adjacent to the current calculation cycle. Correspondingly, when the model parameter of the current calculation cycle is i, the model parameter of the previous calculation cycle is i-1. The gradient value can be obtained by using the gradient descent method to calculate the gradient of the parameter-determining function.

[0154] Based on this, after determining the (i-1)th model parameters corresponding to the previous calculation cycle, and the gradient value of the parameter-determining function in the previous calculation cycle, the i-th model parameters corresponding to the current calculation cycle can be calculated by subtracting the (i-1)th model parameters from the gradient value of the parameter-determining function in the previous calculation cycle. In practical applications, the gradient descent method can be used to calculate the i-th model parameters. The constant coefficients in the gradient descent formula can be empirical values ​​determined through multiple experiments. It should be noted that the model parameters corresponding to each calculation cycle include at least one parameter value.

[0155] Continuing with the previous example, the first difference of 10 is calculated based on the function value L2 of the current second calculation cycle and the function value L1 of the previous calculation cycle. Since the difference of 10 is greater than the preset difference threshold of 2, it is necessary to calculate the third model parameters and then calculate the third function value. The third model parameters are determined based on the difference between the second model parameters and the gradient value corresponding to the second calculation cycle. The third model parameters are used to continue function calculation to obtain the third function value until the calculated gradient value is less than or equal to the preset gradient threshold.

[0156] In summary, this method involves identifying the text features contained in the text corpus and their corresponding feature labels; generating feature label nodes based on the text features and feature labels; constructing a multi-chain undirected graph with a chain-like structure based on the feature label nodes, where each node in the multi-chain undirected graph corresponds to at least two edges; determining at least one subgraph in the multi-chain undirected graph; constructing an objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph; and tuning the initial label prediction model based on the objective function, text features, and feature labels until a target label prediction model that meets the training conditions is obtained. This method achieves improved accuracy in text label prediction by using the contextual relationships between feature labels as a reference condition for label prediction during model training based on multi-chain undirected graphs.

[0157] Figure 6 A flowchart of a label prediction method according to an embodiment of this specification is shown, which specifically includes the following steps:

[0158] Step S602: Obtain the text to be predicted;

[0159] Step S604: Input the text to be predicted into the target label prediction model to obtain the predicted label output by the target label prediction model corresponding to the text to be predicted.

[0160] Specifically, the text to be predicted refers to the text that is directly input into the target label prediction model for label prediction. The text to be predicted can be any sentence; correspondingly, the predicted label is the prediction result output by the target label prediction model that corresponds to the text to be predicted.

[0161] Based on this, the text to be predicted is determined, and the text to be predicted is input into the trained target label prediction model for prediction. The feature label corresponding to each text feature contained in the text to be predicted is predicted, and then the predicted label corresponding to the text to be predicted is obtained from the target label prediction model.

[0162] Furthermore, when the target label prediction model predicts the input text to be predicted, it predicts the probability value of each feature contained in the text and the corresponding feature label associated with the target label prediction model. Then, it selects the feature label corresponding to the highest probability value as the target feature label corresponding to the feature to be predicted. The specific implementation is as follows:

[0163] The text to be predicted is input into the target label prediction model; based on the target label prediction model, the probability value corresponding to each feature label associated with the target label prediction model is calculated for the features to be predicted contained in the text to be predicted; the maximum probability value is selected from the probability values ​​corresponding to each feature label, and the feature label corresponding to the maximum probability value is used as the target feature label corresponding to the feature to be predicted; the prediction label corresponding to the text to be predicted is composed of the target feature labels corresponding to each feature to be predicted contained in the text to be predicted.

[0164] Specifically, the feature to be predicted refers to the text to be predicted being split into multiple word units, from which target word units that can be used as text features for attribute prediction are selected, and the determined target word units are the features to be predicted; during the training process, the target label model associates multiple feature labels, and when predicting the label for each feature to be predicted, it calculates the probability value of the feature to be predicted corresponding to each feature label, and takes the maximum probability value of the feature to be predicted corresponding to each feature label as the predicted label; the label prediction is performed on each feature to be predicted contained in the text to be predicted, and the prediction result is the predicted label corresponding to the text to be predicted.

[0165] Based on this, the determined text to be predicted is input into the target label prediction model. The target label prediction model calculates the probability value corresponding to each feature in the text and its associated feature label. The highest probability value among these calculated probability values ​​is selected as the maximum probability value. The feature label corresponding to the maximum probability value has a high correlation with the text to be predicted; therefore, this feature label is used as the target feature label for the predicted feature. The target label prediction model then calculates and predicts the target feature label for each feature in the text, and these target feature labels together form the predicted label for the text.

[0166] For example, when predicting the text "A bought a piece of clothing produced in place a", the text "A bought a piece of clothing produced in place a" is input into the target label prediction model. The target label prediction model calculates the predicted features "A", "place a", and "clothes" in the text and makes predictions for them. The feature labels and probability values ​​corresponding to the predicted feature "A" are as follows: "A": "Consumer" -0.9, "Merchant" -0.3, "Place of Origin" -0.2, "Product" -0.1. Therefore, the target feature label corresponding to the predicted feature "A" is "Consumer". Similarly, the target feature labels corresponding to the predicted features "Place a" and "clothes" are determined, resulting in "Place a" - "Place of Origin" and "Clothes" - "Product". Therefore, "Consumer", "Place of Origin", and "Product" are the predicted labels corresponding to the text "A bought a piece of clothing produced in place a".

[0167] In summary, this method involves inputting the text to be predicted into a target label prediction model; calculating the probability value of each feature label associated with the target label prediction model for the features contained in the text; selecting the highest probability value among the probability values ​​for each feature label and using the feature label corresponding to the highest probability value as the target feature label for the feature to be predicted; and finally, constructing the predicted label for the text by combining the target feature labels corresponding to each feature to be predicted in the text. This achieves the prediction of the predicted label for the text using a machine learning model, improving both the accuracy and efficiency of label prediction.

[0168] The following is in conjunction with the appendix Figure 7 Taking the application of the label prediction model training method provided in this specification in financial text label prediction as an example, the label prediction model training method will be further explained. Among other things, Figure 7This specification illustrates a flowchart of a label prediction model training method for financial text label prediction, provided in one embodiment. The method includes the following steps:

[0169] Step S702: Obtain the text corpus.

[0170] When training a label prediction model using texts containing financial terminology as the corpus, the obtained text is "A sells 10 million worth of bond with code number 190215 to B at an interest rate of 3.575%".

[0171] Step S704: Perform word segmentation on the text corpus to obtain multiple word units, and select the target word unit from the multiple word units as the text feature corresponding to the text corpus.

[0172] The text corpus "A lends 10 million worth of bond with code number 190215 to B at an interest rate of 3.575%" is segmented into words, resulting in the following words: "A", "10 million", "code number", "190215", "bond", "3.575%", "interest rate", and "B". Word units such as "A", "10 million", "190215", "3.575%", and "B" are selected as target word units, and each target word unit represents a text feature.

[0173] Step S706: Each word unit label is used as a feature label corresponding to the text feature to form a feature label pair.

[0174] Each word unit is labeled as follows: "A" - "Seller", "10 million" - "Contract Value", "190215" - "Bond Code", "3.575%" - "Interest Rate", and "B" - "Buyer". Each word unit label is then combined with the text feature to obtain the corresponding feature label pair. That is, for the text feature "A", we can obtain feature label pairs such as "A" - "Seller", "A" - "Contract Value", "A" - "Bond Code", "A" - "Interest Rate", and "A" - "Buyer". Using the above method, we can obtain the feature label pair corresponding to each text feature.

[0175] Step S708: Generate a feature label set based on the feature label pairs, and use the feature label set as a feature label node.

[0176] For the text feature "A", we can obtain feature label pairs such as "A" - "Seller", "A" - "Contract Value", "A" - "Bond Code", "A" - "Interest Rate", and "A" - "Buyer". Combining these feature label pairs yields a set of feature labels corresponding to the text feature "A", which is the feature label node corresponding to the text feature "A". Furthermore, we can determine the feature label node corresponding to each text feature: "A", "10 million", "190215", "3.575%", and "B".

[0177] Step S710: The textual relationships between text features are used as node association edges.

[0178] The textual association between feature label nodes can be determined based on the semantic order of text features in the text corpus, and the textual association is used as node association edges.

[0179] Step S712: Construct a bilinked undirected graph based on the feature label nodes and the edges associated with those nodes.

[0180] Construct a system based on the determined nodes and edges, such as... Figure 8 The diagram shows a bichain undirected graph, which, as can be seen from the figure, is a bichain structure.

[0181] Step S714: Determine at least one subgraph in the doubly linked undirected graph and construct the subgraph function corresponding to each subgraph.

[0182] like Figure 8 As shown, in the constructed doubly linked undirected graph, the label node "interest rate" is taken as the initial label node. From the doubly linked undirected graph, it can be seen that using the label node "interest rate" as the initial label node can construct the subgraph shown in the dashed box, i.e., the maximum clique. Each node in the subgraph has a directly connected undirected edge with any other node in the subgraph. Based on the nodes contained in the subgraph, the corresponding subgraph function, i.e., the potential function, is constructed to represent the probability of the subgraph appearing relative to the doubly linked undirected graph. The expression for the subgraph function is formula (6).

[0183] Ψ(t)=e∑ k ω k *f k (Y t-2 Y t-1 Y t ,X,t) (6)

[0184] Where ψ(t) represents the probability of a subgraph appearing relative to a doubly linked undirected graph; f k Denotes the characteristic function, ω kLet X represent the k unknown parameters, representing the weights of the k feature functions; X represent the text feature set; Y represent the feature label node; t represents the t-th feature label node in the doubly-linked undirected graph; n represents the number of chains in the doubly-linked undirected graph; Y... t This represents the target feature label node in the subgraph.

[0185] Step S716: Construct a joint subgraph function based on the distribution relationship between each subgraph and the doubly linked undirected graph, and the subgraph function corresponding to each subgraph.

[0186] Based on the subgraph function corresponding to each subgraph and the distribution relationship between each subgraph and the doubly linked undirected graph, that is, the order of the subgraphs in the doubly linked undirected graph, a joint subgraph function is constructed, where the joint subgraph function refers to the product of all subgraph functions.

[0187] Step S718: Based on the graph structure corresponding to the doubly linked undirected graph, perform full permutation processing on the feature label pairs contained in the feature label nodes of the doubly linked undirected graph, and determine the full permutation function based on the processing result. The expression of the full permutation function is formula (7).

[0188] Z(X) = ∑Ye∑ t ∑ k ω k *f k (Y t-2 Y t-1 Y t (7)

[0189] The permutation function value represents the number of undirected graphs obtained after connecting the feature label nodes according to the permutation strategy.

[0190] Step S720: Construct the objective function based on the joint subgraph function and the permutation function. The expression of the objective function is formula (8).

[0191]

[0192] Where Z(X) represents the sum of the objective function values ​​of all undirected graphs obtained by connecting the feature label pairs contained in the feature label nodes according to the full permutation strategy; P ω (Y|X) represents the probability of a multi-chain undirected graph formed by specific feature label pairs among all feature label nodes, relative to the probability of an undirected graph obtained by permuting all feature label pairs contained in all feature label nodes.

[0193] The objective function represents the probability of the occurrence of all undirected graphs relative to the number of undirected graphs in a doubly linked undirected graph that incorporates the set of feature functions.

[0194] Step S722: Based on the text features, feature labels, and the i-th model parameters corresponding to the current calculation cycle, calculate the L-th parameter determination function. i Function value, and according to the Lth i function value and Lth i-1 Calculate the difference between function values.

[0195] Construct a likelihood function, i.e., a parameter determination function, based on text features, feature labels, and unknown model parameters. Set initial model parameters ω0. Calculate the gradient of the likelihood function and iteratively calculate the target model parameters ω using gradient descent. Determine the model parameters i corresponding to the current calculation cycle, and calculate the function value L based on text features, feature labels, the likelihood function, and model parameters i. i The function value L calculated based on the previous calculation cycle. i-1 and function value L i Calculate the difference.

[0196] Step S724: Determine whether the difference is greater than the preset difference threshold. If yes, proceed to step S722; otherwise, proceed to step S726.

[0197] Step S726: Use the i-th model parameter as the target model parameter, update the model parameters of the initial label prediction model based on the target model parameter, and obtain the target label prediction model based on the update result.

[0198] By using the model parameter i as the target model parameter, we obtain the trained label prediction model, i.e., the target label prediction model.

[0199] Step S728: Obtain the text to be predicted.

[0200] When performing label prediction based on the target label prediction model, the text to be predicted is determined to be "C will issue 1 million of the bond with code number 156275 to D at an interest rate of 2.986%".

[0201] Step S730: Input the text to be predicted into the target label prediction model.

[0202] Step S732: Calculate the probability value of each feature label associated with the target label prediction model for the features to be predicted contained in the text to be predicted.

[0203] Each text feature in the text to be predicted, namely “C”, “1 million”, “156275”, “2.986%”, and “D”, is predicted separately. The probability values ​​of text feature “C” corresponding to each feature label are: “seller”, “contract value”, “bond code”, “interest rate”, and “buyer”. The probability values ​​of text feature “C” corresponding to each feature label are 0.9, 0.3, 0.2, 0.1, and 0.6, respectively.

[0204] Step S734: Select the highest probability value among the probability values ​​corresponding to each feature label, and use the feature label corresponding to the highest probability value as the target feature label corresponding to the feature to be predicted.

[0205] Step S736: The prediction label for the text to be predicted is composed of the target feature label corresponding to each feature to be predicted contained in the text to be predicted.

[0206] The probability values ​​for each feature label corresponding to text feature "C" are 0.9, 0.3, 0.2, 0.1, and 0.6, respectively. Therefore, the feature label "seller" corresponding to the highest probability value of 0.9 is determined to be the feature label corresponding to text feature "C". Using the above method, the feature labels corresponding to text features "1 million", "156275", "2.986%", and "D" are determined as follows: "1 million" - "contract value", "156275" - "bond code", "2.986%" - "interest rate", and "D" - "buyer". "Seller", "contract value", "bond code", "interest rate", and "buyer" are the predicted labels corresponding to the text to be predicted.

[0207] Furthermore, in this embodiment, the overhead of the forward algorithm (alpha) and the backward algorithm (beta) in the target label prediction model is recorded on the edge. When cutting the doubly linked undirected graph, it can be cut according to two adjacent nodes. At this time, the node sequence composed of feature label nodes can be composed of the overhead of the forward algorithm (alpha) and the backward algorithm (beta) of this edge and the overhead of this edge itself, without repetition or omission.

[0208] In summary, the label prediction model training method provided in this specification involves: determining the text features contained in the text corpus and the corresponding feature labels; constructing a doubly linked undirected graph with text features and feature labels as nodes, where each node in the doubly linked undirected graph corresponds to at least three edges; determining at least one subgraph in the doubly linked undirected graph; constructing an objective function based on the distribution relationship between each subgraph and the doubly linked undirected graph; and tuning the initial label prediction model based on the objective function, text features, and feature labels until a target label prediction model that meets the training conditions is obtained. This method utilizes the contextual relationships between feature labels as a reference condition for label prediction during model training based on a doubly linked undirected graph, thereby improving the accuracy of label prediction for text.

[0209] Corresponding to the above method embodiments, this specification also provides embodiments of a label prediction model training device. Figure 9 A schematic diagram of a label prediction model training device according to an embodiment of this specification is shown. Figure 9 As shown, the device includes:

[0210] The determination module 902 is configured to determine the text features contained in the text corpus and the feature labels corresponding to the text features;

[0211] The construction module 904 is configured to generate feature label nodes based on the text features and the feature labels, and to construct a multi-chain undirected graph with a chain structure based on the feature label nodes, wherein each node in the multi-chain undirected graph corresponds to at least two edges;

[0212] Processing module 906 is configured to determine at least one subgraph in the multi-linked undirected graph and construct an objective function based on the distribution relationship between each subgraph and the multi-linked undirected graph;

[0213] The training module 908 is configured to tune the parameters of the initial label prediction model based on the objective function, the text features, and the feature labels until a target label prediction model that meets the training conditions is obtained.

[0214] In an optional embodiment, the building module 904 is further configured to:

[0215] The text features and each feature label are combined to obtain at least one feature label pair; a feature label set is generated based on the at least one feature label pair, and the feature label set is used as a feature label node; the text association relationship between the text features is used as a node association edge, wherein the text association relationship is the relationship between text features with word unit connection relationship in the text corpus; a multi-chain undirected graph is constructed based on the feature label node and the node association edge.

[0216] In an optional embodiment, the processing module 906 is further configured to:

[0217] Construct a subgraph function corresponding to each subgraph; construct a joint subgraph function based on the distribution relationship between each subgraph and the multi-chain undirected graph, and the subgraph function corresponding to each subgraph; perform full permutation processing on the feature label pairs contained in the feature label nodes of the multi-chain undirected graph according to the graph structure corresponding to the multi-chain undirected graph, and determine the full permutation function based on the processing result; construct a target function based on the joint subgraph function and the full permutation function.

[0218] In an optional embodiment, the processing module 906 is further configured to:

[0219] Determine the subgraph text features corresponding to each subgraph feature label node in the subgraph; determine the node association relationships between subgraph feature label nodes based on the feature association relationships between the subgraph text features corresponding to each subgraph feature label node; construct the subgraph function corresponding to the subgraph based on the node association relationships. The expression of the subgraph function is formula (1):

[0220] Ψ(t)=e∑ k ω K *f k (Y t-n …Y t-1 Y t (1)

[0221] Where ψ(t) represents the probability of a subgraph appearing relative to a multi-chain undirected graph; f k Denotes the characteristic function, ω k Let X represent the k unknown parameters, representing the weights of the k feature functions; X represent the text feature set; Y represent the feature label node; t represents the t-th feature label node in the multi-chain undirected graph; n represents the number of chains in the multi-chain undirected graph; Y... t Y represents the target feature label node in the subgraph. t-n This represents the nth feature label node that has an indirect relationship with the target feature label node.

[0222] The expression for the permutation function is formula (2), and the expression for the objective function is formula (3):

[0223] Z(X) = ∑Ye∑ t ∑ k ω k *f k (Y t-n …Y t-1 Y t ,X,t) (2)

[0224]

[0225] Where Z(X) represents the sum of the objective function values ​​of all undirected graphs obtained by connecting the feature label pairs contained in the feature label nodes according to the full permutation strategy; P ω (Y|X) represents the probability of a multi-chain undirected graph formed by specific feature label pairs among all feature label nodes, relative to the probability of an undirected graph obtained by permuting all feature label pairs contained in all feature label nodes.

[0226] In an optional embodiment, the processing module 906 is further configured to:

[0227] The number of chains contained in the multi-chain undirected graph is determined, and an initial feature label node is determined in the multi-chain undirected graph; a first feature label node with a direct connection to the initial feature label node is determined in the multi-chain undirected graph, and a second feature label node with an indirect connection to the initial feature label node is determined in the multi-chain undirected graph based on the number of chains; a subgraph containing the text feature node, the first feature label node, and the second feature label node is determined in the multi-chain undirected graph.

[0228] In an optional embodiment, the training module 908 is further configured to:

[0229] Based on the text features, the feature labels, and the i-th model parameters corresponding to the current calculation cycle, the calculation parameter determination function corresponds to the L-th... i The function value, where i is a positive integer; according to the Lth... i function value and Lth i-1 The function values ​​are calculated to determine the difference; if the difference is greater than a preset difference threshold, i+1 is incremented, and the Lth model parameter corresponding to the current calculation cycle is calculated based on the text features, the feature labels, and the i-th model parameter. i The steps for determining the function value are as follows: if the difference is less than or equal to the preset difference threshold, the i-th model parameter is used as the target model parameter, and the model parameters of the initial label prediction model are updated based on the target model parameter, and the target label prediction model is obtained according to the update result.

[0230] In an optional embodiment, the training module 908 is further configured to:

[0231] Determine the (i-1)th model parameter corresponding to the previous calculation cycle, and the gradient value corresponding to the previous calculation cycle; calculate the i-th model parameter corresponding to the current calculation cycle based on the (i-1)th model parameter and the gradient value corresponding to the previous calculation cycle.

[0232] The parameter determination function is determined by the following formula (4):

[0233] L(ω) = log₂X, YP ω (Y|X)P^(X,Y)=∑ X,Y P^(X,Y)logP ω (Y|X) (4)

[0234] Among them, P ω (Y|X) represents the probability of a multi-chain undirected graph formed by specific feature label pairs among all feature label nodes, relative to the probability of an undirected graph obtained by permuting all feature label pairs contained in all feature label nodes; P^(x, y) represents the joint probability of text feature X and feature label Y; L(ω) is the function value corresponding to the parameter determination function; ω represents the unknown parameter; X represents the text feature set; Y represents the feature label node.

[0235] In an optional embodiment, the determining module 902 is further configured to:

[0236] Obtain a text corpus; perform word segmentation on the text corpus to obtain multiple word units; select a target word unit from the multiple word units as the text feature corresponding to the text corpus; and use the word unit label corresponding to the target word unit as the feature label corresponding to the text feature.

[0237] The tag prediction model training device provided in this specification determines the text features contained in the text corpus and the corresponding feature labels of the text features; generates feature label nodes based on the text features and feature labels, and constructs a chain-like multi-chain undirected graph based on the feature label nodes, wherein each node in the multi-chain undirected graph corresponds to at least two edges; determines at least one subgraph in the multi-chain undirected graph, and constructs an objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph; and tunes the initial tag prediction model based on the objective function, text features, and feature labels until a target tag prediction model that meets the training conditions is obtained. This device improves the accuracy of text tag prediction by using the contextual relationships between feature labels as a reference condition for tag prediction during model training based on multi-chain undirected graphs.

[0238] The above is an illustrative scheme of a label prediction model training device according to this embodiment. It should be noted that the technical solution of this label prediction model training device and the technical solution of the label prediction model training method described above belong to the same concept. For details not described in detail in the technical solution of the label prediction model training device, please refer to the description of the technical solution of the label prediction model training method described above.

[0239] Corresponding to the above-described label prediction method embodiments, this specification also provides embodiments of label prediction devices. Figure 10 A schematic diagram of a tag prediction device according to an embodiment of this specification is shown. Figure 10 As shown, the device includes:

[0240] Module 1002 is configured to acquire the text to be predicted.

[0241] The prediction module 1004 is configured to input the text to be predicted into the target label prediction model and obtain the predicted label corresponding to the text to be predicted output by the target label prediction model.

[0242] In an optional embodiment, the prediction module 1004 is further configured to:

[0243] The text to be predicted is input into the target label prediction model; based on the target label prediction model, the probability value corresponding to each feature label associated with the target label prediction model is calculated for the features to be predicted contained in the text to be predicted; the maximum probability value is selected from the probability values ​​corresponding to each feature label, and the feature label corresponding to the maximum probability value is used as the target feature label corresponding to the feature to be predicted; the prediction label corresponding to the text to be predicted is composed of the target feature labels corresponding to each feature to be predicted contained in the text to be predicted.

[0244] In summary, this method involves inputting the text to be predicted into a target label prediction model; calculating the probability value of each feature label associated with the target label prediction model for the features contained in the text; selecting the highest probability value among the probability values ​​for each feature label and using the feature label corresponding to the highest probability value as the target feature label for the feature to be predicted; and finally, constructing the predicted label for the text by combining the target feature labels corresponding to each feature to be predicted in the text. This achieves the prediction of the predicted label for the text using a machine learning model, improving both the accuracy and efficiency of label prediction.

[0245] The above is an illustrative scheme of a label prediction device according to this embodiment. It should be noted that the technical solution of this label prediction device and the technical solution of the label prediction method described above belong to the same concept. For details not described in detail in the technical solution of the label prediction device, please refer to the description of the technical solution of the label prediction method described above.

[0246] Figure 11A structural block diagram of a computing device 1100 according to an embodiment of this specification is shown. The components of the computing device 1100 include, but are not limited to, a memory 1110 and a processor 1120. The processor 1120 is connected to the memory 1110 via a bus 1130, and a database 1150 is used to store data.

[0247] The computing device 1100 also includes an access device 1140, which enables the computing device 1100 to communicate via one or more networks 1160. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 1140 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0248] In one embodiment of this specification, the aforementioned components of the computing device 1100 and Figure 11 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 11 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0249] The computing device 1100 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 1100 can also be a mobile or stationary server.

[0250] The processor 1120 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above method.

[0251] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the above method belong to the same concept, and all details not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the above method.

[0252] An embodiment of this specification also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the above-described method.

[0253] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the above method belong to the same concept, and all details not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the above method.

[0254] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0255] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0256] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this specification is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this specification. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this specification.

[0257] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0258] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. These embodiments have been selected and specifically described in this specification to better explain the principles and practical applications of this specification, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A method for training a label prediction model, characterized in that, include: Determine the text features contained in the text corpus, and the feature labels corresponding to the text features; When there is at least one feature label, the text features and each feature label are combined to obtain at least one feature label pair; a feature label set is generated based on the at least one feature label pair, and the feature label set is used as a feature label node; the text association relationship between the text features is used as a node association edge; a multi-chain undirected graph is constructed based on the feature label node and the node association edge, wherein the text association relationship is the relationship between text features with word unit connection relationship in the text corpus, and each node in the multi-chain undirected graph corresponds to at least two edges; In the multi-chain undirected graph, at least one subgraph is determined, and an objective function is constructed based on the distribution relationship between each subgraph and the multi-chain undirected graph. Based on the objective function, the text features, and the feature labels, the parameters of the initial label prediction model are tuned until a target label prediction model that meets the training conditions is obtained.

2. The method according to claim 1, characterized in that, The step of constructing the objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph includes: Construct the subgraph function corresponding to each subgraph; Construct a joint subgraph function based on the distribution relationship between each subgraph and the multi-chain undirected graph, and the subgraph function corresponding to each subgraph; Based on the graph structure corresponding to the multi-chain undirected graph, the feature label pairs contained in the feature label nodes of the multi-chain undirected graph are subjected to full permutation processing, and the full permutation function is determined based on the processing result; Construct the objective function based on the joint subgraph function and the permutation function.

3. The method according to claim 2, characterized in that, The subgraph function corresponding to each subgraph is constructed using the following method: Determine the subgraph text features corresponding to each subgraph feature label node in the subgraph; Based on the feature association relationships between the subgraph text features corresponding to each subgraph feature label node, determine the node association relationships between the subgraph feature label nodes; The subgraph function corresponding to the subgraph is constructed based on the node association relationship.

4. According to claim 2, the expression of the subgraph function is formula (1): in, f represents the probability of a subgraph appearing relative to a multi-chain undirected graph; k Denotes the characteristic function, ω k Let X represent the k unknown parameters, representing the weights of the k feature functions; X represent the text feature set; Y represent the feature label node; t represents the t-th feature label node in the multi-chain undirected graph; n represents the number of chains in the multi-chain undirected graph; Y... t Y represents the target feature label node in the subgraph. t-n This represents the nth feature label node that has an indirect relationship with the target feature label node.

5. The method according to claim 4, wherein the expression of the permutation function is formula (2), and the expression of the objective function is formula (3): in, Z(X) represents the sum of the objective function values ​​of all undirected graphs obtained by connecting the feature label pairs contained in the feature label nodes according to the full permutation strategy; P ω (Y|X) represents the probability of a multi-chain undirected graph formed by specific feature label pairs among all feature label nodes, relative to the probability of an undirected graph obtained by permuting all feature label pairs contained in all feature label nodes.

6. The method according to claim 1, characterized in that, Any subgraph in the multi-chain undirected graph is determined by the following method: Determine the number of chains contained in the multi-chain undirected graph, and determine the initial feature label nodes in the multi-chain undirected graph; In the multi-chain undirected graph, a first feature label node that has a direct connection with the initial feature label node is determined, and a second feature label node that has an indirect connection with the initial feature label node is determined in the multi-chain undirected graph based on the number of chains. A subgraph containing the initial feature label node, the first feature label node, and the second feature label node is determined in the multi-chain undirected graph.

7. The method according to claim 1, characterized in that, The step of tuning the initial label prediction model based on the objective function, the text features, and the feature labels until a target label prediction model that meets the training conditions is obtained includes: Based on the text features, the feature labels, and the i-th model parameters corresponding to the current calculation cycle, the calculation parameter determination function corresponds to the L-th... i The function value, where i is a positive integer; According to L i function value and Lth i-1 Calculate the difference between function values; If the difference is greater than a preset difference threshold, increment i by 1, and execute the calculation of the Lth parameter determination function based on the text features, the feature labels, and the i-th model parameters corresponding to the current calculation cycle. i Steps for calculating function values; If the difference is less than or equal to the preset difference threshold, the i-th model parameter is used as the target model parameter, and the model parameters of the initial label prediction model are updated based on the target model parameter. The target label prediction model is obtained based on the update result.

8. The method according to claim 7, characterized in that, The determination of the i-th model parameters corresponding to the current calculation cycle includes: Determine the i-1th model parameters corresponding to the previous calculation cycle, and the gradient value corresponding to the previous calculation cycle; Calculate the i-th model parameters corresponding to the current calculation cycle based on the (i-1)-th model parameters and the gradient value corresponding to the previous calculation cycle.

9. The method according to claim 7, wherein the parameter determination function is determined by the following formula (4): in, P ω (Y|X) represents the probability of a multi-chain undirected graph formed by specific feature label pairs among all feature label nodes appearing relative to the undirected graph obtained by performing full permutations of all feature label nodes. L(ω) represents the joint probability of text feature X and feature label Y; L(ω) is the function value corresponding to the parameter determination function; ω represents the unknown parameter; X represents the text feature set; Y represents the feature label node.

10. The method according to claim 1, characterized in that, The determination of the text features contained in the text corpus, and the feature labels corresponding to the text features, includes: Obtain text corpus; The text corpus is segmented to obtain multiple word units, and the target word unit is selected from the multiple word units as the text feature corresponding to the text corpus. The word unit label corresponding to the target word unit is used as the feature label corresponding to the text feature.

11. A label prediction method, characterized in that, include: Obtain the text to be predicted; The text to be predicted is input into the target label prediction model in the method of any one of claims 1-10 to obtain the predicted label corresponding to the text to be predicted output by the target label prediction model.

12. The method according to claim 11, wherein inputting the text to be predicted into a target label prediction model to obtain a predicted label output by the target label prediction model corresponding to the text to be predicted comprises: The text to be predicted is input into the target label prediction model; Based on the target label prediction model, calculate the predictable features contained in the text to be predicted, and the probability value corresponding to each feature label associated with the target label prediction model; Select the highest probability value among the probability values ​​corresponding to each feature label, and use the feature label corresponding to the highest probability value as the target feature label corresponding to the feature to be predicted; The predicted label for the text to be predicted is composed of the target feature label corresponding to each feature to be predicted contained in the text to be predicted.

13. A label prediction model training device, characterized in that, include: The determination module is configured to determine the text features contained in the text corpus, and the feature labels corresponding to the text features; The construction module is configured to, when there is at least one feature label, combine the text features and each feature label to obtain at least one feature label pair; generate a feature label set based on the at least one feature label pair, and use the feature label set as a feature label node; use the text association relationship between the text features as node association edges; and construct a multi-chain undirected graph based on the feature label node and the node association edges, wherein the text association relationship is the relationship between text features with word unit connection relationship in the text corpus, and each node in the multi-chain undirected graph corresponds to at least two edges; The processing module is configured to determine at least one subgraph in the multi-chain undirected graph and construct an objective function based on the distribution relationship between each subgraph and the multi-chain undirected graph. The training module is configured to tune the parameters of the initial label prediction model based on the objective function, the text features, and the feature labels until a target label prediction model that meets the training conditions is obtained.

14. A tag prediction device, characterized in that, include: The acquisition module is configured to acquire the text to be predicted. The prediction module is configured to input the text to be predicted into the target label prediction model in the method as described in any one of claims 1-10, and obtain the predicted label corresponding to the text to be predicted output by the target label prediction model.

15. A computing device, characterized in that, It includes a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the method of any one of claims 1 to 12.

16. A computer-readable storage medium storing computer instructions, characterized in that, When executed by the processor, this instruction implements the steps of the method of any one of claims 1 to 12.

Citation Information

Patent Citations

  • Information identification method and device, computer equipment and storage medium

    CN111414451A

  • Method and device for predicting identity tag of user and electronic equipment

    CN111444350A