ML之LoR:基于信用卡数据集利用LoR逻辑回归算法实现如何开发通用信用风险评分卡模型之以toad框架全流程讲解


梅菜扣肉
梅菜扣肉 2022-09-19 10:23:16 52048
分类专栏: 资讯

ML之LoR:基于信用卡数据集利用LoR逻辑回归算法实现如何开发通用信用风险评分卡模型之以toad框架全流程讲解

目录

基于信用卡数据集利用LoR逻辑回归算法实现如何开发通用信用风险评分卡模型之以toad框架全流程讲解

1、定义数据集

1.1、加载德国信用卡数据集

1.2、对各个变量进行EDA分析

1.3、输出连续型变量的mean、std、min、3种分位数、max

2、数据预处理

2.1、对类别型目标变量映射成数值型变量

2.2、分析每个特征的iv、基尼系数gini、熵entropy、unique等

2.3、筛选特征:分别基于IV、empty、corr指标

2.4、分箱处理

2.5、利用badrate图进一步调整分箱

2.5.1、自定义调整分箱示例

2.5.2、绘制每一箱的占比柱状图、及其对应的坏样本率折线图

  2.5.3、调整分箱:使得bad_rate整体上呈现单调的趋势

  2.6、对分箱后的数据进行WOE转换

2.7、特征选择

3、模型建立、训练、评估

3.1、切分训练集、测试集

3.2、模型训练

3.3、模型评估:F1、KS、AUC

4、模型上线评估,并计算信用分

4.1、评估变量的稳定性PSI:比较训练集和测试集

4.2、训练集等频分箱,观测每组的区别

4.3、评分卡分数变换


相关文章
ML之LoR:基于信用卡数据集利用LoR逻辑回归算法实现如何开发通用信用风险评分卡模型之以toad框架全流程讲解
ML之LoR:基于信用卡数据集利用LoR逻辑回归算法实现如何开发通用信用风险评分卡模型之以toad框架全流程讲解代码实现

基于信用卡数据集利用LoR逻辑回归算法实现如何开发通用信用风险评分卡模型之以toad框架全流程讲解

1、定义数据集

1.1、加载德国信用卡数据集

将由一组属性描述的债务人分类为良好或不良信用风险的信用数据。 https://archive.ics.uci.edu/ml/datasets/Statlog+

status.of.existing.checking.accountduration.in.monthcredit.historypurposecredit.amountsavings.account.and.bondspresent.employment.sinceinstallment.rate.in.percentage.of.disposable.incomepersonal.status.and.sexother.debtors.or.guarantorspresent.residence.sincepropertyage.in.yearsother.installment.planshousingnumber.of.existing.credits.at.this.bankjobnumber.of.people.being.liable.to.provide.maintenance.fortelephoneforeign.workercreditability
0... < 0 DM6critical account/ other credits existing (not at this bank)radio/television1169unknown/ no savings account... >= 7 years4male : divorced/separatednone4real estate67noneown2skilled employee / official1yes, registered under the customers nameyesgood
10 <= ... < 200 DM48existing credits paid back duly till nowradio/television5951... < 100 DM1 <= ... < 4 years2male : divorced/separatednone2real estate22noneown1skilled employee / official1noneyesbad
2no checking account12critical account/ other credits existing (not at this bank)education2096... < 100 DM4 <= ... < 7 years2male : divorced/separatednone3real estate49noneown1unskilled - resident2noneyesgood
3... < 0 DM42existing credits paid back duly till nowfurniture/equipment7882... < 100 DM4 <= ... < 7 years2male : divorced/separatedguarantor4building society savings agreement/ life insurance45nonefor free1skilled employee / official2noneyesgood
4... < 0 DM24delay in paying off in the pastcar (new)4870... < 100 DM1 <= ... < 4 years3male : divorced/separatednone4unknown / no property53nonefor free2skilled employee / official2noneyesbad
5no checking account36existing credits paid back duly till noweducation9055unknown/ no savings account1 <= ... < 4 years2male : divorced/separatednone4unknown / no property35nonefor free1unskilled - resident2yes, registered under the customers nameyesgood
6no checking account24existing credits paid back duly till nowfurniture/equipment2835500 <= ... < 1000 DM... >= 7 years3male : divorced/separatednone4building society savings agreement/ life insurance53noneown1skilled employee / official1noneyesgood
70 <= ... < 200 DM36existing credits paid back duly till nowcar (used)6948... < 100 DM1 <= ... < 4 years2male : divorced/separatednone2car or other, not in attribute Savings account/bonds35nonerent1management/ self-employed/ highly qualified employee/ officer1yes, registered under the customers nameyesgood
8no checking account12existing credits paid back duly till nowradio/television3059... >= 1000 DM4 <= ... < 7 years2male : divorced/separatednone4real estate61noneown1unskilled - resident1noneyesgood
90 <= ... < 200 DM30critical account/ other credits existing (not at this bank)car (new)5234... < 100 DMunemployed4male : divorced/separatednone2car or other, not in attribute Savings account/bonds28noneown2management/ self-employed/ highly qualified employee/ officer1noneyesbad
100 <= ... < 200 DM12existing credits paid back duly till nowcar (new)1295... < 100 DM... < 1 year3male : divorced/separatednone1car or other, not in attribute Savings account/bonds25nonerent1skilled employee / official1noneyesbad
11... < 0 DM48existing credits paid back duly till nowbusiness4308... < 100 DM... < 1 year3male : divorced/separatednone4building society savings agreement/ life insurance24nonerent1skilled employee / official1noneyesbad
120 <= ... < 200 DM12existing credits paid back duly till nowradio/television1567... < 100 DM1 <= ... < 4 years1male : divorced/separatednone1car or other, not in attribute Savings account/bonds22noneown1skilled employee / official1yes, registered under the customers nameyesgood
13... < 0 DM24critical account/ other credits existing (not at this bank)car (new)1199... < 100 DM... >= 7 years4male : divorced/separatednone4car or other, not in attribute Savings account/bonds60noneown2unskilled - resident1noneyesbad
14... < 0 DM15existing credits paid back duly till nowcar (new)1403... < 100 DM1 <= ... < 4 years2male : divorced/separatednone4car or other, not in attribute Savings account/bonds28nonerent1skilled employee / official1noneyesgood
15... < 0 DM24existing credits paid back duly till nowradio/television1282100 <= ... < 500 DM1 <= ... < 4 years4male : divorced/separatednone2car or other, not in attribute Savings account/bonds32noneown1unskilled - resident1noneyesbad
16no checking account24critical account/ other credits existing (not at this bank)radio/television2424unknown/ no savings account... >= 7 years4male : divorced/separatednone4building society savings agreement/ life insurance53noneown2skilled employee / official1noneyesgood
17... < 0 DM30no credits taken/ all credits paid back dulybusiness8072unknown/ no savings account... < 1 year2male : divorced/separatednone3car or other, not in attribute Savings account/bonds25bankown3skilled employee / official1noneyesgood
180 <= ... < 200 DM24existing credits paid back duly till nowcar (used)12579... < 100 DM... >= 7 years4male : divorced/separatednone2unknown / no property44nonefor free1management/ self-employed/ highly qualified employee/ officer1yes, registered under the customers nameyesbad
19no checking account24existing credits paid back duly till nowradio/television3430500 <= ... < 1000 DM... >= 7 years3male : divorced/separatednone2car or other, not in attribute Savings account/bonds31noneown1skilled employee / official2yes, registered under the customers nameyesgood

