Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I print all eli5.explain_weights() results without ellipsis?

I want to print the feature importance of all the features but I'm keep on getting only first few.

Functions I've tried:

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

and

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

and also the show option on the format functions, show=("WEIGHTS", "ALL") but they all only print first few answers and then omits the rest with ellipsis like the following:

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 …   

Is there a way to print everything?

like image 532
Bing Avatar asked Dec 13 '25 04:12

Bing


1 Answers

Pass the attribute top=100 to explain_weights like eli5.explain_weights(perm, top=100)

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

It looks like the default is 20: https://eli5.readthedocs.io/en/latest/_modules/eli5/sklearn/explain_weights.html?highlight=_TOP

see _TOP=20

like image 60
swagrov Avatar answered Dec 15 '25 17:12

swagrov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!