ML之RF:利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(预测、推理)
ML之RF:利用Pipeline(客戶年齡/職業/婚姻/教育/違約/余額/住房等)預測客戶是否購買該銀行的產品二分類(預測、推理)
?
?
?
?
目錄
利用Pipeline(客戶年齡/職業/婚姻/教育/違約/余額/住房等)預測客戶是否購買該銀行的產品二分類(預測、推理)
數據說明
輸出結果
查看數據分布
?分析數據
輸出訓練過程
導出推理結果
?
?
?
相關文章
ML之RF:利用Pipeline(客戶年齡/職業/婚姻/教育/違約/余額/住房等)預測客戶是否購買該銀行的產品二分類(預測、推理)
ML之RF:利用Pipeline(客戶年齡/職業/婚姻/教育/違約/余額/住房等)預測客戶是否購買該銀行的產品二分類(預測、推理)全部代碼
利用Pipeline(客戶年齡/職業/婚姻/教育/違約/余額/住房等)預測客戶是否購買該銀行的產品二分類(預測、推理)
數據說明
? ? ? ? 該數據集是葡萄牙銀行機構進行營銷活動所得。這些營銷活動一般以電話為基礎,銀行的客服人員至少聯系客戶一次,以確認客戶是否有意愿購買該銀行的產品(定期存款)。目標是預測客戶是否購買該銀行的產品。
| 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
?
輸出結果
查看數據分布
分析數據
?# ? Column ? ? Non-Null Count ?Dtype?
--- ?------ ? ? -------------- ?-----?0 ? ID ? ? ? ? 25317 non-null ?int64?1 ? age ? ? ? ?25317 non-null ?int64?2 ? job ? ? ? ?25317 non-null ?object3 ? marital ? ?25317 non-null ?object4 ? education ?25317 non-null ?object5 ? default ? ?25317 non-null ?object6 ? balance ? ?25317 non-null ?int64?7 ? housing ? ?25317 non-null ?object8 ? loan ? ? ? 25317 non-null ?object9 ? contact ? ?25317 non-null ?object10 ?day ? ? ? ?25317 non-null ?int64?11 ?month ? ? ?25317 non-null ?object12 ?duration ? 25317 non-null ?int64?13 ?campaign ? 25317 non-null ?int64?14 ?pdays ? ? ?25317 non-null ?int64?15 ?previous ? 25317 non-null ?int64?16 ?poutcome ? 25317 non-null ?object17 ?y ? ? ? ? ?25317 non-null ?int64?
dtypes: int64(9), object(9)
memory usage: 3.5+ MB訓練集計算相關系數:?y ? ? ? ? ? 1.000000
ID ? ? ? ? ?0.556627
duration ? ?0.394746
pdays ? ? ? 0.107565
previous ? ?0.088337
campaign ? ?0.075173
balance ? ? 0.057564
day ? ? ? ? 0.031886
age ? ? ? ? 0.029916訓練集 y標簽的比例: 0.11695698542481336
依次查看訓練集、測試集中,類別型字段的細分類
job ['admin.', 'blue-collar', 'entrepreneur', 'housemaid', 'management', 'retired', 'self-employed', 'services', 'student', 'technician', 'unemployed', 'unknown']
job ['admin.', 'blue-collar', 'entrepreneur', 'housemaid', 'management', 'retired', 'self-employed', 'services', 'student', 'technician', 'unemployed', 'unknown']
marital ['divorced', 'married', 'single']
marital ['divorced', 'married', 'single']
education ['primary', 'secondary', 'tertiary', 'unknown']
education ['primary', 'secondary', 'tertiary', 'unknown']
default ['no', 'yes']
default ['no', 'yes']
housing ['no', 'yes']
housing ['no', 'yes']
loan ['no', 'yes']
loan ['no', 'yes']
contact ['cellular', 'telephone', 'unknown']
contact ['cellular', 'telephone', 'unknown']
month ['apr', 'aug', 'dec', 'feb', 'jan', 'jul', 'jun', 'mar', 'may', 'nov', 'oct', 'sep']
month ['apr', 'aug', 'dec', 'feb', 'jan', 'jul', 'jun', 'mar', 'may', 'nov', 'oct', 'sep']
poutcome ['failure', 'other', 'success', 'unknown']
poutcome ['failure', 'other', 'success', 'unknown']
輸出訓練過程
Fitting 7 folds for each of 32 candidates, totalling 224 fits [Parallel(n_jobs=-1)]: Using backend LokyBackend with 4 concurrent workers. [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 .......... [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 .......... [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 .......... [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 .......... [CV] forst_reg__max_features=45, forst_reg__n_estimators=50, total= 31.1s [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 .......... [CV] forst_reg__max_features=45, forst_reg__n_estimators=50, total= 31.0s [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 .......... [CV] forst_reg__max_features=45, forst_reg__n_estimators=50, total= 31.7s [CV] forst_reg__max_features=45, forst_reg__n_estimators=50 .......... [CV] forst_reg__max_features=45, forst_reg__n_estimators=50, total= 32.2s [CV] forst_reg__max_features=45, forst_reg__n_estimators=100 ......... [CV] forst_reg__max_features=45, forst_reg__n_estimators=50, total= 27.1s [CV] forst_reg__max_features=45, forst_reg__n_estimators=100 ......... [CV] forst_reg__max_features=45, forst_reg__n_estimators=50, total= 27.1s [CV] forst_reg__max_features=45, forst_reg__n_estimators=50, total= 26.6s [CV] forst_reg__max_features=45, forst_reg__n_estimators=100 ......... [CV] forst_reg__max_features=45, forst_reg__n_estimators=100 .........導出推理結果
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
總結
以上是生活随笔為你收集整理的ML之RF:利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(预测、推理)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sklearn之pipeline:pip
- 下一篇: ML之RF/kNNC/LoRC/SVMC