Text classification method, and training method and device of deep learning model
By connecting the deep learning model's network and adjusting the loss function, the problems of large training data requirements and costly manual annotation in the field of medical aesthetics are solved, achieving efficient and accurate text information intent recognition and classification.
Patent Information
- Application Number
- CN202310275165.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-21
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-03-21
AI Technical Summary
In the field of medical aesthetics, the training of deep learning models requires a large amount of labeled data, and the labeling is labor-intensive, making it difficult to achieve automated and efficient text information intent recognition.
By using the first and second networks of the initial deep learning model in series, initial classification is performed first, and then a fusion vector is generated. The model parameters are adjusted by combining the loss function to achieve text classification from coarse-grained to fine-grained, thereby improving classification accuracy.
It achieves efficient and accurate text information intent recognition in the field of medical aesthetics, improves the classification accuracy and automation of the model, and reduces the need for manual annotation.
Smart Images

Figure CN116304047B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the fields of computer technology and data processing technology, and in particular to the fields of artificial intelligence and deep learning technology. Specifically, it relates to a text classification method, a training method for a deep learning model, an apparatus, a device, a storage medium, and a program product. Background Technology
[0002] With the development of artificial intelligence technology, deep learning, as a machine learning method in the field of artificial intelligence, can be applied to all aspects of production and life. For example, deep learning models can process text information. Summary of the Invention
[0003] This disclosure provides a text classification method, a training method for a deep learning model, an apparatus, a device, a storage medium, and a program product.
[0004] According to one aspect of this disclosure, a text classification method is provided, comprising: in response to receiving query text, determining an initial classification result of the query text; determining a fusion vector based on the initial classification result and the query text; and obtaining a target classification result of the query text based on the fusion vector.
[0005] According to another aspect of this disclosure, a method for training a deep learning model is provided, comprising: inputting text samples into a first network of an initial deep learning model to obtain an initial classification result of the text samples; determining a fusion vector based on the initial classification result and the text samples; inputting the fusion vector into a second network of the initial deep learning model to obtain a target classification result of the text samples, wherein the initial classification result includes the target classification result; determining a feedback value based on the target classification result and a loss function; and adjusting the model parameters of the initial deep learning model based on the feedback value to obtain a target deep learning model.
[0006] According to another aspect of this disclosure, a text classification apparatus is provided, comprising: an initial classification result first determining module, configured to determine an initial classification result of a query text in response to receiving query text; a fusion vector first determining module, configured to determine a fusion vector based on the initial classification result and the query text; and a target classification result first determining module, configured to obtain a target classification result of the query text based on the fusion vector.
[0007] According to another aspect of this disclosure, a deep learning model training apparatus is provided, comprising: a second initial classification result determination module, used to input text samples into a first network of an initial deep learning model to obtain an initial classification result for the text samples; a second fusion vector determination module, used to determine a fusion vector based on the initial classification result and the text samples; a second target classification result determination module, used to input the fusion vector into a second network of the initial deep learning model to obtain a target classification result for the text samples, wherein the initial classification result includes a target classification result; a feedback value determination module, used to determine a feedback value based on the target classification result and a loss function; and a target deep learning model determination module, used to adjust the model parameters of the initial deep learning model based on the feedback value to obtain a target deep learning model.
[0008] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor and a memory communicatively connected to the at least one processor. The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the methods of embodiments of this disclosure.
[0009] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions for causing a computer to perform the methods of embodiments of this disclosure.
[0010] According to another aspect of this disclosure, a computer program product is provided, including a computer program stored on at least one of a readable storage medium and an electronic device, wherein the computer program, when executed by a processor, implements the methods of embodiments of this disclosure.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0012] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0013] Figure 1 The diagram illustrates the system architecture of a text classification method, a deep learning model training method, and an apparatus according to embodiments of the present disclosure.
[0014] Figure 2 A flowchart illustrating a method for training a deep learning model according to an embodiment of the present disclosure is shown schematically.
[0015] Figure 3A schematic diagram illustrating a training method 300 for a deep learning model according to another embodiment of the present disclosure is shown.
[0016] Figure 4 A schematic diagram illustrating a text classification method according to an embodiment of the present disclosure is shown.
[0017] Figure 5 A schematic diagram illustrating a text classification method according to another embodiment of the present disclosure is shown.
[0018] Figure 6A The illustration shows a schematic diagram of the quantity ratio related to the displayed content for each initial classification result of the query text according to another embodiment of the present disclosure, when the initial classification result of the query text is sentiment polarity.
[0019] Figure 6B The illustration shows a diagram of popular topics related to the displayed content for each initial classification result of the query text according to another embodiment of the present disclosure, when the initial classification result of the query text is sentiment polarity.
[0020] Figure 6C The illustration shows a diagram illustrating the display of keywords related to the displayed content for each initial classification result according to yet another embodiment of the present disclosure;
[0021] Figure 7 A block diagram of a text classification apparatus according to an embodiment of the present disclosure is shown schematically;
[0022] Figure 8 A block diagram illustrating a training apparatus for a deep learning model according to an embodiment of the present disclosure is shown schematically; and
[0023] Figure 9 A schematic block diagram of an electronic device 900 that can be used to implement the text classification method and the deep learning model training method of the embodiments of the present disclosure is shown. Detailed Implementation
[0024] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0025] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0026] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0027] When using expressions such as "at least one of A, B, and C", they should generally be interpreted in accordance with the meaning that is commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B, and C, etc.).
[0028] With the development of artificial intelligence technology, deep learning, as a machine learning method in the field of artificial intelligence, can be applied to various aspects of production and life. For example, deep learning models can process text information. Specifically, deep learning models can classify text information. For instance, in the field of medical aesthetics, user-input text information (i.e., queries) can be classified to determine the user's intent.
[0029] In the field of medical aesthetics, for example, the text information entered by the user can be classified to determine the user's intent, which may represent the user's emotional category (emotional polarity).
[0030] Some implementations can perform intent recognition on text information based on rule templates, such as determining intent through direct matching of a vocabulary. For example, they can parse based on rule templates and then perform matching based on the parsing results to determine intent. However, this approach requires manual intervention due to operations such as word segmentation, part-of-speech tagging, named entity recognition, dependency parsing, and semantic analysis, making it difficult to automate and resulting in low efficiency.
[0031] Some implementations can rely on deep learning and machine learning for intent recognition of textual information. Examples include long short-term memory artificial neural networks with added attention mechanisms and deep learning models such as BERT (Bidirectional Encoder Representation from Transformer). For user-input text, the model calculates the probability of each intent category and determines the intent. However, deep learning and machine learning models require large amounts of labeled data. Especially in fields like medicine and cosmetic medicine, obtaining large amounts of labeled data for training deep learning and machine learning models is difficult. Furthermore, labeling samples also consumes significant human resources.
[0032] Figure 1 The illustration schematically depicts the system architecture of a text classification method, a deep learning model training method, and an apparatus according to an embodiment of the present disclosure. It should be noted that... Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.
[0033] like Figure 1 As shown, the system architecture 100 in this embodiment may include:
[0034] Terminal 101 for acquiring text samples, terminal 102 for training deep learning models, and terminal 103 for text classification processing.
[0035] In this embodiment of the disclosure, terminal 101 can be used to acquire a training set, which may include text samples. Terminal 102 can execute the training method of the corresponding deep learning model based on the text samples acquired by terminal 101 to train a target deep learning model. Terminal 103 can perform classification processing on the text to be classified based on the target deep learning model obtained by terminal 102, for example, it can determine the target classification result of the query text.
[0036] It should be noted that obtaining text samples, model training, and text classification, or any one or more of these can be done on the same terminal or on different terminals.
[0037] Terminal 101, Terminal 102 and Terminal 103 can be servers or server clusters.
[0038] It should be understood that Figure 1 The number of terminals 101, 102, and 103 is merely illustrative. Depending on implementation needs, there can be any number of terminals 101, 102, and 103.
[0039] It should be noted that the collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0040] In the technical solution disclosed herein, the user's authorization or consent is obtained before acquiring or collecting the user's personal information.
[0041] This disclosure provides a method for training a deep learning model, which will be described below in conjunction with... Figure 1 The system architecture, referencing Figures 2-5 This describes a training method for a deep learning model according to exemplary embodiments of the present disclosure. The training method for the deep learning model in embodiments of the present disclosure can, for example, be provided by... Figure 1 The terminal 102 shown is used to execute this.
[0042] Figure 2 A flowchart illustrating a method for training a deep learning model according to an embodiment of the present disclosure is shown.
[0043] like Figure 2 As shown, the deep learning model training method 200 of this embodiment may include, for example, operations S210 to S250.
[0044] In operation S210, the text sample is input into the first network of the initial deep learning model to obtain the initial classification result of the text sample.
[0045] A text sample can be understood as text information with a label, where the label represents the truth value of the text information.
[0046] For example, the initial deep learning model may include natural language processing models such as ERNIE and BERT. ERNIE stands for Enhanced Representation through Knowledge Integration. BERT stands for Bidirectional Encoder Representation from Transformer.
[0047] In operation S220, the fusion vector is determined based on the initial classification results and text samples.
[0048] For example, the initial classification result and the text sample can be vectorized separately, and then the vectorized initial classification result and the text sample can be concatenated to obtain a fused vector.
[0049] In operation S230, the fused vector is input into the second network of the initial deep learning model to obtain the target classification result of the text sample.
[0050] For example, the initial classification result includes the target classification result. It should be noted that "the initial classification result includes the target classification result" can be understood as the target classification result being a more granular classification result than the initial classification result. Therefore, the initial classification result can cover at least one target classification result, and thus it can be considered that the initial classification result includes the target classification result.
[0051] In operation S240, the feedback value is determined based on the target classification result and the loss function.
[0052] The loss function can be used to evaluate the degree of difference between the output of the initial deep learning model and the true value for any training text sample in the current training phase.
[0053] By operating the S250, the model parameters of the initial deep learning model are adjusted based on the feedback values to obtain the target deep learning model.
[0054] For example, the model parameters of the initial deep learning model may include, for instance, the weights and biases of the network layers of the deep learning model.
[0055] For example, the target deep learning model may be trained on a predetermined number of text samples. Alternatively, the target deep learning model may be an initial deep learning model with corresponding model parameters, provided the loss function converges.
[0056] According to the deep learning model training method of this disclosure, the input text sample is processed by the first network of the initial deep learning model to obtain the initial classification result of the text sample. This initial coarse-grained classification of the text sample yields the initial classification result. Then, by generating a fusion vector from the initial classification result and the text sample, both the initial classification result and the text sample are combined as input for the second fine-grained classification, facilitating accurate fine-grained classification results, i.e., the target classification result. The fusion vector is then input into the second network of the initial deep learning model to obtain the target classification result of the text sample. That is, through two cascaded first and second networks for classification, the initial classification result is obtained first, and then a finer-grained target classification result is obtained based on the initial classification result, resulting in a more accurate and precise output. The feedback value determined by the output result and the loss function can be fed back into the process of adjusting the model parameters of the deep learning model, realizing backpropagation, and the resulting target deep learning model has better performance.
[0057] Figure 3 A schematic diagram of a training method 300 for a deep learning model according to another embodiment of the present disclosure is shown.
[0058] exist Figure 3 The example also illustrates a specific instance of labeling the initial text according to a preset data labeling standard to obtain a text sample. The initial text may, for example, include historical query text entered by the user.
[0059] For example, the initial classification results may include positive categories, negative categories, and neutral categories.
[0060] The following explanation uses a medical aesthetics scenario as an example. In this scenario, the initial text can be categorized into three main categories based on sentiment: negative, positive, and neutral. Each main category can be further subdivided into multiple subcategories. For instance, the negative category could include subcategories such as negative evaluations exaggerating risks, negative recommendations, negative process, negative pricing, and questionable qualifications. These subcategories can represent the specific reasons for the main category corresponding to the initial text. These three main categories can be used as labels to annotate the initial text, resulting in intermediate samples with these main category labels. Similarly, multiple subcategories can be used as subcategory labels to annotate the intermediate samples, resulting in text samples. Subsequently, these text samples can be used to train an initial deep learning model. The resulting target deep learning model can be used for sentiment classification in medical aesthetics scenarios. The initial classification result can be obtained using the granularity corresponding to the main category, and the target classification result can be obtained using the granularity corresponding to the subcategories.
[0061] For example, in the field of medical aesthetics, the subcategory of negative reviews could include negative events related to medical aesthetics. The subcategory of exaggerated risks could include exaggerating the risks of medical aesthetic procedures. The subcategory of negative recommendations could include advising against medical aesthetic procedures. The subcategory of negative process could include poor experience during the medical aesthetic procedure or with the medical aesthetic product. The subcategory of negative pricing could include opaque pricing or high prices for medical aesthetic products. Corresponding to the negative categories, positive categories could include positive statements, explanations of advantages, positive recommendations, positive process, and positive pricing. Furthermore, the neutral category could include subcategories such as feasibility consultation, consulting agencies, product efficacy, product comparison, and inquiries.
[0062] According to the deep learning model training method of this disclosure, when labeling the initial text according to the preset data labeling standard, the labeling can be done manually, automatically, or by a combination of both methods.
[0063] exist Figure 3The examples also illustrate a specific instance of operation S310, where text sample 301 is input into the first network N1 of the initial deep learning model to obtain the initial classification result 302 of text sample 301. The examples also illustrate a specific instance of operation S320, where the fusion vector 303 is determined based on the initial classification result 302 and the text sample. The examples also illustrate a specific instance of operation S330, where the fusion vector 303 is input into the second network N2 of the initial deep learning model to obtain the target classification result 304 of the text sample. The examples also illustrate a specific instance of operation S340, where the feedback value 306 is determined based on the target classification result 304 and the loss function 305. Finally, the examples also illustrate a specific instance of operation S350, where the model parameters of the initial deep learning model are adjusted based on the feedback value 306 to obtain the target deep learning model 307.
[0064] For example, in a training method for a deep learning model according to another embodiment of the present disclosure, the loss function may include, for example, a first loss function and a second loss function; the feedback value is related to the first feedback value and the second feedback value.
[0065] For example, the following embodiment can be used to implement a specific example of determining a feedback value based on the target classification result and the loss function: Based on the target classification result, determine an initial classification result corresponding to the target classification result. Based on a first difference value between the initial classification result and a first loss function, determine a first feedback value. Based on a second difference value between the target classification result and a second loss function, determine a second feedback value. Based on the first feedback value and the second feedback value, determine the final feedback value.
[0066] It should be noted that the target classification result is a more granular classification result compared to the initial classification result. Therefore, the accuracy of the target classification result depends on the accuracy of the initial classification result. For example, a feedback value is obtained by weighting the first feedback value and the second feedback value. To improve the accuracy of the model's classification result, the weight of the first feedback value can be set to be greater than the weight of the second feedback value. This ensures the accuracy of the initial classification result obtained by the first network, thereby ensuring the accuracy of the target classification result.
[0067] According to the deep learning model training method of the present disclosure, the performance of the first network of the initial deep learning model can be evaluated using a first loss function, and the performance of the second network of the initial deep learning model can be evaluated using a second loss function. The accurate feedback values for adjusting the model parameters of the initial deep learning model can be determined based on the corresponding first and second feedback values, so that the initial deep learning model after model parameter adjustment can have better overall classification performance in obtaining the initial classification result in coarse-grained classification and the target classification result in fine-grained classification.
[0068] For example, the deep learning model training method according to the embodiments of this disclosure can also select a large model, such as the Wenxin large model, as the initial deep learning model for deep learning model training, which can adapt to various specific model application scenarios.
[0069] This disclosure provides a text classification method, which will be described below in conjunction with... Figure 1 The system architecture, referencing Figures 4-5 This describes a text classification method according to exemplary embodiments of the present disclosure. The text classification method of the embodiments of the present disclosure may, for example, be derived from... Figure 1 The terminal 103 shown is used to execute this.
[0070] Figure 4 A flowchart illustrating a text classification method according to an embodiment of the present disclosure is shown schematically.
[0071] like Figure 4 As shown, the text classification method 400 of this disclosure embodiment may include, for example, operations S410 to S430.
[0072] In operation S410, in response to receiving query text, the initial classification result of the query text is determined.
[0073] In operation S420, the fusion vector is determined based on the initial classification results and the query text.
[0074] In operation S430, the target classification result of the query text is obtained based on the fusion vector.
[0075] For example, the query text may include text data (i.e., query) input by the user. The query text is input into a first network of a pre-trained target deep learning model, and the output is an initial classification result of the query text, which represents the category of the query text.
[0076] For example, the initial classification result may characterize the sentiment category (i.e., sentiment polarity) of the query text, and the initial classification result may include positive category, negative category and neutral category.
[0077] For example, the initial classification result obtained from operation S410 can be converted into a fusion vector with the query text, and the fusion vector can be input into the second network of the pre-trained target deep learning model. The input result is the target classification result of the query text.
[0078] It should be noted that the text classification method of this disclosure can input a single query text into the target deep learning model, or it can input multiple query texts within a preset time period into the target deep learning model to obtain the target classification result of the query text. The target deep learning model is trained according to the training method of the deep learning model in the above embodiments. The process of training the target deep learning model based on the initial deep learning model has been described in detail in the above embodiments and will not be repeated here. Since the target deep learning model includes a first network and a second network for classification connected in series, the text classification method according to this disclosure can perform an initial coarse-grained classification and a second fine-grained classification on the query text, resulting in a more accurate target classification result with finer granularity. This can accurately identify the user's query intent and sentiment category, which is beneficial for assisting the user's decision-making.
[0079] For example, a text classification method according to another embodiment of this disclosure may further include the following operations: determining display content matching the query text from a retrieval database based on the classification results of the query text; and displaying the display content.
[0080] For example, the classification result may include at least one of the initial classification result and the target classification result.
[0081] In one example, after obtaining the classification results of the query text, the search library can be used to determine the display content that matches the query text. The search library can be pre-built, for example. In a scenario involving sentiment category classification, the search library could include content entities representing different sentiment categories.
[0082] For example, the content to be displayed can be determined based on at least one of the initial classification result and the target classification result, to provide a specific example of determining the content to be displayed based on the classification result. For example, display content related to the query text can be matched in the search database based on at least one of the classification results.
[0083] According to embodiments of this disclosure, when performing retrieval matching based on initial classification results and target classification results, the matching efficiency is higher and the results are more accurate.
[0084] Figure 5 A flowchart illustrating a text classification method according to another embodiment of this disclosure is shown schematically.
[0085] like Figure 5As shown, for example, the following embodiment can be used to determine the display content matching the query text from the retrieval library based on the classification results of the query text: In operation S551, for multiple query texts within a preset time period, each query text is vectorized to obtain multiple query text vectors. In operation S552, the multiple query text vectors are clustered to obtain query text vector clusters. In operation S553, based on the page views corresponding to the query text vector clusters, the target query vector corresponding to each initial classification result is determined. In operation S554, the similarity between the target query vector and the candidate text vectors in the retrieval library is calculated to determine the display content corresponding to each initial classification result.
[0086] For example, the initial classification results include positive categories, negative categories, and neutral categories.
[0087] In one example, multiple query texts within a preset time period can be retrieved. This time period could be within a day, a week, or a month, etc. These query texts can come from different users. Due to differences in language habits among users, different query texts may represent the same semantics. Therefore, to improve the efficiency and accuracy of query text classification, the retrieved query texts can be clustered. Specifically, for example, multiple query texts can be vectorized separately, and the vectors of multiple query texts can be clustered to obtain one or more query text vector clusters. The target query vector corresponding to each initial classification result is determined based on the page views corresponding to the query text vector cluster. For example, the top ten query text vector clusters by page views are identified, and then the target query vector is determined. The similarity between the target query vector and the candidate text vectors in the search database is calculated to determine the display content corresponding to each initial classification result.
[0088] For example, according to another embodiment of the text classification method of this disclosure, the specific example of displaying the content can be implemented using the following embodiments: for each initial classification result, at least one of the following is displayed: the quantity ratio related to the content, popular topics, and keywords.
[0089] For example, taking the medical aesthetics scenario, keywords can include medical aesthetic procedures and related descriptive terms for each procedure. For instance, taking "hyaluronic acid" as an example, related descriptive terms could include "nasolabial folds," "chin," "dark circles," "benefits," "removing dark circles," "anti-aging," "swelling," and "lumps." Positive descriptive terms could include "benefits," "removing dark circles," and "anti-aging." Neutral descriptive terms could include "nasolabial folds," "chin," and "dark circles." Negative descriptive terms could include "swelling" and "lumps."
[0090] Figure 6AThis illustration schematically depicts the proportion of quantities related to the displayed content for each initial classification result when the initial classification result of the query text according to another embodiment of this disclosure is a sentiment category. In one example, the initial classification result of the query text is determined according to the text classification method provided in this embodiment of the disclosure, and a proportion of quantities related to the displayed content can be displayed for each initial classification result. The displayed content may include, for example, a trending topic, and the proportion of quantities related to the displayed content may include, for example, the number of views on the trending topic and the proportion of sentiment categories. For example, in the field of medical aesthetics, taking hyaluronic acid as a trending topic of interest, as an example... Figure 6A As shown, this illustration schematically shows how the popularity of the trending term "hyaluronic acid" changes over time, as well as the proportion of sentiment categories for this keyword, such as 0.2% positive, 93.2% neutral, and 6.6% negative.
[0091] Figure 6B This illustration schematically shows a scenario where, according to another embodiment of this disclosure, the initial classification result of the query text is a sentiment category, and for each initial classification result, trending topics related to the displayed content are shown. For example... Figure 6B As shown, for example, taking the trending topic of "hyaluronic acid" as an example, topics of different emotional categories can be displayed to attract user interest. For instance, popular topics of different emotional categories can be sorted and displayed based on page views, popularity, or query frequency.
[0092] Figure 6C This illustration schematically shows a diagram of keywords related to the displayed content for each initial classification result, according to yet another embodiment of this disclosure. For example... Figure 6C As shown, the descriptive terms related to keyword A include positive, negative, and neutral categories.
[0093] The text method provided in this disclosure categorizes user-input query samples and determines the content to be displayed based on the categorization results. This allows for the presentation of fine-grained, relevant, high-quality information to users, assisting them in decision-making, attracting their interest, and improving their user experience. For example, this high-quality information may include information related to the field of medical aesthetics.
[0094] Figure 7 A block diagram of a text classification apparatus according to an embodiment of the present disclosure is shown schematically.
[0095] like Figure 7 As shown, the text classification device 700 of this embodiment includes, for example, an initial classification result first determination 710, a fusion vector first determination module 720, and a target classification result first determination module 730.
[0096] The initial classification result determination module 710 is used to determine the initial classification result of the query text in response to receiving the query text.
[0097] The first fusion vector determination module 720 is used to determine the fusion vector based on the initial classification results and the query text.
[0098] The first target classification result determination module 730 is used to obtain the target classification result of the query text based on the fusion vector.
[0099] For example, the text classification device 700 also includes a content determination module and a display module.
[0100] The content display determination module is used to determine the display content that matches the query text from the retrieval database based on the classification results of the query text. The classification results include at least one of the initial classification results and the target classification results.
[0101] The display module is used to showcase the content.
[0102] For example, the content determination module includes: a query text vector generation submodule, used to vectorize each query text within a preset time period to obtain multiple query text vectors; a query text vector cluster generation submodule, used to cluster the multiple query text vectors to obtain query text vector clusters; a target query vector determination submodule, used to determine the target query vector corresponding to each initial classification result based on the pageview volume corresponding to the query text vector cluster; and a content determination submodule, used to calculate the similarity between the target query vector and candidate text vectors in the retrieval database to determine the content to be displayed for each initial classification result.
[0103] For example, the display module includes a display submodule for displaying at least one of the following for each initial classification result: the proportion of quantity related to the displayed content, popular topics, and keywords.
[0104] Figure 8 A block diagram of a training apparatus for a deep learning model according to an embodiment of the present disclosure is shown schematically.
[0105] like Figure 8 As shown, the deep learning model training device 800 of this embodiment includes, for example, an initial classification result second determination module 810, a fusion vector second determination module 820, a target classification result second determination module 830, a feedback value determination module 840, and a target deep learning model determination module 850.
[0106] The second determination module 810 for initial classification results is used to input text samples into the first network of the initial deep learning model to obtain the initial classification results of the text samples.
[0107] The second fusion vector determination module 820 is used to determine the fusion vector based on the initial classification results and text samples.
[0108] The second target classification result determination module 830 is used to input the fused vector into the second network of the initial deep learning model to obtain the target classification result of the text sample, wherein the initial classification result includes the target classification result.
[0109] The feedback value determination module 840 is used to determine the feedback value based on the target classification result and the loss function.
[0110] The target deep learning model determination module 850 is used to adjust the model parameters of the initial deep learning model based on the feedback values to obtain the target deep learning model.
[0111] For example, the loss function includes a first loss function and a second loss function; the feedback value is related to the first feedback value and the second feedback value.
[0112] For example, the feedback value determination module includes: an initial classification result determination submodule, used to determine an initial classification result corresponding to the target classification result based on the target classification result; a first feedback value determination submodule, used to determine a first feedback value based on a first difference value between the initial classification result and a first loss function; a second feedback value determination submodule, used to determine a second feedback value based on a second difference value between the target classification result and a second loss function; and a feedback value determination submodule, used to determine a feedback value based on the first feedback value and the second feedback value.
[0113] For example, the initial classification results include positive categories, negative categories, and neutral categories.
[0114] It should be understood that the embodiments of the apparatus portion of this disclosure correspond to the same or similar embodiments of the method portion of this disclosure, and the technical problems solved and the technical effects achieved are also the same or similar. This disclosure will not repeat them here.
[0115] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0116] Figure 9A schematic block diagram of an electronic device 900 that can be used to implement the text classification method of embodiments of the present disclosure is illustrated. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0117] like Figure 9 As shown, device 900 includes a computing unit 901, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 902 or a computer program loaded into random access memory (RAM) 903 from storage unit 908. RAM 903 may also store various programs and data required for the operation of device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via bus 904. Input / output (I / O) interface 905 is also connected to bus 904.
[0118] Multiple components in device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of monitors, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0119] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as text classification methods. For example, in some embodiments, the text classification method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by the computing unit 901, one or more steps of the text classification method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the text classification method by any other suitable means (e.g., by means of firmware).
[0120] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0121] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0122] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0123] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0124] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0125] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
[0126] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0127] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A deep learning model training method, comprising: The text sample is input into the first network of the initial deep learning model to obtain the initial classification result of the text sample; Based on the initial classification result and the text sample, a fusion vector is determined, wherein the text sample is text information with labels; The fusion vector is input into the second network of the initial deep learning model to obtain the target classification result of the text sample. The initial classification result includes the target classification result. The initial classification result is obtained by classifying at the granularity corresponding to the major category, and the target classification result is obtained by classifying at the granularity corresponding to the minor category. Based on the target classification result, determine the initial classification result corresponding to the target classification result; The first feedback value is determined based on the first difference value between the initial classification result and the first loss function; The second feedback value is determined based on the second difference value between the target classification result and the second loss function; The first feedback value and the second feedback value are weighted to obtain a feedback value, wherein the weight of the first feedback value is greater than the weight of the second feedback value; and Based on the feedback values, the model parameters of the initial deep learning model are adjusted to obtain the target deep learning model.
2. The method according to claim 1, wherein, The initial classification results include positive, negative, and neutral categories.
3. A text classification method, comprising: In response to receiving query text, the query text is input into the first network of the target deep learning model to determine the initial classification result of the query text; Based on the initial classification result and the query text, determine the fusion vector; as well as The fused vector is input into the second network of the target deep learning model to obtain the target classification result of the query text. The target deep learning model is obtained by the deep learning model training method according to claim 1 or 2.
4. The method according to claim 3, further comprising: Based on the classification results of the query text, display content matching the query text is determined from the retrieval database, wherein the classification results include at least one of the initial classification results and the target classification results; and The content to be displayed is shown.
5. The method according to claim 4, wherein, The initial classification results include positive, negative, and neutral categories; determining the display content matching the query text from the retrieval database based on the classification results of the query text includes: For multiple query texts within a preset time period, each query text is vectorized to obtain multiple query text vectors; Cluster the multiple query text vectors to obtain query text vector clusters; Based on the pageview count corresponding to the query text vector clusters, determine the target query vector corresponding to each initial classification result; and The similarity between the target query vector and the candidate text vectors in the retrieval database is calculated to determine the display content corresponding to each initial classification result.
6. The method according to claim 5, wherein, The content to be displayed includes: For each of the initial classification results, at least one of the following is displayed: the proportion of quantities related to the displayed content, popular topics, and keywords.
7. A training device for a deep learning model, comprising: The initial classification result second determination module is used to input the text sample into the first network of the initial deep learning model to obtain the initial classification result of the text sample; The second fusion vector determination module is used to determine the fusion vector based on the initial classification result and the text sample, wherein the text sample is text information with labels; The second target classification result determination module is used to input the fusion vector into the second network of the initial deep learning model to obtain the target classification result of the text sample, wherein the initial classification result includes the target classification result; The initial classification result determination submodule is used to determine the initial classification result corresponding to the target classification result based on the target classification result. The initial classification result is obtained by classifying at the granularity corresponding to the major category, and the target classification result is obtained by classifying at the granularity corresponding to the minor category. The first feedback value determination submodule is used to determine the first feedback value based on the first difference value between the initial classification result and the first loss function; The second feedback value determination submodule is used to determine the second feedback value based on the second difference value between the target classification result and the second loss function; and A feedback value determination submodule is used to determine the feedback value based on the first feedback value and the second feedback value, wherein the weight of the first feedback value is greater than the weight of the second feedback value; and The target deep learning model determination module is used to adjust the model parameters of the initial deep learning model based on the feedback values to obtain the target deep learning model.
8. The apparatus according to claim 7, wherein, The initial classification results include positive, negative, and neutral categories.
9. A text classification device, comprising: The initial classification result first determination module is used to, in response to receiving query text, input the query text into the first network of the target deep learning model to determine the initial classification result of the query text; The first module for determining the fusion vector is used to determine the fusion vector based on the initial classification result and the query text. as well as The first target classification result determination module is used to input the fused vector into the second network of the target deep learning model to obtain the target classification result of the query text. The target deep learning model is obtained by the deep learning model training apparatus according to claim 7 or 8.
10. The apparatus according to claim 9, wherein, Also includes: The content display determination module is used to determine the display content that matches the query text from the retrieval library based on the classification results of the query text, wherein the classification results include at least one of the initial classification results and the target classification results; as well as The display module is used to display the content.
11. The apparatus according to claim 10, wherein, The initial classification results include positive categories, negative categories, and neutral categories; The content determination module includes: The query text vector generation submodule is used to vectorize each of the multiple query texts within a preset time period to obtain multiple query text vectors. The query text vector cluster generation submodule is used to cluster the multiple query text vectors to obtain query text vector clusters; The target query vector determination submodule is used to determine the target query vector corresponding to each initial classification result based on the pageview volume corresponding to the query text vector cluster; and The content determination submodule is used to calculate the similarity between the target query vector and the candidate text vectors in the retrieval database, and determine the content to be displayed for each initial classification result.
12. The apparatus according to claim 11, wherein, The display module includes: The display submodule is used to display at least one of the following for each of the initial classification results: the quantity ratio related to the displayed content, popular topics, and keywords.
13. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.
15. A computer program product comprising a computer program stored on at least one of a readable storage medium and an electronic device, the computer program implementing the method according to any one of claims 1-6 when executed by a processor.
Citation Information
Patent Citations
Text classification model building and text classification methods and apparatuses
CN107908635A
Text classification method and device, computer equipment and storage medium
CN111309912A
Text processing method and synonymous text recall method and device
CN112925912A
