Skip to content

docs: end-to-end notebook on the KDD Cup 1998 donor file - #228

Merged
shivamlalakiya merged 1 commit into
mainfrom
docs/kdd98-end-to-end-notebook
Sep 24, 2026
Merged

shivamlalakiya merged 1 commit into
mainfrom
docs/kdd98-end-to-end-notebook

Conversation

@shivamlalakiya

Copy link
Copy Markdown
Contributor

Adds examples/notebooks/04_kdd98_end_to_end.ipynb and a tutorial page, "End to End on Real Donor Data", linked from the Tutorials nav and index.

Notebooks 01 to 03 all run on synthetic data. This one runs the whole library path on the 95,412 real donors of KDD Cup 1998, in ten steps: size up the file (Gini, top-donor share), reshape the wide export into a gift log with CRMCleaner and FiscalYearTransformer (plus retention, lifetime value and the waterfall), read it back as a Raiser's Edge export with a pledge row, build as-of RFM features, backtest LapsePredictor with as-of versus whole-history features under FiscalYearGroupedSplitter, fit a response model (WealthScreeningImputer + MajorGiftClassifier) with permutation importance, predict gift size with AskAmountRecommender wrapped in GiftIntervalCalibrator plus an ask ladder, decide who to mail against the $0.68 piece cost, check selection rates by gender, and save the bundle.

Results from one run, random_state=0, are on the tutorial page. One of them is worth reading before review: on the held-out final mailing, the whole-history lapse model scores slightly higher (0.583 against 0.547), but its backtest overpromised by more (0.218 against 0.170). The notebook text makes the backtest-reliability point, not a claim that the leaky model does worse in production.

CI: the notebook downloads the ~35 MB archive from UCI on first run, so the notebook step in ci.yml now caches ~/philanthropy_data, keyed on the loader file that pins the checksum. Committed without outputs, matching 01 to 03.

Verified locally: pytest --nbmake on the notebook passes (about 40 s with the archive cached), mkdocs build --strict passes, and the pre-push full suite passed.

Note for the Colab badge: the Raiser's Edge step needs main until the next release; the first cell shows the install line.

Notebooks 01 to 03 all run on synthetic data. Notebook 04 runs the whole
library path on the 95,412 real donors of KDD Cup 1998: reshape the wide
export into a gift log, clean it and add fiscal years, read it back as a
Raiser's Edge export with a pledge row, build as-of RFM features, backtest a
lapse model with as-of against whole-history features, fit a response model
with a leakage-safe wealth imputer and permutation importance, predict gift
size with a calibrated interval and an ask ladder, make the mailing decision
against the $0.68 piece cost, check selection rates by gender, and save the
fitted bundle.

A tutorial page summarises it with a Colab badge and the results of one run.
CI caches ~/philanthropy_data so the notebook step does not depend on the UCI
mirror on every push.
@shivamlalakiya
shivamlalakiya merged commit d019bed into main Sep 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant