学习dask-ml时,遇到下面问题:
from dask_ml.cluster import KMeans
AttributeError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\dask\utils.py in wrapper(method)
569 method.__doc__ = _derived_from(
--> 570 original_klass, method, ua_args=ua_args, extra=extra
571 )
~\Anaconda3\lib\site-packages\dask\utils.py in _derived_from(cls, method, ua_args, extra)
525 if doc:
--> 526 doc = ignore_warning(doc, cls, method.__name__, extra=extra)
527 elif extra:
~\Anaconda3\lib\site-packages\dask\utils.py in ignore_warning(doc, cls, name, extra)
478 """Expand docstring by adding disclaimer and extra text"""
--> 479 l1 = "This docstring was copied from %s.%s.%s. \n\n" % (cls.__module__, cls.__name__, name)
480 l2 = "Some inconsistencies with the Dask version may exist."
AttributeError: module 'sklearn.metrics.pairwise' has no attribute '__module__'
问题查找过程:
1、搜索错误AttributeError: module ‘sklearn.metrics.pairwise’ has no attribute ‘module’ ,没有找到
2、到https://github.com/dask/dask-ml/issues 官网找相关问题,没找到。
3、猜测为版本问题:
因为搜索引擎搜不到此问题,说明该问题大多数人没有碰到,所以应该是最新版本出现的。考虑上一版本是否对相关’sklearn.metrics.pairwise’内容进行更改
当前dask-ml版本为:
import dask_ml
dask_ml.__version__
'1.3.0'
查看与上一版本的比较:
到https://github.com/dask/dask-ml/compare/v1.2.0…v1.3.0
搜索pairwise,发现:
说明该问题是由于1.3版本增加pairwise造成。
解决:
将dask版本换为1.2,问题解决