Text classification method, device, and electronic device based on multi-task learning
Through adaptive learning and the use of Lasso penalty items, the problem of sample connection being ignored in the text classification method is solved, information sharing and automatic grouping between tasks are realized, and the accuracy and generalization ability of text classification are improved.
Patent Information
- Application Number
- CN202011166494.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-27
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2040-10-27
AI Technical Summary
The existing text classification method splits the connection between samples and ignores the shared information between data, resulting in poor classification results. Multi-task learning methods have challenges in passing between tasks or model parameters, especially in task relevance. Assumptions and negatively related task grouping aspects.
Through adaptive learning methods, text data is divided into training and testing data sets, the number of tasks is determined, the training data set samples are assigned to multiple tasks, and the linear combination and correlation matrix between tasks is realized using the trace Lasso penalty term. Automatically group relevant tasks and obtain a regression matrix W to improve generalization ability.
It improves the accuracy and generalization ability of text classification, can more effectively convey knowledge between multiple tasks and improve classification effect.
Smart Images

Figure CN114491008B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of text processing technology, and in particular to a text classification method, device, electronic device and storage medium based on multi-task learning. Background Art
[0002] Text classification can be widely used in many scenarios such as spam monitoring, sentiment classification, and article classification topics. However, current text classification methods often break the connection between samples and ignore the shared information between data, resulting in poor classification results.
[0003] In multi-task learning, multiple tasks are learned together to share information between related tasks. The purpose of multi-task learning is to improve the generalization ability of all tasks by transferring knowledge between multiple tasks. Therefore, text classification based on multi-task learning can achieve better results.
[0004] The main challenge of multi-task learning is how to extract and utilize shared information among related tasks in order to transfer knowledge about features or model parameters between tasks. Ideally, only related tasks should share information with each other.
[0005] In most existing multi-task learning methods, shared information between tasks is extracted by introducing an inductive bias in the hypothesis space of all tasks. The inductive bias consists of an assumption about the structure of task dependencies.
[0006] Different assumptions lead to different specific methods. Some assumptions assume that the task parameters are close to each other or share prior knowledge, or stipulate that the shared knowledge is located in a low-order subspace. This approach assumes that all tasks are correlated with each other. The correlation between tasks is achieved by forcing the distances between task parameters to be close to each other, or forcing the task parameters to be in the same low-order subspace. However, in real-world applications, this assumption may not be achieved. To solve this problem, different tasks can be grouped into different clusters. In each cluster, the task parameters share prior knowledge and are close to each other in some distance metric. However, one problem with this approach is that negatively correlated tasks are placed in different clusters. One solution is to incorporate the grouping information into the subspace regularization based method. It is assumed that the tasks are grouped and each group of task parameters is located in a low-dimensional subspace, and cross-validation is required to select the appropriate number of groups.
[0007] Different from the above method, another method allows flexible task division by assuming that a task can be clustered into multiple clusters with different weights. Each cluster has its own representative tasks, and each task is represented by some of them. This can be achieved by adjusting the Euclidean distance between representative tasks. Although this method can save the determination of the number of task clusters, since the l2 norm distance is used to measure the similarity between task parameters, negatively correlated tasks cannot be grouped into the same cluster. Summary of the invention
[0008] In order to solve the above technical problems, the embodiments of the present invention provide a text classification method, device, electronic device and storage medium based on multi-task learning that can adaptively learn and have good text classification effect.
[0009] The technical solution provided by the embodiment of the present invention is as follows:
[0010] On the one hand, a text classification method based on multi-task learning is provided, comprising:
[0011] Step 1: Input the feature vector set of text data and its corresponding label value;
[0012] Step 2: Divide all text into training data set and test data set according to a certain ratio;
[0013] Step 3: Determine the value of the number of tasks m and evenly distribute the samples of the training data set to m tasks;
[0014] Step 4: Solve the following model to obtain the regression matrix W;
[0015]
[0016] Among them, the m tasks are Each task T i A set of training data D i ={(x ij ,y ij ),j=1,2,…,N i}composition, represents the jth input data in the i-th task, y ij Indicates its corresponding output; Represents the weight parameters of m tasks;
[0017] Assume that each task parameter is represented by a linear combination of other task parameters:
[0018]
[0019] in, is the correlation matrix between tasks, ci represents the i-th column in C, C ki w k and w i The relevance weight represents the relevance between task k and task i. It describes how much information in task k can be transferred to task i, thereby realizing the automatic grouping of related tasks.
[0020] in, represents the convex loss function of the i-th task, λ and γ are regularization parameters, W -i means there is no W in the i-th column, Represents the column vector c i There is no item i;
[0021] Step 5: Use the regression matrix W to regress the samples of the test data set and estimate the label estimation value of the test text, thereby completing the classification of the test text.
[0022] On the other hand, a text classification device based on multi-task learning is provided, comprising:
[0023] An input module is used to input a feature vector set of text data and its corresponding label value;
[0024] The segmentation module is used to segment all text into training data sets and test data sets according to a certain ratio;
[0025] The allocation module is used to determine the value of the number of tasks m and evenly allocate the samples of the training data set to m tasks;
[0026] The solution module is used to solve the following model and obtain the regression matrix W;
[0027]
[0028] Among them, the m tasks are Each task T i A set of training data D i ={(x ij ,y ij ),j=1,2,…,N i}composition, represents the jth input data in the i-th task, y ij Indicates its corresponding output; Represents the weight parameters of m tasks;
[0029] Assume that each task parameter is represented by a linear combination of other task parameters:
[0030]
[0031] in, is the correlation matrix between tasks, c i represents the i-th column in C, ki w k and w i The relevance weight represents the relevance between task k and task i. It describes how much information in task k can be transferred to task i, thereby realizing the automatic grouping of related tasks.
[0032] in, represents the convex loss function of the i-th task, λ and γ are regularization parameters, W -i means there is no W in the i-th column, Represents the column vector c i There is no item i;
[0033] The regression module is used to use the regression matrix W to regress the samples of the test data set and estimate the label estimation value of the test text, so as to complete the classification of the test text.
[0034] On the other hand, an electronic device is provided, comprising: a shell, a processor, a memory, a circuit board and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute any of the above-mentioned methods.
[0035] On the other hand, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement any of the methods described above.
[0036] The embodiments of the present invention have the following beneficial effects:
[0037] The text classification method, device, electronic device and storage medium based on multi-task learning provided by the embodiment of the present invention first input a feature vector set of text data and its corresponding label value, then divide all texts into a training data set and a test data set according to a certain ratio, then determine the value of the number of tasks m, evenly distribute the samples of the training data set to m tasks, then solve the model to obtain a regression matrix W, and finally use the regression matrix W to regress the samples of the test data set to estimate the label estimation value of the test text, thereby completing the classification of the test text. The present invention improves the generalization ability of all tasks by transferring knowledge between multiple tasks, thereby improving the effect of text classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0039] Figure 1 A flowchart of a text classification method based on multi-task learning according to the present invention;
[0040] Figure 2 The accuracy comparison diagram of text classification methods, where (a) is the other comparison experiment diagram and (b) is the self comparison experiment diagram;
[0041] Figure 3 It is a structural schematic diagram of a text classification device based on multi-task learning of the present invention;
[0042] Figure 4 It is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0044] On the one hand, the embodiment of the present invention provides a text classification method based on multi-task learning, such as Figure 1 As shown, including:
[0045] Step 101: input a feature vector set of text data and its corresponding label value;
[0046] In this step, the feature vector set D of the data i =(x ij ,y ij ),j=1,2,…,N i} can be represented by N i The feature vectors of samples are composed of N i represents the number of samples in the i-th task, represents the jth input data in the i-th task (i.e., a d×1 vector, where d represents the feature dimension of the vector), and y ij Indicates its corresponding output (label value), y ijis a one-dimensional number (1 or -1). The present invention provides a text classification method rather than a text feature extraction method, so the feature vector of the sample data is known in advance.
[0047] Step 102: Divide all text into a training data set and a test data set according to a certain ratio;
[0048] In this step, the segmentation ratio can be flexibly set as needed, for example, 20% is the test data set and 80% is the training data set.
[0049] Step 103: Determine the value of the number of tasks m, and evenly distribute the samples of the training data set to m tasks;
[0050] Step 104: Solve the following model to obtain a regression matrix W;
[0051]
[0052] Among them, the m tasks are Each task T i A set of training data D i ={(x ij ,y ij ),j=1,2,…,N i}composition, represents the jth input data in the i-th task, y ij Indicates its corresponding output; Represents the weight parameters of m tasks;
[0053] In order to exploit the relationship between tasks, each task parameter is assumed to be represented by a linear combination of other task parameters:
[0054]
[0055] in, is the correlation matrix between tasks, c i represents the i-th column in C, C ki w k and w i The relevance weight represents the relevance between task k and task i. It describes how much information in task k can be transferred to task i, thereby realizing the automatic grouping of related tasks.
[0056] in, represents the convex loss function of the i-th task, λ and γ are regularization parameters, W -i means there is no W in the i-th column, Represents the column vector c i There is no item i;
[0057] That is, the present invention provides an adaptive group sparse multi-task learning method based on trace Lasso for text classification. More specifically, it is necessary to solve the optimization problem of the above objective function (model). The first term in the objective function is the sum of the training losses of all tasks. For different learning problems, the loss function can be different. The second term acts as a regularization term to ensure that each task is a linear combination of other tasks. The third term is applied to the relationship vector c between tasks. i The trace Lasso penalty term on .
[0058] The trace lasso is a regularization term that is the interaction between the l1 norm and the l2 norm. The regularization term is very important in learning the sparsity of the coefficient vector (that is, {c i}), it is adaptive to the relevance of the data, i.e., the task weight parameter W. In other words, it transforms the data predictor {w i} are merged into the regularization term. i} are uncorrelated, the trace lasso behaves as the l1 norm. In the case where the data predictors are highly correlated, the trace lasso behaves like the l2 norm. Adapting the correlation between different task weight parameters by the trace lasso can help the model represent each task as a set of related tasks. Therefore, the present invention uses the trace lasso penalty as the task linear combination coefficient {c i} regularizer.
[0059] As an optional embodiment, the present invention proposes an alternating optimization algorithm to solve the above model, and the step 104 preferably includes:
[0060] Step 1041: Calculate the initial regression vector w for each task through the following optimization model: k
[0061]
[0062] in, represents the p-th sample in the k-th task, represents the label value of the pth sample in the kth task, n k represents the number of samples in the kth task;
[0063] Step 1042: Initialize the correlation matrix C to the identity matrix;
[0064] Step 1043: Fix W and rewrite the model Ω1 as:
[0065]
[0066]
[0067] The augmented Lagrangian of model Π1 is:
[0068]
[0069] And iteratively calculate C, J by the following formula i , and U i :
[0070]
[0071]
[0072]
[0073] Among them, + represents the iterative value of the corresponding variable, is the dual variable introduced in the form of a ratio;
[0074] Step 1044: Fix C and rewrite the model Ω1 as:
[0075]
[0076]
[0077] The augmented Lagrangian of model Σ1 is:
[0078]
[0079] And iteratively calculate W, Z by the following formula i , and U i :
[0080]
[0081]
[0082]
[0083] Among them, + represents the iterative value of the corresponding variable;
[0084] Step 1045: When the difference between the optimization variable values obtained by the two previous iterations, i.e., the regression matrix W, is less than the preset convergence threshold θ, the iteration is stopped, and the regression matrix W is obtained by the optimal solution of the above optimization model; otherwise, go to step 1043 and continue the iteration.
[0085] In this step, the two iterations refer to the nth and n-1th iterations. The above steps 1043 and 1044 are combined into one iteration. The optimized variable value refers to the regression matrix W. The threshold θ is driven by the data and has different values for different data. Generally, the threshold θ is on the order of 10. -2 .
[0086] In this way, the above-mentioned alternating optimization algorithm can easily solve the above-mentioned model, thereby obtaining the regression matrix
[0087] Step 105: Using the regression matrix W, regress the samples of the test data set to estimate the label estimation value of the test text, thereby completing the classification of the test text.
[0088] In this step, the regression algorithm can adopt a conventional linear regression algorithm. In addition, the formula y=W T x computes the label estimate for the test text If the non-negative values account for the majority of the m predicted values, the label estimate of the test data is 1 for the positive class, otherwise, it is -1 for the negative class.
[0089] In summary, the present invention introduces adaptive learning into a multi-task learning framework to complete the text classification task. First, the training text set is evenly distributed into m tasks, and it is assumed that each task parameter is represented by a linear combination of other task parameters. In order to achieve automatic grouping of related tasks (implemented by matrix C), the proposed model uses trace Lasso penalty instead of l1 norm as a regularization term. This penalty is adapted to the correlation of variables, so that the proposed model can adaptively learn grouping information and sparse relationships between tasks. In essence, the method proposed by the present invention is very different from other existing methods. When all tasks are unrelated, the model proposed by the present invention can be transformed into a multi-task learning model based on the regularization term of l1 norm. However, when there is correlation between some tasks, the proposed model can adaptively learn the weights of the linear combination of tasks, thereby grouping related tasks together. The feature of the present invention is to improve the generalization ability of all tasks by transferring knowledge between multiple tasks, thereby improving the effect of text classification.
[0090] The comparative experiments of text classification methods are as follows:
[0091] (1) His comparative experiment
[0092] The experiments are conducted on the public text dataset 20-newsgroup (20NG) (http: / / ana.cachopo.org / datasets-for-single-label-textcategorization).
[0093] In order to demonstrate the superiority of the present invention in text classification, the present method is compared with the classic methods SVM[1], CNN[2], and other new methods in the same field such as LSTM[3]. Since the connections between samples are not fully considered, it is difficult for other compared methods to capture more related information from different texts. This will lead to a decrease in the accuracy of text classification. To verify this, the accuracy of the present method and these text classification methods are compared in this experiment. The parameter settings in the comparison method are the same as those in the original literature. The experimental results are shown in Figure 2 (a).
[0094] Depend on Figure 2 (a) It can be seen that the method of the present invention (the method corresponding to the above steps 101-105 and steps 1041-1045) improves the accuracy of text classification more effectively than other methods, which means that the method of the present invention can classify text more effectively.
[0095] The references are:
[0096] [1]David D.Lewis,Yiming Yang,Tony G.Rose,Fan Li:RCV1:A New BenchmarkCollection for Text Categorization Research.Journal of Marchine LearningResearch,5:361-397(2004)
[0097] [2] LeCun, Yann, Bottou, Leon, Bengio, Yoshua, and Haffner, Patrick. Gradient-based learning applied to document recognition. In Proceedings of the IEEE, 86(11):2278-2324(1998).
[0098] [3]Rie Johnson,Tong Zhang:Supervised and Semi-Supervised TextCategorization using LSTM for Region Embeddings.ICML 2016:526-534
[0099] (2) Self-comparison experiment
[0100] In order to demonstrate the advantages of the multi-task learning method based on trace Lasso of the present invention, the self-comparison experiment with the closest multi-task learning method based on l1 or l2 norm is as follows:
[0101] The experiments are still conducted on the public text dataset 20-newsgroup (20NG) (http: / / ana.cachopo.org / datasets-for-single-label-textcategorization).
[0102] Since all data predictors {w i Therefore, the adaptation of the correlation between the weight parameters of different tasks by lasso can help the model represent each task with a set of related tasks, thereby improving the classification accuracy of the model.
[0103] Depend on Figure 2 (b) It can be seen that the multi-task learning method based on trace Lasso of the present invention (the method corresponding to the above steps 101-105 and steps 1041-1045) has obvious advantages over the multi-task learning method based on l1 or l2 norm in the prior art.
[0104] On the other hand, an embodiment of the present invention provides a text classification device based on multi-task learning, such as Figure 3 As shown, including:
[0105] An input module 11 is used to input a feature vector set of text data and its corresponding label value;
[0106] A segmentation module 12 is used to segment the entire text into a training data set and a test data set according to a certain ratio;
[0107] An allocation module 13 is used to determine the value of the number of tasks m and evenly allocate the samples of the training data set to the m tasks;
[0108] The solution module 14 is used to solve the following model to obtain a regression matrix W;
[0109]
[0110] Among them, the m tasks are Each task T i A set of training data D i ={(x ij ,y ij ),j=1,2,…,N i}composition, represents the jth input data in the i-th task, y ijIndicates its corresponding output; Represents the weight parameters of m tasks;
[0111] Assume that each task parameter is represented by a linear combination of other task parameters:
[0112]
[0113] in, is the correlation matrix between tasks, c i represents the i-th column in C, C ki w k and w i The relevance weight represents the relevance between task k and task i. It describes how much information in task k can be transferred to task i, thereby realizing the automatic grouping of related tasks.
[0114] in, represents the convex loss function of the i-th task, λ and γ are regularization parameters, W -i means there is no W in the i-th column, Represents the column vector c i There is no item i;
[0115] The regression module 15 is used to use the regression matrix W to regress the samples of the test data set and estimate the label estimation value of the test text, so as to complete the classification of the test text.
[0116] The device of this embodiment can be used to perform Figure 1 The technical solution of the method embodiment shown has similar implementation principles and technical effects, which will not be repeated here.
[0117] Preferably, the solution module 14 may include:
[0118] The first calculation subunit 141 is used to calculate the initial regression vector w of each task through the following optimization model: k
[0119]
[0120] in, represents the p-th sample in the k-th task, represents the label value of the pth sample in the kth task, n k represents the number of samples in the kth task;
[0121] An initialization subunit 142, used to initialize the correlation matrix C to a unit matrix;
[0122] The second calculation subunit 143 is used to fix W and rewrite the model Ω1 as follows:
[0123]
[0124]
[0125] The augmented Lagrangian of model Π1 is:
[0126]
[0127] And iteratively calculate C, J by the following formula i , and U i :
[0128]
[0129]
[0130]
[0131] Among them, + represents the iterative value of the corresponding variable, is the dual variable introduced in the form of a ratio;
[0132] The third calculation subunit 144 is used to fix C and rewrite the model Ω1 as follows:
[0133]
[0134]
[0135] The augmented Lagrangian of model Σ1 is:
[0136]
[0137] And iteratively calculate W, Z by the following formula i , and U i :
[0138]
[0139]
[0140]
[0141] Among them, + represents the iterative value of the corresponding variable;
[0142] The judgment subunit 145 is used to stop the iteration when the difference between the optimization variable values, i.e., the regression matrix W, obtained by the current and the next two iterations is less than a preset convergence threshold θ, and obtain the regression matrix W through the optimal solution of the above optimization model; otherwise, turn to the second calculation subunit 143 to continue the iteration.
[0143] An embodiment of the present invention further provides an electronic device, Figure 4 This is a schematic diagram of the structure of an embodiment of the electronic device of the present invention, which can implement the present invention. Figure 1 The process of the embodiment shown is as follows: Figure 4 As shown, the electronic device may include: a housing 41, a processor 42, a memory 43, a circuit board 44 and a power supply circuit 45, wherein the circuit board 44 is arranged inside the space enclosed by the housing 41, and the processor 42 and the memory 43 are arranged on the circuit board 44; the power supply circuit 45 is used to supply power to various circuits or devices of the electronic device; the memory 43 is used to store executable program codes; the processor 42 runs the program corresponding to the executable program code by reading the executable program code stored in the memory 43, so as to execute the method described in any of the aforementioned method embodiments.
[0144] For details on the specific execution process of the above steps by the processor 42 and the steps further executed by the processor 42 by running the executable program code, please refer to the present invention. Figure 1 The description of the illustrated embodiment will not be repeated here.
[0145] This electronic device exists in many forms, including but not limited to:
[0146] (1) Mobile communication devices: These devices are characterized by their mobile communication functions and their main purpose is to provide voice and data communications. These terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.
[0147] (2) Ultra-mobile personal computer devices: These devices fall into the category of personal computers, have computing and processing capabilities, and generally also have mobile Internet access features. These terminals include: PDA, MID and UMPC devices, such as iPad.
[0148] (3) Portable entertainment devices: These devices can display and play multimedia content. They include audio and video players (such as iPods), handheld game consoles, e-books, smart toys, and portable car navigation devices.
[0149] (4) Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.
[0150] (5) Other electronic devices with data interaction functions.
[0151] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any of the above method embodiments are implemented.
[0152] An embodiment of the present invention further provides an application program, which is executed to implement the method provided by any method embodiment of the present invention.
[0153] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A text classification method based on multi-task learning, characterized in that: include: Step 1: Input the feature vector set of text data and its corresponding label value; Step 2: Divide all text into training data set and test data set according to a certain ratio; Step 3: Determine the value of the number of tasks m and evenly distribute the samples of the training data set to m tasks; Step 4: Solve the following model to obtain the regression matrix W; Oh1: Among them, the m tasks are Each task T i A set of training data D i =((x ij ,y ij ), j = 1, 2, ..., N i }composition, represents the jth input data in the i-th task, y ij Indicates its corresponding output; Represents the weight parameters of m tasks; Assume that each task parameter is represented by a linear combination of other task parameters: in, is the correlation matrix between tasks, c i represents the i-th column in C, C ki w k and w i The relevance weight represents the relevance between task k and task i. It describes how much information in task k can be transferred to task i, thereby realizing the automatic grouping of related tasks. in, represents the convex loss function of the i-th task, λ and γ are regularization parameters, W -i means there is no W in the i-th column, Represents the column vector c i There is no item i; Step 5: Use the regression matrix W to regress the samples of the test data set and estimate the label estimation value of the test text, thereby completing the classification of the test text.
2. The method according to claim 1, characterized in that The step 4 comprises: Step 41: Calculate the initial regression vector w for each task through the following optimization model k in, represents the p-th sample in the k-th task, represents the label value of the pth sample in the kth task, n k represents the number of samples in the kth task; Step 42: Initialize the correlation matrix C to the identity matrix; Step 43: Fix W and rewrite the model Ω1 as: P1: The augmented Lagrangian of model Π1 is: And iteratively calculate C, J by the following formula i , and U i : Among them, + represents the iterative value of the corresponding variable, is the dual variable introduced in the form of a ratio; Step 44: Fix C and rewrite the model Ω1 as: ∑1: The augmented Lagrangian of model ∑1 is: And iteratively calculate W, Z by the following formula i , and U i : Among them, + represents the iterative value of the corresponding variable; Step 45: When the difference between the optimization variable values obtained by the two previous iterations, i.e., the regression matrix W, is less than the preset convergence threshold θ, the iteration is stopped, and the regression matrix W is obtained by the optimal solution of the above optimization model; otherwise, go to step 43 and continue the iteration.
3. A text classification device based on multi-task learning, characterized in that: include: An input module is used to input a feature vector set of text data and its corresponding label value; The segmentation module is used to segment all text into training data sets and test data sets according to a certain ratio; The allocation module is used to determine the value of the number of tasks m and evenly allocate the samples of the training data set to m tasks; The solution module is used to solve the following model and obtain the regression matrix W; Oh1: Among them, the m tasks are Each task T i A set of training data D i ={(x ij ,y ij ), j = 1, 2, ..., N i }composition, represents the jth input data in the i-th task, y ij Indicates its corresponding output; Represents the weight parameters of m tasks; Assume that each task parameter is represented by a linear combination of other task parameters: in, is the correlation matrix between tasks, c i represents the i-th column in C, C ki w k and w i The relevance weight represents the relevance between task k and task i. It describes how much information in task k can be transferred to task i, thereby realizing the automatic grouping of related tasks. in, represents the convex loss function of the i-th task, λ and γ are regularization parameters, W -i means there is no W in the i-th column, Represents the column vector c i There is no item i; The regression module is used to use the regression matrix W to regress the samples of the test data set and estimate the label estimation value of the test text, so as to complete the classification of the test text.
4. The device according to claim 3, characterized in that The solution module includes: The first computing subunit is used to calculate the initial regression vector w for each task through the following optimization model: k in, represents the p-th sample in the k-th task, represents the label value of the pth sample in the kth task, n k represents the number of samples in the kth task; An initialization subunit, used to initialize the correlation matrix C to a unit matrix; The second computing subunit is used to fix W and rewrite the model Ω1 as: ∏1: The augmented Lagrangian of model Π1 is: And iteratively calculate C, J by the following formula i , and U i : Among them, + represents the iterative value of the corresponding variable, is the dual variable introduced in the form of a ratio; The third calculation subunit is used to fix C and rewrite the model Ω1 as: ∑1: The augmented Lagrangian of model ∑1 is: And iteratively calculate W, Z by the following formula i , and U i : Among them, + represents the iterative value of the corresponding variable; The judgment subunit is used to stop the iteration when the difference between the optimization variable values, i.e., the regression matrix W, obtained by the current and the next two iterations is less than the preset convergence threshold θ, and obtain the regression matrix W through the optimal solution of the above optimization model; otherwise, it turns to the second calculation subunit to continue the iteration.
5. An electronic device, characterized in that: The electronic device comprises: a housing, a processor, a memory, a circuit board and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the housing, and the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program codes; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method described in any one of claims 1-2 above.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method described in any one of claims 1-2 above.
Citation Information
Patent Citations
Multitask machine learning method for text classification and device thereof
CN103678580A
Text classification method based on generative multi-task learning model
CN110347839A