排列对物理学的重要性
PermutationImportancePhysics的Python项目详细描述
置换重要物理
这个包有助于计算基于给定度量的给定模型的特征排列重要性,以度量性能。其思想是在给定性能指标的基础上评估trained model的性能,前提是一个输入特征被拿走(特征值在样本之间洗牌)。
结果通常比由增强决策树提供的^ {EM1}$特征重要性
此包处理“示例权重”、自定义性能度量,并提供一些预定义的基于高能物理的度量。它可用于评估给定数据集上的特征重要性,该数据集不一定来自与训练集相同的分布,因此可以为新的测试数据集和/或评估度量重新计算训练模型的特征重要性。这可能有助于测试对系统位移(域适应)的敏感性,或仅测试数据集特定子集的特征的影响(具有1个喷射、2个喷射的样本、得分大于0.6的样本、质量为700 gev、800 gev的信号等)。它还可以处理多个输入矩阵,只要它们以列表的形式组合在一起(例如,如果您的计算度量要求系统化向上、系统化向下的数据集)。
WARNING: Choosing the right metric is essential to get meaningful results. Make sure to check if the value of PI for your given features makes sense. If 'discovery significance' is your metric (which usually ranges between 0 and 6), a permutation importance of 112 for a particular feature should worry you.
当有疑问时,使用“AUC”作为分类问题的合理度量,而不是“准确性”。
WARNING: With random forrests or DNN with dropouts, the PI for 2 correlated features might be 0 because dropping any one individually does not hamper the performance of the model, however dropping both might decrease performance. In this package the PI is calculated by dropping only 1 feature at a time for now. Future versions might provide an option to calculate PI taking into account correlations, if there is demonstrated interest.
快速教程
pip install PermutationImportancePhysics
在Python3
from permutationimportancephysics.PermutationImportance import PermulationImportance
pi = PermulationImportance(model=bdt, X=X_test,y=y_test,weights=weights_test,n_iterations=3,usePredict_poba=True,
scoreFunction="AUC")
pi.dislayResults()
或发现意义
pi = PermulationImportance(model=bdt, X=X_test,y=y_test,weights=weights_test,n_iterations=3,usePredict_poba=True,
scoreFunction="amsasimov")
pi.dislayResults()
带误差条的绘图功能重要性
plt = pi.plotBars()
plt.show()
n_iterations(default=3)
:新洗牌后计算特征排列重要性的次数。越高=>;不确定度越小,计算时间越长。
usePredict_poba(default=False)
:使用model.predict_proba()
而不是model.predict()
,这对于sklearn模型很有用。
scoreFunction(default='AUC')
:用于计算整个计算数据集上排列重要性的计算度量。用户定义函数的形式可能是:func (X_eval, y_true, weights)
。
依赖关系:
- 努比
- matplotlib
- sklearn
待办事项:
- 多处理
- 负重处理的AUC
- 添加更多物理度量(系统学意义,干扰)