akaAKR47/download_dataset.py
akr f47c7d7196 feat: 实现客户流失预测与行动建议闭环系统
添加完整的客户流失预测系统,包括数据处理、模型训练、预测和行动建议功能。主要包含以下模块:
1. 数据预处理流水线(Polars + Pandera)
2. 机器学习模型训练(LightGBM + Logistic Regression)
3. AI Agent预测和建议工具
4. Streamlit交互式Web界面
5. 完整的课程设计报告文档
2026-01-15 15:19:07 +08:00

27 lines
723 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import requests
import zipfile
import os
# 下载Telco Customer Churn数据集
def download_telco_churn():
# 使用公开可访问的数据集URL
url = "https://raw.githubusercontent.com/IBM/telco-customer-churn-on-icp4d/master/data/Telco-Customer-Churn.csv"
# 创建data目录如果不存在
os.makedirs("data", exist_ok=True)
# 下载文件
response = requests.get(url)
response.raise_for_status()
# 保存文件
file_path = "data/Telco-Customer-Churn.csv"
with open(file_path, "wb") as f:
f.write(response.content)
print(f"数据集已成功下载到 {file_path}")
return file_path
if __name__ == "__main__":
download_telco_churn()