简体   繁体   English

keras 的特征重要性

[英]Feature importance with keras

i have the following question.我有以下问题。 I created a neural network with Keras.我用 Keras 创建了一个神经网络。 That is a Part of my dataFrame.这是我的数据框的一部分 My DataFrame looks like:我的数据帧看起来像:

    Id          MainCl   Class     Other Options...
    1016178069  0        30        1              
    1016178012  0        25        0              

My result vector gives me the probability in which class the result can be classified.我的结果向量给了我结果可以分类的概率。 Example:例子:

Prob_isClass_A    Prob_isClass_b
0.756686          0.243314
0.999843          0.000157006
0.999818          0.000182159

Now to the main question: Is there a way to get the highest probability of a feature that is responsible for the result?现在主要问题是:有没有办法获得对结果负责的特征的最高概率? Like:像:

Prob_isClass_A    Prob_isClass_b      Most_Probability_Reason    Probability
0.756686          0.243314            Main_CL_Feature            0.75
0.999843          0.000157006         Class_Feature              0.8
0.999818          0.000182159         Other_Option_Feature       0.7

I answered a related question at Feature Importance Chart in neural network using Keras in Python .在 Python 中使用 Keras 的神经网络中的特征重要性图表中回答了一个相关问题。 The only difference I can see here is that rather looking for an explanation of the feature importance for the ensemble metric, you want feature importance per individual prediction.我在这里看到的唯一区别是,与其寻找对集成度量的特征重要性的解释,不如说您想要每个单独预测的特征重要性。 In this case, the same package, ELI5 , has functions which can explain individual predictions as well in eli5.sklearn.explain_prediction .在这种情况下,同一个包ELI5具有可以在eli5.sklearn.explain_prediction 中解释单个预测的函数 I haven't yet had the need to use this functionality, but the documentation there seems straightforward.我还没有需要使用此功能,但那里的文档似乎很简单。

If i understand your question, you want something like first of feature importance of every sample separately ...如果我理解你的问题,你想要像每个样本的第一个特征重要性分开......

Feature importance isn't supported by keras. keras 不支持特征重要性。 You have to look in tree models for something like that.你必须在树模型中寻找类似的东西。 Furthermore you need something more that and as far as i can tell, has not yet implemented and probably wont be.此外,您需要更多的东西,据我所知,尚未实施,可能不会实施。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM