본문 바로가기
public void static main/AI

[AI] 챕터06 - 성능 평가

by 햄리뮤 2025. 7. 21.
반응형

공부할 챕터

챕터 주제 간단 설명
1 머신러닝이란 무엇인가 머신러닝의 정의, 동작 원리, AI와의 관계
2 머신러닝의 분류 지도학습, 비지도학습, 강화학습의 차이
3 데이터와 전처리 데이터가 왜 중요한가, 어떻게 다듬는가
4 특징(Feature)과 레이블(Label) 입력과 출력의 개념, 특징 추출
5 학습과 예측 모델 훈련(training), 예측(predict)의 의미
6 성능 평가 정확도, 정밀도, 재현율, F1 Score 등
7 대표 알고리즘 이해 회귀, 분류, 군집 등 알고리즘 소개
8 과적합과 일반화 학습을 너무 많이/적게 했을 때 문제
9 실습과 프로젝트 간단한 실전 예제, 모델 만들기

 

 

좋아 이제 머신러닝 모델이 얼마나 잘 배웠는지를 판단해보는 시간이다아아아!

성능 평가가 왜 중요한걸까?

 

모델을 학습했으면 이제 예측을 얼마나 잘하게요~하는지 알아야한다!

학습이 잘 됐는지 과적합인지 실전에서 쓸 수 있는지 등을 수치로 평가할 수 있어야 진짜 좋은 모델인지 판단할 수 있다!

머신러닝 성능 평가의 문제 유형을 알아보쟈

분류(Classification) 문제 중심으로 문제유형을 알아보자!

정확도(Accuracy)

Accuracy = (정답으로 예측한 개수) / (전체 예측 개수)

단점: 불균형 데이터에 약하다. (99% 정상, 1% 오류일 때 전부 '정상'이라고 해도 정확도 99%)


정밀도(Precision) & 재현율(Recall)

  • 정밀도: 예측이 Positive 라고 한 것 중에서 실제로 Positive인 비율
    • 모델이 스팸이라고 예측한 10개중 8개만 진짜 스팸 -> 정밀도 80%
  • 재현율: 실제로 Positive인 것 중에서 모델이 맞춘 비율
    • 실제 스팸 20개 중 15개를 찾아냄 -> 재현율 75%
모델 정밀도⬆️ 재현율 ⬆️
매우 보수적인 모델
매우 민감한 모델

F1 Score

정밀도와 재현율의 균형을 고려한 평균 지표

F1 = 2 x (Precision x Recall) / (Precision + Recall)

  • 정밀도와 재현율이 비슷할수록 F1 점수가 높아짐
  • 불균형 데이터셋에서 가장 널리 쓰임

혼동 행렬(Confusion Matrix)

모델이 예측한 결과를 행렬로 정리한 표

  실제 양성(Positive) 실제 음성 (Negative)
예측 양성 TP (True Positive)
정답 맞춤
FP (False Positive)
아닌 걸 맞췄다고 우김(오탐)
예측 음성 FN (False Negative)
맞는 걸 틀렸다고 함💢(누락)
TN (True Negative)
정답 틀림 없이 잘 맞춤

ROC Curve & AUC

모델이 얼마나 잘 분리(classify) 하는지를 시각으로 보여주는 도구

  • ROC Curve: TPR(재현율) vs FPR(오탐율) 그래프
  • AUCL ROC 아래 면적 1에 가까울수록 좋은 모델

