ML之RF:利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(预测、推理)

简介: ML之RF:利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(预测、推理)


目录

利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(预测、推理)

数据说明

输出结果

查看数据分布

分析数据

输出训练过程

导出推理结果


 

 

 

相关文章

ML之RF:利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(预测、推理)

ML之RF:利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(预测、推理)全部代码

利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(预测、推理)

数据说明

       该数据集是葡萄牙银行机构进行营销活动所得。这些营销活动一般以电话为基础,银行的客服人员至少联系客户一次,以确认客户是否有意愿购买该银行的产品(定期存款)。目标是预测客户是否购买该银行的产品。

NO 字段名称 数据类型 字段描述
1 ID Int 客户唯一标识
2 age Int 客户年龄
3 job String 客户的职业
4 marital String 婚姻状况
5 education String 受教育水平
6 default String 是否有违约记录
7 balance Int 每年账户的平均余额
8 housing String 是否有住房贷款
9 loan String 是否有个人贷款
10 contact String 与客户联系的沟通方式
11 day Int 最后一次联系的时间(几号)
12 month String 最后一次联系的时间(月份)
13 duration Int 最后一次联系的交流时长
14 campaign Int 在本次活动中,与该客户交流过的次数
15 pdays Int 距离上次活动最后一次联系该客户,过去了多久(999表示没有联系过)
16 previous Int 在本次活动之前,与该客户交流过的次数
17 poutcome String 上一次活动的结果
18 y Int 预测客户是否会订购定期存款业务

数据参考:Citation: [Moro et al., 2014] S. Moro, P. Cortez and P. Rita. A Data-Driven Approach to Predict the Success of Bank Telemarketing. Decision Support Systems, Elsevier, 62:22-31, June 2014

 

输出结果

查看数据分布

分析数据

1.  #   Column     Non-Null Count  Dtype 
2. ---  ------     --------------  ----- 
3.  0   ID         25317 non-null  int64 
4.  1   age        25317 non-null  int64 
5.  2   job        25317 non-null  object
6.  3   marital    25317 non-null  object
7.  4   education  25317 non-null  object
8.  5   default    25317 non-null  object
9.  6   balance    25317 non-null  int64 
10.  7   housing    25317 non-null  object
11.  8   loan       25317 non-null  object
12.  9   contact    25317 non-null  object
13.  10  day        25317 non-null  int64 
14.  11  month      25317 non-null  object
15.  12  duration   25317 non-null  int64 
16.  13  campaign   25317 non-null  int64 
17.  14  pdays      25317 non-null  int64 
18.  15  previous   25317 non-null  int64 
19.  16  poutcome   25317 non-null  object
20.  17  y          25317 non-null  int64 
21. dtypes: int64(9), object(9)
22. memory usage: 3.5+ MB
23. 
24. 训练集计算相关系数: 
25.  y           1.000000
26. ID          0.556627
27. duration    0.394746
28. pdays       0.107565
29. previous    0.088337
30. campaign    0.075173
31. balance     0.057564
32. day         0.031886
33. age         0.029916
34. 
35. 
36. 训练集 y标签的比例: 0.11695698542481336
37. 依次查看训练集、测试集中,类别型字段的细分类
38. job ['admin.', 'blue-collar', 'entrepreneur', 'housemaid', 'management', 'retired', 'self-employed', 'services', 'student', 'technician', 'unemployed', 'unknown']
39. job ['admin.', 'blue-collar', 'entrepreneur', 'housemaid', 'management', 'retired', 'self-employed', 'services', 'student', 'technician', 'unemployed', 'unknown']
40. marital ['divorced', 'married', 'single']
41. marital ['divorced', 'married', 'single']
42. education ['primary', 'secondary', 'tertiary', 'unknown']
43. education ['primary', 'secondary', 'tertiary', 'unknown']
44. default ['no', 'yes']
45. default ['no', 'yes']
46. housing ['no', 'yes']
47. housing ['no', 'yes']
48. loan ['no', 'yes']
49. loan ['no', 'yes']
50. contact ['cellular', 'telephone', 'unknown']
51. contact ['cellular', 'telephone', 'unknown']
52. month ['apr', 'aug', 'dec', 'feb', 'jan', 'jul', 'jun', 'mar', 'may', 'nov', 'oct', 'sep']
53. month ['apr', 'aug', 'dec', 'feb', 'jan', 'jul', 'jun', 'mar', 'may', 'nov', 'oct', 'sep']
54. poutcome ['failure', 'other', 'success', 'unknown']
55. poutcome ['failure', 'other', 'success', 'unknown']
56.

