基于 AUC 的输入选择

R 中的信用风险建模

Lore Dirick

Manager of Data Science Curriculum at Flatiron School

4 个逻辑回归模型的 ROC 曲线

2020-06-22 18:31:53 的屏幕截图.png

R 中的信用风险建模

4 个逻辑回归模型的 ROC 曲线

2020-06-22 18:31:44 的屏幕截图.png

R 中的信用风险建模

4 个逻辑回归模型的 ROC 曲线

2020-06-22 18:31:33 的屏幕截图.png

R 中的信用风险建模

基于 AUC 的剪枝

1)从包含所有变量的模型开始(此处为 7 个),并计算 AUC

log_model_full <- glm(loan_status ~ loan_amnt + grade + home_ownership + 
                      annual_inc + age + emp_cat + ir_cat, 
                      family = "binomial", data = training_set)

predictions_model_full <- predict(log_model_full, 
                                  newdata = test_set, type ="response")

AUC_model_full <- auc(test_set$loan_status, predictions_model_full)
Area under the curve: 0.6512
R 中的信用风险建模

2)构建 7 个新模型,每次移除一个变量,并用测试集生成 PD 预测

log_1_remove_amnt <- glm(loan_status ~ grade + home_ownership + annual_inc + age + emp_cat + ir_cat,
                         family = "binomial",
                         data = training_set)

log_1_remove_grade <- glm(loan_status ~ loan_amnt + home_ownership + annual_inc + age + emp_cat + ir_cat,
                          family = "binomial",
                          data = training_set)

log_1_remove_home <- glm(loan_status ~ loan_amnt + grade + annual_inc + age + emp_cat + ir_cat,
                         family = "binomial",
                         data = training_set)

pred_1_remove_amnt <- predict(log_1_remove_amnt, newdata = test_set, type = "response")
pred_1_remove_grade <- predict(log_1_remove_grade, newdata = test_set, type = "response")
pred_1_remove_home <- predict(log_1_remove_home, newdata = test_set, type = "response")
...
R 中的信用风险建模

3)保留 AUC 最佳的模型(完整模型 AUC:0.6512)

auc(test_set$loan_status, pred_1_remove_amnt)
Area under the curve: 0.6537
auc(test_set$loan_status, pred_1_remove_grade)
Area under the curve: 0.6438
auc(test_set$loan_status, pred_1_remove_home)
Area under the curve: 0.6537

4)重复,直到 AUC 明显下降

R 中的信用风险建模

Passons à la pratique !

R 中的信用风险建模

Preparing Video For Download...