Müşteri Yaşam Boyu Değeri Tahmini: Altı Aylık Gelir Kimden Gelecek?Customer Lifetime Value: Who Brings the Next Six Months of Revenue?

Bir online perakendecinin 25 aylık işlem kaydıyla her müşterinin sonraki 183 günde getireceği net geliri tahmin ettim. Müşterilerin %42,8'i hiç dönmüyor, gelirin %69'u en değerli %10'dan geliyor; bütün modelleme çabası basit bir kuralı yalnızca %5,3 geçebildi.Using 25 months of transactions from an online retailer, I predicted the net revenue each customer would bring over the next 183 days. 42.8% never come back and 69% of revenue comes from the top 10%; all the modelling effort beat a one-line rule by just 5.3%.

  • Python
  • BG/NBD
  • Gamma-Gamma
  • scikit-learn
  • CLV

Abonelik ve tekrar satın alma işlerinde bütçe sorusu hep aynı: önümüzdeki altı ayda kim ne kadar bırakacak, parayı kime harcayalım? Bu projede bir online perakendecinin 1.067.371 fatura satırlık gerçek işlem geçmişini alıp her müşteri için 183 günlük net gelir tahmini kurdum: iadeleri netleyerek, eğitim ve testi takvim zamanına göre ayırarak, olasılıksal müşteri modelleriyle makine öğrenmesini aynı test döneminde karşılaştırarak.

607 GBPEn iyi modelin müşteri başına ortalama hatası
%5,3En güçlü basit kurala göre tek kazanç
%61,5Üst %10'un yakaladığı gerçek gelir
%42,8Hedef dönemde hiç alışveriş yapmayan müşteri

Veri ve kapsam

Veri seti UCI Online Retail II (CC BY 4.0): Birleşik Krallık merkezli, ağırlıklı olarak hediyelik eşya toptancılığı yapan gerçek bir perakendecinin 1 Aralık 2009 – 9 Aralık 2011 arasındaki bütün fatura satırları. 41 ülke, 4.636 ürün kodu, kimliği olan 5.878 müşteri.

Veri setinin bu proje için iki açık eksiği var ve ikisini de uydurmadan yürüttüm. Birincisi, edinim kanalı alanı yok: reklam, arama, e-posta gibi bir etiket bulunmuyor. Kanal yerine vekil olarak müşterinin ilk siparişinin düştüğü çeyreği ve ülke grubunu kullandım; bunlar kanalın yerine geçmez, yalnızca kohort davranışını gösterir. İkincisi, maliyet ve marj verisi yok: bu yüzden brüt kâr ve net katkı ölçülmüş değil, oranı açıkça yazılmış birer senaryo.

Temizlikte verilen kararlar

Ham veriden 270.897 satır çıktı, 796.474 satır kaldı. Üç karar sonucu belirledi:

  • Kimliksiz satırlar çıkarıldı (243.007 satır, ~1,78 milyon GBP). Bu ciro şirket için gerçektir ama hiçbir müşteriye bağlanamadığı için kişi bazlı modellemeye giremez. Raporlanan toplamların şirketin gerçek cirosunun altında kalmasının sebebi budur.
  • İadeler silinmedi, netlendi. C ile başlayan faturalar ve negatif adetler iade olarak işaretlenip gerçekleştikleri dönemin gelirinden düşüldü. İadeyi silmek satın alma davranışını olduğundan iyi gösterirdi; netlemek hem hedefi doğru yaptı hem de müşteri başına iade oranı özelliğini verdi.
  • Uç değer kırpılmadı. Verinin en büyük iki kaydı — 80.995 adetlik 168.470 GBP'lik ve 74.215 adetlik 77.184 GBP'lik siparişler — aynı gün iptal edilmiş siparişlerdir, netlendiğinde sıfıra iniyorlar. Kalan uç değerler gerçek toptancı müşterilerdir; onları atmak portföyün en önemli parçasını saklamak olurdu. Bunun yerine bütün metrikleri bir de %99 kırpılmış veride hesapladım.

Muhasebe kodları (ADJUST, BANK CHARGES, AMAZONFEE, indirim, numune, bağış, test kayıtları) çıkarıldı; posta ve kargo kalemleri bilerek tutuldu — bunlar müşteriden tahsil edilen gerçek gelirdir.

CLV'yi nasıl tanımladım

Bu projede CLV, müşterinin gözlem penceresi bittikten sonraki 183 gün içinde getireceği, iadeler düşülmüş net satış geliridir. "Sonsuz yaşam boyu" değil, bilerek sonlu bir ufuk: veri 739 gün, sonsuz ufuklu bir tahminin doğrulanabileceği bir gelecek dönem bu veride yok. Doğrulanamayan bir sayı raporlamaktansa doğrulanabilir bir ufuk seçtim.

Ölçüldü

Net gelir

