dask-ml引入機器學習算法錯誤AttributeError: module 'sklearn.metrics.pairwise' has no attribute '__module__'

學習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,問題解決
更換dask版本

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章