딥 러닝 모델의 다양한 metric 확인하는법

김우빈·2022년 6월 1일
0

JUST DEEP_HINT

목록 보기
4/6
post-thumbnail

metric 확인코드

from sklearn.metrics import classification_report
import numpy as np

#softmax 사용해 구별한 라벨이라고 가정, 각각숫자는 라벨입니다.
target_names=['0','1','2','3','4','5','6','7','8','9']

#scikit-learn의 classification_report를 이용해서 다양한 metric들 도출

print(classification_report(np.argmax(y_valid,axis=-1), np.argmax(pred,axis=-1),target_names = target_names))

결과 예시

                precision   recall    f1-score   support

           0       0.99      1.00      0.99       980
           1       0.99      0.99      0.99      1135
           2       1.00      0.99      1.00      1032
           3       1.00      1.00      1.00      1010
           4       1.00      0.98      0.99       982
           5       0.99      0.99      0.99       892
           6       0.99      0.99      0.99       958
           7       0.99      1.00      0.99      1028
           8       0.99      0.99      0.99       974
           9       0.99      0.99      0.99      1009

    accuracy                           0.99     10000
   macro avg       0.99      0.99      0.99     10000
weighted avg       0.99      0.99      0.99     10000

라벨별 metric의 수치를 확인 하실 수 있습니다.

오늘도 깊은하루 되세요!

profile
DeepLearning, MLOps

0개의 댓글