“Drucken Sie Etiketten auf Confusion_Matrix aus” Code-Antworten

Drucken Sie Etiketten auf Confusion_Matrix aus

unique_label = np.unique([y_true, y_pred])
cmtx = pd.DataFrame(
    confusion_matrix(y_true, y_pred, labels=unique_label), 
    index=['true:{:}'.format(x) for x in unique_label], 
    columns=['pred:{:}'.format(x) for x in unique_label]
)
print(cmtx)
# Output:
#           pred:no  pred:yes
# true:no         3         0
# true:yes        2         1
Xerothermic Xenomorph

Drucken Sie Etiketten auf Confusion_Matrix aus

import pandas as pd
cmtx = pd.DataFrame(
    confusion_matrix(y_true, y_pred, labels=['yes', 'no']), 
    index=['true:yes', 'true:no'], 
    columns=['pred:yes', 'pred:no']
)
print(cmtx)
# Output:
#           pred:yes  pred:no
# true:yes         1        2
# true:no          0        3
Xerothermic Xenomorph

Ähnliche Antworten wie “Drucken Sie Etiketten auf Confusion_Matrix aus”

Fragen ähnlich wie “Drucken Sie Etiketten auf Confusion_Matrix aus”

Weitere verwandte Antworten zu “Drucken Sie Etiketten auf Confusion_Matrix aus” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen