Customer lifetime value modeling with cohort curves, RFMT, and gradient boosting
Project description
LTVToolkit
Customer Lifetime Value modeling with cohort curves, RFMT, and gradient boosting.
Installation
pip install ltvtoolkit
For full functionality (XGBoost, LightGBM, Lifetimes):
pip install ltvtoolkit[full]
Quick Start
import pandas as pd
import asyncio
from ltvtoolkit import run_ltv_model
# Load your transaction data
transactions = pd.read_csv('transactions.csv')
# Required columns: customer_id, order_date, value
# Optional: acquisition_date, acquisition_channel
# Convert to bytes
data_bytes = transactions.to_csv(index=False).encode()
# Run LTV model
async def analyze():
results = await run_ltv_model(data_bytes)
return results
results = asyncio.run(analyze())
# Access predictions
customer_predictions = results['individual_files']['ltv_projection_by_customer']
print(customer_predictions)
Features
- Multi-model ensemble: Combines cohort curves, gradient boosted trees, and RFMT/BG-NBD models
- Flexible data formats: Supports various transaction schemas
- 36-month projections: Customer and cohort-level LTV forecasts
- Production-ready: Comprehensive validation and error handling
Data Requirements
Your CSV/DataFrame must have:
customer_id: Unique customer identifierorder_date: Transaction datevalue: Transaction amount
Optional columns:
acquisition_date: Customer acquisition dateacquisition_channel: Marketing channel
Output
The model returns a dictionary with:
individual_files: Dict of output datasetsltv_projection_by_customer: Customer-level predictionsltv_projection_by_cohort: Cohort curves (M0-M36)ltv_model_performance_metrics: Performance metricsltv_feature_importance: Feature importance scores- And more...
summary_file: Combined summary report
Use Cases
- Marketing ROI analysis
- Customer segmentation
- Revenue forecasting
- Channel optimization
- CAC payback analysis
License
MIT License - see LICENSE file for details.
Links
- GitHub: https://github.com/yourusername/ltvtoolkit
- PyPI: https://pypi.org/project/ltvtoolkit/
- Issues: https://github.com/yourusername/ltvtoolkit/issues
Version History
0.1.0 (2025-01-XX)
- Initial release
- Cohort revenue curve model
- Gradient boosted trees model
- RFMT/BG-NBD model
- Ensemble prediction strategy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ltvtoolkit-0.1.0.tar.gz.
File metadata
- Download URL: ltvtoolkit-0.1.0.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a43dcfd9a5b64e806f3127800a486c4c313ca5057f325553f0cd8965e85c9a6c
|
|
| MD5 |
2c2dbb858b87151000926834a0d430d0
|
|
| BLAKE2b-256 |
edd3dd146a47de4921eeb700c9ffa84191d868b8aaf2c7267491e6134936be34
|
File details
Details for the file ltvtoolkit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ltvtoolkit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87aa5e0f763741558d45f64898be10187ea5c8e86d29a444ea39871d9c3053e4
|
|
| MD5 |
948918ac962dbe1139166fd50ff18b1f
|
|
| BLAKE2b-256 |
a7563b1ab3815aebb5dcb0e118db6277eebcf868ce985fd815c2b372a07c5cfe
|