該對象具有一些不錯的屬性,例如 和 。PermutationImportancefeature_importances_feature_importances_std_為了在HTML樣式中可視化此屬性,我使用了函數。但是,我注意到顯示的標準偏差與 中的值不一致。eli5.show_weightsfeature_importances_std_更具體地說,我可以看到顯示的HTML值等于feature_importances_std_ * 2。為什么?法典:from sklearn import datasetsimport eli5from eli5.sklearn import PermutationImportancefrom sklearn.svm import SVC, SVR# import some data to play withiris = datasets.load_iris()X = iris.data[:, :2] # we only take the first two features.y = iris.targetclf = SVC()perms = PermutationImportance(clf, n_iter=1000, cv=10, random_state=0).fit(X, y)print(perms.feature_importances_)# this is the actual SDprint(perms.feature_importances_std_)# These are the displayed valuesprint(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)我們可以看到,不同的標準差是雙重的,即。2 * perms.feature_importances_std_這可能是一個錯誤嗎?
1 回答

www說
TA貢獻1775條經驗 獲得超8個贊
找到:
它在模板中生成了以下頁面的功能重要性html表*2
{% if not fw.std is none %} ± {{ "%0.4f"|format(2 * fw.std) }} {% endif %}
它顯然是用手放的
添加回答
舉報
0/150
提交
取消