Satış eksi iade. Veriden doğrudan hesaplanır ve modelin tahmin ettiği şey budur. Test döneminde gerçekleşen: 4.227.243 GBP.

Senaryo

Brüt kâr

Net gelir × brüt marj. Veride ürün maliyeti yok; hediyelik eşya toptancılığında %30–40 bandı tipiktir, raporda %35 varsayıldı.

Senaryo

Net katkı

Brüt kâr eksi kargo, iade işleme ve komisyon gibi değişken maliyetler. Pazarlama bütçesi gelirden değil bu rakamdan ayrılır.

Zaman bazlı kurulum ve sızıntı

CLV tahmininde en sık yapılan hata müşterileri rastgele eğitim/test diye bölmektir: model o zaman "geleceği" aynı takvim döneminden öğrenir ve gerçekte ulaşılamayacak bir başarı raporlanır. Ayrımı takvim zamanına göre yaptım.

Eğitim ve test pencereleri
2010-012010-072011-012011-07Eğitim · özellik penceresi2009-12-01 → 2010-12-01 · 365 günEğitim · hedef (y)2010-12-01 → 2011-06-02 · 183 günTest · özellik penceresi2010-06-10 → 2011-06-10 · 365 günTest · hedef (y)2011-06-10 → 2011-12-10 · 183 günHedef pencereler çakışmaz: eğitim hedefi 2011-06-02'de biter, test hedefi 2011-06-10'da başlar.

Özellikler yalnızca özellik penceresinden, hedef yalnızca hedef penceresinden hesaplanır. Eğitim hedefi 2011-06-02'de biter, test hedefi 2011-06-10'da başlar; iki hedef tek bir günü bile paylaşmaz.

Dört kural sızıntıyı kapatıyor: (1) hedef penceresindeki hiçbir sipariş, iade veya tutar özelliğe girmez; (2) her iki kümede özellik penceresi 365, hedef penceresi 183 gün — sabit uzunluk olmasa eğitim ve test karşılaştırılamazdı; (3) hedef pencereleri çakışmaz; (4) kohort tanımı ileriye bakmaz — müşteri kümeye yalnızca özellik penceresinde alışveriş yaptıysa girer, hedef dönemde hiç dönmeyen %42,8 kümede tutulur ve hedefi 0 kabul edilir. "Hedef dönemde alışveriş yapanlar" üzerinden kohort seçmek en ciddi sızıntı biçimidir.

Özellik penceresinden 24 özellik türettim: frekans, recency, müşteri yaşı, ilk–son alış aralığı, brüt ve net gelir, ortalama ve medyan sepet, tekrar alışların ortalama değeri, ürün çeşidi, aktif ay sayısı, iade tutarı ve oranı, son 90 ve 180 günün geliri ve sipariş sayısı, 90/90 ivme oranı, sipariş aralığının ortalaması ve standart sapması, günlük gelir, ülke grubu.

Üç temel tahmin, beş model, tek test dönemi

Bir CLV çalışmasında temel tahmini raporlamamak, başarıyı olduğundan büyük göstermenin en kolay yoludur. Aşılması gereken eşik şu: müşterinin son 180 günde bıraktığı geliri aynen gelecek döneme kopyala.

Modellerin ortalama absolut hatası (MAE, GBP)
02905798691.158BG/NBD + Gamma-Gamma607Temel: son 180 gün taşıma641İki aşamalı (sınıf × Poisson)644Gradyan artırma (Poisson)669Ridge (log–log)745Gradyan artırma (log hedef)779Temel: günlük ortalama × 1831.071Temel: global ortalama1.073Ortalama Absolut Hata (MAE, GBP) · düşük olan iyi · mor: model, gri: temel tahmin

Gri çubuklar temel tahminler. Beş modelin yalnızca biri en güçlü temel tahmini geçebildi.

ModelMAE (GBP)RMSE MAE %99 kırpılmışSpearmanÜst %10 yakalama Toplam sapma
BG/NBD + Gamma-Gamma6072.4904650,568%61,5−%19,6
Temel: son 180 günü taşı6413.0724840,544%60,1−%25,1
İki aşamalı (sınıf × Poisson)6443.2564620,590%61,5−%44,0
Gradyan artırma (Poisson)6693.4764620,582%61,3−%45,8
Ridge (log–log)7453.4875440,599%59,7−%62,4
Gradyan artırma (log hedef)7794.2565270,561%59,6−%73,8
Temel: günlük ortalama × 1831.0714.8759730,559%57,4+%61,9
Temel: herkese ortalama1.0735.191740—%13,2−%34,1

BG/NBD + Gamma-Gamma iki olasılıksal modelin çarpımı: biri müşterinin kaç kez daha alışveriş yapacağını ve hâlâ "canlı" olma olasılığını, diğeri sipariş başına ortalama tutarı modelliyor. Hazır bir CLV kütüphanesi kullanmadım; olabilirlik fonksiyonlarını Fader ve Hardie'nin yayınından doğrudan yazıp Nelder–Mead ile kestirdim (beklenen işlem sayısı için Gauss hipergeometrik fonksiyon). Kestirilen parametreler: r=0.584, α=39.73, a=0.193, b=1.585; Gamma-Gamma p=1.95, q=3.93, γ=553.