지금까지 분류를 보았는데 회귀(숫자 예측) 문제에서는 다른 지표를 쓴다.

  • MSE (Mean Squared Error): 예측값과 실제값의 차이를 제곱해서 평균한 값, 모델의 예측 오차를 측정하는 지표
    • 특징? 
      • 큰오차에 민감하고, 최적화(학습)에 자주 사용된다.
      • 단위가 원래 데이터 단위의 제곱이어서 해석은 어렵다.
    • 언제 사용될까? 큰 오차를 특히 줄여야할 때 유용하다.

  • MAE(Mean Absolute Error): 예측값과 실제값의 절대오차의 평균
    • 특징?
      • 모든 오차가 동일하게 취급되어 이상치에 둔감함.
      • 해석이 쉽고 직관적.
    • 언제 사용될까? 이상치가 많거나 평균 오차 자체를 알고 싶을 때.

  • RMSE(Root Mean Squared Error): MSE의 제곱근, 원 데이터와 동일한 단위를 가진다.
    • 특징?
      • 해석이 직관적이며, MSE와 마찬가지로 이상치에 민감하다.
    • 언제 사용될까? 평균 오차가 실제로 얼마나 큰지 감이 필요할 때.

  • R^2(R-suared): 모델이 결과 분산의 얼마나 잘 설명하는가 (1에 가까울수록 좋음)
    • 해석: 0 - 1 사이에서 1에 가까울수록 설명력이 좋고, 0.8이면 80% 설명
    • 주의: 변수가 늘어날수록 값이 무조건 증가한다 -> 과적합 위험.

더 자세히는 다음에 알아보자 이번 시리즈에서는 아주 기본적인 개념만! 아~ 이런게 있구나 정도~!!


 

https://spotintelligence.com/2024/06/17/roc-auc-curve-in-machine-learning/

 

ROC And AUC Curves In Machine Learning Made Simple & How To Tutorial In Python

What are ROC and AUC Curves in Machine Learning?The ROC CurveThe ROC (Receiver Operating Characteristic) curve is a graphical representation used to eva

spotintelligence.com

https://www.geeksforgeeks.org/machine-learning/auc-roc-curve/

 

AUC ROC Curve in Machine Learning - GeeksforGeeks

Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.

www.geeksforgeeks.org

https://www.shiksha.com/online-courses/articles/how-to-calculate-the-f1-score-in-machine-learning/

 

How to Calculate the F1 Score in Machine Learning - Shiksha Online

f1 score is the evaluation metric that is used to evaluate the performance of the machine learning model. It uses both precision and Recall, that makes it best for unbalanced dataset. In this article, we will briefly cover what is f1 score, its formula, an

www.shiksha.com

https://www.evidentlyai.com/classification-metrics/accuracy-precision-recall

 

Accuracy vs. precision vs. recall in machine learning: what's the difference?

Confused about accuracy, precision, and recall in machine learning? This illustrated guide breaks down each metric and provides examples to explain the differences.

www.evidentlyai.com

https://www.blog.trainindata.com/confusion-matrix-precision-and-recall/

 

Confusion Matrix, Precision, and Recall - Train in Data's Blog

Find out what the confusion matrix is and how it relates to other classification metrics like precision, recall and f1-score.

www.blog.trainindata.com

https://spotintelligence.com/2024/03/27/regression-metrics-for-machine-learning/

 

10 Regression Metrics For Machine Learning & Practical How To Guide

What are Evaluation Metrics for Regression Models?Regression analysis is a fundamental tool in statistics and machine learning used to model the relationshi

spotintelligence.com

https://farshadabdulazeez.medium.com/essential-regression-evaluation-metrics-mse-rmse-mae-r%C2%B2-and-adjusted-r%C2%B2-0600daa1c03a

 

Essential Regression Evaluation Metrics: MSE, RMSE, MAE, R², and Adjusted R²

In regression analysis, evaluating model performance is essential for understanding how well the model fits the data. This post covers five…

farshadabdulazeez.medium.com

 

 

** 그냥 하루하루 개인 공부한 것을 끄적 거리는 공간입니다.

이곳 저곳에서 구글링한 것과 강의 들은 내용이 정리가 되었습니다.

그림들은 그림밑에 출처표시를 해놓았습니다.

문제가 될시 말씀해주시면 해당 부분은 삭제 하도록하겠습니다. **

반응형

댓글