A New Intention Discovery Method, Device, Equipment and Storage Medium Based on Clustering
By pre-training the classifier and optimizing the contour coefficients, and iterative updates of the known intent data, the problem of failing to fully utilize the known intent in the prior art is solved, and more accurate new intent discovery is achieved.
Patent Information
- Application Number
- CN202111592178.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-12-23
AI Technical Summary
The prior art does not fully utilize data of known intentions and does not consider the difference between new intentions and known intentions, resulting in poor clustering effects and it is difficult to accurately and fully discover new intentions.
By pre-training the classifier, selecting cluster numbers using the optimized contour coefficients, clustering them with known intent data and labelless data, iteratively updates the known intent data until no new intent is added, outputting the aligned labels, making full use of the known intent data, and enhancing information exchange.
It improves the clustering effect, can discover new intentions more accurately, enhances information exchange between classification and clustering processes, guides the clustering process, and ensures accurate discovery of new intentions.
Smart Images

Figure CN114510567B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular, to a new intention discovery method, device, equipment and storage medium based on clustering. Background Technique
[0002] When the user is unable to answer the phone, the phone assistant can answer the phone on behalf of the user, understand the caller's words, perform corresponding interactions and guidance, and record important call information and convey it to the user. This not only reduces the situation of losing important information due to missed calls, but also saves time and communication costs, and greatly improves people's living and working efficiency. The premise of intention recognition is to discover as many user intentions as possible. On this basis, an intention recognition model is trained, and corresponding interaction guidance is designed. Through intention discovery, new intentions and new interest points of users can be mined, so as to further improve the ability to recognize user intentions and perfect the interaction guidance, and enhance the user experience.
[0003] When classical unsupervised clustering algorithms are used for intention discovery tasks, there are two disadvantages. One is that for bottom-up clustering algorithms such as K-Means, the number of clusters needs to be set before clustering, and the number of clusters will directly affect the final clustering effect. When performing intention discovery, the true number of clusters is not known. The other is that classical unsupervised clustering algorithms do not learn the high-dimensional representation of the text, and it is difficult to accurately calculate the distance of the text in the feature space. For unsupervised clustering algorithms based on deep learning, first use the neural network of deep learning to extract the high-dimensional features or encodings of the text, and then use the feature or encoding vectors to find the clustering centers for clustering. At the same time, an intention classifier is trained, and the results of clustering and the classifier are used to train the model. This method has two disadvantages. One is that no supervised signal is introduced, so it is easily interfered by outliers during clustering, which affects the clustering effect. Especially for the unlabeled data of the intention discovery task, it usually mixes known intentions and even data from other fields, and it is difficult to accurately cluster new intentions. The other is that since the number of clusters and categories are changing, the parameters of the classifier need to be re-initialized each time. The third method is based on weakly supervised or semi-supervised clustering algorithms, which guide the clustering process by using labeled data or imposing restrictions. For example, a bipartite model is trained with labeled data to evaluate the clustering effect. The disadvantage of this type of method is that most weakly supervised or supervised signals still do not make full use of the labeled data. The above three intention discovery methods do not make full use of the data of known intentions, do not consider the difference between new intentions and known intentions, resulting in poor clustering effects and difficulty in accurately and fully discovering new intentions. Summary of the Invention
[0004] The present application provides a new intention discovery method, device, equipment and storage medium based on clustering, which is used to solve the technical problem that the existing technology does not make full use of the data of known intentions and does not consider the difference between new intentions and known intentions, resulting in poor clustering effect and difficulty in accurately and fully discovering new intentions.
[0005] In the first aspect of the present application, a new intention discovery method based on clustering is provided, including:
[0006] S101. Pre-train a classifier according to known intention data;
[0007] S102. Select the number of clusters according to a preset silhouette coefficient;
[0008] S103. Based on the K-means clustering algorithm, cluster the unlabeled data according to the number of clusters to generate a clustering result, and align the clustering result with the true label to obtain an alignment label for discovering new intentions;
[0009] S104. Train the classifier according to the clustering result and the known intention data to obtain a pseudo-label of the classifier;
[0010] S105. Calculate the KL divergence between the alignment label and the pseudo-label to update the known intention data;
[0011] S106. Repeat steps S101 to S105 until no new intention is added, and then output the alignment label.
[0012] The present application first pre-trains a classifier according to known intention data, then selects the number of clusters through an optimized silhouette coefficient, and has a good clustering effect. The mode of combining known intention data and unlabeled data to train the classifier uses the known intention data of the previous round as a supervision signal during iteration, continuously updates the known intention data, stops iterating until no new intention is added, and outputs the alignment label for discovering new intentions. It makes full use of the known intention data, enhances the information exchange between the classification and clustering processes, is more conducive to guiding the clustering process and accurately and fully discovering new intentions, thus solving the technical problem that the existing technology does not make full use of the data of known intentions and does not consider the difference between new intentions and known intentions, resulting in poor clustering effect and difficulty in accurately and fully discovering new intentions.
[0013] Optionally, the selecting the number of clusters according to a preset silhouette coefficient includes:
[0014] Selecting the number of clusters according to a first silhouette coefficient and / or a second silhouette coefficient;
[0015] The first silhouette coefficient is:
[0016]
[0017] The second silhouette coefficient is as follows:
[0018]
[0019] where l(i) is the silhouette coefficient with penalty term, l(i) a is the extended silhouette coefficient with penalty term, s(i) is the definition of the traditional silhouette coefficient, s(i)a is the silhouette coefficient, λ and γ are both hyperparameters, K is the number of clusters, N is the total number of samples, C k is the cluster to which sample i belongs, is the newly added cluster to which sample i belongs, and σ and u are the standard deviation and mean of the number of samples in the current clustering cluster respectively.
[0020] Optionally, before training the classifier according to the clustering result and the known intent data to obtain the pseudo-label of the classifier, it includes:
[0021] Adjust the number of classifier labels according to the number of clustering labels.
[0022] Optionally, training the classifier according to the clustering result and the known intent data to obtain the pseudo-label of the classifier includes:
[0023] Calculating a joint loss according to the known intent data and the alignment label;
[0024] Updating the classifier parameters according to the joint loss to obtain the pseudo-label of the classifier.
[0025] Optionally, based on the K-means clustering algorithm, clustering the unlabeled data according to the number of clusters to generate a clustering result, and aligning the clustering result with the true label to obtain the alignment label for discovering new intents, includes:
[0026] Based on the K-means clustering algorithm, clustering the unlabeled data according to the number of clusters to generate a clustering result;
[0027] Aligning the clustering result with the true label through the Hungarian algorithm to obtain the alignment label for discovering new intents.
[0028] Optionally, pre-training the classifier according to the known intent data includes:
[0029] Extracting the feature vector of the known intent data based on the BERT pre-trained language model;
[0030] Inputting the feature vector into the classifier to obtain a predicted label;
[0031] Calculating the cross-entropy loss between the predicted label and the true label;
[0032] Update the classifier parameters according to the cross-entropy loss.
[0033] Optionally, until no new intent is added, output the alignment label, and then include:
[0034] Convert the implicit alignment label into an explicit intent label through an intent label generator.
[0035] The second aspect of this application provides a new intent discovery device based on clustering, including:
[0036] A preprocessing unit for pre-training the classifier according to known intent data;
[0037] A selection unit for selecting the number of clusters according to a preset silhouette coefficient;
[0038] A clustering unit for clustering unlabeled data based on the K-means clustering algorithm according to the number of clusters to generate a clustering result, and aligning the clustering result with the true label to obtain an alignment label for discovering new intents;
[0039] A training unit for training the classifier according to the clustering result and the known intent data to obtain pseudo-labels of the classifier;
[0040] A calculation unit for calculating the KL divergence between the alignment label and the pseudo-label to update the known intent data;
[0041] An output unit for outputting the alignment label when no new intent is added.
[0042] The third aspect of this application provides an electronic device, including a processor and a memory storing a computer program, and when the processor executes the computer program, the steps of the new intent discovery method based on clustering as described in the first aspect are implemented.
[0043] The fourth aspect of this application provides a computer-readable storage medium, on which a computer program is stored, and characterized in that when the computer program is executed by a processor, the steps of the new intent discovery method based on clustering as described in the first aspect are implemented. Description of the Drawings
[0044] Figure 1 It is a flowchart of the new intent discovery method based on clustering provided by the embodiments of this application;
[0045] Figure 2 It is a model block diagram of the new intent discovery method based on clustering provided by the embodiments of this application;
[0046] Figure 3Schematic diagram of the structure of the new intention discovery device based on clustering provided by the embodiment of the present application;
[0047] Figure 4 Schematic diagram of the structure of the electronic device provided by the embodiment of the present application. Detailed implementation manners
[0048] The embodiment of the present application provides a new intention discovery method, device, equipment and storage medium based on clustering, which is used to solve the technical problem that the prior art does not make full use of the data of known intentions and does not consider the difference between new intentions and known intentions, resulting in poor clustering effect and difficulty in accurately and fully discovering new intentions.
[0049] In order to make the objectives, features, and advantages of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the embodiments described below are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0050] Please refer to Figure 1 and Figure 2 , the embodiment of the present application provides a new intention discovery method based on clustering, including:
[0051] Step 101: Pre-train the classifier according to the known intention data.
[0052] It should be noted that the known intention data is usually the labeled data that has been used before. The classifier is pre-trained according to the labeled known intention data to ensure the smooth progress of the subsequent training and classification process.
[0053] Step 102: Select the number of clusters according to the preset silhouette coefficient.
[0054] It can be understood that in this example, the optimized silhouette coefficient (i.e., the preset silhouette coefficient) is used to select the number of clusters. Specifically, the number of clusters can be selected according to the first silhouette coefficient and / or the second silhouette coefficient, so as to select a number of clusters that is more conducive to clustering and discovering new intentions. Specifically as follows:
[0055] Substitute the first preset formula and the second preset formula into the traditional silhouette coefficient definition formula to calculate s(i), where the first preset formula is:
[0056]
[0057] The second preset formula is:
[0058]
[0059] The definition formula of the traditional silhouette coefficient is as follows:
[0060]
[0061] Among them, a(i) measures the distance between the sample point and the samples in the same cluster, that is, the degree of aggregation within the same cluster. b(i) measures the distance between the sample point and the samples in different clusters, that is, the degree of separation between different clusters. s(i) is the definition of the traditional silhouette coefficient. Both i and j are samples. The closer s(i) is to 1, the better the separation degree between different clusters and the aggregation degree within the same cluster.
[0062] s(i) is calculated according to the third preset formula and the fourth preset formula a , where the third preset formula is as follows:
[0063]
[0064] The fourth preset formula is as follows:
[0065]
[0066] It should be noted that in this embodiment, the optimized silhouette coefficient has two improvements compared with the traditional silhouette coefficient. On the one hand, the distance between the new intention and the known intention data is introduced, and b(i) is extended to b(i)a, making the difference between the new intention and the known intention data more significant. And the weight of the distance between the two is dynamically regulated by the adaptive parameter α, that is, the better the distinction effect between the new intention and the known intention data, the smaller the adaptive parameter α. On the other hand, two penalty terms are added.
[0067] The first silhouette coefficient is as follows:
[0068]
[0069] The second silhouette coefficient is as follows:
[0070]
[0071] Among them, l(i) is the silhouette coefficient with penalty terms, l(i) a is the extended silhouette coefficient with penalty terms, s(i) is the definition of the traditional silhouette coefficient, s(i) a is the silhouette coefficient, λ and γ are both hyperparameters, K is the number of clusters, N is the total number of samples, C k is the cluster to which sample i belongs, is the newly added cluster to which sample i belongs, and σ and u are the standard deviation and mean of the number of samples in the current clustering cluster respectively.
[0072] Since there are no clusters from the previous iteration in the first iteration, the number of clusters is selected by the first silhouette coefficient in the first iteration, and the number of clusters is selected by the second silhouette coefficient in subsequent iterations. The former constrains the number of samples in each cluster during clustering to be as balanced as possible, which is beneficial for clustering; the latter constrains the number of samples in the newly added clusters during clustering to be as small as possible, which is beneficial for mining new long-tail intents in practical applications. λ and γ are the hyperparameters of the above two penalty terms respectively.
[0073] Step 103: Based on the K-means clustering algorithm, cluster the unlabeled data according to the number of clusters to generate a clustering result, and align the clustering result with the true labels to obtain the aligned labels for discovering new intents.
[0074] Step 104: Train a classifier according to the clustering result and the known intent data to obtain the pseudo-labels of the classifier.
[0075] Step 105: Calculate the KL divergence between the aligned labels and the pseudo-labels to update the known intent data.
[0076] It should be noted that, first, assume that the aligned labels and the pseudo-labels follow probability distributions P and Q, and calculate the KL divergence between the distributions of the aligned labels and the pseudo-labels according to the fifth formula. The smaller the KL divergence, the closer the distributions of the aligned labels and the pseudo-labels are, indicating that the clustering effect is better, and the distinction between the new intent and the known intent is clearer. If the current KL divergence is less than the KL divergence in the previous iteration, then retain the current newly added labels, that is, update the known intent data, and use it as the known intent data in the next iteration. Otherwise, return to the previous round of labels. The fifth preset formula is:
[0077]
[0078] where P and Q are probability distributions, and both i and j are samples.
[0079] Step 106: Repeat steps 101 to 105 until no new intents are added, and then output the aligned labels.
[0080] It should be noted that by repeating steps 101 to 105, continuously iterating clustering and updating the known intent data, as Figure 2 shown, is the model block diagram of iterative update. In this embodiment, a training mode of iteratively updating intents with known intent data is introduced. When no new intents are added for several consecutive times, the iteration stops, and the aligned labels are output, that is, the discovered new intents are output.
[0081] Furthermore, before step 104, it includes: adjusting the number of classifier labels according to the number of clustering labels.
[0082] It should be noted that before training the classifier with the clustering results and known intent data, the number of classifier labels needs to be adjusted first. Specifically, if the number of clustering labels is greater than the number of classifier labels, the classifier labels are increased; otherwise, the current number of classifier labels is maintained, so as to ensure the smooth progress of training.
[0083] Further, step 104 includes:
[0084] Calculating the joint loss based on the known intent data and the alignment labels;
[0085] Updating the classifier parameters according to the joint loss to obtain the pseudo-labels of the classifier.
[0086] The joint loss consists of two parts. The first part is the cross-entropy loss between the output of the classifier and the labeled known intent data, which can ensure that the classifier accurately classifies the known intent data. The second part is the cross-entropy loss between the output of the classifier and the alignment labels, enabling the classifier to obtain the classification ability for new intents.
[0087] Further, step 103 includes:
[0088] Based on the K-means clustering algorithm, clustering the unlabeled data according to the number of clusters to generate clustering results;
[0089] Aligning the clustering results and the true labels through the Hungarian algorithm to obtain the alignment labels for discovering new intents.
[0090] Further, step 101 includes:
[0091] Extracting the feature vectors of the known intent data based on the BERT pre-trained language model;
[0092] Inputting the feature vectors into the classifier to obtain prediction labels;
[0093] Calculating the cross-entropy loss between the prediction labels and the true labels;
[0094] Updating the classifier parameters according to the cross-entropy loss.
[0095] This embodiment can use a large-scale pre-trained language model based on Transformer to extract the features of the input text, such as BERT, so that the extracted feature vectors are relatively comprehensive. Inputting the obtained feature vectors into the classifier to obtain prediction labels, and then calculating the cross-entropy loss between the prediction labels and the true labels to update the classifier parameters, preparing for subsequent iterative training.
[0096] Further, after step 106 includes:
[0097] Converting the implicit alignment labels into explicit intent labels through the intent label generator.
[0098] Since the new intents obtained by clustering are in the form of implicit IDs, it is usually necessary to manually observe and analyze various types of data, and then give understandable explicit labels for use in subsequent intent recognition tasks and interaction designs of the phone assistant. To save labor and time costs, in this embodiment, an intent label generator can be used to automatically generate explicit intent labels from implicit alignment labels. The specific steps for generating intent labels are as follows:
[0099] 1. Perform syntactic dependency analysis on various types of input texts, extract the verb-object relationships in the sentences, and form preliminary intent labels of "verb - noun".
[0100] 2. Count the frequencies of the preliminary intent labels in each category, and select the high-frequency intent labels as the final intent labels (Intent labels) for this category. Specifically, in the case where there are no high-frequency "verb - noun" labels, that is, when a verb or a noun is missing, select the high-frequency noun or verb as the final intent label for this category.
[0101] In this embodiment, the classifier is pre-trained according to the known intent data first, and then the number of clusters is selected through the optimized silhouette coefficient. The clustering effect is good. The mode of combining the known intent data and the unlabeled data to train the classifier uses the known intent data of the previous round as the supervision signal during iteration, continuously updates the known intent data until no new intents are added, then stops the iteration, and outputs the alignment labels of the discovered new intents. This fully utilizes the known intent data, enhances the information exchange between the classification and clustering processes, is more conducive to guiding the clustering process and accurately and fully discovering new intents, thus solving the technical problems in the prior art that the known intent data is not fully utilized, the difference between the newly added intents and the known intents is not considered, resulting in poor clustering effect and difficulty in accurately and fully discovering new intents.
[0102] The above is a detailed description of an embodiment of a method for discovering new intents based on clustering provided by this application. The following is a detailed description of an embodiment of a device for discovering new intents based on clustering provided by this application. The device for discovering new intents based on clustering described below can be mutually corresponding and referred to with the method for discovering new intents based on clustering described above.
[0103] Please refer to Figure 3 , this application embodiment provides a device for discovering new intents based on clustering, including:
[0104] A preprocessing unit 201, configured to pre-train a classifier according to known intent data.
[0105] A selection unit 202, configured to select the number of clusters according to a preset silhouette coefficient.
[0106] The clustering unit 203 is used to cluster the unlabeled data according to the number of clusters based on the K-means clustering algorithm to generate a clustering result, and align the clustering result with the true label to obtain the aligned label for discovering new intents.
[0107] The training unit 204 is used to train the classifier according to the clustering result and the known intent data to obtain the pseudo-labels of the classifier.
[0108] The calculation unit 205 is used to calculate the KL divergence between the aligned label and the pseudo-label to update the known intent data.
[0109] The output unit 206 is used to output the aligned label when no new intent is added.
[0110] Furthermore, the selection unit 202 is specifically used for:
[0111] Selecting the number of clusters according to the first silhouette coefficient and / or the second silhouette coefficient.
[0112] The first silhouette coefficient is:
[0113]
[0114] The second silhouette coefficient is:
[0115]
[0116] Among them, l(i) is the silhouette coefficient with penalty term, l(i) a is the extended silhouette coefficient with penalty term, s(i) is the definition of the traditional silhouette coefficient, s(i) a is the silhouette coefficient, λ and γ are both hyperparameters, K is the number of clusters, N is the total number of samples, C k is the cluster to which the sample i belongs, is the newly added cluster to which the sample i belongs, σ and u are the standard deviation and mean of the number of samples in the current clustering cluster respectively.
[0117] Furthermore, it further includes an adjustment unit for adjusting the number of classifier labels according to the number of clustering labels.
[0118] Furthermore, the training unit 204 includes:
[0119] The first calculation subunit is used to calculate the joint loss according to the known intent data and the aligned label.
[0120] The first update subunit is used to update the classifier parameters according to the joint loss to obtain the pseudo-labels of the classifier.
[0121] Furthermore, the clustering unit 203 includes:
[0122] A clustering subunit, configured to cluster unlabeled data based on the K-means clustering algorithm according to the number of clusters to generate a clustering result.
[0123] An alignment subunit, configured to align the clustering result and the true labels through the Hungarian algorithm to obtain alignment labels for discovering new intents.
[0124] Further, the preprocessing unit 201 includes:
[0125] An extraction subunit, configured to extract feature vectors of known intent data based on the BERT pre-trained language model.
[0126] An input subunit, configured to input the feature vectors into a classifier to obtain predicted labels.
[0127] A second calculation subunit, configured to calculate the cross-entropy loss between the predicted labels and the true labels.
[0128] A second update subunit, configured to update the classifier parameters according to the cross-entropy loss.
[0129] Further, it further includes a conversion unit, configured to convert the implicit alignment labels into explicit intent labels through an intent label generator.
[0130] Figure 4 An example of the entity structure diagram of an electronic device. As Figure 4 shown, the present invention further provides an electronic device, which may include: a processor 310, a communication interface 320, a memory 330, and a communication bus 340. Among them, the processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 can call a computer program in the memory 330 to execute the steps of a new intent discovery method based on clustering, for example, including:
[0131] Pre-train a classifier according to known intent data;
[0132] Select the number of clusters according to the preset silhouette coefficient;
[0133] Based on the K-means clustering algorithm, cluster unlabeled data according to the number of clusters to generate a clustering result, and align the clustering result and the true labels to obtain alignment labels for discovering new intents;
[0134] Train a classifier according to the clustering result and known intent data to obtain pseudo-labels of the classifier;
[0135] Calculate the KL divergence between the alignment labels and the pseudo-labels to update the known intent data;
[0136] Repeat the above steps until no new intention is added, and then output the alignment labels.
[0137] In addition, when the logic instructions in the above-mentioned memory 330 can be implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in the various embodiments of the present invention. The foregoing storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs, etc., which can store program codes.
[0138] On the other hand, an embodiment of the present application further provides a computer-readable storage medium. The processor-readable storage medium stores a computer program, and the computer program is used to cause the processor to execute the steps of the methods provided in the above-mentioned various embodiments, for example, including:
[0139] Pre-train the classifier according to the known intention data;
[0140] Select the number of clusters according to the preset silhouette coefficient;
[0141] Based on the K-means clustering algorithm, cluster the unlabeled data according to the number of clusters to generate a clustering result, and align the clustering result with the true label to obtain the alignment labels for discovering new intentions;
[0142] Train the classifier according to the clustering result and the known intention data to obtain the pseudo-labels of the classifier;
[0143] Calculate the KL divergence between the alignment labels and the pseudo-labels to update the known intention data;
[0144] Repeat the above steps until no new intention is added, and then output the alignment labels.
[0145] The processor-readable storage medium may be any available medium or data storage device accessible by the processor, including but not limited to magnetic memories (such as floppy disks, hard disks, magnetic tapes, magneto-optical discs (MO), etc.), optical memories (such as CDs, DVDs, BDs, HVDs, etc.), and semiconductor memories (such as ROMs, EPROMs, EEPROMs, non-volatile memories (NANDFLASH), solid-state drives (SSD)).
[0146] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative labor.
[0147] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0148] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A new intention discovery method based on clustering, characterized in that Including: S101. Pre-train the classifier according to the known intent text data; S102. Select the number of clusters according to the preset silhouette coefficient, including: Select the number of clusters according to the first silhouette coefficient and / or the second silhouette coefficient; The first silhouette coefficient is: The second silhouette coefficient is: Among them, l(i) is the silhouette coefficient with penalty term, l(i) a is the extended silhouette coefficient with penalty term, s(i) is the definition of the traditional silhouette coefficient, both λ and γ are hyperparameters, K is the number of clusters, N is the total number of samples, C k is the cluster to which sample i belongs, s(i)a is the silhouette coefficient, is the newly added cluster to which sample i belongs, σ and u are the standard deviation and mean of the number of samples in the current clustering cluster respectively. The number of clusters is selected by the first silhouette coefficient in the first iteration, and the number of clusters is selected by the second silhouette coefficient in subsequent iterations; S103. Based on the K-means clustering algorithm, cluster the unlabeled data according to the number of clusters to generate a clustering result, and align the clustering result with the true label to obtain an alignment label for discovering new intents; S104. Train the classifier according to the clustering result and the known intent text data to obtain the pseudo-label of the classifier; S105. Calculate the KL divergence between the alignment label and the pseudo-label to update the known intent text data; S106. Repeat steps S101 to S105 until no new intents are added, and output the alignment label.
2. The method for discovering new intents based on clustering according to claim 1, wherein Before the step of training the classifier according to the clustering result and the known intent text data to obtain the pseudo-label of the classifier, it includes: Adjust the number of classifier labels according to the number of cluster labels.
3. The method for discovering new intents based on clustering according to claim 2, wherein The step of training the classifier according to the clustering result and the known intent text data to obtain the pseudo-label of the classifier includes: Calculate the joint loss according to the known intent text data and the alignment label; Update the classifier parameters according to the joint loss to obtain the pseudo-label of the classifier.
4. The method for discovering new intents based on clustering according to claim 1, wherein, The step of, based on the K-means clustering algorithm, clustering the unlabeled data according to the number of clusters to generate a clustering result, and aligning the clustering result with the true label to obtain an alignment label for discovering new intents includes: Based on the K-means clustering algorithm, cluster the unlabeled data according to the number of clusters to generate a clustering result; Align the clustering result with the true label through the Hungarian algorithm to obtain an alignment label for discovering new intents.
5. The new intention discovery method based on clustering according to claim 1, wherein The step of pre-training the classifier according to the known intent text data includes: Extract the feature vector of the known intent text data based on the BERT pre-trained language model; Input the feature vector into the classifier to obtain a predicted label; Calculate the cross-entropy loss between the predicted label and the true label; Update the classifier parameters according to the cross-entropy loss.
6. The method for discovering new intents based on clustering according to claim 1, wherein After the step of outputting the alignment label until no new intents are added, it includes: Convert the implicit alignment label into an explicit intent label through an intent label generator.
7. A new intention discovery device based on clustering, characterized in that, Including: A preprocessing unit for pre-training the classifier according to the known intent text data; A selection unit for selecting the number of clusters according to the preset silhouette coefficient, including: Select the number of clusters according to the first silhouette coefficient and / or the second silhouette coefficient; The first silhouette coefficient is: The second silhouette coefficient is: Among them, l(i) is the silhouette coefficient with penalty term, l(i) a is the extended silhouette coefficient with penalty term, s(i) is the definition of the traditional silhouette coefficient, both λ and γ are hyperparameters, K is the number of clusters, N is the total number of samples, C k is the cluster to which sample i belongs, s(i)a is the silhouette coefficient, is the newly added cluster to which sample i belongs, σ and u are respectively the standard deviation and mean of the number of samples in the current clustering cluster. The number of clusters is selected by the first silhouette coefficient in the first iteration, and the number of clusters is selected by the second silhouette coefficient in subsequent iterations; A clustering unit for, based on the K-means clustering algorithm, clustering the unlabeled data according to the number of clusters to generate a clustering result, and aligning the clustering result with the true label to obtain an alignment label for discovering new intents; A training unit for training the classifier according to the clustering result and the known intent text data to obtain the pseudo-label of the classifier; A calculation unit, configured to calculate the KL divergence between the alignment label and the pseudo label to update the known intent text data; An output unit, configured to output the alignment label when no new intent is added.
8. An electronic device, comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the clustering-based new intent discovery method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the steps of the clustering-based new intent discovery method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Intention recognition method and device
CN111079448A
Cross-domain target re-identification method based on feature adversarial learning and self-similarity clustering
CN111738172A