Clustering result interpretation text generation method and device, equipment and storage medium
By combining intra-cluster features and domain knowledge to generate personalized explanatory text for clustering results, the problem of explanations not fitting the application scenarios in existing technologies is solved, and the interpretability and application effect of clustering results are improved.
Patent Information
- Application Number
- CN202510538309.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-09-05
AI Technical Summary
The clustering result interpretation methods in existing technologies fail to incorporate relevant domain knowledge, resulting in the generated explanations not being suitable for specific application scenarios.
By obtaining the intra-cluster features of the clustering results, combining them with the pre-built domain knowledge base and large language model, personalized explanatory text is generated. The feature description text and domain knowledge are used to construct prompt text, which is input into the large language model to generate explanatory text, and the model is optimized through user feedback.
It enables the generation of personalized clustering result explanations based on different application fields or scenarios, enhancing users' understanding and application of clustering results.
Smart Images

Figure CN120596673A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of artificial intelligence technology, and in particular to a method, apparatus, device, and storage medium for generating explanatory text of clustering results. Background Art
[0002] With the advent of the big data era, cluster analysis, as an important data mining technique, has been widely used in various fields, such as social network analysis and bioinformatics. Cluster analysis can divide large amounts of data into distinct groups, thereby revealing the data's inherent structure and characteristics. In fields such as business, healthcare, and the social sciences, clustering results can help decision makers identify different customer groups, disease types, or social groups. By interpreting clustering results, decision makers can formulate more precise and effective strategies. However, traditional clustering methods only provide clustering results, but cannot intuitively explain the meaning and characteristics of each cluster group. This makes them difficult to meet the needs of business scenarios. Therefore, interpretable explanations of clustering results are needed.
[0003] Existing methods use decision trees to fit clustering results. This method leverages the inherent interpretability of decision trees to explain clustering. However, this method fails to incorporate relevant domain knowledge into the generated explanations, resulting in explanations that are not sufficiently tailored to specific application scenarios. Therefore, there is an urgent need for a method to generate explanations for clustering results that can generate personalized explanations tailored to different application domains or scenarios. Summary of the Invention
[0004] In response to the above-mentioned problems in the prior art, the purpose of the embodiments of this specification is to provide a method, device, equipment and storage medium for generating explanation text of clustering results, so as to solve the problem that the prior art does not consider combining relevant field knowledge to generate explanations, resulting in the generated explanations not being suitable for specific application scenarios.
[0005] In order to solve the above technical problems, the specific technical solutions of the embodiments of this specification are as follows:
[0006] On the one hand, an embodiment of this specification provides a method for generating an explanation text of a clustering result, the method comprising:
[0007] Get the clustering results corresponding to the business data set;
[0008] Performing feature extraction on each cluster in the clustering result to obtain intra-cluster features of each cluster;
[0009] Generating a feature description text corresponding to each cluster according to the intra-cluster features of each cluster;
[0010] Determining domain knowledge corresponding to each cluster based on the feature description text of each cluster and a pre-built domain knowledge base, wherein the domain knowledge base includes a plurality of correspondences between feature description texts and domain knowledge;
[0011] According to the feature description text and domain knowledge of each cluster, a prompt text is constructed and input into a pre-trained large language model to obtain an explanation text for each cluster in the clustering result.
[0012] Furthermore, the feature extraction is performed on each cluster in the clustering result to obtain the intra-cluster features of each cluster, including:
[0013] Determine a cluster label for each cluster according to the clustering result;
[0014] Calculating the information gain between each feature in each cluster and the cluster label;
[0015] Feature selection is performed based on the information gain to obtain intra-cluster features of each cluster.
[0016] Furthermore, generating a feature description text corresponding to each cluster according to the intra-cluster features of each cluster includes:
[0017] Determine the type of features within each cluster;
[0018] Calculate the eigenvalue of each intra-cluster feature in each cluster to obtain the intra-cluster eigenvector of each cluster;
[0019] The intra-cluster feature vector of each cluster and the type of the feature within each cluster are input into a text generation model to obtain a feature description text corresponding to each cluster.
[0020] Furthermore, the determining of the domain knowledge corresponding to each cluster based on the feature description text of each cluster and the pre-built domain knowledge base includes:
[0021] Performing representation learning on the domain knowledge base to obtain a first text feature vector corresponding to each domain knowledge in the domain knowledge base;
[0022] Calculating a second text feature vector corresponding to the feature description text of each cluster;
[0023] Calculating the similarity between the first text feature vector and the second text feature vector;
[0024] The domain knowledge with a similarity greater than a preset threshold is used as the domain knowledge corresponding to each cluster.
[0025] Furthermore, the prompt text constructed based on the feature description text and domain knowledge of each cluster is input into the pre-trained large language model to obtain the explanation text of each cluster in the clustering result, including:
[0026] Fill the feature description and domain knowledge of each cluster into the placeholder corresponding to the pre-created structured text template to obtain the prompt text;
[0027] The prompt text is input into a pre-trained large language model to generate an explanation text for each cluster in the clustering result.
[0028] Furthermore, the method further comprises:
[0029] receiving user feedback on the interpretation text;
[0030] If the feedback is that the requirements are not met, the prompt text is optimized using the thought chain to obtain a new prompt text, and the new prompt text is input into the large language model to generate a new explanation text;
[0031] If the feedback is that the requirements are met, the explanation text and the prompt text are used as training samples to retrain the large language model, and the trained large language model is used as a new large language model to generate the explanation text.
[0032] On the other hand, an embodiment of this specification provides a device for generating an explanation text of a clustering result, the device comprising:
[0033] The acquisition module is used to obtain the clustering results corresponding to the business data set;
[0034] A feature extraction module is used to extract features from each cluster in the clustering result to obtain intra-cluster features of each cluster;
[0035] A feature description generating module, configured to generate a feature description text corresponding to each cluster according to the intra-cluster features of each cluster;
[0036] A determination module, configured to determine the domain knowledge corresponding to each cluster based on the feature description text of each cluster and a pre-built domain knowledge base, wherein the domain knowledge base includes a plurality of correspondences between the feature description texts and the domain knowledge;
[0037] The explanation text generation module is used to construct a prompt text based on the feature description text and domain knowledge of each cluster and input it into the pre-trained large language model to obtain the explanation text of each cluster in the clustering result.
[0038] On the other hand, an embodiment of this specification further provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein when the computer program is run by the processor, the computer program executes instructions of any one of the above methods.
[0039] On the other hand, an embodiment of the present specification further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor of a computer device, executes instructions of any one of the above methods.
[0040] On the other hand, the embodiments of this specification further provide a computer program product, which, when executed by a processor of a computer device, executes instructions of any one of the above methods.
[0041] By adopting the above technical solution, the embodiment of this specification provides a method for generating explanatory text for clustering results. By combining the generation capability and domain knowledge of a large language model, it can automatically generate corresponding explanatory text for the clustering results, and construct prompt text as the input of the large language model based on the intra-cluster features of each cluster and the corresponding domain knowledge, so that the large language model can generate personalized explanatory text according to different application fields or scenarios, thereby providing personalized explanations for different clustering results according to specific business scenarios and needs, thereby enhancing the user's understanding and application of the clustering results.
[0042] The above description is only an overview of the technical solutions of some embodiments of this specification. In order to more clearly understand the technical means of some embodiments of this specification, they can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiments of this specification more obvious and easy to understand, the following specifically cites preferred embodiments and provides detailed descriptions in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0044] Figure 1 A schematic diagram showing the steps of a method for generating an explanation text of clustering results in some embodiments of this specification is shown;
[0045] Figure 2 A schematic diagram showing the steps of extracting features from each cluster in the clustering results in some embodiments of this specification is shown;
[0046] Figure 3 A schematic diagram showing the steps of generating feature description text corresponding to each cluster in some embodiments of this specification is shown;
[0047] Figure 4A schematic diagram showing the steps of determining the domain knowledge corresponding to each cluster in some embodiments of this specification is shown;
[0048] Figure 5 A schematic diagram showing the steps of obtaining the explanatory text of each cluster in the clustering results in some embodiments of this specification is shown;
[0049] Figure 6 A schematic diagram showing another step of a method for generating an explanation text of a clustering result in some embodiments of this specification;
[0050] Figure 7 A schematic diagram showing the structure of a device for generating an explanation text of a clustering result in some embodiments of this specification is shown;
[0051] Figure 8 A schematic structural diagram of a computer device in this specification is shown.
[0052] Description of the accompanying symbols:
[0053] 701. Get module;
[0054] 702. Feature extraction module;
[0055] 703. Feature description generation module;
[0056] 704. Determine module;
[0057] 705. Explanation text generation module;
[0058] 802. Computer equipment;
[0059] 804, processor;
[0060] 806, memory;
[0061] 808, driving mechanism;
[0062] 810, input / output module;
[0063] 812. Input devices;
[0064] 814. Output device;
[0065] 816. Presentation equipment;
[0066] 818. Graphical User Interface;
[0067] 820, network interface;
[0068] 822, communication link;
[0069] 824. Communication bus. DETAILED DESCRIPTION
[0070] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this specification.
[0071] It should be noted that the terms "first," "second," and the like in this specification, the claims, and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this specification described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products, or devices.
[0072] In order to solve the above problems, the present invention provides a method for generating an explanation text of clustering results. Figure 1 It is a schematic diagram of the steps of a method for generating an explanation text of a clustering result provided in an embodiment of this specification. This specification provides the method operation steps described in the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many steps, and does not represent the only execution order. When the actual system or device product is executed, it can be executed in the order or in parallel according to the method shown in the embodiment or the accompanying drawings. Specifically, Figure 1 As shown, the method may include:
[0073] S101: Obtain clustering results corresponding to a business data set.
[0074] In the embodiments of this specification, the method for generating an explanatory text for the clustering results provided in this specification is described in detail using the financial business application field as an example. The business data set refers to the data from the feature source used for clustering, which can be obtained from various business data sources, mainly including: basic user data, such as name, gender, age, income, residential address, etc., financial transaction data, such as bank account transaction records, consumption habits, repayment records, etc., credit rating data, such as loan application records, repayment records, overdue records, etc., user behavior data, such as online payment records, financial product purchase records, risk preferences, etc. In other embodiments, more types of data can be obtained according to specific application scenarios or needs.
[0075] Because each data dimension is different and financial data has multidimensional characteristics and complexity, feature engineering processing must be performed on the data before clustering the financial business data set. In this embodiment, the processing steps include missing value processing, outlier processing, data normalization, etc. The specific steps are as follows:
[0076] a. Handling Missing Values: Because variable data must conform to real-world financial scenarios, default values such as "0" and "1" should not be used directly when handling missing values. Variables with high missing rates can be deleted directly, while interpolation methods can be used to fill missing values for data with low missing rates. In the financial field, Lagrange interpolation or time series interpolation methods may be more suitable for dynamic data. Additionally, model-based missing value handling methods (such as KNN interpolation and random forest interpolation) can more accurately predict the filled values and preserve the integrity of the data structure.
[0077] b. Handling outliers: Detect and handle outliers. You can use outlier detection methods to identify outliers, and then select appropriate methods to handle them (repair or remove outliers, etc.). This specification does not specifically limit the specific outlier handling method.
[0078] c. Data conversion:
[0079] Feature encoding: Convert non-numeric features to numeric values. For example, categorical variables can be converted to numeric values using methods such as one-hot encoding and label encoding.
[0080] Feature Scaling: Scaling features to ensure that the values of different features have similar ranges. Common methods include min-max scaling and normalization. For time series financial data, normalization can also be used to remove seasonality or long-term trends.
[0081] After preprocessing the business data set, clustering is performed on the business data set using a clustering algorithm. Preferably, in the embodiment of this specification, K-Means clustering is used to cluster the preprocessed business data set to obtain a clustering result.
[0082] S102: Extracting features from each cluster in the clustering result to obtain intra-cluster features of each cluster.
[0083] It can be understood that in order to retain the key features that can distinguish different clusters, for each cluster obtained by clustering, it is necessary to extract the features within it that can clearly distinguish it from other clusters, so that targeted explanatory text can be generated based on the features of each cluster. Figure 2 , extracting features from each cluster in the clustering result to obtain intra-cluster features of each cluster specifically includes the following steps:
[0084] S201: Determine a cluster label for each cluster according to the clustering result;
[0085] S202: Calculating the information gain between each feature in each cluster and the cluster label;
[0086] S203: Perform feature selection according to the information gain to obtain intra-cluster features of each cluster.
[0087] For each cluster, a label that represents the characteristics of the cluster needs to be determined. This label can be based on certain statistical characteristics of the data within the cluster (such as the mean, median, mode, etc.), or it can be determined based on certain business logic or domain knowledge. For example, if the data within the cluster mainly represents a certain type of financial product transaction, then the cluster label can be "high-yield financial product transaction cluster." In other embodiments, to improve feature extraction efficiency, as shown in Table 1, the cluster label of each cluster can be directly represented by a number, such as Cluster 1, Cluster 2, Cluster 3, etc.
[0088] Table 1
[0089] Customer Number age XX product purchase records Cluster labels 1 25 1 1 2 30 0 1 3 35 1 2 4 40 0 3 5 50 1 2
[0090] Next, the information gain between the features within each cluster and the cluster label needs to be determined. Information gain reflects each feature's ability to distinguish between different cluster labels, thereby selecting features that significantly differentiate from the remaining clusters. Taking age as an example, the distribution probability of each age value in the business dataset is first calculated. Based on this distribution probability, the conditional probability of cluster label 1, 2, or 3 is then calculated for each age value. For example, for age = 25, the probability of cluster label 1 is 0.8. The conditional probabilities for each age value are then substituted into the conditional entropy formula to calculate the conditional entropy for each age value. Based on this conditional entropy, the information gain between each age value and the cluster label can be calculated. The greater the information gain, the stronger the feature's ability to distinguish between features within and outside the cluster. In this embodiment, the calculated information gain can be compared with a preset threshold. Features with information gains below the threshold are eliminated, thereby selecting features that significantly differentiate from the remaining clusters. In other embodiments, to reduce feature redundancy, in addition to considering information gain, the correlation between features can also be calculated when selecting features within a cluster. If the features are highly correlated, only one is selected as the representative.
[0091] S103: Generate a feature description text corresponding to each cluster according to the intra-cluster features of each cluster.
[0092] It can be understood that by converting abstract feature data into intuitive text descriptions, it is easier for the large language model to understand the meaning of the data and the significance of the clustering results, thereby enhancing the learning of the large language model on the interpretability of the clustering results. Figure 3 The step of generating a feature description text corresponding to each cluster according to the intra-cluster features of each cluster specifically includes the following steps:
[0093] S301: Determine the type of features within each cluster;
[0094] S302: Calculate the eigenvalue of each intra-cluster feature in each cluster to obtain the intra-cluster eigenvector of each cluster;
[0095] S303: Inputting the intra-cluster feature vector of each cluster and the type of the feature within each cluster into a text generation model to obtain a feature description text corresponding to each cluster.
[0096] It can be understood that the feature descriptions of different types of features are different. In this embodiment, the feature types within a cluster can include numerical features, categorical features, text features, date / time features, and Boolean features. For numerical features, such as age and income, their feature descriptions can be expressed by statistics such as average, maximum, or minimum values. For example, "For cluster 1, the average age is xx years old and the maximum income is xx." For categorical features, such as gender, occupation, credit rating, etc., their feature descriptions can be expressed by extracting the main categories and proportions. For example, "For cluster 1, the information level is mainly concentrated in level A and level B, and 70% of customers are in occupation A." For text features, such as comments and descriptions, these features are composed of text and usually require text processing and analysis. Their feature descriptions can be expressed by text content and text content sentiment. For example, "User comments in this cluster frequently mention product quality and after-sales service, and the overall sentiment is positive." Date / time features, such as purchase date and registration time, represent a point in time or a time period and are typically used in time series analysis. A description might be, "Users in this cluster primarily purchase products on weekends, particularly between 3:00 PM and 5:00 PM." Boolean features, such as membership status and purchase status, have only two possible values (e.g., True / False or 1 / 0) and represent a state or behavior. A description might be, "80% of users in this cluster are members, and most have purchased at least once."
[0097] For each feature within a cluster, its type must first be determined, and then its eigenvalue is calculated based on the type of each feature, and these eigenvalues are combined into a eigenvector to represent each cluster. For example, for numerical features, statistics such as the mean, median, and standard deviation are calculated. For categorical features, the frequency or proportion of each category is calculated. For text features, text processing tools are used to extract keywords, phrases, or perform sentiment analysis. For date / time features, the average value, distribution range, or time series trend of important time points is calculated. For Boolean features, the ratio of True and False can be calculated. For each data cluster, its intra-cluster eigenvector and feature type are input into the text generation model, and the text generation model generates text describing the cluster features based on the input eigenvector and feature type. In the embodiments of this specification, the text generation model can be any model that can generate text, such as BERT, Transformer, or GAN.
[0098] S104: Determine the domain knowledge corresponding to each cluster according to the feature description text of each cluster and a pre-built domain knowledge base, wherein the domain knowledge base includes a plurality of correspondences between feature description texts and domain knowledge.
[0099] In this embodiment, domain knowledge is collected and organized through various channels, such as internal enterprise knowledge bases, professional books, academic papers, industry reports, expert interviews, etc., to ensure that the collected knowledge is accurate, comprehensive, and in line with standards and specifications in the field. Feature extraction is performed on the collected domain knowledge to identify the key features of each knowledge point. Then, based on the extracted features, natural language generation technology is used to generate corresponding feature description texts, and the generated feature description texts are associated with the corresponding domain knowledge through databases or knowledge graphs to form a corresponding relationship. The corresponding relationship is stored to obtain a domain knowledge base. In other embodiments, inference rules and algorithms can be used to infer domain knowledge, dig out hidden knowledge and relationships, and further improve the domain knowledge base. As the field develops and changes, the domain knowledge base is continuously updated to ensure the timeliness and accuracy of the domain knowledge.
[0100] After the domain knowledge base is built, the feature description text of each cluster is matched with the entries in the domain knowledge base to find the domain knowledge that best matches each cluster, such as asset management knowledge for high-net-worth customer groups, risk management knowledge for high-risk customer groups, etc. Applying domain knowledge to clustering results can provide a deeper explanation and context for the data. Figure 4 The process of determining the domain knowledge corresponding to each cluster based on the feature description text of each cluster and the pre-built domain knowledge base includes:
[0101] S401: Performing representation learning on the domain knowledge base to obtain a first text feature vector corresponding to each domain knowledge in the domain knowledge base;
[0102] S402: Calculating a second text feature vector corresponding to the feature description text of each cluster;
[0103] S403: Calculating the similarity between the first text feature vector and the second text feature vector;
[0104] S404: The domain knowledge with a similarity greater than a preset threshold is used as the domain knowledge corresponding to each cluster.
[0105] Specifically, first, text representation learning technology (such as Word2Vec, BERT, and other pre-trained models) is used to convert the text in the domain knowledge base and the feature description text of each cluster into vector representations, obtaining the first text feature vector corresponding to each domain knowledge and the second text feature vector corresponding to the feature description text of each cluster. The text feature vector can capture the semantic information in the text, making similar texts closer in the vector space. Then, for the second text feature vector of the feature description text of each cluster, its cosine similarity with all the first text feature vectors in the domain knowledge base is calculated, and the domain knowledge with a similarity greater than a preset threshold is selected as the domain knowledge corresponding to the cluster. If the similarity of multiple domain knowledge is greater than the threshold, they can be sorted according to the similarity, and the top n domain knowledge with the highest similarity are selected as the final matching results. If some clusters do not find corresponding domain knowledge (i.e., the similarity is not greater than the threshold), it may be necessary to readjust the feature description text of these clusters or update the domain knowledge base to include more relevant knowledge.
[0106] S105: Constructing prompt text based on the feature description text and domain knowledge of each cluster and inputting it into the pre-trained large language model to obtain the explanation text of each cluster in the clustering result.
[0107] Based on the characteristic description text and domain knowledge of each cluster, prompt text is constructed as input. A large language model is used to generate text explaining the clustering results. This can generate text reports, visual charts, or other forms of output to convey the clustering results and their explanations to users or decision makers. Based on the clustering results, personalized marketing strategies can be developed for customers in different clusters. For example, high-net-worth customers with conservative investment strategies can be recommended high-end wealth management products, while young customers with large loan needs can be promoted low-interest loan products.
[0108] Preferably, refer to Figure 5 The prompt text constructed based on the feature description text and domain knowledge of each cluster is input into the pre-trained large language model to obtain the explanation text of each cluster in the clustering result, including:
[0109] S501: Fill the feature description and domain knowledge of each cluster into the placeholder corresponding to the pre-created structured text template to obtain a prompt text;
[0110] S502: Input the prompt text into a pre-trained large language model to generate an explanation text for each cluster in the clustering result.
[0111] In this embodiment, the structured text template contains placeholders for inserting feature descriptions and domain knowledge, for example: "For cluster X, [feature description 1], [feature description 2], [feature description 3], the corresponding domain knowledge includes [domain knowledge 1] and [domain knowledge 2]. Please generate an explanatory text about the cluster based on these feature descriptions and domain knowledge". By filling the corresponding feature descriptions and domain knowledge into the placeholders corresponding to the above structured text template, the prompt text corresponding to each cluster can be obtained. For example: "For cluster 1, the average asset size of the customers is 5 million yuan, the credit rating is mainly concentrated in A and B, and 70% of the customers prefer stable investment. The domain knowledge corresponding to this cluster includes asset management and wealth planning. Please generate an explanatory text about the cluster based on these feature descriptions and background knowledge". The filled prompt text is input into the pre-trained large language model. The large language model is trained with a large amount of text data and can understand and generate coherent and logical text. For example, for the above prompt text, the generated explanation text is: "The customer group of cluster 1 shows distinct characteristics and investment preferences. These characteristics not only reflect their financial status, but also reveal their inclinations in investment choices. The following is a detailed explanation of the cluster: The average asset size of the customers in this cluster is 5 million yuan, which shows that they have relatively strong financial strength. Such an asset size gives them more flexibility and choice when making investment decisions, and also puts forward higher professional and personalized requirements for the services provided by financial institutions. The credit ratings of customers are mainly concentrated in A and B, which reflects their good performance in credit records. A high credit rating usually means that the customer performs well in repayment ability and credit record, which helps them gain more trust and preference in financial institutions. 70% of clients prefer conservative investments, indicating a greater emphasis on risk control and asset preservation in their investment choices. They may prefer financial products with relatively stable returns and relatively low risks, such as bonds, money market funds, and conservative stock funds. Given these clients' large asset holdings, asset management becomes a key area of concern. Financial institutions need to provide them with professional asset management services, including asset allocation, investment strategy development, and risk monitoring, to ensure effective asset management and growth. In addition to asset management, wealth planning is also a key concern for this client group. They may desire comprehensive wealth planning services, including tax planning, estate planning, and insurance planning, to help them better plan and manage their wealth. This explanation can assist relevant business personnel in making decisions and develop personalized marketing strategies for different client groups. For example, high-net-worth clients with conservative investment strategies could be recommended high-end wealth management products, while young clients with large loan needs could be promoted with low-interest loan products.
[0112] In the embodiments of this specification, refer to Figure 6 , the method further comprises:
[0113] S601: receiving user feedback on the interpretation text;
[0114] S602: If the feedback is that the requirement is not met, the prompt text is optimized using a thought chain to obtain a new prompt text, and the new prompt text is input into the large language model to generate a new explanation text;
[0115] S603: If the feedback is that the requirements are met, the explanation text and the prompt text are used as training samples to retrain the large language model, and the trained large language model is used as a new large language model to generate the explanation text.
[0116] Specifically, Chain of Thought (COT) is a prompt text optimization method that improves the model's interpretability through step-by-step reasoning. When applied to interpreting clustering results in the financial field, COT can help large language models more clearly process each logical step, thereby generating more accurate interpretations. The COT optimization steps include:
[0117] 1) Step-by-step guidance: The explanation process is divided into multiple prompts, guiding the model to reason step by step. For example, the model is first guided to identify the main features within the cluster, then in the next step, these features are associated with domain knowledge, and finally a complete explanatory conclusion is generated.
[0118] 2) Refine the logical chain: Through COT, guide the model to first analyze features, then integrate domain knowledge and background, and finally logically derive conclusions. For example, prompt the model to identify the key features of cluster X (such as "credit ratings are concentrated in grades A and B"), prompt the model to integrate domain knowledge (such as "asset management knowledge of high-net-worth clients"), and finally generate a comprehensive explanation that organically combines feature descriptions, background information, and application scenarios.
[0119] 3) Problem decomposition: Break down complex interpretation requirements into smaller subtasks. For example, when interpreting high-risk customer groups, you can first prompt the model to analyze the main risk characteristics and then generate interpretation conclusions based on risk assessment knowledge.
[0120] The prompt text is optimized through thought chaining, such as adjusting the content, improving the logic, etc., and the optimized prompt text is re-input into the large language model to generate a new explanation text. In other embodiments, detailed text feedback from the user on the explanation text can also be obtained, and key information is extracted from the text feedback to construct the prompt text, so that the explanation text generated based on the prompt text is more in line with user needs. If the explanation text meets the user's needs, the explanation text and the corresponding prompt text are used as training samples of the large language model, and the large language model is retrained so that it can better understand the prompt text and generate an explanation text that meets the user's needs. After the training is completed, the new large language model is applied to the subsequent explanation text generation task.
[0121] By adopting the above technical solution, the embodiment of this specification provides a method for generating explanatory text for clustering results. By combining the generation capability and domain knowledge of a large language model, it can automatically generate corresponding explanatory text for the clustering results, and construct prompt text as the input of the large language model based on the intra-cluster features of each cluster and the corresponding domain knowledge, so that the large language model can generate personalized explanatory text according to different application fields or scenarios, thereby providing personalized explanations for different clustering results according to specific business scenarios and needs, thereby enhancing the user's understanding and application of the clustering results.
[0122] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, storage, and display, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. The acquisition, storage, use, and processing of data in the technical solutions described in the embodiments of this application comply with relevant regulations.
[0123] Based on the above-mentioned method for generating an explanation text of a clustering result, an embodiment of this specification also provides a device for generating an explanation text of a clustering result. The device may include a system (including a distributed system), software (application), module, component, server, client, etc. using the method described in the embodiment of this specification and combined with the necessary implementation hardware. Based on the same innovative concept, the device in one or more embodiments provided in the embodiment of this specification is as described in the following embodiments. Since the implementation scheme and method for solving the problem of the device are similar, the implementation of the specific device in the embodiment of this specification can refer to the implementation of the aforementioned method, and the repetitions will not be repeated. As used below, the term "unit" or "module" can implement a combination of software and / or hardware of predetermined functions. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0124] Specifically, Figure 7This is a schematic diagram of the module structure of an embodiment of a device for generating an explanation text of a clustering result provided by an embodiment of this specification, referring to Figure 7 As shown, the embodiment of this specification provides a device for generating an explanation text of a clustering result, including:
[0125] Acquisition module 701, used to obtain the clustering result corresponding to the business data set;
[0126] A feature extraction module 702 is used to extract features from each cluster in the clustering result to obtain intra-cluster features of each cluster;
[0127] A feature description generating module 703 is configured to generate a feature description text corresponding to each cluster based on the intra-cluster features of each cluster;
[0128] A determination module 704 is configured to determine the domain knowledge corresponding to each cluster based on the feature description text of each cluster and a pre-built domain knowledge base, wherein the domain knowledge base includes a plurality of correspondences between the feature description texts and the domain knowledge;
[0129] The explanation text generation module 705 is used to construct a prompt text based on the feature description text and domain knowledge of each cluster and input it into the pre-trained large language model to obtain the explanation text of each cluster in the clustering result.
[0130] The beneficial effects achieved by the device provided in the embodiments of this specification are consistent with the beneficial effects achieved by the above-mentioned method and will not be repeated here.
[0131] Reference Figure 8As shown, based on the above-described method for generating explanatory text based on clustering results, one embodiment of this specification further provides a computer device 802, wherein the above-described method is executed on the computer device 802. The computer device 802 may include one or more processors 804, such as one or more central processing units (CPUs), each of which may implement one or more hardware threads. The computer device 802 may also include any memory 806 for storing any type of information, such as code, settings, data, etc. For example, without limitation, the memory 806 may include any one or more combinations of the following: any type of RAM, any type of ROM, a flash memory device, a hard disk, an optical disk, etc. More generally, any memory may use any technology to store information. Furthermore, any memory may provide volatile or non-volatile retention of information. Furthermore, any memory may represent a fixed or removable component of the computer device 802. In one embodiment, when the processor 804 executes associated instructions stored in any memory or combination of memories, the computer device 802 may perform any operation of the associated instructions. The computer device 802 also includes one or more drive mechanisms 808 for interacting with any storage, such as a hard disk drive mechanism, an optical disk drive mechanism, and the like.
[0132] The computer device 802 may also include an input / output module 810 (I / O) for receiving various inputs (via input devices 812) and for providing various outputs (via output devices 814). A specific output mechanism may include a presentation device 816 and an associated graphical user interface (GUI) 818. In other embodiments, the input / output module 810 (I / O), input devices 812, and output devices 814 may not be included, and the computer device 802 may simply be a computer device in a network. The computer device 802 may also include one or more network interfaces 820 for exchanging data with other devices via one or more communication links 822. One or more communication buses 824 couple the components described above together.
[0133] The communication link 822 may be implemented in any manner, for example, via a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 822 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.
[0134] Corresponding to Figures 1 to 6 In addition to the method shown, an embodiment of this specification also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are executed.
[0135] The embodiment of this specification also provides a computer-readable instruction, wherein when the processor executes the instruction, the program therein causes the processor to execute the following Figures 1 to 6 The method shown.
[0136] The embodiment of this specification also provides a computer program product, including at least one instruction or at least one program, which is loaded and executed by a processor to implement the following Figures 1 to 6 The method shown.
[0137] It should be understood that in the various embodiments of this specification, the size of the serial numbers of the above-mentioned processes does not mean 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 specification.
[0138] It should also be understood that in the embodiments of this specification, the term "and / or" is merely a description of the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. Furthermore, the character " / " in this specification generally indicates that the associated objects are in an "or" relationship.
[0139] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this specification.
[0140] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0141] In the several embodiments provided in this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. 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 mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or can be an electrical, mechanical or other form of connection.
[0142] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this specification.
[0143] In addition, the functional units in the various embodiments of this specification may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0144] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this specification is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of this specification. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0145] Specific embodiments are used in this specification to illustrate the principles and implementation methods of this specification. The description of the above embodiments is only used to help understand the methods and core ideas of this specification. At the same time, for those skilled in the art, based on the ideas of this specification, there will be changes in the specific implementation methods and application scope. In summary, the contents of this specification should not be understood as limiting this specification.
Claims
1. A method for generating explanatory text of clustering results, characterized in that: The method comprises: Get the clustering results corresponding to the business data set; Performing feature extraction on each cluster in the clustering result to obtain intra-cluster features of each cluster; Generating a feature description text corresponding to each cluster according to the intra-cluster features of each cluster; Determining domain knowledge corresponding to each cluster based on the feature description text of each cluster and a pre-built domain knowledge base, wherein the domain knowledge base includes a plurality of correspondences between feature description texts and domain knowledge; According to the feature description text and domain knowledge of each cluster, a prompt text is constructed and input into a pre-trained large language model to obtain an explanation text for each cluster in the clustering result.
2. The method according to claim 1, characterized in that The feature extraction for each cluster in the clustering result to obtain the intra-cluster features of each cluster includes: Determine a cluster label for each cluster according to the clustering result; Calculating the information gain between each feature in each cluster and the cluster label; Feature selection is performed based on the information gain to obtain intra-cluster features of each cluster.
3. The method according to claim 1, characterized in that Generating a feature description text corresponding to each cluster according to the intra-cluster features of each cluster includes: Determine the type of features within each cluster; Calculate the eigenvalue of each intra-cluster feature in each cluster to obtain the intra-cluster eigenvector of each cluster; The intra-cluster feature vector of each cluster and the type of the feature within each cluster are input into a text generation model to obtain a feature description text corresponding to each cluster.
4. The method according to claim 1, wherein The process of determining the domain knowledge corresponding to each cluster based on the feature description text of each cluster and a pre-built domain knowledge base includes: Performing representation learning on the domain knowledge base to obtain a first text feature vector corresponding to each domain knowledge in the domain knowledge base; Calculating a second text feature vector corresponding to the feature description text of each cluster; Calculating the similarity between the first text feature vector and the second text feature vector; The domain knowledge with a similarity greater than a preset threshold is used as the domain knowledge corresponding to each cluster.
5. The method according to claim 1, wherein The prompt text constructed based on the feature description text and domain knowledge of each cluster is input into the pre-trained large language model to obtain the explanation text of each cluster in the clustering result, including: Fill the feature description and domain knowledge of each cluster into the placeholder corresponding to the pre-created structured text template to obtain the prompt text; The prompt text is input into a pre-trained large language model to generate an explanation text for each cluster in the clustering result.
6. The method according to claim 1, characterized in that The method further comprises: receiving user feedback on the interpretation text; If the feedback is that the requirements are not met, the prompt text is optimized using the thought chain to obtain a new prompt text, and the new prompt text is input into the large language model to generate a new explanation text; If the feedback is that the requirements are met, the explanation text and the prompt text are used as training samples to retrain the large language model, and the trained large language model is used as a new large language model to generate the explanation text.
7. A device for generating an explanation text of clustering results, characterized in that: The device comprises: The acquisition module is used to obtain the clustering results corresponding to the business data set; A feature extraction module is used to extract features from each cluster in the clustering result to obtain intra-cluster features of each cluster; A feature description generating module, configured to generate a feature description text corresponding to each cluster according to the intra-cluster features of each cluster; A determination module, configured to determine the domain knowledge corresponding to each cluster based on the feature description text of each cluster and a pre-built domain knowledge base, wherein the domain knowledge base includes a plurality of correspondences between the feature description texts and the domain knowledge; The explanation text generation module is used to construct a prompt text based on the feature description text and domain knowledge of each cluster and input it into the pre-trained large language model to obtain the explanation text of each cluster in the clustering result.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The method comprises at least one instruction or at least one program, wherein the at least one instruction or the at least one program is loaded and executed by a processor to implement the method according to any one of claims 1 to 6.