본문 바로가기

Deep Learning/Tensorflow

Tensorflow - softmax로 나온 결과를, 레이블 인코딩으로 바꾸는 방법

반응형
argmax()

 

 

최대값의 인덱스를 알려주는 argmax () 함수

 

 

from sklearn.metrics import confusion_matrix
y_pred = model.predict(test_images)
y_pred = y_pred.argmax( axis = 1 )
y_pred

test_labels

cm = confusion_matrix(test_labels, y_pred)
cm

import seaborn as sb
sb.heatmap(cm, annot=True, fmt='.0f', cmap= 'RdPu')
plt.show()

 

 

반응형