简体   繁体   中英

Anaconda : cannot import name auc_score

I try running a python file in spyder of Anaconda with mac, but an ImportError occured.

The python file is running well in Ubuntu. I installed Anaconda because it is said that all kinds of packages are included. The import error is really unexpected and I do not know how to fix the problem.

from sklearn.metrics import auc_score
 ImportError: cannot import name auc_score

auc_score is apparently not in the namespace...

use this instead:

from sklearn.metrics import roc_curve, auc, roc_auc_score

Whichever suits your needs

The right import is roc_auc_score instead of auc_score .

Its usage is roc_auc_score(y_test, y_pred) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM