![](/img/trans.png)
[英]AttributeError: module 'sklearn.datasets' has no attribute 'load_titanic'
[英]AttributeError: module 'sklearn.metrics' has no attribute 'items'
这是我的代码..
import imp
from sklearn.metrics import classification_report
from sklearn import metrics
from sklearn.metrics import accuracy_score
for title, metric in metrics.items():
print(title, metric(labels_categorical_dev.argmax(axis=1), y_pred.argmax(axis=1)))
print(classification_report(labels_categorical_dev.argmax(axis=1), y_pred.argmax(axis=1)))
y_pred = model.predict([message_first_message_test, message_second_message_test, message_third_message_test])
我正在低于错误..
回溯(最近一次通话最后):
文件“getopt.py”,第 6 行,在
for title, metric in metrics.items():
AttributeError:模块“sklearn.metrics”没有属性“项目”
我尝试过从 scikit-learn=0.20.0 到 scikit-learn=0.24.2 的版本
但仍然收到此错误。 请给我一个解决方案。
您能否分享有关代码用途的更多详细信息? 正如您在此处看到的, sklearn.metrics
没有任何名为items()
的属性。
.items()
用于字典,以获取与该字典中不同键有关的值。
此外,您在y_pred
被引用后定义了它,因此也会导致错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.