ML之LoR:基于信用卡数据集利用LoR逻辑回归算法实现如何开发通用信用风险评分卡模型之以scorecardpy框架全流程讲解
目录
基于信用卡数据集利用LoR逻辑回归算法实现如何开发通用信用风险评分卡模型之全流程讲解
相关文章
ML之LoR:基于信用卡数据集利用LoR逻辑回归算法实现如何开发通用信用风险评分卡模型之以scorecardpy框架全流程讲解
ML之LoR:基于信用卡数据集利用LoR逻辑回归算法实现如何开发通用信用风险评分卡模型之以scorecardpy框架全流程讲解代码实现
加载德国信用卡数据集,将由一组属性描述的债务人分类为良好或不良信用风险的信用数据。
数据集:UCI Machine Learning Repository: Data Set
status.of.existing.checking.account | duration.in.month | credit.history | purpose | credit.amount | savings.account.and.bonds | present.employment.since | installment.rate.in.percentage.of.disposable.income | personal.status.and.sex | other.debtors.or.guarantors | present.residence.since | property | age.in.years | other.installment.plans | housing | number.of.existing.credits.at.this.bank | job | number.of.people.being.liable.to.provide.maintenance.for | telephone | foreign.worker | creditability | |
0 | ... < 0 DM | 6 | critical account/ other credits existing (not at this bank) | radio/television | 1169 | unknown/ no savings account | ... >= 7 years | 4 | male : divorced/separated | none | 4 | real estate | 67 | none | own | 2 | skilled employee / official | 1 | yes, registered under the customers name | yes | good |
1 | 0 <= ... < 200 DM | 48 | existing credits paid back duly till now | radio/television | 5951 | ... < 100 DM | 1 <= ... < 4 years | 2 | male : divorced/separated | none | 2 | real estate | 22 | none | own | 1 | skilled employee / official | 1 | none | yes | bad |
2 | no checking account | 12 | critical account/ other credits existing (not at this bank) | education | 2096 | ... < 100 DM | 4 <= ... < 7 years | 2 | male : divorced/separated | none | 3 | real estate | 49 | none | own | 1 | unskilled - resident | 2 | none | yes | good |
3 | ... < 0 DM | 42 | existing credits paid back duly till now | furniture/equipment | 7882 | ... < 100 DM | 4 <= ... < 7 years | 2 | male : divorced/separated | guarantor | 4 | building society savings agreement/ life insurance | 45 | none | for free | 1 | skilled employee / official | 2 | none | yes | good |
4 | ... < 0 DM | 24 | delay in paying off in the past | car (new) | 4870 | ... < 100 DM | 1 <= ... < 4 years | 3 | male : divorced/separated | none | 4 | unknown / no property | 53 | none | for free | 2 | skilled employee / official | 2 | none | yes | bad |
5 | no checking account | 36 | existing credits paid back duly till now | education | 9055 | unknown/ no savings account | 1 <= ... < 4 years | 2 | male : divorced/separated | none | 4 | unknown / no property | 35 | none | for free | 1 | unskilled - resident | 2 | yes, registered under the customers name | yes | good |
6 | no checking account | 24 | existing credits paid back duly till now | furniture/equipment | 2835 | 500 <= ... < 1000 DM | ... >= 7 years | 3 | male : divorced/separated | none | 4 | building society savings agreement/ life insurance | 53 | none | own | 1 | skilled employee / official | 1 | none | yes | good |
7 | 0 <= ... < 200 DM | 36 | existing credits paid back duly till now | car (used) | 6948 | ... < 100 DM | 1 <= ... < 4 years | 2 | male : divorced/separated | none | 2 | car or other, not in attribute Savings account/bonds | 35 | none | rent | 1 | management/ self-employed/ highly qualified employee/ officer | 1 | yes, registered under the customers name | yes | good |
8 | no checking account | 12 | existing credits paid back duly till now | radio/television | 3059 | ... >= 1000 DM | 4 <= ... < 7 years | 2 | male : divorced/separated | none | 4 | real estate | 61 | none | own | 1 | unskilled - resident | 1 | none | yes | good |
9 | 0 <= ... < 200 DM | 30 | critical account/ other credits existing (not at this bank) | car (new) | 5234 | ... < 100 DM | unemployed | 4 | male : divorced/separated | none | 2 | car or other, not in attribute Savings account/bonds | 28 | none | own | 2 | management/ self-employed/ highly qualified employee/ officer | 1 | none | yes | bad |
10 | 0 <= ... < 200 DM | 12 | existing credits paid back duly till now | car (new) | 1295 | ... < 100 DM | ... < 1 year | 3 | male : divorced/separated | none | 1 | car or other, not in attribute Savings account/bonds | 25 | none | rent | 1 | skilled employee / official | 1 | none | yes | bad |
11 | ... < 0 DM | 48 | existing credits paid back duly till now | business | 4308 | ... < 100 DM | ... < 1 year | 3 | male : divorced/separated | none | 4 | building society savings agreement/ life insurance | 24 | none | rent | 1 | skilled employee / official | 1 | none | yes | bad |
12 | 0 <= ... < 200 DM | 12 | existing credits paid back duly till now | radio/television | 1567 | ... < 100 DM | 1 <= ... < 4 years | 1 | male : divorced/separated | none | 1 | car or other, not in attribute Savings account/bonds | 22 | none | own | 1 | skilled employee / official | 1 | yes, registered under the customers name | yes | good |
13 | ... < 0 DM | 24 | critical account/ other credits existing (not at this bank) | car (new) | 1199 | ... < 100 DM | ... >= 7 years | 4 | male : divorced/separated | none | 4 | car or other, not in attribute Savings account/bonds | 60 | none | own | 2 | unskilled - resident | 1 | none | yes | bad |
14 | ... < 0 DM | 15 | existing credits paid back duly till now | car (new) | 1403 | ... < 100 DM | 1 <= ... < 4 years | 2 | male : divorced/separated | none | 4 | car or other, not in attribute Savings account/bonds | 28 | none | rent | 1 | skilled employee / official | 1 | none | yes | good |
15 | ... < 0 DM | 24 | existing credits paid back duly till now | radio/television | 1282 | 100 <= ... < 500 DM | 1 <= ... < 4 years | 4 | male : divorced/separated | none | 2 | car or other, not in attribute Savings account/bonds | 32 | none | own | 1 | unskilled - resident | 1 | none | yes | bad |
16 | no checking account | 24 | critical account/ other credits existing (not at this bank) | radio/television | 2424 | unknown/ no savings account | ... >= 7 years | 4 | male : divorced/separated | none | 4 | building society savings agreement/ life insurance | 53 | none | own | 2 | skilled employee / official | 1 | none | yes | good |
17 | ... < 0 DM | 30 | no credits taken/ all credits paid back duly | business | 8072 | unknown/ no savings account | ... < 1 year | 2 | male : divorced/separated | none | 3 | car or other, not in attribute Savings account/bonds | 25 | bank | own | 3 | skilled employee / official | 1 | none | yes | good |
18 | 0 <= ... < 200 DM | 24 | existing credits paid back duly till now | car (used) | 12579 | ... < 100 DM | ... >= 7 years | 4 | male : divorced/separated | none | 2 | unknown / no property | 44 | none | for free | 1 | management/ self-employed/ highly qualified employee/ officer | 1 | yes, registered under the customers name | yes | bad |
19 | no checking account | 24 | existing credits paid back duly till now | radio/television | 3430 | 500 <= ... < 1000 DM | ... >= 7 years | 3 | male : divorced/separated | none | 2 | car or other, not in attribute Savings account/bonds | 31 | none | own | 1 | skilled employee / official | 2 | yes, registered under the customers name | yes | good |
- <class 'pandas.core.frame.DataFrame'>
- RangeIndex: 1000 entries, 0 to 999
- Data columns (total 21 columns):
- Column Non-Null Count Dtype
- --- ------ -------------- -----
- 0 status.of.existing.checking.account 1000 non-null category
- 1 duration.in.month 1000 non-null int64
- 2 credit.history 1000 non-null category
- 3 purpose 1000 non-null object
- 4 credit.amount 1000 non-null int64
- 5 savings.account.and.bonds 1000 non-null category
- 6 present.employment.since 1000 non-null category
- 7 installment.rate.in.percentage.of.disposable.income 1000 non-null int64
- 8 personal.status.and.sex 1000 non-null category
- 9 other.debtors.or.guarantors 1000 non-null category
- 10 present.residence.since 1000 non-null int64
- 11 property 1000 non-null category
- 12 age.in.years 1000 non-null int64
- 13 other.installment.plans 1000 non-null category
- 14 housing 1000 non-null category
- 15 number.of.existing.credits.at.this.bank 1000 non-null int64
- 16 job 1000 non-null category
- 17 number.of.people.being.liable.to.provide.maintenance.for 1000 non-null int64
- 18 telephone 1000 non-null category
- 19 foreign.worker 1000 non-null category
- 20 creditability 1000 non-null object
- dtypes: category(12), int64(7), object(2)
- memory usage: 84.0+ KB
利用var_filter函数根据变量的缺失率、IV值、等价值率等因素进行筛选,并指定目标变量y
- var_filter(dt, y, x=None, iv_limit=0.02, missing_limit=0.95,
- identical_limit=0.95, var_rm=None, var_kp=None,
- return_rm_reason=False, positive='bad|1')
- '''
- 函数功能:即当某个变量的 IV 值iv_limit小于0.02,或缺失率missing_limit大于95%,或同值率(除空值外)identical_limit大于95%,则剔除掉该变量。
- 体参数如下:可跳到该函数查询
- varrm:可设置强制保留的变量,默认为空;
- varkp:可设置强制剔除的变量,默认为空;
- return_rm_reason:可设置是否返回剔除原因,默认为不返回(False);
- positive:可设置坏样本对应的值,默认为“bad|1”。
- '''
age.in.years | other.debtors.or.guarantors | savings.accoun |
网站声明:如果转载,请联系本站管理员。否则一切后果自行承担。
加入交流群
请使用微信扫一扫!