Tablodaki en öğretici satırlar en alttakiler değil, sıralama ile seviyenin ayrıştığı satırlar. Ridge ve iki aşamalı model sıralamada BG/NBD'den iyi (Spearman 0,599 ve 0,590'a karşı 0,568) ama portföy toplamını %44–62 eksik tahmin ediyor. Sebebi tek cümlede: logaritmik hedefte kare hata ile optimize edilen bir model geometrik ortalamayı hedefler, sağa çok çarpık bir dağılımda da bu toplamı sistematik olarak küçültür. Log dönüşümü bedava değil.

Tek bir "en iyi model" yok — karara göre model seçilir. Bütçenin büyüklüğünü hesaplayacaksanız BG/NBD + Gamma-Gamma: en düşük MAE, en az toplam sapma. Kimi hedefleyeceğiz sorusunda iki aşamalı model veya Ridge daha iyi ayırıyor. Pratikte ikisi birlikte kullanılır: sıralama için biri, tutar için diğeri.

Neden MAPE yok

Test kohortundaki müşterilerin %42,8'i hedef dönemde hiç alışveriş yapmadı; gerçek değerleri tam olarak sıfır. MAPE ve benzeri yüzdesel metrikler bu noktalarda tanımsızdır ve sıfıra yakın değerlerde patlar. Yerine şunları kullandım: GBP cinsinden yorumlanabilen MAE (ana karar metriği), uç değerlere duyarlı RMSE, tipik müşteriyi gösteren MedAE, aktif ve pasif müşteriler için ayrı MAE, sıralama kalitesi için Spearman, bütçe kararına en yakın ölçü olan üst %10 yakalama oranı ve portföy yanlılığını gösteren toplam gelir sapması.

Portföyün şekli

Hedef dönem gelirinin dağılımı
04569121.3671.8230 GBP1.8231101001.00010.000100.000Hedef dönem net geliri (GBP, logaritmik eksen) · y: müşteri sayısı1.823 müşteri (%42) hedef dönemde hiç alışveriş yapmadı · 28 müşteride net iade

Sıfırda büyük bir yığılma ve sağa çok uzun bir kuyruk. Ortalama (977 GBP) medyanın (181 GBP) 5,4 katı — bu veride "ortalama müşteri" diye konuşmak yanıltıcı.

Gelir konsantrasyonu
%0%25%50%75%100üst %10 → %69üst %20 → %830%25%50%75%100Müşteriler gelire göre sıralı (x) · kümülatif gelir payı (y)

En değerli %10 müşteri gelirin %69'ini, %20'si yaklaşık dörtte üçünü getiriyor. Modelin asıl işi bu üst dilimi doğru seçmek.

Tahmin desillerine göre kalibrasyon
01.6223.2444.8656.487D1D2D3D4D5D6D7D8D9D10Gerçek ortalama gelirTahmin ortalaması%80 tahmin aralığı (p10–p90)D1 = en düşük tahmin desili · D10 = en yüksek

Müşteriler tahmine göre on desile ayrıldı. İlk dokuz desilde tahmin ile gerçekleşen birbirine yakın; sapma neredeyse tamamen en üst desilde ve eksik tahmin yönünde toplanıyor.

Kümülatif gelir yakalama
%0%25%50%75%1000%50%100BG/NBD + Gamma-GammaTemel: son 180 günKusursuz sıralamaRastgele (çapraz)Tahmine göre sıralı müşterilerin yakaladığı gerçek gelir

Tahmine göre sıralanan müşterilerin ilk %10'u gerçek gelirin %61'ini yakalıyor. Kusursuz sıralamanın tavanı %69; model mümkün olanın %89'ine ulaşıyor.

Segment ve edinim kırılımı

Segmentleri yalnızca özellik penceresindeki sipariş sayısı ve son alış tarihinden tanımladım (Şampiyon: en az 5 sipariş ve son 60 gün içinde alış; Sadık: en az 3 sipariş, son 120 gün; Riskli: en az 3 sipariş ama 120 günden eski; Yeni/gelişen: en çok 2 sipariş, son 90 gün; Uykuda: kalanlar).

Segment bazında gerçek ve tahmin
02.0004.000Şampiyonn=796 · gelir payı %67sapma %-23Sadıkn=697 · gelir payı %13sapma %-5Uykudan=1.745 · gelir payı %9sapma %-20Risklin=460 · gelir payı %6sapma %-50Yeni/gelişenn=628 · gelir payı %5sapma %+23Gerçek ortalama (GBP)Tahmin ortalaması (GBP)

