신용 전략과 최소 기대 손실

Python을 활용한 신용 위험 모델링

Michael Crabtree

Data Scientist, Ford Motor Company

승인율 선택하기

  • 먼저 승인율을 85%로 설정했지만, 다른 비율도 선택할 수 있습니다
  • 다양한 비율을 테스트하는 두 가지 방법:
    • 임계값, 불량률, 손실을 직접 계산
    • 이 값들의 표를 자동으로 생성하고 승인율 선택
  • 가능한 모든 값을 모은 표를 전략표라고 합니다
Python을 활용한 신용 위험 모델링

전략표 설정하기

  • 각 값을 저장할 배열이나 리스트 설정
# Set all the acceptance rates to test
accept_rates = [1.0, 0.95, 0.9, 0.85, 0.8, 0.75, 0.7, 0.65, 0.6, 0.55,
                0.5, 0.45, 0.4, 0.35, 0.3, 0.25, 0.2, 0.15, 0.1, 0.05]
# Create lists to store thresholds and bad rates 
thresholds = []
bad_rates = []
Python을 활용한 신용 위험 모델링

표 값 계산하기

  • 모든 승인율에 대해 임계값과 불량률 계산
for rate in accept_rates:
    # Calculate threshold
    threshold = np.quantile(preds_df['prob_default'], rate).round(3)
    # Store threshold value in a list
    thresholds.append(np.quantile(preds_gbt['prob_default'], rate).round(3))
    # Apply the threshold to reassign loan_status
    test_pred_df['pred_loan_status'] = \ 
        test_pred_df['prob_default'].apply(lambda x: 1 if x > thresh else 0)
    # Create accepted loans set of predicted non-defaults
    accepted_loans = test_pred_df[test_pred_df['pred_loan_status'] == 0]
    # Calculate and store bad rate
    bad_rates.append(np.sum((accepted_loans['true_loan_status']) 
             / accepted_loans['true_loan_status'].count()).round(3))
Python을 활용한 신용 위험 모델링

전략표 해석

strat_df = pd.DataFrame(zip(accept_rates, thresholds, bad_rates),
                        columns = ['Acceptance Rate','Threshold','Bad Rate'])

전략표와 불량률 막대 예시

Python을 활용한 신용 위험 모델링

승인된 대출 추가하기

  • 각 승인율별 승인된 대출 수
    • len() 또는 .count() 사용 가능

승인된 대출이 포함된 전략표

Python을 활용한 신용 위험 모델링

평균 대출 금액 추가하기

  • 테스트 세트 데이터의 평균 loan_amnt

평균 대출 금액이 포함된 전략표

Python을 활용한 신용 위험 모델링

포트폴리오 가치 추정하기

  • 승인된 대출 중 정상 상환 평균 가치에서 부도 평균 가치를 뺀 값
  • 각 부도는 loan_amnt만큼 손실로 가정

추정 가치가 포함된 전략표

Python을 활용한 신용 위험 모델링

총 기대 손실

  • 포트폴리오 내 부도로 인해 예상되는 손실 규모

총 기대 손실 공식

# Probability of default (PD)
test_pred_df['prob_default']
# Exposure at default = loan amount (EAD)
test_pred_df['loan_amnt']
# Loss given default = 1.0 for total loss (LGD)
test_pred_df['loss_given_default']
Python을 활용한 신용 위험 모델링

연습해 봅시다!

Python을 활용한 신용 위험 모델링

Preparing Video For Download...