输出训练过程

1. Fitting 7 folds for each of 32 candidates, totalling 224 fits
2. [Parallel(n_jobs=-1)]: Using backend LokyBackend with 4 concurrent workers.
3. [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 ..........
4. [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 ..........
5. [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 ..........
6. [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 ..........
7. [CV]  forst_reg__max_features=45, forst_reg__n_estimators=50, total=  31.1s
8. [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 ..........
9. [CV]  forst_reg__max_features=45, forst_reg__n_estimators=50, total=  31.0s
10. [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 ..........
11. [CV]  forst_reg__max_features=45, forst_reg__n_estimators=50, total=  31.7s
12. [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 ..........
13. [CV]  forst_reg__max_features=45, forst_reg__n_estimators=50, total=  32.2s
14. [CV] forst_reg__max_features=45, forst_reg__n_estimators=100 .........
15. [CV]  forst_reg__max_features=45, forst_reg__n_estimators=50, total=  27.1s
16. [CV] forst_reg__max_features=45, forst_reg__n_estimators=100 .........
17. [CV]  forst_reg__max_features=45, forst_reg__n_estimators=50, total=  27.1s
18. [CV]  forst_reg__max_features=45, forst_reg__n_estimators=50, total=  26.6s
19. [CV] forst_reg__max_features=45, forst_reg__n_estimators=100 .........
20. [CV] forst_reg__max_features=45, forst_reg__n_estimators=100 .........

导出推理结果

 


相关文章
|
18天前
|
机器学习/深度学习 数据可视化 关系型数据库
基于机器学习的信用卡办卡意愿模型预测项目
基于机器学习的信用卡办卡意愿模型预测项目
|
17天前
|
机器学习/深度学习 算法 数据挖掘
【阿旭机器学习实战】【32】预测银行客户是否会开设定期存款账户--逻辑回归
【阿旭机器学习实战】【32】预测银行客户是否会开设定期存款账户--逻辑回归
|
2月前
|
算法 数据可视化 数据挖掘
R语言指数平滑预测法分析南京出租车打车软件空载率时间序列补贴政策可行性
R语言指数平滑预测法分析南京出租车打车软件空载率时间序列补贴政策可行性
|
2月前
|
机器学习/深度学习 算法 数据可视化
【视频】从决策树到随机森林:R语言信用卡违约分析信贷数据实例|数据分享
【视频】从决策树到随机森林:R语言信用卡违约分析信贷数据实例|数据分享
|
2月前
|
机器学习/深度学习 数据采集 算法
数据分享|R语言机器学习预测案例合集:众筹平台、机票折扣、糖尿病患者、员工满意度
数据分享|R语言机器学习预测案例合集:众筹平台、机票折扣、糖尿病患者、员工满意度
|
2月前
|
机器学习/深度学习 数据可视化 数据挖掘
R语言用CPV模型的房地产信贷信用风险的度量和预测
R语言用CPV模型的房地产信贷信用风险的度量和预测
|
2月前
R语言基于线性回归的资本资产定价模型(CAPM)
R语言基于线性回归的资本资产定价模型(CAPM)
|
机器学习/深度学习 Python
基于LightGBM实现银行客户信用违约预测
基于LightGBM实现银行客户信用违约预测
161 1
|
机器学习/深度学习 算法 Python
贷款违约预测-Task1 赛题理解
贷款违约预测-Task1 赛题理解
487 1
ML之RF/kNNC/LoRC/SVMC/RFC/GBDTC:利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(评估、调优、推理)
ML之RF/kNNC/LoRC/SVMC/RFC/GBDTC:利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(评估、调优、推理)
ML之RF/kNNC/LoRC/SVMC/RFC/GBDTC:利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(评估、调优、推理)