概述:
data/ 目录下)。研究问题(建议):
y,yes/no)。duration, balance, poutcome 等)?数据目录:
data/train.csv : 训练集data/test.csv : 测试集data/val_unlabeled.csv : 验证/未标注集(可用于半监督或上机考察)数据字典:
age: 年龄(数值) — 客户年龄,整数,通常 18–95。job: 职业(类别) — 如 admin., blue-collar, entrepreneur, management, retired, student 等;含 unknown 表示未知。marital: 婚姻状况(类别) — 如 married, single, divorced。education: 教育程度(类别) — 如 primary, secondary, tertiary, unknown。default: 是否有违约记录(类别) — yes 或 no。balance: 年均账户余额(数值,欧元) — 可为负值;建模前请查看极端值并考虑截断或变换。housing: 是否有住房贷款(类别) — yes / no。loan: 是否有个人贷款(类别) — yes / no。contact: 联系方式(类别) — unknown, telephone, cellular。day: 当月最后一次联系的日(数值) — 1–31。month: 最后一次联系的月份(类别) — 三字母缩写 jan … dec。duration: 最后一次联系通话时长(数值,秒) — 对 y 有强影响,但注意在实际预测中通话可能尚未发生。campaign: 本次活动中联系次数(数值) — 当前活动期间的联系次数。pdays: 自上次接触以来的天数(数值) — 未接触为 -1。previous: 之前联系次数(数值) — 非负整数。poutcome: 上一次活动结果(类别) — unknown, other, failure, success。y: 目标变量(类别) — yes 表示认购,no 表示未认购。建议实验与分析流程:
balance 和 duration 的极端值。age、balance)。y 严重不平衡,尝试过采样/欠采样、加权损失、或评价以 AUC/F1 为主。duration 的偏倚问题并在报告中说明。requirements.txt)、用 git 提交 Notebook 与结果。交付物与提交要求:
bank_marketing_experiment.ipynb)。jupyter nbconvert --to webpdf 将 Notebook 导出为 PDF(见下方说明以确保环境正确)。git 管理作业,提交时包含 Notebook、任何脚本、以及 requirements.txt。示例提交命令:git add .
git commit -m "Add bank marketing experiment notebook and requirements"
git push
如何生成可打印的 PDF(建议):
nbconvert 的 webpdf 导出(通常生成效果较好)。在命令行中运行:jupyter nbconvert --to webpdf bank_marketing_experiment.ipynb
依赖与注意事项:webpdf 需要 Chromium/Chrome 可用并可能需要 playwright。如果遇到问题,可以:
pip install playwright nbconvert[webpdf];--to pdf,此方式需安装 TeX 发行版(如 TeX Live 或 MikTeX)。建议的 Python 依赖(示例):
requirements.txt,包含(示例):pandas numpy scikit-learn matplotlib seaborn notebook jupyter nbconvert[webpdf] pyppeteer lightgbm xgboost shap
python -m pip install -r requirements.txt
实现与实验小贴士:
duration 警告: duration 在数据集中对 y 预测极强,但在真实任务中通话发生之前不可知。做模型和报告时请分别展示“包含 duration”与“不包含 duration”两类结果。评估标准(教师参考):
duration)及商业意义。-- 祝你实验顺利!