`eli5.show_weights` displayed standard deviation does not agree with the values in `feature_importances_std_`

不问归期 提交于 2020-03-04 18:18:52

问题


The PermutationImportance object has some nice attributes such as feature_importances_ and feature_importances_std_.

To visualize in an HTML style this attributes I used eli5.show_weights function. However, I noticed that the displayed standard deviation does not agree with the values in feature_importances_std_.

More specifically, I can see that the displayed HTML values are equal to feature_importances_std_ * 2. Why is that ?

Code:

from sklearn import datasets
import eli5
from eli5.sklearn import PermutationImportance
from sklearn.svm import SVC, SVR

# import some data to play with
iris = datasets.load_iris()
X = iris.data[:, :2]  # we only take the first two features.
y = iris.target

clf = SVC()
perms = PermutationImportance(clf, n_iter=1000, cv=10, random_state=0).fit(X, y)

print(perms.feature_importances_)
# this is the actual SD
print(perms.feature_importances_std_)
# These are the displayed values
print(perms.feature_importances_std_* 2)

[0.39527333 0.17178   ] # the actual mean
[0.13927548 0.11061278] # the actual SD
[0.27855095 0.22122556] # the displayed values by `show_weights()`

eli5.show_weights(perms)

We can see that the diplayed standard deviation is doupled i.e. 2 * perms.feature_importances_std_.

Is this a bug maybe?

来源:https://stackoverflow.com/questions/60489934/eli5-show-weights-displayed-standard-deviation-does-not-agree-with-the-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!