Gelirin %67'si tek bir segmentten (Şampiyon, n=796) geliyor ve model orada %23 eksik tahmin ediyor.

SegmentMüşteriHedefte aktif Gerçek ort. (GBP)MAESapmaGelir payı
Şampiyon796%933.5711.562−%23%67,2
Sadık697%77788592−%5%13,0
Uykuda1.745%35207263−%20%8,6
Riskli460%55529498−%50%5,8
Yeni / gelişen628%53367446+%23%5,5

En zoru Riskli segment: −%50 ile en yüksek göreli hata orada. Üç veya daha fazla sipariş vermiş ama 120 günden uzun süre sessiz kalmış müşteriler; geri dönüp dönmeyecekleri veriden kestirilemiyor. Oysa %55'ı aslında geri döndü. Tam da bu belirsizlik, elde tutma kampanyasının en yüksek getiriyi vaat ettiği yer.

Değer dilimlerinde sapmanın işareti dönüyor: en alt dilimde model fazla (+%130), en üst dilimde eksik (−%27) tahmin ediyor. Bu, ortalamaya regresyonun klasik imzası ve bütçede doğrudan sonucu var: tahminler ham tavan olarak kullanılırsa küçük müşterilere fazla, büyüklere az harcanır.

Edinim kohortu — kanal vekili

Dikkat: bu kırılım bir edinim kanalı değildir. Veri setinde kanal alanı yok; aşağıdaki gruplar müşterinin ilk siparişinin düştüğü çeyreğe göre kurulmuştur ve yalnızca aynı dönemde kazanılmış müşterilerin birlikte davranmasını gösterir.

Edinim çeyreğine göre gerçek ve tahmin
01.3792.7592010Q2n=755 · gelir payı %44sapma %-232010Q3n=1.537 · gelir payı %35sapma %-282010Q4n=1.252 · gelir payı %12sapma %-192011Q1n=468 · gelir payı %5sapma %+232011Q2n=314 · gelir payı %3sapma %+38Gerçek ortalama (GBP)Tahmin ortalaması (GBP)

Eski kohortlar (2010Q2–Q3) hem daha değerli hem eksik tahmin ediliyor; yeni kohortlar (2011Q1–Q2) fazla tahmin ediliyor.

Örüntü net ve uyarıcı: yeni müşteriler için model iyimser, olgun müşteriler için kötümser. 2011Q1 kohortunda +%23, 2011Q2'de +%38 fazla tahmin var; 2010Q2'de −%23, 2010Q3'te −%28 eksik tahmin. Yeni kohortlarda kısa gözlem süresi modelin yüksek bir satın alma hızı varsaymasına yol açıyor. Yeni müşteri edinimine yapılacak yatırım bu tahminlere dayandırılırsa geri dönüş olduğundan iyi görünür.

Coğrafyada da benzer bir yanlılık var: yurt dışı müşteriler sayıca az (n=371) ama müşteri başına 2.5 kat değerli ve model bu grupta −%35 eksik tahmin ediyor.

Belirsizlik: tek sayı değil, aralık

Her müşteri için kuantil gradyan artırma ile alt (%10) ve üst (%90) tahminler ürettim. Nominal %80'lik bu aralığın ampirik kapsaması %70,9, nominal %90'lık aralığınki %80,5 — ikisi de nominal değerin altında, yani aralıklar olması gerekenden dar ve gerçek belirsizlik raporlanandan büyük.

Belirsizliğin iki kaynağı karıştırılmamalı. Dönecek mi? — pasif müşterilerde MAE 281 GBP; model geri dönmeyecek müşterilere sıfırdan büyük bir beklenti atfediyor. Ne kadar harcayacak? — aktif müşterilerde MAE 851 GBP; toptancı müşterilerde tek bir sipariş tahmini ikiye katlayabiliyor.

İki kaynağın birleştiği yer en değerli müşteriler: orada alt sınır sıfıra iniyor. Sebebi veri — eğitim döneminde benzer profildeki müşterilerin yaklaşık onda biri sonraki dönemde hiç alışveriş yapmadı, dolayısıyla %10'luk kuantil gerçekten sıfır. "Bu müşteri kesin 50.000 GBP getirir" denemez; doğru ifade, beklenen değerin yüksek olduğu ama tek bir müşterinin tamamen susma ihtimalinin ihmal edilemez olduğudur. Elde tutma yatırımının gerekçesi de tam olarak budur.

Tahminden bütçeye

Pazarlama bütçesi tahmin edilen gelirden değil net katkıdan ayrılır. Modelin öngördüğü 3.397.308 GBP gelir, %35 brüt marj ve %6 değişken yük varsayımıyla yaklaşık 985.219 GBP net katkıya iniyor; bunun %30'u ayrılırsa pazarlama tavanı yaklaşık 295.566 GBP olur. Oranlar veride yok, bu yüzden senaryodur — ama zincirin kendisi değişmez.

Şampiyon

