본문 바로가기
Study/ML

[ML] Evaluation Metrics

by jizy 2024. 3. 26.
728x90

01. Evaluation Metrics in Regression Models

 

  1. MAE(Mean abolute error)
    • 예측 값과 실제 값 차이의 절댓값
  2. MSE(Mean squared error)
    • 회귀모델에서 학습하는 error function과 동일한 형태
  3. RMSE(Root mean squared error)
    • MSE의 값에 루트를 씌운 형태
    • 가장 널리 활용

 

 

 

 

 

 

02-1. Evaluation Metrics in Classification Models(binary classification)

 

  • binary classification : confusion matrix를 이용하여 accuracy이나 precision, recall 등을 평가함

 

 

  1. Accuracy
    • 전체 test set에 있는 샘플 중에서 얼마나 맞췄는지 계산하는 지표
    • positive/negative 개수가 imbalance 한 경우 정확도 평가가 어려움
  2. Error rate
    • 1에서 accuracy를 뺀 값, 0인 경우 모델이 정확하다고 할 수 있음
  3. Precision
    • imbalance 한 레이블을 가진 데이터에서도 사용할 숫 있는 평가지표
    • 정답이라고 예측한 값 중에서 실제로 얼마나 맞췄는지 계산하는 지표
    • ex. 스팸/정상 메일 분류 
  4. Recall
    • 실제 positive인 것 중에서 true positive를 가진 경우가 얼마인지 계산하는 지표
    • precision과 trade off관계를 가짐
    • ex. 감염병 양성/음성 테스트 
  5. F-measure(F1 or F-score)
    • precision과 recall을 합친 평가지표
    • 산술 평균 or 조화 평균(harmonic mean) 사용
      • 산술 평균 사용 시 A, B모델 precision와 recall이 0.5, 0.5인 경우와 0.9, 0.1인 경우 F1이 동일함
      • 조화 평균을 사용하여 A, B모델의 불균형을 보완하여 0.5와 0.18로 계산할 수 있음 

 

 

 

 

 

02-2. Evaluation Metrics in Classification Models(Multiclass classification)

  • multiclass classification : confusion matrix에서 row와 column을 확장하여 표현함

 

 

  1. Accuracy = (3+2+5) / 25 = 10 / 25
  2. Error rate = 1 - 10 / 25 
  3. Precision = for Cat, 3 / (3+6+5) = 3 / 14
  4. Recall = for Cat, 3 / (3+2+1) = 3 / 6
  5. Macro-Precision and Macro-Recall
    • Macro-Precision = (3/14 + 2/4 + 5/7) / 3 = 0.476
    • Macro-Recall = (3/6 + 2/9 + 5/10) / 3 = 0.407

 

 

 

 

 

 

 

 

 

728x90

'Study > ML' 카테고리의 다른 글

[ML] Cross-Validation  (1) 2024.03.26
[ML] Generalize Models  (0) 2024.01.31
[ML] Overfitting Problem  (0) 2024.01.31
[ML] Multinomial Logistic Regression  (1) 2024.01.04
[ML] Logistic Regression  (0) 2024.01.02