1.2、对各个变量进行EDA分析

数值型变量:数据类型、缺失率、唯一值、均值、标准差、分位数等,
分类型变量:数据类型、缺失率、唯一值、top1(占比第一的数据类)等。

typesizemissinguniquemean_or_top1std_or_top2min_or_top31%_or_top410%_or_top550%_or_bottom575%_or_bottom490%_or_bottom399%_or_bottom2max_or_bottom1
status.of.existing.checking.accountcategory10000.00%4no checking account:39.40%... < 0 DM:27.40%0 <= ... < 200 DM:26.90%... >= 200 DM / salary assignments for at least 1 year:6.30%no checking account:39.40%... < 0 DM:27.40%0 <= ... < 200 DM:26.90%... >= 200 DM / salary assignments for at least 1 year:6.30%
duration.in.monthint6410000.00%3320.90312.058814454691824366072
credit.historycategory10000.00%5existing credits paid back duly till now:53.00%critical account/ other credits existing (not at this bank):29.30%delay in paying off in the past:8.80%all credits at this bank paid back duly:4.90%no credits taken/ all credits paid back duly:4.00%existing credits paid back duly till now:53.00%critical account/ other credits existing (not at this bank):29.30%delay in paying off in the past:8.80%all credits at this bank paid back duly:4.90%no credits taken/ all credits paid back duly:4.00%
purposeobject10000.00%10radio/television:28.00%car (new):23.40%furniture/equipment:18.10%car (used):10.30%business:9.70%education:5.00%repairs:2.20%domestic appliances:1.20%others:1.20%retraining:0.90%
credit.amountint6410000.00%9213271.2582822.736876250425.839322319.53972.257179.414180.3918424
savings.account.and.bondscategory10000.00%5... < 100 DM:60.30%unknown/ no savings account:18.30%100 <= ... < 500 DM:10.30%500 <= ... < 1000 DM:6.30%... >= 1000 DM:4.80%... < 100 DM:60.30%unknown/ no savings account:18.30%100 <= ... < 500 DM:10.30%500 <= ... < 1000 DM:6.30%... >= 1000 DM:4.80%
present.employment.sincecategory10000.00%51 <= ... < 4 years:33.90%... >= 7 years:25.30%4 <= ... < 7 years:17.40%... < 1 year:17.20%unemployed:6.20%1 <= ... < 4 years:33.90%... >= 7 years:25.30%4 <= ... < 7 years:17.40%... < 1 year:17.20%unemployed:6.20%

网站声明:如果转载,请联系本站管理员。否则一切后果自行承担。

本文链接:https://www.xckfsq.com/news/show.html?id=1750
赞同 0
评论 0 条
梅菜扣肉L0
粉丝 0 发表 10 + 关注 私信
上周热门
如何使用 StarRocks 管理和优化数据湖中的数据?  2672
【软件正版化】软件正版化工作要点  2637
统信UOS试玩黑神话:悟空  2532
信刻光盘安全隔离与信息交换系统  2216
镜舟科技与中启乘数科技达成战略合作,共筑数据服务新生态  1092
grub引导程序无法找到指定设备和分区  743
WPS City Talk · 校招西安站来了!  15
金山办公2024算法挑战赛 | 报名截止日期更新  15
看到某国的寻呼机炸了,就问你用某水果手机发抖不?  14
有在找工作的IT人吗?  13
本周热议
我的信创开放社区兼职赚钱历程 40
今天你签到了吗? 27
信创开放社区邀请他人注册的具体步骤如下 15
如何玩转信创开放社区—从小白进阶到专家 15
方德桌面操作系统 14
我有15积分有什么用? 13
用抖音玩法闯信创开放社区——用平台宣传企业产品服务 13
如何让你先人一步获得悬赏问题信息?(创作者必看) 12
2024中国信创产业发展大会暨中国信息科技创新与应用博览会 9
中央国家机关政府采购中心:应当将CPU、操作系统符合安全可靠测评要求纳入采购需求 8

加入交流群

请使用微信扫一扫!