Kaybetmemek üzerine kurul

Gelirin %67'si, 796 müşteri, kişi başına 6 ayda ortalama 3.571 GBP. Kişiye atanmış hesap yönetimi, stok önceliği, hacim indirimi. Model burada eksik tahmin ettiği için tahmin harcama tavanı değil alt sınır olarak okunmalı.

Riskli

Geri kazanımın asıl adresi

460 müşteri, %55'ı geri döndü. Belirsizliğin yüksek olduğu yerde müdahalenin marjinal etkisi en büyük. Önce tekliften ucuz temas, yanıt vermeyene maliyetli teklif — kontrol gruplu olarak.

Uykuda

Harcamamak da bir karar

1.745 müşteri ama gelirin yalnızca %9'ı ve dönüş oranı %35. Kitlesel indirim yerine düşük maliyetli otomatik temas. Modelin en net iş değeri, bu grupta boşa gidecek bütçeyi önlemesi.

Üç kural, modeli karar kuralına çevirirken: dilim kullan, nokta kullanma (kalibrasyon ilk dokuz desilde güvenilir, bireysel tahmin değil); teklif maliyetini net katkıyla karşılaştır, gelirle değil; kampanyayı kontrol gruplu testle doğrula — CLV tahmini kimi hedefleyeceğini söyler, kampanyanın işe yarayıp yaramadığını söylemez.

Sınırlar

  • Tahminler gelir garantisi değil. Müşteri başına ortalama 607 GBP sapma var; tek bir müşteri için tahmin gerçeğin birkaç katı veya kesri olabilir.
  • Veri dönemi 2009–2011 ve o dönemin koşullarını taşıyor. Test dönemi Noel sezonunu kapsarken eğitim hedefi sezonun sonundan başlıyor; bu asimetri, modelin test döneminde eksik tahmin etmesinin nedenlerinden biri. Model başka bir takvim dilimine olduğu gibi taşınamaz.
  • Ufuk 183 gün, "yaşam boyu" değil. Daha uzun ufuklar bu veriyle doğrulanamaz.
  • Brüt kâr ve net katkı ölçülmedi, senaryodur; gerçek marjlarla yeniden hesaplanmalı.
  • Kanal analizi vekil üzerinden. Kanal bazlı bütçe kararları bu kırılıma dayandırılamaz.
  • Gelir birkaç müşteriye bağımlı: en büyük müşteri test dönemi gelirinin ~%4'ünü, en büyük on müşteri ~%21'ini oluşturuyor. Bu yüzden bütün metrikler %99 kırpılmış veride ikinci kez hesaplandı.
  • Nedensellik yok. Model kimin ne kadar harcayacağını kestirir; bir kampanyanın harcamayı artırıp artırmayacağını söylemez.

Dosyalar

Aynı analizin tek dosyalık rapor sürümü: CLV raporu (HTML) — 225 KB, grafikler dosyanın içine gömülü, internet bağlantısı olmadan da açılır. Bu sayfadaki bulguların aynısını içerir; indirip çevrimdışı okumak ya da paylaşmak isteyenler için.

Sonuç

Bu projenin en dürüst çıktısı en gösterişli olanı değil: özenle kurulmuş bir olasılıksal model, bir satırlık bir kuralı yalnızca %5,3 geçti. Yine de bunu bir başarısızlık saymıyorum, çünkü modelin verdiği şey tek bir MAE rakamı değil — hangi segmentin gelirin üçte ikisini taşıdığı, hangi kohortta iyimser olduğu, hangi müşteride alt sınırın sıfıra indiği. Bütçe kararı bu bilgilerle kurulur, tek bir tahmin sayısıyla değil.

Analiz Python 3.13, pandas, NumPy, scikit-learn ve SciPy ile yapıldı; bütün betiklerde rastgelelik sabitlendi, aynı veriyle aynı sayılar üretilir. Veri seti: Chen, D. (2019). Online Retail II, UCI Machine Learning Repository, doi.org/10.24432/C5CG6D, CC BY 4.0.

In repeat-purchase businesses the budget question is always the same: who will spend how much over the next six months, and where should the money go? In this project I took 1,067,371 invoice lines of real transaction history from an online retailer and built a 183-day net revenue prediction for every customer — netting returns, splitting train and test by calendar time, and comparing probabilistic customer models against machine learning on the same test period.

£607Mean absolute error per customer, best model
5.3%The only gain over the strongest simple rule
61.5%Real revenue captured by the top 10%
42.8%Customers who bought nothing in the target period

Data and scope

The dataset is UCI Online Retail II (CC BY 4.0): every invoice line of a real UK-based retailer, mostly a giftware wholesaler, between 1 December 2009 and 9 December 2011. 41 countries, 4,636 product codes, 5,878 identified customers.

