Python中的Yellowbrick模块NotFoundError [英] Yellowbrick Module NotFoundError in Python

查看:540
本文介绍了Python中的Yellowbrick模块NotFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Yellowbrick绘制肘部曲线(以使k均值聚类)

I am trying to using Yellowbrick to make an elbow plot.(to make the k-means clustering)

我已在jupyter笔记本中安装了Yellowbrick.但是,它会继续返回错误消息,如下所示.

I have installed Yellowbrick in jupyter notebook. but, it keeps returning the error message like below.

错误消息和信息如下图所示. 如果您能帮助我,我将非常高兴.

The error message and information are attached as pictures below. I would be very happy if you could help me.

from yellowbrick.cluster import KElbowVisualizer

model = KMeans()

visualizer = KElbowVisualizer(model, k=(1,250))

visualizer.fit(x.reshape(-1,1))
 


ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-84-390153c57930> in <module>
----> 1 from yellowbrick.cluster import KElbowVisualizer
      2 model = KMeans()
      3 visualizer = KElbowVisualizer(model, k=(1,250))
      4 visualizer.fit(x.reshape(-1,1))
      5 

~/.local/lib/python3.7/site-packages/yellowbrick/__init__.py in <module>
     37 from .anscombe import anscombe
     38 from .datasaurus import datasaurus
---> 39 from .classifier import ROCAUC, ClassBalance, ClassificationScoreVisualizer
     40 
     41 # from .classifier import crplot, rocplot

~/.local/lib/python3.7/site-packages/yellowbrick/classifier/__init__.py in <module>
     24 from ..base import ScoreVisualizer
     25 from .base import ClassificationScoreVisualizer
---> 26 from .class_prediction_error import ClassPredictionError, class_prediction_error
     27 from .classification_report import ClassificationReport, classification_report
     28 from .confusion_matrix import ConfusionMatrix, confusion_matrix

~/.local/lib/python3.7/site-packages/yellowbrick/classifier/class_prediction_error.py in <module>
     22 
     23 from sklearn.utils.multiclass import unique_labels
---> 24 from sklearn.metrics._classification import _check_targets
     25 
     26 from yellowbrick.draw import bar_stack

ModuleNotFoundError: No module named 'sklearn.metrics._classification'

推荐答案

您好,感谢您检查Yellowbrick!

Hello and thanks for checking out Yellowbrick!

在sklearn v0.22中已弃用了sklearn.metrics.classification模块,因此我们更新了程序包以从sklearn.metrics._classification导入.

The sklearn.metrics.classification module was deprecated in sklearn v0.22, so we have updated our package to import from sklearn.metrics._classification instead.

尝试更新scikit-learn的版本(例如pip install -U scikit-learnconda update scikit-learn),看看是否有帮助!

Try updating your version of scikit-learn (e.g. pip install -U scikit-learn or conda update scikit-learn) and see if that helps!

这篇关于Python中的Yellowbrick模块NotFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