Feature importance measurement method, device and readable storage medium
The hash coding model calculates the feature importance in the deep learning model, and solves the problem of poor measurement of feature importance in the prior art, achieving a more accurate model interpretation.
Patent Information
- Application Number
- CN202010446010.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-22
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2040-05-22
AI Technical Summary
In the prior art, the performance of the feature importance measurement method of deep learning models has poor interpretation effect and it is difficult to accurately measure the importance of feature dimensions to the model.
By obtaining the feature dimension to be measured and its corresponding sample categories, the sample set is hashed to be encoded using the preset hash coding model, the classification correlation strength of the feature dimension is calculated, and its importance value is determined.
Accurate measurement of the characteristics of deep learning models is achieved, the intuitiveness and accuracy of model interpretation is improved, and the accuracy of feature importance measurement is improved.
Smart Images

Figure CN111612159B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence in financial technology (Fintech), and in particular to a feature importance measurement method, device and readable storage medium. Background Art
[0002] With the continuous development of financial technology, especially Internet technology finance, more and more technologies (such as distributed, blockchain, artificial intelligence, etc.) are applied in the financial field, but the financial industry also puts forward higher requirements on technology, such as higher requirements on the distribution of corresponding to-do items in the financial industry.
[0003] With the continuous development of computer software and artificial intelligence, the application fields of deep learning are becoming more and more extensive, but the internal operating principles of deep learning models and the composition of their various parts still need to be clarified. At present, the importance of model input features is usually estimated by methods such as Shapley importance. However, this method is usually used to explain whether a certain feature is important to the model. However, this method can only roughly and approximately explain the importance of a certain feature to the model, and it is difficult to explain the degree of importance of a certain feature to the model, which leads to low accuracy of model interpretation of deep learning models, and then leads to poor model interpretation effect. Therefore, there is a technical problem of poor model interpretation effect in the prior art. Summary of the invention
[0004] The main purpose of this application is to provide a feature importance measurement method, device and readable storage medium, aiming to solve the technical problem of poor model interpretation effect in the prior art.
[0005] To achieve the above object, the present application provides a feature importance measurement method, which is applied to a feature importance measurement device, and the feature importance measurement method includes:
[0006] Obtain each feature dimension to be measured, and determine the sample category corresponding to each feature dimension to be measured;
[0007] Inputting the sample sets corresponding to the sample categories into a preset hash coding model to obtain output hash coding values corresponding to the sample categories;
[0008] Obtaining a preset hash code value corresponding to each of the sample categories, and determining a classification association strength result corresponding to each of the feature dimensions to be measured based on each of the output hash code values and each of the preset hash code values;
[0009] According to each association strength value in the classification association strength result, the feature importance value corresponding to each of the feature dimensions to be measured is determined.
[0010] Optionally, the classification association strength result includes one or more association strength values, and one of the feature dimensions to be measured corresponds to one of the association strength values.
[0011] The step of determining the classification association strength result corresponding to each of the feature dimensions to be measured based on each of the output hash code values and each of the preset hash code values comprises:
[0012] Determine the same type target hash value and the different type target hash value corresponding to each sample category in each of the preset hash code values, and determine the hash code value corresponding to each sample category in each of the output hash code values;
[0013] Based on the hash code values, the same type target hash values and the different type target hash values respectively corresponding to the sample categories, the association strength values corresponding to the feature dimensions to be measured are calculated.
[0014] Optionally, the association strength value includes a first association strength representation value and a second association strength representation value.
[0015] The step of calculating the association strength value corresponding to each of the feature dimensions to be measured based on the hash code values, the same target hash values, and the different target hash values corresponding to each of the sample categories includes:
[0016] Calculating first Hamming distances between the hash code values corresponding to the sample categories and the target hash values of the same category, and averaging the first Hamming distances corresponding to the sample categories to obtain the first association strength representation values;
[0017] The second Hamming distances between the hash code values corresponding to the sample categories and the heterogeneous target hash values are calculated respectively, and the second Hamming distances corresponding to the sample categories are averaged to obtain the second association strength representation values, wherein there is a second Hamming distance between a hash code value and a heterogeneous target hash value.
[0018] Optionally, the step of determining the feature importance values corresponding to each of the feature dimensions to be measured respectively according to each association strength value in the classification association strength result includes:
[0019] A preset transformation function is obtained, and based on the preset transformation function, each of the association strength values is normalized to obtain each of the feature importance values.
[0020] Optionally, the preset hash coding model includes a deep polarization network,
[0021] The step of inputting the sample sets corresponding to the sample categories into a preset hash coding model to obtain the output hash coding values corresponding to the sample categories comprises:
[0022] Input each of the sample sets into the hidden layer of the deep polarization network respectively, and output the data to be hashed corresponding to each of the sample sets;
[0023] Input each of the data to be hashed into the hash layer of the deep polarization network, perform hash coding on each of the data to be hashed respectively, and obtain each of the output hash coding values.
[0024] Optionally, before the step of inputting the sample sets corresponding to the sample categories into a preset hash coding model to obtain the output hash coding values corresponding to the sample categories, the feature importance measurement method includes:
[0025] Acquire training data and a hash coding model to be trained, and generate a preset target hash value corresponding to the training data based on a preset target hash coding method;
[0026] Based on the preset hash code value and the training data, the hash code model to be trained is iteratively trained to optimize a preset polarization loss function corresponding to the hash code model to be trained, until the hash code model to be trained reaches a preset iteration end condition, thereby obtaining the preset hash code model.
[0027] Optionally, the step of iteratively training the hash coding model to be trained based on the preset target hash value and the training data until the hash coding model to be trained reaches a preset iteration end condition, and obtaining the preset hash coding model includes:
[0028] Inputting the training data into the hash coding model to be trained, so as to perform hash coding on the training data based on the preset polarization loss function to obtain an initial hash coding value;
[0029] Calculating a training Hamming distance between the initial hash code value and the preset hash code value, and comparing the training Hamming distance with a preset Hamming distance threshold;
[0030] If the training Hamming distance is greater than the preset Hamming distance threshold, it is determined that the hash coding model to be trained does not meet the preset iteration end condition, and based on the initial hash coding value, the preset polarization loss function is optimized;
[0031] Based on the optimized preset polarization loss function, retraining the hash coding model to be trained until the training Hamming distance is less than or equal to the preset Hamming distance threshold;
[0032] If the training Hamming distance is less than or equal to the preset Hamming distance threshold, it is determined that the hash coding model to be trained meets the preset iteration end condition, and the hash coding model to be trained is used as the preset hash coding model.
[0033] Optionally, one of the feature dimensions to be measured corresponds to an input dimension data, and the preset hash coding model includes a deep polarization network.
[0034] After the step of determining the feature importance values corresponding to the feature dimensions to be measured according to the respective association strength values in the classification association strength result, the feature importance measurement method includes:
[0035] Determine in the deep polarization network the network links corresponding to the input dimensional data, and obtain the network weights corresponding to the network links;
[0036] The target feature importance values corresponding to each of the input dimensional data are determined in each of the feature importance values, and the dimensional data input strength values corresponding to each of the input dimensional data are calculated based on the network weights and the target feature importance values corresponding to each of the input dimensional data.
[0037] Optionally, the feature importance value includes a homogeneous feature importance representation value and a heterogeneous feature importance representation value, the preset hash coding model includes a deep polarization network, and the sample set includes one or more samples to be measured.
[0038] After the step of determining the feature importance values corresponding to the feature dimensions to be measured according to the respective association strength values in the classification association strength result, the feature importance measurement method includes:
[0039] Comparing the importance representation values of the same type of features with the preset upper threshold of feature importance and the preset lower threshold of feature importance respectively;
[0040] If the similar feature importance representation value is greater than or equal to the preset feature importance upper threshold, it is determined that the feature dimension to be measured corresponding to the similar feature importance representation value supports the classification decision of the deep polarization network for each of the samples to be measured;
[0041] If the importance representation value of the same type of features is less than or equal to the preset feature importance lower threshold, it is determined that the feature dimension to be measured opposes the classification decision of the deep polarization network for each of the samples to be measured; or
[0042] Comparing the heterogeneous feature importance representation value with a preset feature importance upper threshold and a preset feature importance lower threshold respectively;
[0043] If the heterogeneous feature importance representation value is less than or equal to the preset feature importance lower threshold, it is determined that the feature dimension to be measured corresponding to the heterogeneous feature importance representation value supports the classification decision of the deep polarization network for each of the samples to be measured;
[0044] If the heterogeneous feature importance representation value is greater than or equal to the preset feature importance upper threshold, it is determined that the feature dimension to be measured opposes the classification decision of the deep polarization network for each of the samples to be measured.
[0045] The present application also provides a feature importance measurement device, which is a virtual device and is applied to a feature importance measurement device. The feature importance measurement device includes:
[0046] A first determination module is used to obtain each feature dimension to be measured and determine the sample category corresponding to each feature dimension to be measured;
[0047] A hash coding module, used to input the sample sets corresponding to the sample categories into a preset hash coding model to obtain output hash coding values corresponding to the sample categories;
[0048] A second determination module is used to obtain a preset hash code value corresponding to each of the sample categories, and determine a classification association strength result corresponding to each of the feature dimensions to be measured based on each of the output hash code values and each of the preset hash code values;
[0049] The third determination module is used to determine the feature importance values corresponding to each of the feature dimensions to be measured according to each association strength value in the classification association strength result.
[0050] Optionally, the second determining module includes:
[0051] A first determining unit, configured to determine, in each of the preset hash code values, the same type of target hash values and the different type of target hash values corresponding to each of the sample categories, and to determine, in each of the output hash code values, the hash code values corresponding to each of the sample categories;
[0052] The first calculation unit is used to calculate the association strength value corresponding to each of the feature dimensions to be measured based on the hash code values, the same type target hash values and the different type target hash values respectively corresponding to each of the sample categories.
[0053] Optionally, the first computing unit includes:
[0054] A first calculation subunit is used to respectively calculate the first Hamming distances between the hash code values corresponding to the sample categories and the target hash values of the same category, and to average the first Hamming distances corresponding to the sample categories to obtain the first association strength representation values;
[0055] The second calculation subunit is used to respectively calculate the second Hamming distances between each of the hash code values corresponding to each of the sample categories and each of the heterogeneous target hash values, and to average the second Hamming distances corresponding to each of the sample categories to obtain each of the second association strength representation values, wherein there is a second Hamming distance between a hash code value and a heterogeneous target hash value.
[0056] Optionally, the third determining module includes:
[0057] The normalization unit is used to obtain a preset transformation function, and based on the preset transformation function, respectively normalize each of the association strength values to obtain each of the feature importance values.
[0058] Optionally, the hash coding module includes:
[0059] A data processing unit, used to input each of the sample sets into the hidden layer of the deep polarization network, and output the to-be-hashed data corresponding to each of the sample sets;
[0060] The first hash coding unit is used to input each of the data to be hashed into the hash layer of the deep polarization network, perform hash coding on each of the data to be hashed respectively, and obtain each of the output hash coding values.
[0061] Optionally, the feature importance measurement device further includes:
[0062] An acquisition module, used to acquire training data and a hash coding model to be trained, and generate a preset target hash value corresponding to the training data based on a preset target hash coding method;
[0063] An optimization module is used to iteratively train the hash coding model to be trained based on the preset hash coding value and the training data to optimize the preset polarization loss function corresponding to the hash coding model to be trained until the hash coding model to be trained reaches a preset iteration end condition, thereby obtaining the preset hash coding model.
[0064] Optionally, the optimization module includes:
[0065] A second hash coding unit, configured to input the training data into the hash coding model to be trained, so as to perform hash coding on the training data based on the preset polarization loss function to obtain an initial hash coding value;
[0066] A second calculation unit, configured to calculate a training Hamming distance between the initial hash code value and the preset hash code value, and compare the training Hamming distance with a preset Hamming distance threshold;
[0067] an optimization unit, configured to determine that the hash coding model to be trained does not meet the preset iteration end condition if the training Hamming distance is greater than the preset Hamming distance threshold, and optimize the preset polarization loss function based on the initial hash coding value;
[0068] A retraining unit, configured to retrain the hash coding model to be trained based on the optimized preset polarization loss function until the training Hamming distance is less than or equal to the preset Hamming distance threshold;
[0069] A determination unit is configured to determine that the hash coding model to be trained meets the preset iteration end condition if the training Hamming distance is less than or equal to the preset Hamming distance threshold, and use the hash coding model to be trained as the preset hash coding model.
[0070] Optionally, the feature importance measurement device further includes:
[0071] A fourth determination module is used to determine each network link corresponding to each input dimension data in the deep polarization network, and obtain a network weight corresponding to each network link;
[0072] A calculation module is used to determine the target feature importance value corresponding to each input dimensional data among each feature importance value, and calculate the dimensional data input strength value corresponding to each input dimensional data based on each network weight and the target feature importance value corresponding to each input dimensional data.
[0073] Optionally, the feature importance measurement device further includes:
[0074] A first comparison module is used to compare the importance representation value of the same type of features with a preset upper threshold of feature importance and a preset lower threshold of feature importance respectively;
[0075] A first determination module is configured to determine, if the similar feature importance representation value is greater than or equal to the preset feature importance upper threshold, whether the feature dimension to be measured corresponding to the similar feature importance representation value supports the classification decision of the deep polarization network for each sample to be measured;
[0076] A second determination module is configured to determine that the feature dimension to be measured opposes the classification decision of the deep polarization network on each of the samples to be measured if the value representing the importance of the same type of feature is less than or equal to the preset feature importance lower threshold; or
[0077] A second comparison module is used to compare the heterogeneous feature importance representation value with a preset feature importance upper threshold and a preset feature importance lower threshold respectively;
[0078] A third determination module is used to determine, if the heterogeneous feature importance representation value is less than or equal to the preset feature importance lower threshold, that the feature dimension to be measured corresponding to the heterogeneous feature importance representation value supports the classification decision of the deep polarization network for each of the samples to be measured;
[0079] The fourth determination module is used to determine that the feature dimension to be measured opposes the classification decision of the deep polarization network on each of the samples to be measured if the heterogeneous feature importance representation value is greater than or equal to the preset feature importance upper threshold.
[0080] The present application also provides a feature importance measurement device, which is a physical device, and includes: a memory, a processor, and a program of the feature importance measurement method stored in the memory and executable on the processor. When the program of the feature importance measurement method is executed by the processor, the steps of the feature importance measurement method as described above can be implemented.
[0081] The present application also provides a readable storage medium, on which is stored a program for implementing a feature importance measurement method. When the program for the feature importance measurement method is executed by a processor, the steps of the feature importance measurement method as described above are implemented.
[0082] The present application obtains each feature dimension to be measured and determines the sample category corresponding to each feature dimension to be measured, and then inputs the sample sets corresponding to each sample category into a preset hash coding model to obtain the output hash coding values corresponding to each sample category, and then obtains the preset hash coding values corresponding to each sample category, and based on each output hash coding value and each preset hash coding value, determines the classification association strength result corresponding to each feature dimension to be measured, and then determines the feature importance value corresponding to each feature dimension to be measured according to each association strength value in the classification association strength result. That is, after determining the sample categories corresponding to each of the feature dimensions to be measured, the present application can determine the classification association strength results corresponding to each of the feature dimensions to be measured based on the output hash code value and the preset hash code value corresponding to each of the sample categories, and then determine the feature importance values corresponding to each of the feature dimensions to be measured according to the respective association strength values in the classification association strength results, wherein the feature importance values represent the contribution of the feature dimensions to be measured to the model, thereby achieving the purpose of quantitatively measuring the importance of each of the feature dimensions to be measured by calculating the feature importance values, and then compared with the current model interpretation method, by calculating the feature importance values, the degree of importance of each feature dimension to the model can be accurately and meticulously measured, thereby improving the accuracy of the feature importance measurement, thereby making the model interpretation more intuitive and accurate, and improving the model interpretation effect, thereby solving the technical problem of poor model interpretation effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0084] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0085] Figure 1 This is a flow chart of the first embodiment of the feature importance measurement method of the present application;
[0086] Figure 2 This is a flow chart of the second embodiment of the feature importance measurement method of the present application;
[0087] Figure 3 This is a flow chart of the third embodiment of the feature importance measurement method of the present application;
[0088] Figure 4A schematic diagram of the construction of the deep polarization network described in the feature importance measurement method of this application;
[0089] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.
[0090] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0091] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0092] The present application embodiment provides a feature importance measurement method. In the first embodiment of the feature importance measurement method of the present application, referring to Figure 1 , the feature importance measurement method includes:
[0093] Step S10, obtaining each feature dimension to be measured, and determining the sample category corresponding to each feature dimension to be measured;
[0094] In this embodiment, it should be noted that one feature dimension to be measured corresponds to one sample category, and the feature dimension to be measured is a set of features to be measured corresponding to each sample to be measured in the corresponding sample category. For example, assuming that the sample category is a cat image, the corresponding feature dimension to be measured includes hair features, eye features, etc.
[0095] Obtain each feature dimension to be measured, and determine the sample category corresponding to each feature dimension to be measured. Specifically, extract each feature dimension to be measured from a preset database, and based on the feature dimension code corresponding to each feature dimension to be measured, determine the sample category corresponding to each feature dimension code, wherein the feature dimension code is an identifier of the feature dimension to be measured, such as a vector, a character string, a code, etc.
[0096] Step S20, inputting the sample sets corresponding to the sample categories into a preset hash coding model to obtain output hash coding values corresponding to the sample categories;
[0097] In this embodiment, it should be noted that the preset hash coding model includes a deep polarization network, wherein the deep polarization network includes a hidden layer and a hash layer, wherein the hidden layer is a one-layer or multi-layer neural network for data processing, wherein the data processing includes convolution and pooling, etc., and the hash coding is a one-layer or multi-layer neural network for hashing the output result of the hidden layer, and the sample set can be represented by a sample matrix to be measured, wherein each row of the sample matrix to be measured corresponds to a feature to be measured, and each column of the sample matrix to be measured corresponds to a sample to be measured. For example, assuming that the sample matrix to be measured is an m*n matrix, the sample matrix to be measured corresponds to m features to be measured and corresponds to n samples to be measured.
[0098] The sample sets corresponding to each of the sample categories are respectively input into a preset hash coding model to obtain output hash coding values corresponding to each of the sample categories. Specifically, the sample matrix to be measured corresponding to the sample set is input into the hidden layer, and data processing is performed on the sample matrix to be measured to obtain a feature representation matrix of the samples to be measured, wherein the feature representation matrix of the samples to be measured includes all feature information in the sample set, and then the feature representation matrix of the samples to be measured is input into the hash layer, and hash coding is performed on the feature representation matrix of the samples to be measured to obtain a hash coding result.
[0099] The preset hash coding model includes a deep polarization network,
[0100] The step of inputting the sample sets corresponding to the sample categories into a preset hash coding model to obtain the output hash coding values corresponding to the sample categories comprises:
[0101] Step S11, inputting each of the sample sets into the hidden layer of the deep polarization network respectively, and outputting the data to be hashed corresponding to each of the sample sets;
[0102] In this embodiment, it should be noted that the data to be hashed is a feature representation matrix of samples to be measured corresponding to each of the sample sets.
[0103] Each of the sample sets is input into the hidden layer of the deep polarization network respectively, and the data to be hashed corresponding to each of the sample sets is output. Specifically, the sample matrix to be measured corresponding to each of the samples to be measured is input into the hidden layer, so as to perform a preset number of convolution and pooling alternating processes on each of the sample matrices to be measured through the data processing layer in the hidden layer, wherein the data processing layer includes a convolution layer, a pooling layer, etc., so as to obtain a feature representation matrix of the samples to be measured corresponding to each of the sample sets.
[0104] Step S12: input each of the data to be hashed into the hash layer of the deep polarization network, perform hash coding on each of the data to be hashed, and obtain each of the output hash coding values.
[0105] In this embodiment, each of the data to be hashed is input into the hash layer of the deep polarization network, and each of the data to be hashed is hashed to obtain each of the output hash code values. Specifically, the sample feature representation matrix to be measured corresponding to each of the sample sets is input into the hash layer, and each of the sample feature representation matrices to be measured is fully connected to obtain the fully connected vectors corresponding to each of the sample feature representation matrices to be measured, and then the corresponding polarization output channel is matched to each target bit in each of the fully connected vectors, and a polarization identifier is assigned to each of the target bits, and then the hash vector corresponding to each of the polarized target bits corresponding to each of the fully connected vectors is output, and then the polarization identifier corresponding to each output bit in each of the hash vectors is extracted, and based on each wherein the polarization output channel is a model output channel that assigns a polarization identifier to the target bit, and the polarization identifier is the positive and negative sign of the target bit. For example, assuming that the fully connected vector is (a, b), and the hash vector is (a, -b), then the polarization identifier corresponding to the target bit a is +1, and the polarization identifier corresponding to the target bit b is +1. The polarization identifier corresponding to the hash vector generates an output hash code value corresponding to each hash vector.
[0106] Step S30, obtaining a preset hash code value corresponding to each of the sample categories, and determining a classification association strength result corresponding to each of the feature dimensions to be measured based on each of the output hash code values and each of the preset hash code values;
[0107] In this embodiment, it should be noted that there is a preset hash coding value corresponding to one sample category, wherein the preset hash coding value is a hash coding value pre-generated based on a preset target hash coding method, and the preset hash coding value is a standard hash result corresponding to each sample category given when training the preset hash coding model, wherein the preset target hash coding method can be any pre-set hash coding method.
[0108] Obtain a preset hash code value corresponding to each of the sample categories, and determine the classification association strength result corresponding to each of the feature dimensions to be measured based on each of the output hash code values and each of the preset hash code values. Specifically, obtain a preset hash code value corresponding to each of the sample categories, and determine the same target hash value and each heterogeneous target hash value corresponding to each sample to be measured in each of the sample categories in each of the preset hash code values, wherein the same target hash value is the preset hash code value corresponding to the sample category of the sample to be measured, and the heterogeneous target hash value is the preset hash code value corresponding to other sample category classifications except the sample category to which the sample to be measured belongs. For example, assuming that the sample categories include sample category A, sample category B, and sample category C, and the preset hash code value corresponding to sample category A is a, the preset hash code value corresponding to sample category B is b, and the preset hash code value corresponding to sample category C is c, then for sample category A, the same target hash value is a, and each of the heterogeneous target hash values is b and c. Further, for each of the sample categories, the following steps are performed:
[0109] Determine the output hash code value corresponding to each sample to be measured in the sample category, and then calculate the first Hamming distance between each output hash code value and the same target hash value, and average the first Hamming distances to obtain the first target Hamming distance. Further, respectively calculate the second Hamming distance between each output hash code value corresponding to the sample category and each heterogeneous target hash value, wherein there is a second Hamming distance between each hash code value and each heterogeneous target hash value, and then average the second Hamming distances to obtain the second target Hamming distance, and then convert the first target Hamming distance and the second target Hamming distance into a classification association strength representation vector. For example, assuming that the classification association strength representation vector is D(k, c), k is a bit, the bit is the first target Hamming distance and the second target Hamming distance, and c indicates that the sample category corresponding to the same target hash value corresponding to the first target Hamming distance and the second target Hamming distance is the cth category. Further, after obtaining each classification association strength representation vector, perform the following steps:
[0110] Based on each of the classification association strength representation vectors, a classification association strength matrix corresponding to each of the sample sets is generated, and the classification association strength matrix is used as the classification association strength result. For example, each of the classification association strength representation vectors is used as a column or a row of the classification association strength matrix to generate the classification association strength matrix, etc.
[0111] In addition, in order to eliminate random errors, the sample sets corresponding to each feature dimension to be measured are re-obtained, and based on each of the sample sets, the above steps S20 to S30 are repeated a preset number of times to obtain multiple classification association strength results, and the classification association strength results are averaged to obtain the target classification association strength result, and the target classification association strength result is normalized to obtain the feature importance result.
[0112] The classification association strength result includes one or more association strength values, and one of the feature dimensions to be measured corresponds to one of the association strength values.
[0113] The step of determining the classification association strength result corresponding to each of the feature dimensions to be measured based on each of the output hash code values and each of the preset hash code values comprises:
[0114] Step S21, determining the same type target hash value and the different type target hash value corresponding to each sample category in each of the preset hash code values, and determining the hash code value corresponding to each sample category in each of the output hash code values;
[0115] In this embodiment, it should be noted that the homogeneous target hash value is a preset hash code value corresponding to the sample category of the sample to be measured, and the heterogeneous target hash value is a preset hash code value corresponding to other sample category classifications except the sample category to which the sample to be measured belongs, and the sample category includes one or more samples to be measured, wherein one sample to be measured corresponds to one output hash code value.
[0116] Step S22, based on the hash code values, the same type target hash values and the different type target hash values corresponding to the sample categories, the association strength values corresponding to the feature dimensions to be measured are calculated.
[0117] In this embodiment, it should be noted that the association strength value can be represented by a classification association strength representation vector. For example, assuming that the vector corresponding to the association strength value is D(k, c), k is the numerical value of the association strength value, and c is the identifier of the sample category corresponding to the association strength value.
[0118] Based on the hash code values, the same target hash values, and the different target hash values corresponding to the sample categories, the association strength values corresponding to the feature dimensions to be measured are calculated. Specifically, the following steps are performed for each sample category:
[0119] Calculate the first Hamming distance between the hash code value corresponding to each of the samples to be measured in the sample category and the same target hash value, and average the first Hamming distances to obtain the first target Hamming distance. Further, calculate the second Hamming distance between each of the hash code values and each of the different target hash values, and average the second Hamming distances to obtain the second target Hamming distance. Convert the first target Hamming distance, the second target Hamming distance and the sample category identifier corresponding to the sample category into a classification association strength representation vector. For example, assuming that the first target Hamming distance is a, the second target Hamming distance is b, and the sample category identifier is c, then the classification association strength representation vector is (a, b, c).
[0120] The association strength value includes a first association strength representation value and a second association strength representation value.
[0121] The step of calculating the association strength value corresponding to each of the feature dimensions to be measured based on the hash code values, the same target hash values, and the different target hash values corresponding to each of the sample categories includes:
[0122] Step S221, respectively calculating the first Hamming distances between the hash code values corresponding to the sample categories and the target hash values of the same category, and averaging the first Hamming distances corresponding to the sample categories to obtain the first association strength representation values;
[0123] In this embodiment, the first Hamming distances between the hash code values corresponding to the sample categories and the target hash values of the same category are calculated respectively, and the first Hamming distances corresponding to the sample categories are averaged respectively to obtain the first association strength representation values. Specifically, the following steps are performed for each sample category:
[0124] An XOR operation is performed on each hash code value corresponding to the sample category and the hash value of the same target corresponding to the sample category to obtain each first Hamming distance, and the first Hamming distances are averaged to obtain a first average value, and the first average value is used as the first association strength representation value. For example, assuming that the hash value of the same target is 1385, and the hash code values are 1122 and 1384 respectively, an XOR operation is performed on 1385 and 1122, and the XOR operation result is 0111, then the corresponding first Hamming distance is 3, further, an XOR operation is performed on 1385 and 1384, and the XOR operation result is 0001, then another first Hamming distance is 1, and then the first average value is 2, that is, the first association strength representation value is 2.
[0125] Step S222, respectively calculate the second Hamming distances between each of the hash code values corresponding to each of the sample categories and each of the heterogeneous target hash values, and respectively average the second Hamming distances corresponding to each of the sample categories to obtain each of the second association strength representation values, wherein there is a second Hamming distance between a hash code value and a heterogeneous target hash value.
[0126] In this embodiment, the second Hamming distances between the hash code values and the heterogeneous target hash values corresponding to the sample categories are calculated respectively, and the second Hamming distances corresponding to the sample categories are averaged respectively to obtain the second association strength representation values, wherein there is a second Hamming distance between a hash code value and a heterogeneous target hash value. Specifically, the following steps are performed for each sample category:
[0127] An XOR operation is performed between each of the hash code values corresponding to the sample category and each of the heterogeneous target hash values to obtain each of the second Hamming distances, and each of the second Hamming distances is averaged to obtain a second average value, and the second average value is used as the second association strength representation value.
[0128] Step S40: determining the feature importance values corresponding to the feature dimensions to be measured respectively according to the respective association strength values in the classification association strength result.
[0129] In this embodiment, it should be noted that the classification association strength result is a classification association strength matrix composed of the classification association strength representation vectors. For example, assuming that the classification association strength representation vectors are D(k 1 , c 1 )、D(k 2 , c 1 ) and D(k 3 , c 3 ), then the classification association strength matrix is {D(k 1 , c 1 ), D(k 2 , c 1 ), D(k 3 , c 3 )}.
[0130] According to each association strength value in the classification association strength result, determine the feature importance value corresponding to each feature dimension to be measured. Specifically, normalize the classification association strength result to map the first association strength representation value and the second association strength representation value in each classification association strength representation vector to a preset value range, wherein the preset value range includes an upper threshold value and a lower threshold value, and the feature importance value is in the preset value range. It should be noted that for the first association strength representation value, the closer the feature importance value corresponding to the first association strength representation value is to the upper threshold value, the higher the importance of the feature corresponding to the sample category corresponding to the first association strength representation value is, and for the second association strength representation value, the closer the feature importance value corresponding to the second association strength representation value is to the lower threshold value, the higher the importance of the feature corresponding to the sample category corresponding to the second association strength representation value is, and further, obtain the feature importance result.
[0131] The step of determining the feature importance values corresponding to the feature dimensions to be measured respectively according to the association strength values in the classification association strength result includes:
[0132] Step S31, obtaining a preset transformation function, and based on the preset transformation function, respectively normalizing each of the association strength values to obtain each of the feature importance values.
[0133] In this embodiment, it should be noted that the preset transformation function is a function for mapping the association strength value to a preset value range, wherein the preset transformation function is as follows:
[0134] The preset transformation function may be one of the following functions:
[0135] 1. a_kc=1.0-~D_n(k,c)
[0136] 2. a_kc=exp(-~D_n(k,c)), where ~D_n(k,c)=(~D_n(k,c)-Dmin) / (Dmax-Dmin)
[0137] Among them, A=[a_kc, ...] is the feature importance representation matrix corresponding to each of the feature importance values, and the feature importance representation matrix is a K*C matrix, and its numerical value represents the degree of fit between K bits and C sample categories, that is, the importance of the features corresponding to the K bits to the deep polarization network, wherein each of the bits has a feature importance value corresponding to the first association strength representation value and a feature importance value corresponding to the second association strength representation value, ~D_n(k, c) is the classification association strength representation vector, a_kc is the classification association strength representation vector after normalization, Dmax is the classification association strength representation vector with the longest length, Dmin is the classification association strength representation vector with the shortest length, and the value range of A is the preset value range, wherein the value range of A is [0.0, 1.0].
[0138] Obtain a preset transformation function, and based on the preset transformation function, normalize each of the association strength values respectively to obtain each of the feature importance values. Specifically, extract the preset transformation function from a preset transformation function database, and based on the preset transformation function, normalize each of the association strength values respectively to map each of the association strength values to a preset value range to obtain a feature importance value corresponding to each of the association strength values.
[0139] The feature importance value includes a homogeneous feature importance representation value and a heterogeneous feature importance representation value, the preset hash coding model includes a deep polarization network, and the sample set includes one or more samples to be measured.
[0140] After the step of determining the feature importance values corresponding to the feature dimensions to be measured according to the respective association strength values in the classification association strength result, the feature importance measurement method includes:
[0141] Step A10, comparing the importance representation value of the same type of features with a preset upper threshold of feature importance and a preset lower threshold of feature importance respectively;
[0142] In this embodiment, it should be noted that the same type feature importance representation value is a bit value obtained by normalizing the first association strength representation value.
[0143] Step A20: If the similar feature importance representation value is greater than or equal to the preset feature importance upper threshold, it is determined that the feature dimension to be measured corresponding to the similar feature importance representation value supports the classification decision of the deep polarization network for each of the samples to be measured;
[0144] In this embodiment, specifically, if the similar feature importance representation value is greater than or equal to the preset feature importance upper threshold, it is determined that the importance of the feature dimension to be measured corresponding to the similar feature importance representation value is high, and then it is determined that the feature dimension to be measured corresponding to the similar feature importance representation value supports the classification decision of the deep polarization network for each of the samples to be measured, wherein the classification decision is the sample classification result of the deep polarization network for each of the samples to be measured.
[0145] Step A30: If the similar feature importance representation value is less than or equal to the preset feature importance lower threshold, it is determined that the feature dimension to be measured opposes the classification decision of the deep polarization network for each of the samples to be measured; or
[0146] In this embodiment, specifically, if the value representing the importance of the same type of features is less than or equal to the preset feature importance lower threshold, it is determined that the importance of the feature dimension to be measured corresponding to the importance of the same type of features is low, and then it is determined that the feature dimension to be measured opposes the classification decision of the deep polarization network for each of the samples to be measured, wherein the preset feature importance lower threshold is less than or equal to the preset feature importance upper threshold.
[0147] Step A40, comparing the heterogeneous feature importance representation value with a preset feature importance upper threshold and a preset feature importance lower threshold respectively;
[0148] In this embodiment, it should be noted that the heterogeneous feature importance representation value is a bit value obtained by normalizing the second association strength representation value.
[0149] Step A50: If the heterogeneous feature importance representation value is less than or equal to the preset feature importance lower threshold, it is determined that the feature dimension to be measured corresponding to the heterogeneous feature importance representation value supports the classification decision of the deep polarization network for each of the samples to be measured;
[0150] In this embodiment, specifically, if the heterogeneous feature importance representation value is less than or equal to the preset feature importance lower threshold, it is determined that the importance of the feature dimension to be measured corresponding to the heterogeneous feature importance representation value is high, and then it is determined that the feature dimension to be measured corresponding to the heterogeneous feature importance representation value supports the classification decision of the deep polarization network for each of the samples to be measured.
[0151] Step A60: If the heterogeneous feature importance representation value is greater than or equal to the preset feature importance upper threshold, it is determined that the feature dimension to be measured opposes the classification decision of the deep polarization network for each of the samples to be measured.
[0152] In this embodiment, specifically, if the heterogeneous feature importance representation value is greater than or equal to the preset feature importance upper threshold, it is determined that the importance of the feature dimension to be measured corresponding to the heterogeneous feature importance representation value is low, and then it is determined that the feature dimension to be measured opposes the classification decision of the deep polarization network for each of the samples to be measured.
[0153] This embodiment obtains each feature dimension to be measured and determines the sample category corresponding to each feature dimension to be measured, and then inputs the sample set corresponding to each sample category into a preset hash coding model to obtain the output hash coding value corresponding to each sample category, and then obtains the preset hash coding value corresponding to each sample category, and based on each output hash coding value and each preset hash coding value, determines the classification association strength result corresponding to each feature dimension to be measured, and then determines the feature importance value corresponding to each feature dimension to be measured according to each association strength value in the classification association strength result. That is, after determining the sample categories corresponding to each of the feature dimensions to be measured, this embodiment can determine the classification association strength results corresponding to each of the feature dimensions to be measured based on the output hash code value and the preset hash code value corresponding to each of the sample categories, and then determine the feature importance values corresponding to each of the feature dimensions to be measured according to the respective association strength values in the classification association strength results, wherein the feature importance values represent the contribution of the feature dimensions to be measured to the model, thereby achieving the purpose of quantitatively measuring the importance of each of the feature dimensions to be measured by calculating the feature importance values, and then compared with the current model interpretation method, by calculating the feature importance values, the degree of importance of each feature dimension to the model can be accurately and meticulously measured, thereby improving the accuracy of the feature importance measurement, thereby making the model interpretation more intuitive and accurate, and improving the model interpretation effect, thereby solving the technical problem of poor model interpretation effect.
[0154] Further, refer to Figure 2 Based on the first embodiment of the present application, in another embodiment of the present application, before the step of inputting the sample sets corresponding to each of the sample categories into a preset hash coding model to obtain the output hash coding values corresponding to each of the sample categories, the feature importance measurement method includes:
[0155] Step B10, obtaining training data and a hash coding model to be trained, and generating a preset target hash value corresponding to the training data based on a preset target hash coding method;
[0156] In the present embodiment, it should be noted that the hash coding model to be trained is an untrained neural network model, the preset target hash coding method can be any pre-set hash coding method, the training data is a training sample for training the hash coding model to be trained, and the preset hash coding value is a hash coding value corresponding to the training sample category to which the training sample belongs, wherein one training sample category corresponds to one preset hash coding value, and the training sample category includes at least one training sample.
[0157] Acquire training data and a hash coding model to be trained, and generate the preset hash coding value corresponding to the training data based on a preset target hash coding method. Specifically, extract the training samples and the hash coding model to be trained from a preset training data storage database, and hash code the training samples based on a preset target hash coding method to generate a preset hash coding value corresponding to the training sample category to which the training samples belong.
[0158] Wherein, in step B10, the preset target hash coding method includes random target hash coding and adaptive target hash coding.
[0159] The step of generating the preset hash code value corresponding to the training data based on the preset target hash code method includes:
[0160] Step B11, performing the random target hash coding on the training data to obtain the preset hash coding value;
[0161] In this embodiment, it should be noted that if the preset target hash coding method is random target hash coding, the Hamming distance between the corresponding target hash vectors belonging to different classification samples in the target hash coding result should be the target Hamming distance 2*K*p*(1-p), wherein K is the number of bits in the target hash vector, and p is the probability that the sample corresponding to the target hash vector belongs to the classification sample. For example, assuming that the training data includes two classification vectors, K is 32 bits, and the classification samples include cats and dogs, if the probability that the sample corresponding to the classification vector belongs to a cat is 0.5, and the probability that it belongs to a dog is 0.5, then the maximum Hamming distance between the target hash vector corresponding to the cat and the target hash vector corresponding to the dog is 16.
[0162] The random target hash coding is performed on the training data to obtain the preset hash coding value. Specifically, based on a preset Gaussian random method, a preset hash coding value corresponding to the training sample is generated.
[0163] Step B12: performing the adaptive target hash coding on the training data to obtain the preset hash coding value.
[0164] In this embodiment, the adaptive target hash coding is performed on the training data to obtain the preset hash coding value. Specifically, multiple training samples of the training sample category corresponding to the training data are obtained to generate random hash coding values corresponding to each of the training samples based on a preset Gaussian random method, wherein one training sample corresponds to one random hash coding value, and then the random hash coding value corresponding to each of the training samples in each of the training sample categories is determined, and the average value of each random hash coding value corresponding to each of the training sample categories is calculated to obtain the average hash coding value corresponding to each of the training sample categories, and then the average hash coding value is used as the preset hash coding value corresponding to all training samples in the corresponding training sample category.
[0165] Step B20, based on the preset hash code value and the training data, iteratively train the hash code model to be trained to optimize the preset polarization loss function corresponding to the hash code model to be trained, until the hash code model to be trained reaches a preset iteration end condition, thereby obtaining the preset hash code model.
[0166] In this embodiment, it should be noted that the preset iteration end condition includes reaching a preset iteration number threshold, a preset polarization loss function convergence, etc., and the iterative training includes one or more rounds of training.
[0167] Based on the preset hash code value and the training data, the hash code model to be trained is iteratively trained to optimize the preset polarization loss function corresponding to the hash code model to be trained, until the hash code model to be trained reaches a preset iteration end condition, and the preset hash code model is obtained. Specifically, the training data is input into the hash code model to be trained, so as to update the hash code model to be trained based on the preset hash code value, and determine whether the hash code model to be trained after the training update meets the preset iteration end condition. If the hash code model to be trained after the training update meets the preset iteration end condition, the hash code model to be trained after the training update is used as the preset hash code model. If the hash code model to be trained after the training update does not meet the preset iteration end condition, the initial hash code value output by the hash code model to be trained based on the training data is obtained, and based on the initial hash code value and the preset hash code value, the preset polarization loss function corresponding to each polarization output channel of the hash code model to be trained is optimized, and the hash code model to be trained is re-trained and updated until the hash code model to be trained after the training update meets the preset iteration end condition.
[0168] The step of iteratively training the hash coding model to be trained based on the preset target hash value and the training data until the hash coding model to be trained reaches a preset iteration end condition, and obtaining the preset hash coding model includes:
[0169] Step B21, inputting the training data into the hash coding model to be trained, so as to perform hash coding on the training data based on the preset polarization loss function to obtain an initial hash coding value;
[0170] In this embodiment, the training data includes at least one training sample, and the initial hash code value includes an initial hash code value corresponding to each training sample.
[0171] The training data is input into the hash coding model to be trained, and the training data is hash-coded based on the preset polarization loss function to obtain an initial hash coding value. Specifically, the training matrix to be processed corresponding to the training sample is input into the hash coding model to be trained, wherein the training matrix to be processed is a matrix representation of the training sample, and then the training matrix to be processed is hashed to obtain a training hash vector, and then based on the preset polarization loss function, each bit of the training hash vector is forced to be polarized to obtain a training polarization vector corresponding to the training hash vector, and then based on the polarization identifier corresponding to each bit in the training polarization vector, the initial hash coding value corresponding to the training sample is generated, wherein the preset polarization loss function is as follows,
[0172] L(v, t^c) = max(mv*t^c, 0)
[0173] Among them, L is the preset polarization loss function, m is the preset forced polarization parameter, v is the value of each hash vector bit in the training hash vector, and the absolute value of v is greater than m, t^c is the target hash value corresponding to the hash vector bit, the target hash value is the bit value of the preset hash code value corresponding to the training sample, and t^c={-1,+1}, and the preset polarization loss function converges to 0. For example, assuming that m is 1, t^c is 1, and v is -1, then L=2. If the preset polarization loss function is to converge to 0, v needs to be forced to polarize so that v is 1. At this time, L=0. Then when t^c is equal to 1, the training hash vector is The value on the special bit will gradually move away from 0 in the positive direction. When t^c is equal to -1, the value on the bit of the training hash vector will gradually move away from 0 in the negative direction. After the polarization is successful, the polarization identifier of each bit in the obtained training polarization vector should be consistent with the corresponding target hash value. Furthermore, since the preset hash code values of the same training sample category are the same, the polarization identifiers on each bit in the training polarization vector corresponding to the training samples belonging to the same training sample category are consistent, and then based on the polarization identifiers, the obtained model output values are consistent, that is, for model input samples belonging to the same sample category, the same hash code value can be obtained based on the trained preset hash code model.
[0174] In addition, it should be noted that each bit in the training hash vector corresponds to a polarization output channel in the hash coding model to be trained, and the preset forced polarization parameters corresponding to each polarization output channel are obtained by training and optimizing the hash coding model, and thus the preset forced polarization parameters corresponding to each polarization output channel may be the same or different, wherein the polarization output channel is used to force the polarization of the value on the corresponding bit in the training hash vector based on the preset forced polarization parameter through the corresponding preset polarization loss function, and output the encoded value of the corresponding bit in the initial hash coding value.
[0175] Step A22, calculating a training Hamming distance between the initial hash code value and the preset hash code value, and comparing the training Hamming distance with a preset Hamming distance threshold;
[0176] In this embodiment, a training Hamming distance between the initial hash code value and the preset hash code value is calculated, and the training Hamming distance is compared with a preset Hamming distance threshold. Specifically, the value on each bit of the initial hash code value is compared with the value on each bit of the preset hash code value, the number of bits whose bit values are different between the initial hash code value and the preset hash code value is determined, and the number of bits is used as the training Hamming distance, and the training Hamming distance is compared with the preset Hamming distance threshold. For example, assuming that the initial hash code value is a vector (1, 1, 1, 1), and the target hash code result is a vector (-1, 1, 1, -1), the number of bits is 2, and the training Hamming distance is 2.
[0177] Step A23: if the training Hamming distance is greater than the preset Hamming distance threshold, it is determined that the hash layer to be trained has not reached the preset iteration end condition, and the preset polarization loss function is optimized based on the initial hash code value;
[0178] In this embodiment, if the training Hamming distance is greater than the preset Hamming distance threshold, it is determined that the hash layer to be trained has not reached the preset iteration end condition, and the preset polarization loss function is optimized based on the initial hash code value. Specifically, if the training Hamming distance is greater than the preset Hamming distance threshold, it is determined that the preset polarization loss function has not converged on all the polarization output channels, that is, the preset polarization loss function has not converged, and then it is determined that the hash coding model to be trained has not reached the preset iteration end condition, and then the initial hash code value and the preset hash code are determined. One or more different bits between the values, and determining the unconverged polarization output channels corresponding to the different bits, and then adjusting the preset forced polarization parameters in the preset polarization loss function corresponding to the unconverged polarization output channels, wherein the unconverged polarization output channel is a polarization output channel corresponding to the unconverged preset polarization loss function, wherein the hash coding model to be trained includes at least one polarization output channel, and the number of the polarization output channels is related to the number of bits in the training hash vector, that is, one bit in the training hash vector corresponds to one polarization output channel.
[0179] Step A24, retraining the hash coding model to be trained based on the optimized preset polarization loss function until the training Hamming distance is less than or equal to the preset Hamming distance threshold;
[0180] In this embodiment, based on the optimized preset polarization loss function, the to-be-trained hash coding model is re-trained until the training Hamming distance is less than or equal to the preset Hamming distance threshold. Specifically, the training data is re-acquired, and based on the re-acquired training data, the to-be-trained hash coding model corresponding to the optimized preset polarization loss function is re-iterated to continue optimizing the preset polarization loss function until the training Hamming distance is less than or equal to the preset Hamming distance threshold.
[0181] Step A25: If the training Hamming distance is less than or equal to the preset Hamming distance threshold, it is determined that the hash coding model to be trained meets the preset iteration end condition, and the hash coding model to be trained is used as the preset hash coding model.
[0182] In this embodiment, if the training Hamming distance is less than or equal to the preset Hamming distance threshold, it is determined that the hash coding model to be trained has reached the preset iteration end condition, and the hash coding model to be trained is used as the preset hash coding model. Specifically, if the training Hamming distance is less than or equal to the preset Hamming distance threshold, it is determined that the hash coding model to be trained has reached the preset iteration end condition, that is, the preset polarization loss function corresponding to each polarization output channel in the hash coding model to be trained converges, and then the hash coding model to be trained is used as the preset hash coding model.
[0183] In addition, it should be noted that the current hash coding method based on deep learning usually uses pairwise similarity labels as training targets, and constraints need to be added during training, which leads to more parameters that need to be optimized when training the preset hash coding model. In this embodiment, when training the preset hash coding model, it is only necessary to optimize the preset hash coding model based on a simple polarization loss function, thereby avoiding the situation where pairwise similarity labels are used as training targets and constraints need to be added during training to train the preset hash coding model, thereby significantly improving the efficiency of building the preset hash coding model.
[0184] In this embodiment, if the training Hamming distance is less than or equal to the preset Hamming distance threshold, it is determined that the hash layer to be trained has reached the preset iteration end condition, and the hash layer to be trained is used as the hash layer. If the training Hamming distance is less than or equal to the preset Hamming distance threshold, it is determined that the hash layer to be trained has reached the preset iteration end condition, that is, the polarization loss function corresponding to each polarization output channel in the hash layer to be trained converges, and then the hash layer to be trained is used as the hash layer.
[0185] This embodiment obtains training data and a hash model to be trained, and based on a preset target hash coding method, generates the preset hash code value corresponding to the training data, and then iteratively trains the hash model to be trained based on the preset hash code value and the training data to optimize the preset polarization loss function corresponding to the hash model to be trained, until the hash model to be trained reaches a preset iteration end condition, and obtains the hash model. That is, this embodiment provides a method for directly training a hash model based on deep learning, that is, iteratively training the hash layer to be trained based on the training data and the preset hash code value to optimize the preset polarization loss function corresponding to the hash layer to be trained, until the hash layer to be trained reaches a preset iteration end condition, and obtains the hash model, wherein, during the iterative training process, no constraints are added, and the hash layer to be trained is iteratively trained directly based on deep learning, thereby avoiding the situation where the hash layer to be trained is trained with paired similarity labels as the training target and constraints are added, reducing the computational complexity during model training, improving the computational efficiency during model training, and laying a foundation for solving the technical problem of poor model interpretation effect.
[0186] Further, refer to Figure 3 Based on the first and second embodiments of the present application, in another embodiment of the present application, a feature dimension to be measured corresponds to an input dimension data, and the preset hash coding model includes a deep polarization network.
[0187] After the step of determining the feature importance values corresponding to the feature dimensions to be measured according to the respective association strength values in the classification association strength result, the feature importance measurement method includes:
[0188] Step S40, determining each network link corresponding to each input dimension data in the deep polarization network, and obtaining a network weight corresponding to each network link;
[0189] In this embodiment, it should be noted that each of the sample sets can be represented in the form of a matrix, and each column of the sample matrix to be measured corresponding to each of the sample sets corresponds to an input data dimension, each row of the sample matrix to be measured corresponds to a feature to be measured, and the network link is a link from the input data dimension to the hash coding result corresponding to the input dimension data in the deep polarization network.
[0190] Determine each network link corresponding to each input dimensional data in the deep polarized network, and obtain the network weight corresponding to each network link. Specifically, determine the hash coding result corresponding to the input dimensional data, and based on the input dimensional data and the hash coding result, determine each network link corresponding to the input dimensional data in the deep polarized network, and obtain the network weight corresponding to each network link. For example, Figure 4 The diagram shows the structure of the deep polarization network, where the hash output layer is the hash layer, i 0 and i 1 are the dimensions of the input data, h 0 、h 1 and h 2 are the hidden layer output results corresponding to the input data dimensions, k 0 and k 1 are the hash coding results output by the hash layer. If the input data dimension is i 0 , the output hash code result is k 0 , then i 0 The corresponding network links are link l_0=i 0 ,h 0 , k 0 , link l_1=i 0 ,h 1 , k 0 and link l_2=i 0 ,h 2 , k 0 .
[0191] Step S50, determining the target feature importance value corresponding to each of the input dimensional data in each of the feature importance values, and calculating the dimensional data input strength value corresponding to each of the input dimensional data based on each of the network weights and the target feature importance value corresponding to each of the input dimensional data;
[0192] In this embodiment, the target feature importance value corresponding to each of the input dimensional data is determined in each of the feature importance values, and based on the network weights and the target feature importance values corresponding to each of the input dimensional data, the dimensional data input strength value corresponding to each of the input dimensional data is calculated. Specifically, the target feature importance value corresponding to the input dimensional data is determined in each of the feature importance values, and each of the network weights and the target feature importance values are substituted into a preset dimensional data input strength calculation formula to calculate the dimensional data input strength value corresponding to the input dimensional data, wherein the preset dimensional data input strength calculation formula is as follows:
[0193]
[0194] Where L is the total number of network links, l represents the lth connection, J is the total number of network weights of the lth connection, j represents the jth weight, and w l,j It is represented as the jth weight of the lth connection, A k,c is the importance of the kth bit of the cth sample category, I i,k,c is the i-th input dimension strength of the k-th bit of the c-th sample category, wherein one of the bit positions of the sample category corresponds to one of the input data dimensions, and further, based on the one-to-one correspondence between the data input strength values of each dimension and the input data dimensions, a data input strength representation matrix corresponding to each of the input data dimensions is generated, and the data input strength representation matrix is used as the data input strength result, wherein any numerical value in the data input strength representation matrix can be expressed as the support / opposition strength of the k-th bit position corresponding to the input data dimension i for the c-th sample category.
[0195] This embodiment determines the network links corresponding to the input dimension data in the deep polarization network, obtains the network weights corresponding to the network links, and then determines the target feature importance values corresponding to the input dimension data in the feature importance values, and calculates the dimension data input strength values corresponding to the input dimension data based on the network weights and the target feature importance values corresponding to the input dimension data. That is, this embodiment determines the support / opposition strength of the sample category corresponding to each input data dimension in the measured data through the back propagation of the deep polarization network and the feature importance results that have been obtained, and then measures the support / opposition strength of each input data dimension for the classification decision of the deep polarization network from the input layer of the deep polarization network, that is, at the input level of the deep polarization network, quantitatively tests the importance of each feature corresponding to each input data dimension, thereby making the model explanation more intuitive and accurate, thereby improving the model explanation effect, and thus solving the technical problem of poor model explanation effect.
[0196] Reference Figure 3 , Figure 3 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.
[0197] like Figure 3As shown, the feature importance measurement device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may optionally be a storage device independent of the aforementioned processor 1001.
[0198] Optionally, the feature importance measurement device may also include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, etc. The rectangular user interface may include a display screen (Display), an input submodule such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0199] Those skilled in the art will understand that Figure 3 The feature importance measurement device structure shown in the figure does not constitute a limitation of the feature importance measurement device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0200] like Figure 3 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a feature importance measurement program. The operating system is a program that manages and controls the hardware and software resources of the feature importance measurement device, and supports the operation of the feature importance measurement program and other software and / or programs. The network communication module is used to realize the communication between the components inside the memory 1005, and the communication with other hardware and software in the feature importance measurement system.
[0201] exist Figure 3 In the feature importance measurement device shown, the processor 1001 is used to execute the feature importance measurement program stored in the memory 1005 to implement the steps of any of the feature importance measurement methods described above.
[0202] The specific implementation of the feature importance measurement device of the present application is basically the same as the embodiments of the above-mentioned feature importance measurement method, and will not be repeated here.
[0203] The embodiment of the present application further provides a feature importance measurement device, which is applied to a feature importance measurement device, and the feature importance measurement device includes:
[0204] A first determination module is used to obtain each feature dimension to be measured and determine the sample category corresponding to each feature dimension to be measured;
[0205] A hash coding module, used to input the sample sets corresponding to the sample categories into a preset hash coding model to obtain output hash coding values corresponding to the sample categories;
[0206] A second determination module is used to obtain a preset hash code value corresponding to each of the sample categories, and determine a classification association strength result corresponding to each of the feature dimensions to be measured based on each of the output hash code values and each of the preset hash code values;
[0207] The third determination module is used to determine the feature importance values corresponding to each of the feature dimensions to be measured according to each association strength value in the classification association strength result.
[0208] Optionally, the second determining module includes:
[0209] A first determining unit, configured to determine, in each of the preset hash code values, the same type of target hash values and the different type of target hash values corresponding to each of the sample categories, and to determine, in each of the output hash code values, the hash code values corresponding to each of the sample categories;
[0210] The first calculation unit is used to calculate the association strength value corresponding to each of the feature dimensions to be measured based on the hash code values, the same type target hash values and the different type target hash values respectively corresponding to each of the sample categories.
[0211] Optionally, the first computing unit includes:
[0212] A first calculation subunit is used to respectively calculate the first Hamming distances between the hash code values corresponding to the sample categories and the target hash values of the same category, and to average the first Hamming distances corresponding to the sample categories to obtain the first association strength representation values;
[0213] The second calculation subunit is used to respectively calculate the second Hamming distances between each of the hash code values corresponding to each of the sample categories and each of the heterogeneous target hash values, and to average the second Hamming distances corresponding to each of the sample categories to obtain each of the second association strength representation values, wherein there is a second Hamming distance between a hash code value and a heterogeneous target hash value.
[0214] Optionally, the third determining module includes:
[0215] The normalization unit is used to obtain a preset transformation function, and based on the preset transformation function, respectively normalize each of the association strength values to obtain each of the feature importance values.
[0216] Optionally, the hash coding module includes:
[0217] A data processing unit, used to input each of the sample sets into the hidden layer of the deep polarization network, and output the to-be-hashed data corresponding to each of the sample sets;
[0218] The first hash coding unit is used to input each of the to-be-hashed data into the hash layer of the deep polarization network, perform hash coding on each of the to-be-hashed data respectively, and obtain each of the output hash coding values.
[0219] Optionally, the feature importance measurement device further includes:
[0220] An acquisition module, used to acquire training data and a hash coding model to be trained, and generate a preset target hash value corresponding to the training data based on a preset target hash coding method;
[0221] An optimization module is used to iteratively train the hash coding model to be trained based on the preset hash coding value and the training data to optimize the preset polarization loss function corresponding to the hash coding model to be trained until the hash coding model to be trained reaches a preset iteration end condition, thereby obtaining the preset hash coding model.
[0222] Optionally, the optimization module includes:
[0223] A second hash coding unit, configured to input the training data into the hash coding model to be trained, so as to perform hash coding on the training data based on the preset polarization loss function to obtain an initial hash coding value;
[0224] A second calculation unit, configured to calculate a training Hamming distance between the initial hash code value and the preset hash code value, and compare the training Hamming distance with a preset Hamming distance threshold;
[0225] an optimization unit, configured to determine that the hash coding model to be trained does not meet the preset iteration end condition if the training Hamming distance is greater than the preset Hamming distance threshold, and optimize the preset polarization loss function based on the initial hash coding value;
[0226] A retraining unit, configured to retrain the hash coding model to be trained based on the optimized preset polarization loss function until the training Hamming distance is less than or equal to the preset Hamming distance threshold;
[0227] A determination unit is configured to determine that the hash coding model to be trained meets the preset iteration end condition if the training Hamming distance is less than or equal to the preset Hamming distance threshold, and use the hash coding model to be trained as the preset hash coding model.
[0228] Optionally, the feature importance measurement device further includes:
[0229] A fourth determination module is used to determine each network link corresponding to each input dimension data in the deep polarization network, and obtain a network weight corresponding to each network link;
[0230] A calculation module is used to determine the target feature importance value corresponding to each input dimensional data among each feature importance value, and calculate the dimensional data input strength value corresponding to each input dimensional data based on each network weight and the target feature importance value corresponding to each input dimensional data.
[0231] Optionally, the feature importance measurement device further includes:
[0232] A first comparison module is used to compare the importance representation value of the same type of features with a preset upper threshold of feature importance and a preset lower threshold of feature importance respectively;
[0233] A first determination module is configured to determine, if the similar feature importance representation value is greater than or equal to the preset feature importance upper threshold, whether the feature dimension to be measured corresponding to the similar feature importance representation value supports the classification decision of the deep polarization network for each sample to be measured;
[0234] A second determination module is configured to determine that the feature dimension to be measured opposes the classification decision of the deep polarization network on each of the samples to be measured if the value representing the importance of the same type of feature is less than or equal to the preset feature importance lower threshold; or
[0235] A second comparison module is used to compare the heterogeneous feature importance representation value with a preset feature importance upper threshold and a preset feature importance lower threshold respectively;
[0236] A third determination module is used to determine, if the heterogeneous feature importance representation value is less than or equal to the preset feature importance lower threshold, that the feature dimension to be measured corresponding to the heterogeneous feature importance representation value supports the classification decision of the deep polarization network for each of the samples to be measured;
[0237] The fourth determination module is used to determine that the feature dimension to be measured opposes the classification decision of the deep polarization network on each of the samples to be measured if the heterogeneous feature importance representation value is greater than or equal to the preset feature importance upper threshold.
[0238] The specific implementation of the feature importance measurement device of the present application is basically the same as the various embodiments of the above-mentioned feature importance measurement method, and will not be repeated here.
[0239] An embodiment of the present application provides a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of any of the feature importance measurement methods described above.
[0240] The specific implementation of the readable storage medium of the present application is basically the same as the embodiments of the above-mentioned feature importance measurement method, and will not be repeated here.
[0241] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.
Claims
1. A feature importance measurement method, characterized in that: The feature importance measurement method includes: Acquire each feature dimension to be measured, and determine the sample category corresponding to each feature dimension to be measured, wherein one feature dimension to be measured corresponds to one sample category, and the feature dimension to be measured is a set of features to be measured corresponding to each sample to be measured in the corresponding sample category, and the sample to be measured is an image; Inputting the sample sets corresponding to the sample categories into a preset hash coding model to obtain output hash coding values corresponding to the sample categories; Obtaining a preset hash code value corresponding to each of the sample categories, and determining a classification association strength result corresponding to each of the feature dimensions to be measured based on each of the output hash code values and each of the preset hash code values; Determine, according to each association strength value in the classification association strength result, the feature importance value corresponding to each of the feature dimensions to be measured; The preset hash coding model includes a deep polarization network, The step of inputting the sample sets corresponding to the sample categories into a preset hash coding model to obtain the output hash coding values corresponding to the sample categories comprises: Input each of the sample sets into the hidden layer of the deep polarization network respectively, and output the data to be hashed corresponding to each of the sample sets; Input each of the data to be hashed into the hash layer of the deep polarization network, perform hash coding on each of the data to be hashed, and obtain each of the output hash coding values; The classification association strength result includes one or more association strength values, one of the feature dimensions to be measured corresponds to one of the association strength values, and the step of determining the classification association strength result corresponding to each of the feature dimensions to be measured based on each of the output hash code values and each of the preset hash code values includes: Determine the same type target hash value and the different type target hash value corresponding to each sample category in each of the preset hash code values, and determine the hash code value corresponding to each sample category in each of the output hash code values; Calculate the association strength value corresponding to each of the feature dimensions to be measured based on the hash code values, the same type target hash values and the different type target hash values corresponding to each of the sample categories; The association strength value includes a first association strength representation value and a second association strength representation value, and the step of calculating the association strength value corresponding to each feature dimension to be measured based on each of the hash code values, the same target hash value, and the heterogeneous target hash value corresponding to each of the sample categories includes: Calculating first Hamming distances between the hash code values corresponding to the sample categories and the target hash values of the same category, and averaging the first Hamming distances corresponding to the sample categories to obtain the first association strength representation values; The second Hamming distances between the hash code values corresponding to the sample categories and the heterogeneous target hash values are calculated respectively, and the second Hamming distances corresponding to the sample categories are averaged to obtain the second association strength representation values, wherein there is a second Hamming distance between a hash code value and a heterogeneous target hash value.
2. The feature importance measurement method according to claim 1, characterized in that: The step of determining the feature importance values corresponding to the feature dimensions to be measured respectively according to the association strength values in the classification association strength result includes: A preset transformation function is obtained, and based on the preset transformation function, each of the association strength values is normalized to obtain each of the feature importance values.
3. The feature importance measurement method according to claim 1, characterized in that: Before the step of inputting the sample sets corresponding to the sample categories into a preset hash coding model to obtain the output hash coding values corresponding to the sample categories, the feature importance measurement method includes: Acquire training data and a hash coding model to be trained, and generate a preset target hash value corresponding to the training data based on a preset target hash coding method; Based on the preset hash code value and the training data, the hash code model to be trained is iteratively trained to optimize a preset polarization loss function corresponding to the hash code model to be trained, until the hash code model to be trained reaches a preset iteration end condition, thereby obtaining the preset hash code model.
4. The feature importance measurement method according to claim 3, characterized in that: The step of iteratively training the hash coding model to be trained based on the preset target hash value and the training data until the hash coding model to be trained reaches a preset iteration end condition, and obtaining the preset hash coding model includes: Inputting the training data into the hash coding model to be trained, so as to perform hash coding on the training data based on the preset polarization loss function to obtain an initial hash coding value; Calculating a training Hamming distance between the initial hash code value and the preset hash code value, and comparing the training Hamming distance with a preset Hamming distance threshold; If the training Hamming distance is greater than the preset Hamming distance threshold, it is determined that the hash coding model to be trained does not meet the preset iteration end condition, and based on the initial hash coding value, the preset polarization loss function is optimized; Based on the optimized preset polarization loss function, retraining the hash coding model to be trained until the training Hamming distance is less than or equal to the preset Hamming distance threshold; If the training Hamming distance is less than or equal to the preset Hamming distance threshold, it is determined that the hash coding model to be trained meets the preset iteration end condition, and the hash coding model to be trained is used as the preset hash coding model.
5. The feature importance measurement method according to claim 1, characterized in that: The feature dimension to be measured corresponds to an input dimension data, and the preset hash coding model includes a deep polarization network. After the step of determining the feature importance values corresponding to the feature dimensions to be measured according to the respective association strength values in the classification association strength result, the feature importance measurement method includes: Determine in the deep polarization network the network links corresponding to the input dimensional data, and obtain the network weights corresponding to the network links; The target feature importance values corresponding to each of the input dimensional data are determined in each of the feature importance values, and the dimensional data input strength values corresponding to each of the input dimensional data are calculated based on the network weights and the target feature importance values corresponding to each of the input dimensional data.
6. The feature importance measurement method according to claim 1, characterized in that: The feature importance value includes a homogeneous feature importance representation value and a heterogeneous feature importance representation value, the preset hash coding model includes a deep polarization network, the sample set includes one or more samples to be measured, After the step of determining the feature importance values corresponding to the feature dimensions to be measured according to the respective association strength values in the classification association strength result, the feature importance measurement method includes: Comparing the importance representation values of the same type of features with the preset upper threshold of feature importance and the preset lower threshold of feature importance respectively; If the similar feature importance representation value is greater than or equal to the preset feature importance upper threshold, it is determined that the feature dimension to be measured corresponding to the similar feature importance representation value supports the classification decision of the deep polarization network for each of the samples to be measured; If the importance representation value of the same type of features is less than or equal to the preset feature importance lower threshold, it is determined that the feature dimension to be measured opposes the classification decision of the deep polarization network for each of the samples to be measured; or Comparing the heterogeneous feature importance representation value with a preset feature importance upper threshold and a preset feature importance lower threshold respectively; If the heterogeneous feature importance representation value is less than or equal to the preset feature importance lower threshold, it is determined that the feature dimension to be measured corresponding to the heterogeneous feature importance representation value supports the classification decision of the deep polarization network for each of the samples to be measured; If the heterogeneous feature importance representation value is greater than or equal to the preset feature importance upper threshold, it is determined that the feature dimension to be measured opposes the classification decision of the deep polarization network for each of the samples to be measured.
7. A feature importance measurement device, characterized in that, The feature importance measurement device includes: a memory, a processor, and a program stored in the memory for implementing the feature importance measurement method. The memory is used to store a program for implementing a feature importance measurement method; The processor is used to execute a program for implementing the feature importance measurement method to implement the steps of the feature importance measurement method as claimed in any one of claims 1 to 6.
8. A readable storage medium, characterized in that: The readable storage medium stores a program for implementing the feature importance measurement method, and the program for implementing the feature importance measurement method is executed by a processor to implement the steps of the feature importance measurement method as claimed in any one of claims 1 to 6.
Citation Information
Patent Citations
Rapid image retrieval method based on supervised topology keeping hash
CN105069173A
Image identification method and device
CN105069457A