The dataset has two clear gaps for this project and I worked around both without inventing anything. First, there is no acquisition channel field. Instead of a channel I used the quarter of the customer's first order and their country group as a proxy; these do not stand in for a channel, they only show how customers acquired in the same period behave together. Second, there is no cost or margin data, so gross profit and net contribution are not measured but stated scenarios with their assumptions written out.

Cleaning decisions

270,897 rows were removed and 796,474 remained. Three decisions shaped the result:

  • Rows without a customer id were dropped (243,007 rows, roughly £1.78m). That revenue is real for the business but cannot be attached to a person, so it cannot enter customer-level modelling. This is why the totals reported here sit below the company's actual turnover.
  • Returns were netted, not deleted. Invoices starting with C and negative quantities were flagged as returns and subtracted from the revenue of the period in which they happened. Deleting returns would have made purchasing behaviour look better than it is; netting them made the target correct and produced a per-customer return-rate feature.
  • No outlier trimming. The two largest records in the data — an 80,995-unit £168,470 order and a 74,215-unit £77,184 order — were cancelled the same day and net to zero. The remaining outliers are genuine wholesale customers; removing them would hide the most important part of the portfolio. Instead every metric was also computed on 99%-trimmed data.

How CLV is defined here

In this project CLV is the net sales revenue, after returns, that a customer brings in the 183 days following the end of the observation window. Not an infinite "lifetime" but a deliberately finite horizon: the data spans 739 days, and there is no future period in it against which an infinite-horizon estimate could be validated. Rather than report a number that cannot be checked, I chose a horizon that can.

Measured

Net revenue

Sales minus returns, computed directly from the data. This is what the model predicts. Actually realised in the test period: £4,227,243.

Scenario

Gross profit

Net revenue × gross margin. The data holds no product cost; 30–40% is typical in giftware wholesale and the report assumes 35%.

Scenario

Net contribution

Gross profit minus variable costs such as shipping, return handling and payment fees. Marketing budget comes out of this figure, not out of revenue.

Time-based setup and leakage

The most common mistake in CLV work is splitting customers into train and test at random: the model then learns "the future" from the same calendar period and a performance figure gets reported that could never be reached in practice. I split by calendar time instead.

Train and test windows
2010-012010-072011-012011-07Train · feature window2009-12-01 → 2010-12-01 · 365 daysTrain · target (y)2010-12-01 → 2011-06-02 · 183 daysTest · feature window2010-06-10 → 2011-06-10 · 365 daysTest · target (y)2011-06-10 → 2011-12-10 · 183 daysThe target windows never overlap: the training target ends 2011-06-02, the test target starts 2011-06-10.

Features come only from the feature window, the target only from the target window. The training target ends 2011-06-02 and the test target starts 2011-06-10; the two never share a single day.

Four rules close the leak: (1) no order, return or amount from the target window enters a feature; (2) in both sets the feature window is 365 days and the target window 183 days — without fixed lengths, train and test would not be comparable; (3) the target windows do not overlap; (4) cohort membership does not look ahead — a customer enters only if they bought in the feature window, and the 42.8% who never returned stay in with a target of zero. Selecting the cohort on "customers who bought in the target period" is the most serious form of leakage.

I derived 24 features from the feature window: frequency, recency, customer age, first-to-last purchase span, gross and net revenue, mean and median basket, mean value of repeat purchases, product variety, active months, return amount and rate, revenue and order count over the last 90 and 180 days, a 90/90 momentum ratio, mean and standard deviation of inter-purchase gaps, daily revenue and country group.

Three baselines, five models, one test period

Not reporting a baseline is the easiest way to make a CLV result look better than it is. The bar to clear is this: copy the revenue the customer left in the last 180 days straight into the next period.

Mean absolute error by model (£)
02905798691,158BG/NBD + Gamma-Gamma607Baseline: carry last 180 days641Two-stage (classifier × Poisson)644Gradient boosting (Poisson)669Ridge (log–log)745Gradient boosting (log target)779Baseline: daily mean × 1831,071Baseline: global mean1,073Mean absolute error (£) · lower is better · purple: model, grey: baseline

Grey bars are the baselines. Only one of the five models cleared the strongest of them.

ModelMAE (£)RMSE MAE 99%-trimmedSpearmanTop 10% capture Total bias
BG/NBD + Gamma-Gamma6072,4904650.56861.5%−19.6%
Baseline: carry last 180 days6413,0724840.54460.1%−25.1%
Two-stage (classifier × Poisson)6443,2564620.59061.5%−44.0%
Gradient boosting (Poisson)6693,4764620.58261.3%−45.8%
Ridge (log–log)7453,4875440.59959.7%−62.4%
Gradient boosting (log target)7794,2565270.56159.6%−73.8%
Baseline: daily average × 1831,0714,8759730.55957.4%+61.9%
Baseline: same mean for everyone1,0735,191740—13.2%−34.1%

