如何打印所有 eli5.explain_weights() 结果而不使用省略号?

我想打印所有特征的重要性,但每次只能显示前几个特征的结果。

我尝试过的函数有:

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

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注