“cannot import name 'graphical_lasso” 解决方案

Traceback (most recent call last):
  File "D:/python workspace/BBA_NEW2/9_IML_binarylassification.py", line 5, in <module>
    from metric_learn import LMNN
  File "E:\annaconda\anaconda\lib\site-packages\metric_learn\__init__.py", line 8, in <module>
    from .sdml import SDML, SDML_Supervised
  File "E:\annaconda\anaconda\lib\site-packages\metric_learn\sdml.py", line 10, in <module>
    from sklearn.covariance import graphical_lasso
ImportError: cannot import name 'graphical_lasso'

scikit-learn版本问题,将sklearn,scikit-learn uninstall掉,重新装一个高版本的scikit-learn就可以了
我的情况是scikit-learn-0.19.1报错,scikit-learn-0.21.3正常

你可能感兴趣的:(机器学习)