BG/NBD + Gamma-Gamma is the product of two probabilistic models: one for how many more purchases a customer will make and the probability they are still "alive", the other for the average value per order. I did not use an off-the-shelf CLV library; I wrote the likelihood functions straight from Fader and Hardie's paper and estimated them with Nelder–Mead, using the Gaussian hypergeometric function for the expected transaction count. Estimated parameters: r=0.584, α=39.73, a=0.193, b=1.585; Gamma-Gamma p=1.95, q=3.93, γ=553.

The most instructive rows are not the worst ones but the ones where ranking and level come apart. Ridge and the two-stage model rank better than BG/NBD (Spearman 0.599 and 0.590 against 0.568) yet understate the portfolio total by 44–62%. The reason fits in one sentence: a model optimised with squared error on a log target aims at the geometric mean, and on a heavily right-skewed distribution that systematically shrinks the total. The log transform is not free.

There is no single "best model" — the decision picks the model. To size a budget (how much revenue do we expect in total?), BG/NBD + Gamma-Gamma: lowest MAE, smallest total bias. To answer who to target, the two-stage model or Ridge separates better. In practice both are used: one for ranking, the other for the amount.

Why there is no MAPE

42.8% of the test cohort bought nothing in the target period, so their actual value is exactly zero. MAPE and similar percentage metrics are undefined at those points and explode near zero. I used instead: MAE as the main decision metric (readable in pounds), RMSE (sensitive to outliers), MedAE for the typical customer, separate MAE for active and inactive customers, Spearman for ranking quality, top-10% capture as the measure closest to the budget decision, and total revenue bias to expose portfolio-level skew.

The shape of the portfolio

Distribution of target-period revenue
04569121,3671,823£01,8231101001,00010,000100,000Net revenue in the target period (£, log axis) · y: number of customers1,823 customers (42%) bought nothing in the target period · 28 had net returns

A large spike at zero and a very long right tail. The mean (£977) is 5.4 times the median (£181), which makes “the average customer” a misleading idea here.

Revenue concentration
0%25%50%75%100%top 10% → 69%top 20% → 83%025%50%75%100%Customers ranked by revenue (x) · cumulative revenue share (y)

The top 10% of customers bring 69% of revenue and the top 20% roughly three quarters. Selecting that top slice correctly is the model's real job.

Calibration by prediction decile
01,6223,2444,8656,487D1D2D3D4D5D6D7D8D9D10Actual mean revenueMean prediction80% prediction interval (p10–p90)D1 = lowest prediction decile · D10 = highest

Customers split into ten deciles by prediction. Across the first nine the predicted and actual means track each other closely; almost all of the bias sits in the top decile, in the direction of under-prediction.

Cumulative revenue capture
0%25%50%75%100%050%100%BG/NBD + Gamma-GammaBaseline: last 180 daysPerfect rankingRandom (diagonal)Real revenue captured by customers ranked on prediction

Ranked on prediction, the first 10% of customers capture 61% of real revenue against a perfect-ranking ceiling of 69% — 89% of what is achievable.

Revenue is extremely concentrated: the top 10% of customers bring 69% of it and the top 20% roughly three quarters. The mean (£977) is 5.4 times the median (£181), which makes "the average customer" a misleading way to talk about this data. Sorted by prediction, the first 10% of customers capture 61% of real revenue against a perfect-ranking ceiling of 69% — the model reaches 89% of what is achievable. Calibration is close in the first nine deciles; almost all of the bias sits in the top decile, in the direction of under-prediction.

Segments and acquisition cohorts

Segments were defined only from order count and last purchase date within the feature window (Champion: 5+ orders and a purchase in the last 60 days; Loyal: 3+ orders, last 120 days; At risk: 3+ orders but older than 120 days; New/growing: up to 2 orders, last 90 days; Dormant: the rest).

Actual and predicted revenue by segment
02,0004,000Championn=796 · revenue share 67%bias -23%Loyaln=697 · revenue share 13%bias -5%Dormantn=1,745 · revenue share 9%bias -20%At riskn=460 · revenue share 6%bias -50%New/growingn=628 · revenue share 5%bias +23%Actual mean (£)Mean prediction (£)

67% of revenue comes from a single segment (Champion, n=796), and the model under-predicts it by 23%.

SegmentCustomersActive in target Actual mean (£)MAEBiasRevenue share
Champion79693%3,5711,562−23%67.2%
Loyal69777%788592−5%13.0%
Dormant1,74535%207263−20%8.6%
At risk46055%529498−50%5.8%
New / growing62853%367446+23%5.5%

The hardest group is At risk, with the largest relative error at −50%. These customers ordered three or more times and then went quiet for over 120 days; whether they come back cannot be read from the data. In fact 55% of them did. That uncertainty is exactly where a retention campaign promises the highest return.

Across value deciles the sign of the bias flips: the model over-predicts the bottom decile (+130%) and under-predicts the top one (−27%). That is the classic signature of regression to the mean, and it has a direct budget consequence: used as a raw ceiling, these predictions would overspend on small customers and underspend on large ones.

