Skip to main content

Customer Lifetime Value Prediction


PyPI version GitHub license


CLV Prediction Documents

Benchmark Results

Benchmarked against a naive baseline (avg order value x purchase frequency x horizon) on synthetic transaction data (381 customers, 1yr train / 30d holdout). Full methodology and numbers: docs/benchmark.md.

metric baseline CLV (default) CLV (tuned)
MAE (per customer) 139.50 213.89 199.87
RMSE (per customer) 232.53 1,105.77 965.22
Portfolio error (total predicted vs. actual) 319.4% 8.1% 19.5%

The naive baseline can look competitive per-customer, but the trained pipeline is dramatically more accurate at the portfolio/aggregate level — the level most CLV decisions (budgeting, cohort value) are actually made at. Hyperparameter tuning narrows the per-customer gap further, though it isn't guaranteed to improve the aggregate number since tuning optimizes each model's own loss, not portfolio-level total error.

This framework we generate 2 main predictive model per customer. First, Next Purchase (Frequency) Model will be trained. This model will help us to predict the day of nex purchases per customer Second, Customer Value Model will be trained. THis model will help us to predict what will be the amount of next purchases per customer. There will be customers can not be predicted by those models above because of lack historical informations. Those customers are NewComers. This platform allows us to predict NewComers' total lifetime values as well.

Installation

Tool can be used any other package by install it via pypi or git command

poetry add clv_prediction

OR

poetry add git+https://github.com/caglanakpinar/clv_prediction.git

Project layout

clv/
    docs/   
        - configs.yaml
        - test_parameters.yaml
    confgis.py
    dashboard.py
    data_access.py
    executor.py
    functions.py
    main.py
    newcomers.py
    next_purchase_model.py
    next_purchase_prediction.py
    purchase_amount_model.py
    utils.py

Release files for clv-prediction 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clv-prediction 0.4
File Size Uploaded
clv_prediction-0.4.tar.gz 31.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clv-prediction 0.4
File Interpreter ABI Platform
clv_prediction-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 72.7 kB

Release files / clv_prediction-0.4.tar.gz

Download URL clv_prediction-0.4.tar.gz
Size 31.8 kB
Tags Source
SHA-256 checksum
How to use checksums
69858dcf190a4922d9a60f7af14ce23e3ae1959f3009d5a5c0379d1908e7edaf
BLAKE2b-256 checksum
How to use checksums
2d9841ce2fe62b7d7487db6ff15c68bbeb748c9bc100bf19cb922808d4e3a187
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / clv_prediction-0.4-py3-none-any.whl

Download URL clv_prediction-0.4-py3-none-any.whl
Size 41.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
980684cac025be2433853d1e359d30e9e1017275cbe6a5e5a574c373f6459dac
BLAKE2b-256 checksum
How to use checksums
6d563973a0e4bc22e7a714f7e5f5645fb1689581e9d5092346ed2c31164fb20f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files

0.1.9

2 release files

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page