A machine learning interpretable method, device and storage medium
By sampling and model training based on feature correlation in the LIME algorithm, the problem of innocence of interpretation results caused by ignoring feature correlation in the LIME algorithm is solved, and a higher fidelity and interpretability of interpretation results are achieved.
Patent Information
- Application Number
- CN202011241293.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-09
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2041-04-25
AI Technical Summary
During the sampling process, the LIME algorithm assumes that features are independent of each other, resulting in ignoring feature correlations and losing useful information, which affects the fidelity and interpretability of the interpreted results.
Sampling is performed based on the feature correlation of the sample to be explained, and the sample set is obtained. These sample values are used for model training to obtain an interpretable model, and then the sample to be explained.
By considering feature correlation, the number of samples is smaller, and the fitted interpretable model is stronger with the original sample fidelity, which improves the fidelity and interpretability of the interpreted results.
Smart Images

Figure CN112561074B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an interpretable machine learning method, device and computer-readable storage medium. Background Art
[0002] The main idea of the model-agnostic local interpretability algorithm (LIME) is to use an interpretable model (such as a linear model) to locally approximate the prediction of the target black box model. LIME uses a feature random sampling method in the local sampling process, that is, it assumes that the features of the signal are independent of each other, and randomly extracts the features during sampling. This sampling method is simple and intuitive.
[0003] However, for images, natural languages, and structured data, there is often a strong correlation between features. If feature random sampling is used, the feature correlation will be ignored, which will inevitably lead to the loss of a large amount of useful information, thus affecting the fidelity and interpretability of the interpretation results. Summary of the invention
[0004] In order to solve the problems existing in the sampling scheme in the LIME algorithm, the embodiments of the present invention creatively propose a machine learning interpretable method, device and computer-readable storage medium.
[0005] According to a first aspect of the present invention, there is provided an interpretable method for machine learning, the method comprising: obtaining a sample to be interpreted; sampling the sample to be interpreted based on the feature correlation of the sample to be interpreted to obtain a sampling set including a number of sampling values; performing model training using the number of sampling values to obtain an interpretable model; and interpreting the sample to be interpreted using the interpretable model to obtain an interpretation result.
[0006] According to an embodiment of the present invention, the sample to be interpreted includes at least one of the following data types: image data, natural language, and structured data.
[0007] According to one embodiment of the present invention, model training is performed using the several sampling values to obtain an interpretable model, including: performing linear fitting on the several sampling values to obtain a linear model; correspondingly, the interpretable model is used to interpret the sample to be interpreted, including: obtaining a classification result of the sample to be interpreted through a classifier; and using the linear model to interpret the classification result.
[0008] According to one embodiment of the present invention, the sample to be interpreted is an original image; the sample to be interpreted is sampled based on the feature correlation of the sample to be interpreted to obtain a sampling set including several sampling values, including: performing image segmentation on the original image to obtain a super-pixel block image; converting the super-pixel block image into an undirected graph; finding all clusters in the undirected graph, the cluster is a subset of the undirected graph, and any two vertices in the subset are connected by an edge.
[0009] According to one embodiment of the present invention, converting a superpixel block image into an undirected graph includes: corresponding the superpixel block image to the vertices of the undirected graph; if there are two adjacent superpixel block images, connecting the corresponding two vertices in the undirected graph through an undirected edge.
[0010] According to an embodiment of the present invention, a deep optimization search algorithm is used to find all the clusters in the undirected graph.
[0011] According to the second aspect of the present invention, there is also provided a machine learning interpretable device, which includes: an acquisition module for acquiring samples to be interpreted; a correlation sampling module for sampling the samples to be interpreted based on the feature correlation of the samples to be interpreted, and obtaining a sampling set including a number of sampling values; a training module for performing model training using the number of sampling values to obtain an interpretable model; and an interpretation module for interpreting the samples to be interpreted using the interpretable model to obtain an interpretation result.
[0012] According to one embodiment of the present invention, the training module is specifically used to perform linear fitting on the plurality of sampling values to obtain a linear model; correspondingly, the interpretation module is also used to obtain the classification result of the sample to be interpreted through a classifier; and the classification result is interpreted using the linear model.
[0013] According to one embodiment of the present invention, the sample to be interpreted is an original image; the correlation sampling module is specifically used to perform image segmentation on the original image to obtain a superpixel block image; convert the superpixel block image into an undirected graph; and find all clusters in the undirected graph, where the cluster is a subset of the undirected graph, and any two vertices in the subset are connected by an edge.
[0014] According to one embodiment of the present invention, the correlation sampling module is also used to correspond the superpixel block image to the vertices of an undirected graph; if there are two adjacent superpixel block images, the corresponding two vertices in the undirected graph are connected through an undirected edge.
[0015] According to an embodiment of the present invention, the correlation sampling module is further used to find all clusters in the undirected graph using a deep optimization search algorithm.
[0016] According to the third aspect of the present invention, there is provided a machine learning interpretable device, characterized in that the device comprises at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; and the processor is used to call program instructions in the memory to execute any of the aforementioned machine learning interpretable methods.
[0017] According to a fourth aspect of the present invention, a computer-readable storage medium is also provided, wherein the storage medium comprises a set of computer-executable instructions, which are used to execute any of the aforementioned machine learning interpretable methods when the instructions are executed.
[0018] The machine learning interpretable method, device and computer-readable storage medium of the embodiment of the present invention first obtain a sample to be interpreted; then sample the sample to be interpreted based on the feature correlation of the sample to be interpreted to obtain a sampling set including a number of sampling values; then use the several sampling values to train a model to obtain an interpretable model; finally use the interpretable model to interpret the sample to be interpreted to obtain an interpretation result. In this way, the sampling method based on feature correlation of the present invention has a smaller number of samples compared to the random sampling method in the prior art, and the fitted interpretable model has a stronger fidelity with the sample to be interpreted (i.e., the original sample), thereby effectively reducing the sampling time consumption, so that the fidelity and interpretability of the interpretation result are greatly improved, thereby providing users with better interpretation capabilities.
[0019] It should be understood that the teachings of the present invention are not required to achieve all of the beneficial effects described above, but specific technical solutions can achieve specific technical effects, and other embodiments of the present invention can also achieve beneficial effects not mentioned above. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, in which:
[0021] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0022] Figure 1 The following is a schematic diagram showing the implementation process of the machine learning interpretable method of the embodiment of the present invention. Figure 1 ;
[0023] Figure 2 The following is a schematic diagram showing the implementation process of the machine learning interpretable method of the embodiment of the present invention. Figure 2 ;
[0024] Figure 3A schematic diagram of the implementation process of sampling based on feature correlation in the machine learning interpretable method according to an embodiment of the present invention is shown;
[0025] Figure 4 An image demonstration effect diagram showing an application example of the present invention in which an original image is sampled based on feature correlation;
[0026] Figure 5 A comparison diagram of interpretable image effects before and after feature correlation is used in an application example of the present invention is shown;
[0027] Figure 6 A schematic diagram of the composition structure of a machine learning interpretable device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0028] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present invention more thorough and complete, and to fully convey the scope of the present invention to those skilled in the art.
[0029] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0030] Figure 1 The following is a schematic diagram showing the implementation process of the machine learning interpretable method of the embodiment of the present invention. Figure 1 .
[0031] refer to Figure 1 An embodiment of the present invention provides an interpretable method for machine learning, which includes: operation 101, obtaining a sample to be interpreted; operation 102, sampling the sample to be interpreted based on the feature correlation of the sample to be interpreted to obtain a sampling set including a plurality of sampling values; operation 103, using the plurality of sampling values to perform model training to obtain an interpretable model; operation 104, using the interpretable model to interpret the sample to be interpreted to obtain an interpretation result.
[0032] In operation 101 , a sample to be interpreted may include at least one of the following data types: image data, natural language, and structured data.
[0033] Specifically, after obtaining the sample to be interpreted, the electronic device will perform preprocessing in an appropriate manner according to the data type of the sample to be interpreted, and then perform subsequent operations 102. For example, the natural language is subjected to syntactic analysis and word segmentation processing to obtain feature words for characterizing the natural language. The electronic device can be any form of smart device that has been developed or will be developed in the future.
[0034] In operation 102, the electronic device samples the sample to be interpreted based on the feature correlation of the sample to be interpreted, including: firstly performing feature correlation analysis on the sample to be interpreted (i.e., the original sample); and then sampling the sample to be interpreted based on the feature correlation of the sample to be interpreted to obtain a sampling set including a plurality of sampling values. In practical applications, the electronic device will adopt different sampling methods with different feature correlations for sampling samples of different data types. In the subsequent embodiments, the sampling process will be described in detail by taking image data as an example.
[0035] In operations 103 to 104, after obtaining a sample set including a number of sample values, the electronic device may perform model training to obtain an interpretable model; and then use the interpretable model to interpret the sample to be interpreted to obtain an interpretation result.
[0036] Specifically, taking the interpretable model as a linear model as an example, the electronic device first performs linear fitting on the several sampling values to obtain a linear model; and then uses the linear model to explain the classification result; wherein the classification result is the classification result of the sample to be explained obtained by the classifier.
[0037] The machine learning interpretable method of the embodiment of the present invention first obtains a sample to be interpreted; then samples the sample to be interpreted based on the feature correlation of the sample to be interpreted to obtain a sampling set including a number of sampling values; then uses the several sampling values to train a model to obtain an interpretable model; finally uses the interpretable model to interpret the sample to be interpreted to obtain an interpretation result. In this way, the sampling method based on feature correlation of the present invention has a smaller number of samples compared to the random sampling method in the prior art, and the fitted interpretable model has a stronger fidelity with the sample to be interpreted (i.e., the original sample), thereby effectively reducing the sampling time consumption, so that the fidelity and interpretability of the interpretation result are greatly improved, thereby providing users with better interpretation capabilities.
[0038] Figure 2 The following is a schematic diagram showing the implementation process of the machine learning interpretable method of the embodiment of the present invention. Figure 2 ; Figure 3 A schematic diagram of the implementation process of sampling based on feature correlation in the machine learning interpretable method according to an embodiment of the present invention is shown; Figure 4 An image demonstration effect diagram showing an application example of the present invention in which an original image is sampled based on feature correlation; Figure 5 A comparison diagram of interpretable image effects before and after feature correlation is used in an application example of the present invention is shown;
[0039] refer to Figure 2The machine learning interpretable method of the embodiment of the present invention includes: operation 201, obtaining a sample to be interpreted, where the sample to be interpreted is an original image; operation 202, sampling the sample to be interpreted based on the feature correlation of the sample to be interpreted to obtain a sampling set including a plurality of sampling values; operation 203, performing linear fitting on the plurality of sampling values to obtain a linear model; operation 204, obtaining a classification result of the sample to be interpreted by a classifier; and operation 205, interpreting the classification result using a linear model.
[0040] In operation 201 , the sample to be interpreted is an original image, that is, the sample to be interpreted is an image data type.
[0041] Specifically, after acquiring the sample to be interpreted, the electronic device first performs image preprocessing and then executes the subsequent operation 202 .
[0042] In operation 202, reference Figure 3 The electronic device samples the samples to be interpreted based on the feature correlation of the samples to be interpreted to obtain a sampling set including a number of sampling values, including: operation 2021, performing image segmentation on the original image to obtain a super-pixel block image; operation 2022, converting the super-pixel block image into an undirected graph; operation 2023, finding all clusters in the undirected graph, the cluster is a subset of the undirected graph, and any two vertices in the subset are connected by an edge.
[0043] In operation 2021-2023, refer to Figure 4 First, the original image is divided into superpixel blocks. Each superpixel block image is used as the main feature processing unit, which is a set of identical or similar interconnected pixels. Then, the superpixel block is converted into an undirected graph. The superpixel block corresponds to the vertex of the undirected graph. If two superpixel blocks are adjacent, the corresponding two vertices in the undirected graph are connected by an undirected edge. Finally, all clusters in the undirected graph are found. A cluster refers to a subset of the undirected graph. Any two vertices in the subset are connected by an edge, such as a cluster with a cardinality of 1, a cluster with a cardinality of 2, and a cluster with a cardinality of 3. Specifically, in operation 2023, a depth-first DFS search method can be used to find all clusters in the undirected graph.
[0044] In operation 203, the electronic device performs linear fitting on a number of sample values to obtain a linear model. Of course, in the linear fitting process, an amplitude w corresponding to the feature is also obtained. The larger the amplitude w, the closer the sample value corresponding to the feature is to the sample to be detected.
[0045] In operations 204 to 205, a classification result of the sample to be explained is obtained by a classifier; and the linear model obtained in operation 203 is used to explain the classification result.
[0046] It should be supplemented that, in the embodiment of the present invention, the implementation of operation 204 is not limited to being implemented after operation 203, but can also be implemented before any operation flow of operations 201 to 203.
[0047] In one example, reference Figure 5 The following table shows the comparison of interpretable image effects before and after feature correlation is used. The first line is the original image, the second line is the image explained by LIME (random sampling), and the third line is the image explained by MPS-LIME (feature correlation sampling). It is not difficult to obtain the following experimental results. The data is shown in the following table, where Table 1 is the comparison of time (s), and Table 2 is the error (Err) and fidelity (R2):
[0048] Table 1
[0049] img1 img2 img3 img4 img5 img6 LIME 232.2 230.45 245.36 264.51 223.79 226.58 This program 91.02 113.85 109.29 154.57 117.21 152.84
[0050] Table 2
[0051]
[0052] It can be seen that the embodiment of the present invention fully considers the correlation of features, and the sampling value can better retain the useful information of the original image. Compared with the random sampling method in the prior art, the sampling method based on feature correlation has a smaller number of samples, and the fitted linear model has a stronger fidelity with the original image, thereby effectively reducing the sampling time, so that the fidelity and interpretability of the interpretation results are greatly improved, thereby providing users with better interpretation capabilities.
[0053] Similarly, based on the machine learning interpretable method as described above, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a program, and when the program is executed by a processor, the processor performs at least the following operation steps: operation 101, obtaining a sample to be interpreted; operation 102, sampling the sample to be interpreted based on the feature correlation of the sample to be interpreted, and obtaining a sampling set including a number of sampling values; operation 103, performing model training using the number of sampling values, and obtaining an interpretable model; operation 104, interpreting the sample to be interpreted using the interpretable model, and obtaining an interpretation result.
[0054] Furthermore, based on the above machine learning interpretable method, an embodiment of the present invention also provides a machine learning interpretable device, which includes at least one processor, and at least one memory and bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call the program instructions in the memory to perform the following operation steps: operation 101, obtaining a sample to be interpreted; operation 102, sampling the sample to be interpreted based on the feature correlation of the sample to be interpreted, and obtaining a sampling set including a plurality of sampling values; operation 103, using the plurality of sampling values to perform model training to obtain an interpretable model; operation 104, using the interpretable model to interpret the sample to be interpreted, and obtaining an interpretation result.
[0055] Further, based on the above machine learning interpretable method, the embodiment of the present invention also provides a machine learning interpretable device, such as Figure 6 As shown, the machine learning interpretable device 60 includes: an acquisition module 601, used to acquire samples to be interpreted; a correlation sampling module 602, used to sample the samples to be interpreted based on the feature correlation of the samples to be interpreted, and obtain a sampling set including a plurality of sampling values; a training module 603, used to perform model training using the plurality of sampling values, and obtain an interpretable model; and an interpretation module 604, used to interpret the samples to be interpreted using the interpretable model, and obtain an interpretation result.
[0056] According to one embodiment of the present invention, the training module 603 is specifically used to perform linear fitting on the plurality of sampling values to obtain a linear model; correspondingly, the interpretation module 604 is also used to obtain the classification result of the sample to be interpreted through a classifier; and use the linear model to interpret the classification result.
[0057] The sample to be interpreted includes at least one of the following data types: image data, natural language and structured data.
[0058] According to one embodiment of the present invention, the sample to be interpreted is an original image; the correlation sampling module 602 is specifically used to perform image segmentation on the original image to obtain a super-pixel block image; convert the super-pixel block image into an undirected graph; and find all clusters in the undirected graph, where the cluster is a subset of the undirected graph, and any two vertices in the subset are connected by an edge.
[0059] According to one embodiment of the present invention, the correlation sampling module 602 is further used to correspond the superpixel block image to the vertices of an undirected graph; if there are two adjacent superpixel block images, the corresponding two vertices in the undirected graph are connected through an undirected edge.
[0060] According to an embodiment of the present invention, the correlation sampling module 602 is further configured to use a deep optimization search algorithm to find all clusters in the undirected graph.
[0061] It should be noted that the above description of the machine learning interpretable device embodiment is different from the above description of the machine learning interpretable device embodiment. Figures 1 to 5 The description of the method embodiment shown is similar, with the same Figures 1 to 5 The method embodiment shown in the figure has similar beneficial effects, so it will not be described in detail. For technical details not disclosed in the embodiment of the machine learning interpretable device of the present invention, please refer to the aforementioned Figures 1 to 5 The description of the method embodiment shown in the figure can be understood, and in order to save space, it will not be repeated.
[0062] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0063] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0064] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0065] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0066] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.
[0067] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0068] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A machine learning interpretable method, characterized in that: The method comprises: Obtain samples to be interpreted; Sampling the sample to be interpreted based on the feature correlation of the sample to be interpreted to obtain a sampling set including a plurality of sampling values; Using the plurality of sample values to perform model training to obtain an interpretable model; The interpretable model is used to interpret the sample to be interpreted to obtain an interpretation result.
2. The method according to claim 1, characterized in that: The sample to be interpreted includes at least one of the following data types: image data, natural language, and structured data.
3. The method according to claim 1, characterized in that The model is trained using the plurality of sample values to obtain an interpretable model, including: Performing linear fitting on the plurality of sampling values to obtain a linear model; Accordingly, using the interpretable model to interpret the sample to be interpreted includes: Obtaining a classification result of the sample to be explained through a classifier; The linear model is used to explain the classification results.
4. The method according to any one of claims 1 to 3, characterized in that: The sample to be interpreted is an original image; the sample to be interpreted is sampled based on the feature correlation of the sample to be interpreted to obtain a sampling set including several sampling values, including: Perform image segmentation on the original image to obtain a super-pixel block image; Convert the superpixel patch image into an undirected graph; All cliques in the undirected graph are found, where the clique is a subset of the undirected graph and any two vertices in the subset are connected by an edge.
5. The method according to claim 4, characterized in that The step of converting the super pixel block image into an undirected graph comprises: Corresponding the superpixel block image to the vertices of an undirected graph; If there are two adjacent superpixel block images, the corresponding two vertices in the undirected graph are connected through an undirected edge.
6. The method according to claim 4, characterized in that A deep optimization search algorithm is used to find all the cliques in the undirected graph.
7. A machine learning explainable device, characterized in that: The device comprises: An acquisition module, used to acquire samples to be interpreted; A correlation sampling module, used for sampling the samples to be interpreted based on the feature correlation of the samples to be interpreted, to obtain a sampling set including a plurality of sampling values; A training module, used to perform model training using the plurality of sample values to obtain an interpretable model; The explanation module is used to use the explainable model to explain the sample to be explained to obtain an explanation result.
8. The device according to claim 7, characterized in that The training module is specifically used to perform linear fitting on the plurality of sampling values to obtain a linear model; Correspondingly, the explanation module is also used to obtain the classification result of the sample to be explained through a classifier; and use the linear model to explain the classification result.
9. A machine learning explainable device, characterized in that: The device includes at least one processor, and at least one memory and bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the machine learning interpretable method described in any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The storage medium includes a set of computer executable instructions, which, when executed, are used to execute the machine learning interpretable method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Intelligent method for multi-scale grading and content visualization of diamonds
CN110766663A