ML之RF:利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(预测、推理)
ML之RF:利用Pipeline(客戶年齡/職業(yè)/婚姻/教育/違約/余額/住房等)預(yù)測(cè)客戶是否購買該銀行的產(chǎn)品二分類(預(yù)測(cè)、推理)
?
?
?
?
目錄
利用Pipeline(客戶年齡/職業(yè)/婚姻/教育/違約/余額/住房等)預(yù)測(cè)客戶是否購買該銀行的產(chǎn)品二分類(預(yù)測(cè)、推理)
數(shù)據(jù)說明
輸出結(jié)果
查看數(shù)據(jù)分布
?分析數(shù)據(jù)
輸出訓(xùn)練過程
導(dǎo)出推理結(jié)果
?
?
?
相關(guān)文章
ML之RF:利用Pipeline(客戶年齡/職業(yè)/婚姻/教育/違約/余額/住房等)預(yù)測(cè)客戶是否購買該銀行的產(chǎn)品二分類(預(yù)測(cè)、推理)
ML之RF:利用Pipeline(客戶年齡/職業(yè)/婚姻/教育/違約/余額/住房等)預(yù)測(cè)客戶是否購買該銀行的產(chǎn)品二分類(預(yù)測(cè)、推理)全部代碼
利用Pipeline(客戶年齡/職業(yè)/婚姻/教育/違約/余額/住房等)預(yù)測(cè)客戶是否購買該銀行的產(chǎn)品二分類(預(yù)測(cè)、推理)
數(shù)據(jù)說明
? ? ? ? 該數(shù)據(jù)集是葡萄牙銀行機(jī)構(gòu)進(jìn)行營銷活動(dòng)所得。這些營銷活動(dòng)一般以電話為基礎(chǔ),銀行的客服人員至少聯(lián)系客戶一次,以確認(rèn)客戶是否有意愿購買該銀行的產(chǎn)品(定期存款)。目標(biāo)是預(yù)測(cè)客戶是否購買該銀行的產(chǎn)品。
| 1 | ID | Int | 客戶唯一標(biāo)識(shí) |
| 2 | age | Int | 客戶年齡 |
| 3 | job | String | 客戶的職業(yè) |
| 4 | marital | String | 婚姻狀況 |
| 5 | education | String | 受教育水平 |
| 6 | default | String | 是否有違約記錄 |
| 7 | balance | Int | 每年賬戶的平均余額 |
| 8 | housing | String | 是否有住房貸款 |
| 9 | loan | String | 是否有個(gè)人貸款 |
| 10 | contact | String | 與客戶聯(lián)系的溝通方式 |
| 11 | day | Int | 最后一次聯(lián)系的時(shí)間(幾號(hào)) |
| 12 | month | String | 最后一次聯(lián)系的時(shí)間(月份) |
| 13 | duration | Int | 最后一次聯(lián)系的交流時(shí)長 |
| 14 | campaign | Int | 在本次活動(dòng)中,與該客戶交流過的次數(shù) |
| 15 | pdays | Int | 距離上次活動(dòng)最后一次聯(lián)系該客戶,過去了多久(999表示沒有聯(lián)系過) |
| 16 | previous | Int | 在本次活動(dòng)之前,與該客戶交流過的次數(shù) |
| 17 | poutcome | String | 上一次活動(dòng)的結(jié)果 |
| 18 | y | Int | 預(yù)測(cè)客戶是否會(huì)訂購定期存款業(yè)務(wù) |
數(shù)據(jù)參考: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
?
輸出結(jié)果
查看數(shù)據(jù)分布
分析數(shù)據(jù)
?# ? 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訓(xùn)練集計(jì)算相關(guān)系數(shù):?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訓(xùn)練集 y標(biāo)簽的比例: 0.11695698542481336
依次查看訓(xùn)練集、測(cè)試集中,類別型字段的細(xì)分類
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']
輸出訓(xùn)練過程
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 .........導(dǎo)出推理結(jié)果
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
總結(jié)
以上是生活随笔為你收集整理的ML之RF:利用Pipeline(客户年龄/职业/婚姻/教育/违约/余额/住房等)预测客户是否购买该银行的产品二分类(预测、推理)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sklearn之pipeline:pip
- 下一篇: ML之RF/kNNC/LoRC/SVMC