[英]How to get the aggregate of all the confusion matrix in python when Stratified 10 fold cross validation is applied
我正在使用 10 折交叉驗證並根據准確性和精度評估模型。 混淆矩陣為每個模型生成 10 次。 任何人都可以讓我知道如何聚合混淆矩陣並計算准確度?
謝謝!!
您可以按如下方式使用cross_val_predict
函數並將其結果用作confusion_matrix()
cross_val_predict
confusion_matrix()
參數。
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import cross_val_predict
y_pred = cross_val_predict(clf, x, y, cv=5)
cm = confusion_matrix(y, y_pred)
您需要提供更多有關您擁有的數據格式的信息!
如果您使用的是 tensorflow,則可以參考此來源
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.