Actual and predicted revenue by acquisition quarter
01,3792,7592010Q2n=755 · revenue share 44%bias -23%2010Q3n=1,537 · revenue share 35%bias -28%2010Q4n=1,252 · revenue share 12%bias -19%2011Q1n=468 · revenue share 5%bias +23%2011Q2n=314 · revenue share 3%bias +38%Actual mean (£)Mean prediction (£)

Older cohorts (2010Q2–Q3) are both more valuable and under-predicted; newer cohorts (2011Q1–Q2) are over-predicted. The grouping is a proxy: the dataset holds no channel field.

The acquisition-cohort breakdown (a proxy, not a channel) shows a clear and cautionary pattern: the model is optimistic about new customers and pessimistic about mature ones. The 2011Q1 cohort is over-predicted by 23% and 2011Q2 by 38%, while 2010Q2 and 2010Q3 are under-predicted by 23% and 28%. Short observation time in the new cohorts leads the model to assume a high purchase rate. Acquisition spend justified on these predictions will look better than it is. Overseas customers show the same tilt: few in number (371) but 2.5× more valuable per head, and under-predicted by 35%.

Uncertainty: a range, not a number

For every customer I produced a lower (10%) and upper (90%) estimate with quantile gradient boosting. The empirical coverage of that nominal 80% interval is 70.9% and of the nominal 90% interval 80.5% — both below nominal, meaning the intervals are narrower than they should be and the real uncertainty is larger than reported.

Two sources should not be conflated. Will they return? — MAE on inactive customers is £281; the model assigns a non-zero expectation to customers who never come back. How much will they spend? — MAE on active customers is £851; for wholesale buyers a single order can double the prediction. Where both sources meet — the most valuable customers — the lower bound falls to zero, because in the training period roughly one in ten comparable customers bought nothing at all in the following period. The honest statement is not "this customer will bring £50,000" but that the expected value is high while the chance of complete silence is not negligible. That is precisely the case for retention spend.

From prediction to budget

Marketing budget comes out of net contribution, not predicted revenue. The £3,397,308 the model forecasts falls to roughly £985,219 of net contribution under a 35% gross margin and 6% variable load; allocating 30% of that gives a marketing ceiling of about £295,566. The rates are assumptions because the data holds none — but the chain itself does not change.

Champion

Built on not losing them

67% of revenue from 796 customers, £3,571 each over six months. Named account management, stock priority, volume terms. Since the model under-predicts here, the figure is a floor, not a spending ceiling.

At risk

Where win-back belongs

460 customers, 55% of whom returned anyway. Where uncertainty is highest, intervention has the largest marginal effect. Cheap contact first, a costly offer only for non-responders — with a control group.

Dormant

Not spending is a decision

1,745 customers but only 9% of revenue and a 35% return rate. Low-cost automated contact instead of mass discounting. The model's clearest business value is preventing wasted budget here.

Three rules turn the model into a decision rule: use slices, not points (calibration is reliable across the first nine deciles, individual predictions are not); compare offer cost against net contribution, never against revenue; and validate the campaign with a control group — CLV prediction tells you who to target, not whether the campaign worked.

Limitations

  • Predictions are not a revenue guarantee. Average error is £607 per customer; for an individual the prediction can be several times or a fraction of reality.
  • The data covers 2009–2011 and carries that period's conditions. The test period includes the Christmas season while the training target starts after it; this asymmetry is one reason the model under-predicts on test. It does not transfer unchanged to another calendar slice.
  • The horizon is 183 days, not a lifetime. Longer horizons cannot be validated here.
  • Gross profit and net contribution are scenarios and must be recomputed with real margins.
  • Channel analysis uses a proxy. Channel-level budget decisions cannot rest on it.
  • Revenue depends on a handful of customers: the largest single customer accounts for ~4% of test-period revenue and the top ten for ~21%. Every metric was therefore recomputed on 99%-trimmed data.
  • No causality. The model estimates who will spend what; it says nothing about whether a campaign would increase that spend.

Files

The same analysis as a single-file report: CLV report (HTML, in Turkish) — 225 KB, charts embedded in the file, opens without an internet connection. It carries the same findings as this page, for reading offline or passing on.

Conclusion

The most honest result here is not the most impressive one: a carefully built probabilistic model beat a one-line rule by 5.3%. I still do not read that as a failure, because what the model delivers is not a single MAE figure — it is knowing which segment carries two thirds of revenue, which cohort it is optimistic about, and which customers have a lower bound of zero. Budget decisions are built on that, not on one predicted number.

Analysis in Python 3.13 with pandas, NumPy, scikit-learn and SciPy; randomness is fixed in every script, so the same data reproduces the same numbers. Dataset: Chen, D. (2019). Online Retail II, UCI Machine Learning Repository, doi.org/10.24432/C5CG6D, CC BY 4.0.