y_pred = model.predict(test_images)
y_pred = y_pred.argmax(axis = 1)
cm = confusion_matrix(test_labels, y_pred)

y_pred의 각행에서(axis = 1) 가장 큰 값의 인덱스를 argmax로 구하면 레이블 인코딩이 된다.

+ Recent posts