com um clique
ltv-predictor
// 基于RFM模型和回归算法的客户生命周期价值(LTV)预测分析工具,支持电商和零售业务的客户价值预测。使用时需要客户交易数据、订单历史或消费记录,自动进行RFM特征工程、回归建模和价值预测。
// 基于RFM模型和回归算法的客户生命周期价值(LTV)预测分析工具,支持电商和零售业务的客户价值预测。使用时需要客户交易数据、订单历史或消费记录,自动进行RFM特征工程、回归建模和价值预测。
Find doctors with Healthgrades - search providers, read reviews, and check credentials
Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks.
IDE setup, dev containers, and local development tools
智能推荐系统分析工具,提供多种推荐算法实现、评估框架和可视化分析。使用时需要用户行为数据、商品信息或评分数据,支持协同过滤、矩阵分解等推荐算法,生成个性化推荐结果和评估报告。
Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks
Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks.
| name | ltv-predictor |
| description | 基于RFM模型和回归算法的客户生命周期价值(LTV)预测分析工具,支持电商和零售业务的客户价值预测。使用时需要客户交易数据、订单历史或消费记录,自动进行RFM特征工程、回归建模和价值预测。 |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep, WebSearch |
一个基于《数据分析咖哥十话》第3课理论的自动化LTV预测分析工具,提供从RFM特征工程到回归建模的完整解决方案。
# 安装基础依赖
pip install pandas numpy scikit-learn matplotlib seaborn
# 安装可选依赖(用于高级功能)
pip install xgboost lightgbm joblib openpyxl
from scripts.ltv_predictor import LTVPredictor
from scripts.data_processor import DataProcessor
# 1. 初始化处理器
processor = DataProcessor()
predictor = LTVPredictor()
# 2. 加载和预处理数据
data = processor.load_order_data('your_orders.csv')
rfm_data = processor.calculate_rfm_features(data,
feature_period='3M',
prediction_period='12M')
# 3. 训练LTV预测模型
model_results = predictor.train_models(rfm_data)
# 4. 进行LTV预测
predictions = predictor.predict_ltv(new_customer_data)
# 5. 生成分析报告
report_path = predictor.generate_report(predictions, 'ltv_analysis_report.html')
from scripts.quick_analysis import quick_ltv_analysis
# 一键完成完整LTV分析流程
results = quick_ltv_analysis(
order_data_path='ecommerce_orders.csv',
feature_period_months=3,
prediction_period_months=12,
output_dir='ltv_analysis_results'
)
print(f"最佳模型R²分数: {results['best_model_r2']:.4f}")
print(f"预测客户数: {len(results['predictions'])}")
print(f"分析报告: {results['report_path']}")
ltv-predictor/
├── scripts/ # 核心功能模块
│ ├── data_processor.py # 数据预处理和RFM计算
│ ├── ltv_predictor.py # LTV预测核心引擎
│ ├── regression_models.py # 回归算法实现
│ ├── visualizer.py # 可视化生成器
│ └── report_generator.py # 报告生成器
├── examples/ # 示例脚本
│ ├── ecommerce_ltv_analysis.py # 电商完整分析示例
│ ├── quick_ltv_prediction.py # 快速预测示例
│ └── model_comparison.py # 模型对比示例
├── data/ # 示例数据
│ └── sample_orders.csv # 示例订单数据
├── tests/ # 测试脚本
│ ├── test_rfm_analysis.py # RFM分析测试
│ └── test_prediction.py # 预测功能测试
├── SKILL.md # 技能说明文档
└── README.md # 使用说明
config = {
'feature_period_months': 3, # 特征计算时间窗口(月)
'prediction_period_months': 12, # 预测时间窗口(月)
'r_weight': 0.2, # R值权重
'f_weight': 0.3, # F值权重
'm_weight': 0.5, # M值权重
'customer_segments': 5 # 客户分层数量
}
config = {
'test_size': 0.2, # 测试集比例
'cv_folds': 5, # 交叉验证折数
'random_state': 42, # 随机种子
'enable_hyperparameter_tuning': True, # 是否调参
'n_iter_search': 50, # 超参数搜索次数
'scoring_metric': 'r2' # 评估指标
}
config = {
'confidence_interval': 0.95, # 置信区间
'batch_size': 1000, # 批处理大小
'feature_importance_threshold': 0.01, # 特征重要性阈值
'prediction_uncertainty': True # 是否计算预测不确定性
}
订单号,产品码,消费日期,产品说明,数量,单价,用户码,城市
536374,21258,2022-06-01 09:09,绿联usb分线器,32,10.95,15100,北京
536376,22114,2022-06-01 09:32,加大男装T恤,48,50.45,15291,上海
必需字段:
用户码: 客户唯一标识消费日期: 购买时间(支持多种日期格式)数量: 购买数量单价: 商品单价可选字段:
订单号: 订单唯一标识产品码: 商品标识产品说明: 商品描述城市: 客户城市信息基于第3课实测数据:
欢迎贡献代码、报告问题或提出改进建议:
本项目采用 MIT 许可证。
通过这个技能,您可以: ✅ 快速进行客户RFM分析 ✅ 构建准确的LTV预测模型 ✅ 获得可解释的业务洞察 ✅ 生成专业的分析报告 ✅ 支持数据驱动的业务决策