Sklearn set_config 出错

May*_*thi 7 python scikit-learn

我面临 sklearn set_config 失败的问题。我正在使用 Google Colab,它在 Jupyter Notebook 上也失败了。即使是从https://scikit-learn.org/stable/auto_examples/release_highlights/plot_release_highlights_0_23_0.html#sphx-glr-auto-examples-release-highlights-plot-release-highlights-0-23-0-复制的代码py也因同样的错误而失败。

from sklearn import set_config
set_config(display='diagram')
Run Code Online (Sandbox Code Playgroud)

错误:类型错误:set_config() 得到了意外的关键字参数“display”

请建议如何解决这个问题。

kHa*_*hit 9

需要在colab上升级scikit-learn,它的版本是'v0.22.2.post1',而函数中的display参数set_config()是在v0.23.

!pip install --upgrade scikit-learn
Run Code Online (Sandbox Code Playgroud)

然后,重新启动运行时,display现在应该可以工作了。