python - 如何在没有省略号的情况下打印所有 eli5.explain_weights() 结果?

标签 python machine-learning keras

我想打印所有特征的特征重要性,但我一直只得到前几个。

我尝试过的功能:

print(eli5.format_as_text(eli5.explain_weights(perm)))

print(eli5.format_as_html(eli5.explain_weights(perm)))

还有格式函数上的显示选项,show=("WEIGHTS", "ALL") 但它们都只打印前几个答案,然后用省略号省略其余部分,如下所示:

0.0955 ± 0.1404  x23
0.0490 ± 0.0661  x33
0.0401 ± 0.0253  x64
0.0324 ± 0.0245  x37
0.0263 ± 0.0480  x111
0.0253 ± 0.0057  x107
0.0248 ± 0.0237  x36
0.0245 ± 0.0265  x81
0.0209 ± 0.0173  x46
0.0139 ± 0.0129  x80
0.0126 ± 0.0121  x14
0.0125 ± 0.0182  x1
0.0122 ± 0.0110  x110
0.0113 ± 0.0135  x51
0.0113 ± 0.0198  x116
0.0106 ± 0.0063  x11
0.0104 ± 0.0153  x66
0.0088 ± 0.0278  x113
0.0086 ± 0.0236  x67
0.0085 ± 0.0194  x21
    … 101 more …   

有没有办法打印所有内容?

最佳答案

将属性 top=100 传递给 explain_weights,例如 eli5.explain_weights(perm, top=100)

https://eli5.readthedocs.io/en/latest/autodocs/eli5.html?highlight=top

看起来默认是 20:https://eli5.readthedocs.io/en/latest/_modules/eli5/sklearn/explain_weights.html?highlight=_TOP

参见_TOP=20

关于python - 如何在没有省略号的情况下打印所有 eli5.explain_weights() 结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54797621/

相关文章:

python - Keras 中的检查点深度学习模型

python - Keras:使用 model.fit() 洗牌数据不会发生变化,但 sklearn.train_test_split() 会发生变化

python - xml中的注释转换为json?

python - 如何反转 matplotlib pyplot 条形图中的条形大小?

python - python optparse的异常处理

algorithm - 相似矩阵 -> 特征向量算法?

python - Cloud ML Engine 在线预测性能

python - Django 请求 XML 文件

python gettext : specify locale in _()

performance - Matlab 中的高效分类