모델 비교

Python으로 배우는 Generalized Linear Models

Ita Cirovic Donev

Data Science Consultant

이탈도(Deviance)

  • 공식 $$ D = -2LL(\beta) $$

  • 오류 측도

  • 이탈도↓ $\rightarrow$ 적합도 향상
  • 비교 기준: null 이탈도 $\rightarrow$ 절편만 있는 모형
  • 평가
    • 무작위 잡음 변수를 추가하면 평균적으로 이탈도가 1 감소
    • 예측변수 $p$개를 추가하면 이탈도는 $p$보다 더 감소해야 함
Python으로 배우는 Generalized Linear Models

Python에서의 이탈도

'y ~ distance100' 모형 요약 출력으로 로그우도와 이탈도 통계를 강조.

Python으로 배우는 Generalized Linear Models

이탈도 계산

  • null 이탈도와 이탈도 추출
    # Extract null deviance
    print(model.null_deviance)
    
4118.0992
# Extract model deviance
print(model.deviance)
4076.2378
  • 로그우도로 이탈도 계산
    print(-2*model.llf)
    
4076.2378
  • 이탈도 41.86 감소
  • distance100 포함으로 적합도 개선
Python으로 배우는 Generalized Linear Models

모형 복잡도

  • model_1model_2, 조건
    • $L1 > L2$
    • model_2의 매개변수 개수가 더 많음
  • model_2과적합
Python으로 배우는 Generalized Linear Models

연습해 봅시다!

Python으로 배우는 Generalized Linear Models

Preparing Video For Download...