모델 평가: 불균형 분류 모델

Python으로 연습하는 Machine Learning 면접 질문

Lisa Stuart

Data Scientist

클래스 불균형

  • 범주형 타깃 변수
    • 각 클래스 관측치 수가 비슷할수록 좋음
    • 큰 차이는 결과를 왜곡함

불균형 vs 균형 클래스

Python으로 연습하는 Machine Learning 면접 질문

혼동 행렬

혼동 행렬

1 https://scaryscientist.blogspot.com/2016/03/confusion-matrix.html
Python으로 연습하는 Machine Learning 면접 질문

성능 지표

성능 지표

1 https://scaryscientist.blogspot.com/2016/03/confusion-matrix.html
Python으로 연습하는 Machine Learning 면접 질문

행렬에서 얻는 지표

성능 지표

1 https://scaryscientist.blogspot.com/2016/03/confusion-matrix.html
Python으로 연습하는 Machine Learning 면접 질문

재샘플링 기법

  • 소수 클래스 오버샘플링
  • 다수 클래스 언더샘플링
  • 참고: 재샘플링 전, 먼저 학습/시험 분할!

재샘플링 기법

1 https://www.svds.com/learning-imbalanced-classes/
Python으로 연습하는 Machine Learning 면접 질문

함수

함수 반환
sklearn.linear_model.LogisticRegression 로지스틱 회귀
sklearn.metrics.confusion_matrix(y_test,y_pred) 혼동 행렬
sklearn.metrics.precision_score(y_test,y_pred) 정밀도(precision)
sklearn.metrics.recall_score(y_test,y_pred) 재현율(recall)
sklearn.metrics.f1_score(y_test,y_pred) F1 점수
sklearn.utils.resample(deny, n_samples=len(approve)) 재샘플링
Python으로 연습하는 Machine Learning 면접 질문

연습해 봅시다!

Python으로 연습하는 Machine Learning 면접 질문

Preparing Video For Download...