print labels on confusion matrix

Solutions on MaxInterview for print labels on confusion matrix by the best coders in the world

showing results for - "print labels on confusion matrix"
Finn
08 Sep 2018
1unique_label = np.unique([y_true, y_pred])
2cmtx = pd.DataFrame(
3    confusion_matrix(y_true, y_pred, labels=unique_label), 
4    index=['true:{:}'.format(x) for x in unique_label], 
5    columns=['pred:{:}'.format(x) for x in unique_label]
6)
7print(cmtx)
8# Output:
9#           pred:no  pred:yes
10# true:no         3         0
11# true:yes        2         1
Marta
23 Jan 2018
1import pandas as pd
2cmtx = pd.DataFrame(
3    confusion_matrix(y_true, y_pred, labels=['yes', 'no']), 
4    index=['true:yes', 'true:no'], 
5    columns=['pred:yes', 'pred:no']
6)
7print(cmtx)
8# Output:
9#           pred:yes  pred:no
10# true:yes         1        2
11# true:no          0        3
queries leading to this page
python print confusion matrix with labelssklearn confusion matrix with labelscreate labels confusion matrixlabel confusion matrix pythonconfusion matrix labelspython confusion matrix with labelshow to print confusion matrix with lablesprint confusion matrixplot confusion matrix with labels pythonconfusion matrix labelspython confusion matrix labelspecify labels in confusion matrix sklearnhow to visualize a confusion matrix with labels in matplotlib pythonprint beautiful confusion matrix pythonconfusion matrix with labelspython print confusion matrix with class labelshow to plot confusion matrix for logistic regressionconfusion matrix python automatic labelswrite labels in confusion matrix sklearnhow to print confusion matrix in python with labelsadd labels to confusion matrixprint confusion matrix with labelshow to print confusion matrixconfusioni matrix labelsimport confusion matrix with labelsplot confusion matrix labelssklearn confusion matrix labelsconfusion matrix python with labelslabels for confusion matrixhow to find the labels of the confusion matrix in pythonconfusion matrix printing in a single lineconfusion matrix with labelsvalues format plot confusion matrixwrite labels in confusion matrix matplotlibprint confusion matrix with labels in pythonprint labels in confusion matrix sklearnconfusion matrix get labelshow to label confusion matrix in pythonconfusion matrix with labels pythondisplay confusion matrix with correct labels pythonplot confusion matrix sklearn with titleprinting confusion matrixprint labels on confusion matrix