A text classification model determination method, system and storage medium
By optimizing the hyperparameters within the experimental range, the target hyperparameters are determined, solving the problem of low efficiency in hyperparameter optimization of support vector machines and achieving high efficiency and accuracy in text classification models.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE CHENGDU INFORMATION & TELECOMM TECH CO LTD
- Filing Date
- 2021-09-01
- Publication Date
- 2026-04-21
AI Technical Summary
Existing hyperparameter optimization methods for support vector machines have limitations in terms of optimization accuracy and efficiency, making it difficult to find the global optimal solution quickly and accurately.
By optimizing the hyperparameters within an experimental region formed by at least two ranges of hyperparameter values, the target hyperparameters are determined, and the hyperparameters of the text classification model to be trained are updated to form the target text classification model.
It improves the determination efficiency and accuracy of text classification models, enabling faster and more accurate finding of hyperparameter optimization values, and achieving more accurate text classification.
Smart Images

Figure CN115759074B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, system and storage medium for determining a text classification model. Background Technology
[0002] In related technologies, question-answering systems typically classify text when analyzing it, with common classification methods including support vector machines. However, the hyperparameter optimization methods for support vector machines in related technologies have certain limitations in terms of optimization accuracy and efficiency. Summary of the Invention
[0003] To address the aforementioned technical problems, embodiments of this application provide a method, system, and storage medium for determining a text classification model. By employing experimental methods within a first experimental region formed by the value ranges of at least two types of hyperparameters, at least two types of hyperparameters are optimized to obtain second target hyperparameters. Subsequently, the hyperparameters of the text classification model to be trained are updated to the second target hyperparameters to obtain the target text classification model. This improves the efficiency of determining the target text classification model.
[0004] To achieve the above objectives, the technical solution of this application is implemented as follows:
[0005] This application provides a method for determining a text classification model, the method comprising:
[0006] Based on the first number of experiments and at least two classes of hyperparameters of the text classification model to be trained, a first hyperparameter set including multiple first hyperparameters is determined.
[0007] By employing different first hyperparameters to train text classification models, the classification results of sample text data are determined, resulting in multiple classification results;
[0008] Based on the accuracy of the multiple classification results, a first target hyperparameter is determined in the first hyperparameter set;
[0009] Based on the first experimental region of the at least two types of hyperparameters and the first target hyperparameter, the second target hyperparameter is determined;
[0010] The hyperparameters of the text classification model to be trained are updated to the second target hyperparameters to obtain the target text classification model.
[0011] This application provides a text classification method, the method comprising:
[0012] Get the text to be categorized;
[0013] The text to be classified is input into a trained target text classification model to obtain the classification result of the text to be classified; wherein, the target text classification model is determined by the above-described text classification model determination method;
[0014] Output the classification result of the text to be classified.
[0015] This application provides a text classification system, including: a processor, a memory, and a communication bus; wherein, the communication bus is used to realize the communication connection between the processor and the memory;
[0016] The processor is used to execute the program in the memory to implement the text classification model determination method as described above, or to implement the text classification method as described above.
[0017] This application provides a computer storage medium storing one or more programs, which can be executed by one or more processors to implement the method described above, or to implement the text classification method described above.
[0018] This application provides a method, system, and storage medium for determining a text classification model. First, based on a first number of experiments and at least two classes of hyperparameters of the text classification model to be trained, a first set of hyperparameters, including multiple first hyperparameters, is determined. Using text classification models to be trained with different first hyperparameters, the classification results of sample text data are determined respectively, resulting in multiple classification results. Based on the accuracy of the multiple classification results, a first target hyperparameter is determined from the first set of hyperparameters. Based on the first experimental region of the at least two classes of hyperparameters and the first target hyperparameter, a second target hyperparameter is determined. The hyperparameters of the text classification model to be trained are updated to the second target hyperparameter, resulting in a target text classification model. Second, the target text classification model is trained using sample text data, resulting in a trained target text classification model. Finally, the text to be classified is obtained; the text to be classified is input into the trained target text classification model to obtain the classification result of the text to be classified; and the classification result of the text to be classified is output. In this way, the optimized values of hyperparameters can be found more quickly and accurately, resulting in a target text classification model that achieves more accurate classification. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating a text classification model determination method according to an embodiment of this application;
[0020] Figure 2 This is a flowchart illustrating a text classification model determination method according to an embodiment of this application;
[0021] Figure 3A flowchart illustrating a text classification method provided in an embodiment of this application;
[0022] Figure 4 A flowchart illustrating a text classification model determination method provided in this application embodiment;
[0023] Figure 5 A structural diagram of a text classification model determination device provided in an embodiment of this application;
[0024] Figure 6 A structural diagram of a text classification device provided in an embodiment of this application;
[0025] Figure 7 This is a structural diagram of a text classification system provided in an embodiment of this application. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the specific technical solutions of the invention will be further described in detail below with reference to the accompanying drawings of the embodiments of this application. The following embodiments are used to illustrate this application, but are not intended to limit the scope of this application.
[0027] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0028] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0030] The following describes an exemplary application of the text classification model determination system provided in the embodiments of this application. The terminal in the system provided in the embodiments of this application can be implemented as various types of electronic devices such as laptops, tablets, desktop computers, and mobile devices (e.g., personal digital assistants, dedicated messaging devices, portable gaming devices) with data processing capabilities.
[0031] This application provides a method for determining a text classification model, such as... Figure 1 As shown, combined with Figure 1 The steps shown are explained below:
[0032] Step S101: Based on the first number of experiments and at least two types of hyperparameters of the text classification model to be trained, determine a first hyperparameter set including multiple first hyperparameters.
[0033] In some embodiments, the number of first experiments can be determined based on the size of the first experimental region. The number of first experiments can be understood as the number of experiments in the first experiment. Generally, the number of first experiments can be relatively large to increase the probability of obtaining the global optimum; in subsequent experiments, as the experimental region gradually decreases, the number of experiments can be relatively small to reduce computational complexity.
[0034] In some embodiments, hyperparameters can be hyperparameters in the text classification model to be trained. Determining the hyperparameters in the text classification model to be trained means determining the text classification model to be trained.
[0035] In some embodiments, hyperparameters interact with each other and jointly determine the performance of the text classification model being trained. Hyperparameters can take several different levels within their value range. Several different level combinations can be formed between the levels of at least two classes of hyperparameters. The first set of hyperparameters can be several level combinations representative of the first experimental region.
[0036] Step S102: Using different first hyperparameters, the classification results of the sample text data are determined to obtain multiple classification results.
[0037] In some embodiments, the first hyperparameters (i.e., level combinations) in the first hyperparameter set are used to sequentially set the text classification model to be trained, resulting in text classification models to be trained with different first hyperparameters; the text classification models to be trained with different first hyperparameters are used to classify the sample text data respectively, resulting in different classification results of the text classification model to be trained under different first hyperparameters; that is, the text classification model to be trained classifies the sample text data respectively under different first hyperparameters, resulting in different classification results of the text classification model to be trained under different first hyperparameters, i.e., multiple classification results.
[0038] Step S103: Based on the accuracy of the multiple classification results, determine the first target hyperparameter in the first hyperparameter set.
[0039] In some embodiments, the different classification results of the text classification model to be trained on the sample text data under different first hyperparameters are compared with the labels of the sample text data to determine whether the classification result of the sample text data is correct; then, the classification accuracy of the text classification model to be trained under different first hyperparameters is calculated based on the judgment result; finally, the first hyperparameter set when the classification accuracy of the text classification model to be trained is higher than a preset threshold is determined as the first target hyperparameter.
[0040] Step S104: Determine the second target hyperparameter based on the first experimental region of the at least two types of hyperparameters and the first target hyperparameter.
[0041] In some embodiments, based on a first target hyperparameter, a first experimental region of at least two types of hyperparameters is adjusted to obtain a second experimental region; in the second experimental region, a second target hyperparameter is determined; wherein, the second experimental region is a portion of the first experimental region (i.e., the initial experimental region).
[0042] Step S105: Update the hyperparameters of the text classification model to be trained to the second target hyperparameters to obtain the target text classification model.
[0043] In some embodiments, a first experiment is conducted based on a first experimental region to obtain a target first hyperparameter; based on the first target hyperparameter, the first experimental region is adjusted to obtain a second experimental region; a second experiment is conducted based on the second experimental region, and so on, until a second target hyperparameter that meets the conditions is obtained; the hyperparameters of the text classification model to be trained are updated with the second target hyperparameter to obtain the target text classification model. Here, the iteration stops when the cutoff condition is met, and the experimental result of the last experiment is output as the second target hyperparameter.
[0044] In this embodiment, based on the first number of experiments and at least two types of hyperparameters of the text classification model to be trained, a first set of hyperparameters, including multiple first hyperparameters, is determined. This allows for the rapid determination of a representative first set of hyperparameters within the value range of at least two types of hyperparameters. Using text classification models to be trained with different first hyperparameters, the classification results of the sample text data are determined, resulting in multiple classification results. Based on the accuracy of the multiple classification results, a first target hyperparameter is determined from the first set of hyperparameters. This allows for the determination of a better first target hyperparameter from the representative first set of hyperparameters. Based on the first experimental region of the at least two types of hyperparameters and the first target hyperparameter, a second target hyperparameter is determined. After meeting the experimental cutoff conditions, the experimental results are output, and these results are used as the second target hyperparameter. This allows for the rapid finding of a second target hyperparameter that meets the conditions in the second experimental region. The hyperparameters of the text classification model to be trained are updated to the second hyperparameter, resulting in a target text classification model. This allows for faster and more accurate finding of optimized hyperparameter values, leading to a more accurate target text classification model.
[0045] In some embodiments, the first target parameter is actually a representative experimental point determined in the first experimental region; that is, step S101 includes the following steps, such as Figure 2 As shown, combined with Figure 2 The steps shown are explained below:
[0046] Step S201: Determine the first experimental region based on the value range of each type of hyperparameter;
[0047] In some embodiments, the first experimental region may be determined based on the value range of each of at least two classes of hyperparameters; for example, there are two classes of hyperparameters. and Among them, hyperparameters The range of values is hyperparameters The range of values is The experimental area is .
[0048] In some possible implementations, a two-dimensional coordinate system is established based on two types of hyperparameters; where the horizontal axis represents the hyperparameters. The vertical axis represents the hyperparameters. Therefore, the first experimental region is the hyperparameter region. Range of values on the horizontal axis , and hyperparameters The range of values on the ordinate The enclosed area. Correspondingly, three types of hyperparameters can construct a three-dimensional coordinate system, and multiple types of hyperparameters can construct a multi-dimensional coordinate system, which will not be elaborated here.
[0049] Step S202: Determine the target matrix based on the first number of experiments and the number of categories of the hyperparameters.
[0050] In some embodiments, the target matrix can be a uniform design that meets certain conditions in a uniform design constructed using the good lattice point method. Several different levels of hyperparameters are numbered to obtain level indices. The uniform design can include level indices for at least two types of parameters, with each type of hyperparameter occupying a separate column.
[0051] In some embodiments, step S202 can be implemented by the following steps S221 to S224:
[0052] Step S221: Determine the set of positive integers less than the number of the first experiment.
[0053] In some embodiments, a set of positive integers less than the first number of experiments is determined based on the first number of experiments and the number of factors (in this embodiment, the experimental factors are at least two types of hyperparameters, therefore, the number of factors is the number of categories of at least two types of hyperparameters); as shown in formula (1):
[0054] (1);
[0055] in, This is the first experiment number. The number of categories is a hyperparameter. It is less than positive integers, and Coprime, and In the model They are different in meaning.
[0056] Step S222: Based on each positive integer in the set of positive integers, generate a U-shaped matrix that includes some hyperparameters from the first experimental region.
[0057] In some embodiments, for each positive integer in the set of positive integers, a U-shaped matrix is generated using congruence operations. In other words, for each positive integer... A U-shaped matrix is generated using congruence operations. ;in, , , In other words, each U-shaped matrix is... OK A matrix of columns; each column represents a class of hyperparameters, and each column consists of 1, 2, ... , A rearrangement of natural numbers: 1, 2, ... , The natural numbers can be understood as level indices of hyperparameters, with each level indice corresponding to a level of the hyperparameter. Therefore, each row represents a level combination of at least two types of hyperparameters.
[0058] In some embodiments, the number of experiments in the U-shaped matrix is equal to the number of levels. The U-shaped matrix represents... The experiment required At least two levels of hyperparameter combinations; that is, at least two levels of hyperparameter combinations in the first experimental region.
[0059] Step S223: Determine the mixing deviation of the U-shaped matrix corresponding to each positive integer.
[0060] In some embodiments, the mixing bias of the U-shaped matrix corresponding to each positive integer is calculated. Since the mixing bias overcomes the shortcomings of the centering bias and the rollability bias, it is more effective for determining uniformity.
[0061] Step S224: The U-shaped matrix with a mixing deviation less than a first preset threshold is taken as the target matrix.
[0062] In some embodiments, a smaller mixing deviation indicates better uniformity of the U-shaped matrix. Therefore, selecting a U-shaped matrix with a smaller mixing deviation as the target matrix can cover more globally representative level combinations, which is beneficial for global optimization of level combinations.
[0063] Step S203: Based on the target matrix, determine the first hyperparameter set in the first experimental region.
[0064] In some embodiments, based on the target matrix, the level indices corresponding to the level indices are replaced in the target matrix to obtain the level combinations of at least two types of hyperparameters to be used in each experiment of the first number of experiments. Since the level combinations in the target matrix are some experimental points in the first experimental region, the first set of hyperparameters obtained based on the target matrix is actually a partial set of experimental points in the first experimental region. In other words, the above process is actually equivalent to transforming the value ranges of at least two types of hyperparameters into the first experimental region, and using experimental methods to optimize the experimental points in the first experimental region to obtain representative experimental points.
[0065] In this embodiment of the application, for the first experimental region formed by the range of hyperparameter values, a uniform design is constructed using the good grid point method to optimize the first experimental region and obtain a better set of first hyperparameters; in this way, a representative set of first hyperparameters can be quickly determined within the range of values of at least two types of hyperparameters.
[0066] In some embodiments, in order to determine a better first target hyperparameter from the first hyperparameter set, the above step S103 can be implemented by the following steps S131 and S132:
[0067] Step S131: Among the multiple classification results, the classification result with an accuracy rate greater than the second preset threshold is determined as the target classification result.
[0068] In some embodiments, the above steps can be implemented through the following process: First, the different classification results of the text classification model to be trained under different first hyperparameters are compared with the labels of the sample text dataset to determine whether the classification results are correct; second, based on the judgment results, the classification accuracy of the text classification model to be trained under different first hyperparameters for classifying the sample text dataset is calculated; finally, the classification results corresponding to the accuracy of the classification results that are greater than the second preset threshold are determined as the target classification results.
[0069] In some embodiments, the number of samples included in the sample dataset determines the number of sub-classification results for each classification result. Therefore, the accuracy of each classification result is actually based on the number of correct sub-classification results among the sub-classification results. For example, if the sample dataset includes 1000 samples and the second preset threshold is 98%, when the hyperparameter of the text classification model to be trained is set to the first hyperparameter 1, 970 out of the 1000 sub-classification results in classification result 1 are correct, then the accuracy of classification result 1 is 97%. When the hyperparameter of the text classification model to be trained is set to the first hyperparameter 2, 995 out of the 1000 sub-classification results in classification result 2 are correct, then the accuracy of classification result 2 is 99.5%. When the hyperparameter of the text classification model to be trained is set to the first hyperparameter 3, 990 out of the 1000 sub-classification results in classification result 3 are correct, then the accuracy of classification result 3 is 99%. Then, classification result 2 and classification result 3 are determined as the target classification results.
[0070] In some embodiments, the sample text dataset may be a collection of labeled sample text data that can be used to train a text classification model.
[0071] Step S132: Determine the first hyperparameter corresponding to the target classification result as the first target hyperparameter.
[0072] In some embodiments, the first hyperparameter set by the text classification model to be trained corresponding to the target classification result is determined as the first target hyperparameter; for example, the first hyperparameter 2 corresponding to the above classification result 2 and the first hyperparameter 3 corresponding to the classification result 3 are determined as the first target hyperparameter.
[0073] In this embodiment, the first hyperparameters in the first hyperparameter set are used to sequentially set the text classification model to be trained. Based on the classification results of the text classification model to be trained under different first hyperparameters, a better first target hyperparameter is determined from the first hyperparameter set. In this way, a better first target hyperparameter can be determined from a representative first hyperparameter set.
[0074] In some embodiments, when conducting the next experiment, the experimental area for the next experiment is needed, and the experiment is performed in the experimental area of the next experiment in order to find a better experimental point; that is, the above step S104 can be achieved by the following steps S141 and S142:
[0075] Step S141: Determine the second experimental region based on the first experimental region and the first target hyperparameter.
[0076] In some embodiments, the experimental region (second experimental region) for this experiment is determined based on the first experimental region and the first target hyperparameter. The second experimental region includes fewer hyperparameters than the first experimental region.
[0077] In some embodiments, the text classification model to be trained may include a support vector machine; at least two types of hyperparameters may include kernel function parameters and a penalty factor. Therefore, determining the kernel function parameters and the penalty factor determines the support vector machine model; that is, step S141 above is achieved through steps one to three:
[0078] Step 1: Adjust the value range corresponding to the kernel function parameters to obtain the first updated value range.
[0079] In some embodiments, the range of kernel function parameters in the current experiment (first updated range) is determined based on the range of kernel function parameters in the previous experiment and the kernel function parameter values in the target hyperparameters obtained in the previous experiment; that is, step one above can be implemented through the following process:
[0080] First, determine the range difference between the range of values corresponding to the kernel function parameters and the range of values corresponding to the penalty factor.
[0081] In some embodiments, the determined range difference is half the difference between the range of values for the kernel function parameter and the range of values for the penalty factor; the formula for determining the range difference is as follows:
[0082] Range difference = (2);
[0083] in, The first experimental area Medium penalty factor The range of values for; The first experimental area kernel function parameters The range of values for .
[0084] Secondly, based on the difference between the target kernel function parameter and the range, a lower limit value for the kernel function parameter is determined; the formula for determining the lower limit value is as follows:
[0085] Lower limit value = (3);
[0086] in, The values of the kernel function parameters in the first objective hyperparameters; The difference is in the range.
[0087] In some embodiments, the upper limit is determined based on the range of values for the kernel function parameters; the formula for determining the upper limit is as follows:
[0088] Upper limit = (4);
[0089] Finally, based on the lower limit value and the value range corresponding to the target kernel function parameter, the first updated value range of the kernel function parameter is determined.
[0090] In some embodiments, the maximum range between the lower limit and the upper limit of the kernel function parameters is determined as the first updated value range of the kernel function parameters; the formula for determining the first updated value range is as follows:
[0091] First update value range = (5);
[0092] Step two: Adjust the value range corresponding to the target penalty factor to obtain the second updated value range.
[0093] In some embodiments, step two above is implemented through the following process:
[0094] First, based on the difference between the target penalty factor and the range, a lower limit value for the penalty factor is determined; the formula for determining the lower limit value is as follows:
[0095] Lower limit value = (6);
[0096] in, The value of the penalty factor in the first objective hyperparameter is given.
[0097] In some embodiments, the upper limit is determined based on the range of values for the penalty factor; the formula for determining the upper limit is as follows:
[0098] Upper limit = (7);
[0099] Secondly, based on the lower limit value and the value range corresponding to the target penalty factor, a second updated value range for the penalty factor is determined; the formula for determining the second updated value range is as follows:
[0100] Second update value range = (8);
[0101] Step 3: Determine the second experimental region based on the first updated value range and the second updated value range.
[0102] In some embodiments, a two-dimensional coordinate system is constructed, and the region enclosed by the first updated value range of the kernel function parameters and the second updated value range of the penalty factor in the coordinate system is used as the second experimental region.
[0103] Step S142: In the second experimental region, determine the second target hyperparameter.
[0104] In some embodiments, a method for determining a first target hyperparameter is used in a first experimental region, and a second target hyperparameter is determined in a second experimental region.
[0105] In some embodiments, the experiment may be conducted twice or multiple times; in short, the second objective hyperparameter is the experimental result of the last experiment before the experiment meets the cutoff condition; that is, the second objective hyperparameter is the final optimization result in the first experimental region, and the second objective hyperparameter is used to set the text classification model to be trained.
[0106] In this embodiment, a new experimental region is obtained by adjusting the experimental region. A sequential uniform design experiment is then performed in this new region to optimize the new region and obtain the globally optimized second objective hyperparameter. This allows for the rapid identification of the second objective hyperparameter that meets the conditions in the new experimental region. The second objective hyperparameter is then used to set the text classification model to be trained, resulting in the target text classification model. This leads to a more accurate classification model.
[0107] In some embodiments, the sample text dataset described above is a preprocessed dataset that can be input into the text classification model to be trained. That is, the method further includes the following steps:
[0108] Step A: Obtain the text dataset with the question types already labeled.
[0109] In some embodiments, a text dataset is constructed; based on the question type to which the text dataset belongs, the text dataset is labeled to obtain a text dataset with labeled question types; for example: constructing a text dataset with the following information: opening hours; what time does it open; what time does it open; when does it open; what time does it close; what time does it close; when does it close; ticket; price; ticket price; how much does the ticket cost; how much; do I need a ticket; is it free; is it half price; the text dataset with "what time does it open" to "when does it close" is labeled with "opening hours" according to its question type; the text dataset with "ticket" to "is it half price" is labeled with "ticket price" according to its question type.
[0110] Step B involves performing word segmentation on each text data in the text dataset.
[0111] In some embodiments, the Jieba word segmentation tool, Han Language Processing (HanLP), LTP Chinese language processing system, or THULAC Chinese lexical analysis tool can be used to segment the question text; for example, the user-input text data "What are some foods nearby" can be segmented to obtain the five words "What are some foods nearby".
[0112] Step C involves feature extraction from the segmented text data.
[0113] In some embodiments, feature extraction may involve calculating the sum of each word in the segmented text data. Value; specifically, this can be achieved through the following process:
[0114] First, calculate the word frequency of each word in each text dataset. Among them, word frequency The frequency of a word in a text is represented by the following formula:
[0115] (9);
[0116] Secondly, calculate the inverse document frequency of each word in each text dataset. .
[0117] Here, a corpus is needed to simulate the usage environment of the text, and inverse document frequency (IVF) is required. The calculation formula is as follows:
[0118] (10);
[0119] Finally, the value of each word in each text dataset is calculated. The value is used to obtain the feature vector of each text data. .
[0120] here, The higher the value, the more important the word is, and the closer it is to a keyword. The calculation formula is as follows:
[0121] (11);
[0122] Step D: Normalize the text data after feature extraction to obtain the sample text dataset.
[0123] Here, the Min-Max algorithm is used to normalize (standardize) the text feature vectors, which can be achieved through the following process:
[0124] Feature vectors of each text data Perform the transformation:
[0125] (12);
[0126] Then the new sequence And it is dimensionless.
[0127] In this embodiment of the application, by preprocessing the text dataset, a sample text dataset that can be input into the text classification model to be trained is obtained; then, it is possible to determine whether the text classification model to be trained correctly classifies the sample text data in the sample text dataset based on the labels in the sample text dataset.
[0128] This application provides a text classification method, such as... Figure 3 As shown, combined with Figure 3 The steps shown are explained below:
[0129] Step S301: Obtain the text to be classified.
[0130] In some embodiments, the text to be categorized can be text input by the user. Text input can be achieved through voice input, text input, or other methods; for example, obtaining the user-inputted text "What are some fun things to do nearby?".
[0131] Step S302: Input the text to be classified into the trained target text classification model to obtain the classification result of the text to be classified.
[0132] In some embodiments, the target text classification model is determined using the text classification model determination method described above.
[0133] In some embodiments, when there are three or more question types, sub-text classification models are constructed between each pair of question types to obtain the target text classification model. The sub-text classification model can be a support vector machine. In this embodiment, the target text classification model may include V binary classification support vector machines, where V is an integer greater than or equal to 2.
[0134] In some embodiments, corresponding support vector machines are trained using sample text data from the sample dataset to obtain multiple binary classification support vector machines. That is, the classification result of the text to be classified is obtained based on the classification results of multiple support vector machines.
[0135] In some embodiments, step S302 is implemented through the following steps S321 to S324:
[0136] Step S321: Preprocess the text to be classified.
[0137] In some embodiments, the text to be classified is sequentially segmented into words, features are extracted, and normalized to obtain preprocessed text to be classified, which can then be input into a support vector machine.
[0138] Step S322: Input the preprocessed text to be classified into the V binary support vector machines for classification.
[0139] Table 1 Support Vector Machine Classification Table
[0140]
[0141] In some embodiments, a support vector machine can classify text into two categories. As shown in Table 1, a support vector machine can classify question type 1 and question type 2, and classify the feature vectors of the text to be classified. Substitute into the Gaussian kernel support vector machine model ;like Then output That is, it is classified into problem type 1; if Then output That is, it is classified as problem type 2.
[0142] Step S323: Based on the preset voting strategy, the classification results of each support vector machine are statistically analyzed to obtain the statistical results.
[0143] In some embodiments, a preset voting strategy is used, that is, voting is performed on the classification results of the support vector machine; for example, when the classification is to problem type 1, the vote for problem type 1 is increased by 1, otherwise the vote for problem type 2 is increased by 1.
[0144] In some embodiments, the voting results of each support vector machine are statistically analyzed to obtain statistical results; for example: support vector machine 1 classifies problem type 1 and problem type 2, support vector machine 2 classifies problem type 1 and problem type 3, and support vector machine 3 classifies problem type 2 and problem type 3; the text to be classified is input into the three support vector machines respectively, support vector machine 1 classifies problem type 1, and the vote for problem type 1 is increased by 1; support vector machine 2 classifies problem type 1, and the vote for problem type 1 is increased by 1; support vector machine 3 classifies problem type 2, and the vote for problem type 2 is increased by 1; the voting results are statistically analyzed, and problem type 1 receives two votes, problem type 2 receives one vote, and problem type 3 receives zero votes.
[0145] Step S324: Determine the classification result of the text to be classified based on the statistical results.
[0146] In some embodiments, the classification result with the most votes is used as the classification result for the text to be classified, based on the voting results. If there is a tie, the question type with the smaller index is used as the classification result for the question text to be classified. For example, the question type 1 with the most votes is used as the classification result for the text to be classified.
[0147] Step S303: Output the classification result of the text to be classified.
[0148] In some embodiments, the classification result of the text to be classified is output; for example, the above-mentioned question type 1 is output and displayed on the display device.
[0149] In this embodiment of the application, the text to be classified is obtained; the text to be classified is input into a trained target text classification model to obtain the classification result of the text to be classified; wherein, the target text classification model is determined by the above-mentioned text classification model determination method; in this way, the classification accuracy of the target text classification model can be improved to obtain a more accurate classification result; the classification result of the text to be classified is output.
[0150] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario, using a tourism question-and-answer system as an example to illustrate the classification of questions in the question-and-answer system.
[0151] The key technologies of a question-answering system include knowledge extraction, representation, and reasoning, as well as the processing of user questions. When a question-answering system returns the correct answer to a user, it first analyzes and processes the question to extract key information, then performs information retrieval from that key information, and finally returns the correct answer.
[0152] In question analysis, questions are typically classified, and pattern matching and machine learning methods are the main approaches for this. Machine learning-based question classification methods require defining a feature set for the question and then using a classification method to categorize it. Relevant classification methods include Naive Bayes, Support Vector Machines (SVMs), and Maximum Entropy. However, SVMs have certain issues with hyperparameter selection. Furthermore, existing parameter optimization methods (such as grid search, gradient descent, genetic algorithms, and particle swarm optimization) are no longer sufficient to meet current needs.
[0153] The main problems with various hyperparameter optimization methods in related technologies are as follows:
[0154] (1) When the optimization interval is large enough and the step size is small enough, the grid search method can theoretically find the global optimal solution. However, the grid search method requires traversing every point within the specified grid range, which is very time-consuming.
[0155] (2) The superiority of gradient descent largely depends on the choice of initial value. If the initial value is not chosen properly, it is more likely to get stuck in a local optimum. In addition, the step size setting in gradient descent also has a certain impact on optimization capability. If the step size is too small, the convergence speed is slow; if the step size is too large, it is more likely to miss the optimal solution.
[0156] (3) Genetic algorithms have strong robustness and parallelism, do not have high requirements for the objective function, do not need to traverse all parameter combinations in the interval, and are not easy to get trapped in local optima. However, they are usually more complex to operate and less efficient.
[0157] (4) Particle swarm optimization algorithm has a fast convergence speed and few adjustable parameters, but it cannot guarantee that it will not get stuck in a local optimum, and its accuracy is often prone to fluctuation.
[0158] Furthermore, there is no comprehensive definition of a set of tourism-related question texts that covers all aspects that tourists care about in the tourism field. As a result, the training samples for tourism question-and-answer systems are not rich enough, which affects the accuracy of question classification.
[0159] The optimization of hyperparameters directly affects the generalization performance of the model and is the key to ensuring the good learning performance of support vector machines. Finding a universally applicable, effective method that can reach the global optimum is an urgent problem to be solved.
[0160] In this application embodiment, in order to achieve problem classification, such as Figure 4 As shown, combined with Figure 4 The steps shown are explained below:
[0161] Step S401: Construct a training set of tourism-related texts.
[0162] In this embodiment, 24 question types are defined, namely: inquiries about the opening hours, ticket prices, best time to visit, introduction, location, famous attractions, recommended routes, food, restaurants, hotels, train stations, airports, suitable groups, entertainment, local specialties, customs, transportation, history and culture, clothing guidelines, climate, area, rating, nearby attractions, and shopping information of attractions. For each question type, a set of question texts is defined as a training dataset for tourism question texts.
[0163] 1. Opening Hours: Opening hours; what time does the door open; what time does the door close; what time does the door close; what time does the door close; what time does the door close.
[0164] 2. Ticket Price: Ticket; Price; Ticket Price; How much is the ticket; How much; Do I need a ticket; Is it free; Is it half price?
[0165] 3. Best time to visit: Best time to visit; Best time to travel; Best time to visit; Which month is suitable to go; Which month is appropriate to go; Which month is the best to go; Which month is the most beautiful; Is it good to go in a certain month; Is it suitable to go in a certain month; Recommended time to visit; Recommended time to travel; Which month is the most lively; Which month is the most comfortable; Which month is the most relaxing; Which month is the most comfortable to visit; Best time to visit; When is the best time to go.
[0166] 4. Introduction: Introduction; Overview; Give a brief introduction; What is it; Brief introduction; Altitude; Height; Lake; Peak; Sea; Mountain; Features.
[0167] 5. Location: Location; Geographical location; Where is it; Which province; Which city; Which district; Address.
[0168] 6. Famous Attractions: Attractions; What attractions are there; Places worth visiting; Recommended places; Popular tourist spots; Main attractions; Must-see places; Must-visit places; Must-check-in places; Recommended places to go; What's fun to do; What's interesting to do; Where to go for fun; How to do it; Recommended activities.
[0169] 7. Recommended Routes: Itinerary recommendations; how to design a route; recommended routes; one-day tour recommendations; two-day tour recommendations; fun places; classic tourist routes; recommended routes; how many days to spend; how many days to spend; how to arrange the itinerary; how to plan; how to schedule; travel guide; route planning; best tourist routes; route arrangement; itinerary planning; how to spend the trip.
[0170] 8. Food: Food; Snacks; What's good to eat; What to eat recommended; What are some good foods; What are some local delicacies; Specialty foods.
[0171] 9. Restaurants: Restaurants; Restaurants; Recommended restaurants; Good restaurants; Popular restaurants; Must-visit restaurants; Hottest restaurants; Restaurants frequented by locals; Where locals eat; Recommended places to eat; Nearby restaurants; Nearby eateries; Food options nearby; What food is available nearby; Nearby cuisine; What are some good restaurants nearby?
[0172] 10. Hotels: Hotels; B&Bs; Inns; Accommodation; Where to stay; Recommended accommodations; Convenient accommodations; Top choice for accommodations.
[0173] 11. Train Station: Train station; What train stations are there; How many train stations are there; Where is the train station located; Are there trains; Can you get there by train?
[0174] 12. Airport: Airport; What airports are there; How many airports are there; Where is the airport; Is there an airport; Can you get there by plane?
[0175] 13. Suitable for: Who is suitable for whom? Is it suitable for children? Is it suitable for the elderly? Is it suitable for pregnant women? Can pregnant women go? Can children go? Can the elderly go? Can pregnant women go? Can children go? Can the elderly go? Who can go?
[0176] 14. Entertainment: Entertainment; entertainment activities; what entertainment activities are available; hot springs; can I soak in hot springs?; can I ski?; can I surf?; can I bungee jump?; are there sightseeing buses?; are there cable cars?; sightseeing buses; cable cars; is there a ropeway?; is there a glass walkway?; ropeway; glass walkway; what activities are available?
[0177] 15. Local specialties: Specialty products; Gifts; Presents; Local specialties; What are some local specialties; What local specialties are there; What local specialties are recommended to buy; What are some gifts; What gifts are there; What gifts are recommended to buy; What gifts are there; What gifts are there; What gifts are recommended to buy; What local specialties are there; What local specialties are recommended to buy.
[0178] 16. Customs and Habits: Customs; Habits; Traditions; Ethnic Minorities; Customs and Habits; What are the customs; What are the habits; What are the traditions; Which ethnic minorities are there; What are the customs; What are the habits; What are the traditions; Which ethnic minority is it?
[0179] 17. Transportation: How to get there; how to go there; how to arrive; how to get there; how to go there; how to arrive; is it possible to get there?
[0180] 18. History and Culture: Legends; Stories; History; Culture; Religion; Sects; What history does it have; What religions are there?
[0181] 19. Clothing Guide: What to wear; Suitable to wear; Should wear; Need to wear; What clothes to wear; Clothing Guide; How to dress; Equipment.
[0182] 20. Climate: weather; climate; is it cold; is it hot; temperature.
[0183] 21. Area: the area occupied; how big; how many acres; how big; is it big; area; is it small; is it vast; is it expansive; is it large or small; is it wide or narrow; is it long or short; is it long?
[0184] 22. Level: Is it a historical and cultural protection zone? Is it a protection zone? What level of scenic area is it? Scenic area level; Level.
[0185] 23. Nearby attractions: What attractions are there in the surrounding area? What attractions are there in the city? Nearby attractions? Surrounding attractions? City attractions? Nearby attractions? What fun attractions are there nearby? What attractions are recommended to visit nearby?
[0186] 24. Shopping situation: Nearby shopping malls; shopping malls; where can I shop nearby; is it possible to shop?
[0187] Step S402: Construct the test problem dataset.
[0188] In this embodiment, a test question dataset for a question-and-answer system is defined. Real user questions (13,761 questions in total) are crawled from the question-and-answer communities of various travel websites using web crawling technology. From these 13,761 questions, 1,000 questions are randomly selected. Based on the definition in step one, the question types of these 1,000 questions are analyzed, and their numbers are recorded to construct the test question dataset. A portion of the test question dataset includes:
[0189] Test Question Data 1: How much is the adult ticket price for ski resort A?
[0190] Test question data 2: What are some fun things to do at scenic spot B in winter?
[0191] Test Question Data 3: How many days should I spend at Scenic Spot C?
[0192] Test Question Data 4: When can you see the red leaves in scenic area D?
[0193] Test Question Data 5: How should I plan my trip to Scenic Area E in early November?
[0194] Test Question Data 6: What should you wear in the autumn scenic area F?
[0195] Test Question Data 7: First time visiting Region A, foodie seeking recommendations for local Greek cuisine!
[0196] Test Question Data 8: I'm planning a trip to region B during my upcoming holiday. What are some must-try foods?
[0197] Test Question Data 9: I'm planning a trip with my family during the Spring Festival to experience the charm of Region C. Any recommendations for good places to visit?
[0198] Test question data 10: Which month is the most suitable to go to region D?
[0199] Test question data 11: How much is the ticket price for scenic spot G?
[0200] Test Question Data 12: First time visiting scenic spot H, desperately seeking expert advice on the best itinerary!
[0201] Test question data 13: What is the best season to visit region E?
[0202] Test Question Data 14: What are the local specialties of Scenic Area I?
[0203] Test Question Data 15: What kind of place is Region F?
[0204] Test Question Data 16: When does Scenic Area J open?
[0205] Step S403: Preprocess the problem text data.
[0206] In this embodiment of the application, the problem text data is sequentially segmented, feature extracted, and normalized.
[0207] Step S404: Optimize the hyperparameters of the Gaussian kernel support vector machine using experimental design methods.
[0208] Here, after optimizing the hyperparameters of the Gaussian kernel support vector machine, the problem text data preprocessed in step S403 is used as the test dataset and input into the support vector machine obtained in step S404.
[0209] Step S441: Construct a training set based on the preprocessed question text.
[0210] Here, the constructed training set corresponds to the sample text dataset in the above embodiments.
[0211] In this embodiment of the application, the preprocessed question text data is defined as X_train, and the question type number corresponding to the question text is defined as Y_train, thus constructing a training set.
[0212] Step S442: Develop an experimental plan using a uniform design.
[0213] In step S442, the power-law grid point method is used to generate a uniform design table with minimal mixing deviation. Step S442 can be achieved through steps 2.1 to 2.7:
[0214] Step 2.1: Determine the range of hyperparameter values, and then determine the experimental area for the first experiment based on the range of hyperparameter values.
[0215] In this embodiment, the range of values for the kernel function parameters and the penalty factor is determined empirically; for example, the range of values for the kernel function parameters is... The range of values for the penalty factor is: .
[0216] In this embodiment, the Gaussian kernel function can be mapped to infinite dimensions and has more diverse decision boundaries, making it suitable for a wide variety of sample situations. It has good anti-interference ability against noise in the data, so its performance is excellent and its application is also widespread.
[0217] Step 2.2: Determine the number of experiments for the first experiment based on the experimental area of the first experiment. ;
[0218] Step 2.3, for a given number of experiments Factor number Find the set of positive integers.
[0219] Step 2.4: For each positive integer in the set of positive integers, generate a U-shaped design (corresponding to the U-shaped matrix mentioned above).
[0220] Step 2.5: Calculate the mixing deviation of the U-shaped design corresponding to different positive integers.
[0221] In this embodiment of the application, step 2.5 is implemented through the following process:
[0222] First of all, OK Columns The elements in the model design are transformed as follows to obtain the matrix. That is, to obtain the point set ,in, :
[0223] (13);
[0224] in, , .
[0225] Secondly, compute the point set. The mixing deviation is calculated using the following formula:
[0226] (14);
[0227] Step 2.6: Determine the U-shaped design with the smallest mixing deviation as the target design (corresponding to the target matrix mentioned above).
[0228] Step 2.7, will Substituting the above target design, we obtain different combinations of hyperparameter values (corresponding to the above level combinations).
[0229] Step S443: Train multiple binary support vector machine models using a one-to-one pairwise classification method.
[0230] Step S444: Output the support vector machine model and classification accuracy.
[0231] Step S445: Determine whether the classification accuracy meets the stopping criterion.
[0232] Here, if the classification accuracy meets the stopping criterion, the support vector machine model and classification accuracy are output; if not, the experimental area is updated, and the next experiment is conducted using the methods from steps S442 to S445.
[0233] Step S405: Use the preprocessed question text data as the test set, input it into the support vector machine, and obtain the test classification results.
[0234] Step S406: Compare the classification accuracy of the test classification results with other classification accuracy rates.
[0235] Here, other classification accuracy rates can be the classification accuracy rates obtained by classifying text using the grid search method. By comparing the classification accuracy rates with those obtained by the grid search method, as shown in Table 2, it is concluded that the classification accuracy rate obtained in this embodiment is higher, thus concluding the experiment.
[0236] Table 2 Experimental Results
[0237]
[0238] As can be seen from Table 2, the experimental design method provided in this application finds a target text classification model with optimized hyperparameter values that is superior to the web search method in terms of both modeling time and classification accuracy. In other words, the optimization process of hyperparameter values is faster, and the classification accuracy of the target text classification model determined by the optimized hyperparameter values is higher.
[0239] In this embodiment, the training set includes 24 question types, and support vector machines are constructed between each pair of question types, totaling... There are 10 Support Vector Machines (SVMs). All SVMs are cascaded to form the target text classification model. The decision boundary of the target text classification model is plotted based on the voting strategy of each SVM (corresponding to the preset voting strategy mentioned above).
[0240] In this embodiment of the application, by applying the method for determining the text classification model to the tourism question-and-answer system, the tourism question-and-answer system can accurately classify the tourism questions (i.e., questions or text) input by the user and obtain the question type to which the corresponding question belongs.
[0241] This application provides a text classification model determination device 500, such as... Figure 5 As shown, the text classification model determining device 500 includes:
[0242] The first determining module 501 is used to determine a first hyperparameter set, which includes multiple first hyperparameters, based on the first number of experiments and at least two types of hyperparameters of the text classification model to be trained.
[0243] The second determining module 502 is used to determine the classification results of the sample text data by using different first hyperparameters for the text classification model to be trained, and to obtain multiple classification results.
[0244] The third determining module 503 is used to determine the first target hyperparameter in the first hyperparameter set based on the accuracy of the multiple classification results.
[0245] The fourth determining module 504 determines the second target hyperparameter based on the first experimental region of the at least two types of hyperparameters and the first target hyperparameter.
[0246] The first setting module 505 updates the hyperparameters of the text classification model to be trained to the second target hyperparameters, thereby obtaining the target text classification model.
[0247] In this embodiment of the application, the first determining module 501 includes:
[0248] The first determination submodule is used to determine the first experimental region based on the value range of each type of hyperparameter.
[0249] The second determination submodule is used to determine the target matrix based on the number of the first experiment and the number of categories of the hyperparameter.
[0250] The third determining submodule is used to determine the first hyperparameter set in the first experimental region based on the target matrix.
[0251] In this embodiment of the application, the second determining submodule is further configured to determine a set of positive integers less than the number of the first experiment; generate a U-shaped matrix including some hyperparameters in the first experimental region based on each positive integer in the set of positive integers; determine the mixing deviation of the U-shaped matrix corresponding to each positive integer; and take the U-shaped matrix with a mixing deviation less than a first preset threshold as the target matrix.
[0252] In this embodiment of the application, the third determining module 503 is further configured to determine the classification result with an accuracy greater than a second preset threshold as the target classification result among the plurality of classification results; and to determine the first hyperparameter corresponding to the target classification result as the first target hyperparameter.
[0253] In this embodiment of the application, the fourth determining module 504 includes:
[0254] The fourth determining submodule is used to determine a second experimental region based on the first experimental region and the first target hyperparameter; wherein the number of hyperparameters included in the second experimental region is less than that in the first experimental region.
[0255] The fifth determination submodule is used to determine the second target hyperparameter in the second experimental region.
[0256] In this embodiment of the application, the fourth determining submodule includes:
[0257] The sixth determining submodule is used to adjust the value range corresponding to the kernel function parameters to obtain the first updated value range.
[0258] The seventh determination submodule is used to adjust the value range corresponding to the penalty factor to obtain the second updated value range.
[0259] The eighth determination submodule is used to determine the second experimental region based on the first update value range and the second update value range.
[0260] In this embodiment of the application, the sixth determining submodule is further configured to determine the range difference between the value range corresponding to the kernel function parameter and the value range corresponding to the penalty factor; determine the lower limit value of the kernel function parameter based on the range difference between the target kernel function parameter and the target kernel function parameter; and determine the first updated value range of the kernel function parameter based on the lower limit value and the value range corresponding to the target kernel function parameter.
[0261] In this embodiment of the application, the seventh determining submodule is further configured to determine the lower limit value of the penalty factor based on the difference between the target penalty factor and the range; and to determine the second updated value range of the penalty factor based on the lower limit value and the value range corresponding to the target penalty factor.
[0262] In this embodiment of the application, the text classification model determination device 500 further includes:
[0263] The second acquisition module is used to acquire text datasets with labeled question types.
[0264] The first processing module is used to perform word segmentation on each text data in the text dataset; extract features from the segmented text data; and normalize the text data after feature extraction to obtain the sample text dataset.
[0265] This application provides a text classification device 600, such as... Figure 6 As shown, the text classification device 600 includes:
[0266] The first acquisition module 601 is used to acquire the text to be classified.
[0267] The first classification module 602 is used to input the text to be classified into a trained target text classification model to obtain the classification result of the text to be classified; wherein, the target text classification model is determined by the above-mentioned text classification model determination method;
[0268] The first output module 603 is used to output the classification result of the text to be classified.
[0269] In this embodiment of the application, the target text classification model includes V binary support vector machines, where V is an integer greater than or equal to 2.
[0270] In this embodiment of the application, the first acquisition module 601 is further configured to preprocess the text to be classified; input the preprocessed text to be classified into the V binary support vector machines for classification; and statistically analyze the classification results of each support vector machine based on a preset voting strategy to obtain statistical results.
[0271] This application provides a text classification system 700, such as... Figure 7 As shown, the system 700 includes:
[0272] The processor 701, the memory 702, and the communication bus 703 are provided; wherein the communication bus 703 is used to establish a communication connection between the processor 701 and the memory 702.
[0273] The processor 701 is used to execute the program in the memory 702 to implement the text classification model determination method as described above, or to implement the text classification method as described above.
[0274] Based on the foregoing embodiments, embodiments of this application provide a computer storage medium storing one or more programs, which can be executed by one or more processors to implement the method described above, or to implement the text classification method described above.
[0275] It should be noted that the descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0276] It should be noted that, in the embodiments of this application, if the above-described data collection method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a terminal, server, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0277] This application embodiment further provides a computer storage medium storing one or more programs, which can be executed by one or more processors to implement the above-described text classification model determination method, or to implement the above-described text classification method.
[0278] The descriptions of the text classification model determination method, system, and storage medium embodiments above are similar to the descriptions of the method embodiments above, and have similar technical descriptions and beneficial effects as the corresponding method embodiments. Due to space limitations, they can be referred to the descriptions of the method embodiments above, and therefore will not be repeated here. For technical details not disclosed in the embodiments of the text classification model determination method, computer device, and storage medium of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0279] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence number of the above-described processes does not imply the order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely for descriptive purposes and do not represent the superiority or inferiority of the embodiments. It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0280] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0281] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0282] Furthermore, in the various embodiments of this application, all functional units can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units. Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.
[0283] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks. The above descriptions are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for determining a text classification model, characterized in that, The method includes: The first experimental region is determined based on the value range of each type of hyperparameter; For each positive integer in the first set of positive integers, generate a U-shaped matrix that includes some hyperparameters from the first experimental region; the number of positive integers in the first set of positive integers is less than the number of the first experiment. Determine the mixing bias of the U-shaped matrix corresponding to each positive integer; The U-shaped matrix with a mixing deviation less than the first preset threshold is taken as the target matrix; Based on the target matrix, a first set of hyperparameters is determined in the first experimental region; By employing different first hyperparameters to train text classification models, the classification results of sample text data are determined, resulting in multiple classification results; Based on the accuracy of the multiple classification results, a first target hyperparameter is determined in the first hyperparameter set; Based on a first experimental region with at least two types of hyperparameters and the first target hyperparameters, determine the second target hyperparameters; The hyperparameters of the text classification model to be trained are updated to the second target hyperparameters to obtain the target text classification model.
2. The method according to claim 1, characterized in that, The step of determining the first target hyperparameter from the first hyperparameter set based on the accuracy of the multiple classification results includes: Among the multiple classification results, the classification result with an accuracy greater than a second preset threshold is determined as the target classification result; The first hyperparameter corresponding to the target classification result is determined as the first target hyperparameter.
3. The method according to claim 1, characterized in that, The determination of the second target hyperparameter based on the experimental region of at least two types of hyperparameters and the first target hyperparameter includes: Based on the first experimental region and the first target hyperparameter, a second experimental region is determined; wherein the number of hyperparameters included in the second experimental region is less than the number of hyperparameters included in the first experimental region; In the second experimental region, the second target hyperparameter is determined.
4. The method according to claim 3, characterized in that, The at least two types of hyperparameters include kernel function parameters and penalty factors, and the first target hyperparameter includes target kernel function parameters and target penalty factors; determining the second experimental region based on the first experimental region and the first target hyperparameter includes: The value range corresponding to the kernel function parameters is adjusted to obtain the first updated value range; The range of values corresponding to the penalty factor is adjusted to obtain a second updated range of values; The second experimental region is determined based on the first update value range and the second update value range.
5. The method according to claim 4, characterized in that, The step of adjusting the value range corresponding to the kernel function parameters to obtain the first updated value range includes: Determine the range difference between the value range corresponding to the kernel function parameter and the value range corresponding to the penalty factor; Based on the difference between the target kernel function parameter and the range, the lower limit value of the kernel function parameter is determined; Based on the lower limit value and the value range corresponding to the target kernel function parameter, the first updated value range of the kernel function parameter is determined.
6. The method according to claim 5, characterized in that, The step of adjusting the value range corresponding to the penalty factor to obtain the second updated value range includes: Based on the difference between the target penalty factor and the range, the lower limit of the penalty factor is determined; Based on the lower limit value and the value range corresponding to the target penalty factor, a second updated value range for the penalty factor is determined.
7. The method according to claim 1, characterized in that, Before using text classification models with different first hyperparameters to determine the classification results of the sample text data and obtain multiple classification results, the method further includes: Obtain the text dataset with labeled question types; Each text data in the text dataset is segmented into words; Feature extraction is performed on the text data after word segmentation. The extracted text data is normalized to obtain a sample text dataset.
8. A text classification method, characterized in that, The method includes: Get the text to be categorized; The text to be classified is input into a trained target text classification model to obtain the classification result of the text to be classified; wherein the target text classification model is determined by the method of any one of claims 1 to 7 above; Output the classification result of the text to be classified.
9. The method according to claim 8, characterized in that, The target text classification model includes V binary support vector machines, where V is an integer greater than or equal to 2.
10. The method according to claim 9, characterized in that, The step of inputting the text to be classified into a trained target text classification model to obtain the classification result of the text to be classified includes: The text to be classified is preprocessed; The preprocessed text to be classified is input into the V binary support vector machines for classification. Based on a preset voting strategy, the classification results of each support vector machine are statistically analyzed to obtain the statistical results. Based on the statistical results, the classification result of the text to be classified is determined.
11. A text classification system, characterized in that, include: A processor, a memory, and a communication bus; wherein the communication bus is used to implement a communication connection between the processor and the memory; The processor is used to execute the program in the memory to implement the text classification model determination method as described in any one of claims 1 to 7, or to implement the text classification method as described in any one of claims 8 to 10.
12. A computer storage medium, characterized in that, The computer storage medium stores one or more programs, which can be executed by one or more processors to implement the text classification model determination method as described in any one of claims 1 to 7, or to implement the text classification method as described in any one of claims 8 to 10.
Citation Information
Patent Citations
Automatic extraction method and device for stable characteristics of power system
CN106786560A
A hyper-parameter optimization method and device in a machine learning model
CN109816116A
Text classification model training method and system and related equipment
CN112256867A