我想打印所有特征的重要性,但每次只能显示前几个特征的结果。
我尝试过的函数有:
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 x230.0490 ± 0.0661 x330.0401 ± 0.0253 x640.0324 ± 0.0245 x370.0263 ± 0.0480 x1110.0253 ± 0.0057 x1070.0248 ± 0.0237 x360.0245 ± 0.0265 x810.0209 ± 0.0173 x460.0139 ± 0.0129 x800.0126 ± 0.0121 x140.0125 ± 0.0182 x10.0122 ± 0.0110 x1100.0113 ± 0.0135 x510.0113 ± 0.0198 x1160.0106 ± 0.0063 x110.0104 ± 0.0153 x660.0088 ± 0.0278 x1130.0086 ± 0.0236 x670.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