Contributing¶
Adding a dataset¶
PaMIR ships no data — a dataset is added as a recipe that fetches it from its original source and harmonizes it locally. You never commit a data file.
Check it meets the inclusion criteria: binary default target, publicly downloadable, ≥1,000 rows, ≥3% default rate, and either a flat table or one the recipe can reduce to a flat table (a documented join/aggregation is fine — see
bondora).Add an entry to
pamir/data/catalog.jsonwith the metadata (name,rows,defaults,DR,features,geography,product,target_definition,license,source,source_url, and — where the license or academic origin requires it —attribution), plus:download:{kind, locator, file, sep, encoding, …}— where the raw file comes from.kindis one of:kaggle(slug),uci_zip/github_zip(a zip URL; a member is extracted, one level of nesting supported),github_raw(a direct file URL), orhf(a HuggingFace dataset repo). For a headerless raw file add"header": "none"+"columns": [...]; for ARFF add"format": "arff".harmonize:{target, target_rule, day_zero_drop, extra_drop, drop_prefix, shuffle_seed, …}.day_zero_dropis the list of post-outcome columns (the leakage-free semantic cut);extra_drop/drop_prefixremove further leaks or identifiers;shuffle_seedfixes the row order.
If it needs a bespoke read, target rule, or rescale, add the branch in
pamir/harmonize.pyand reference it viatarget_rule(seebondora,prosper,south_german).Run
pamir.download("<id>"), confirm it harmonizes cleanly, then freeze the result intopamir/data/expected.json(columns,n_rows,n_defaults,DR) — this is the validation contract every future download is checked against.Cite the source: put the paper / repository that introduced or used the dataset in the catalog
attributionfield and in Licenses & attribution.pamir/data/*.parquetis git-ignored — never commit the dataset itself.Open a pull request.
Running tests¶
pip install -e ".[dev,data]"
pytest tests/ -v
Tests that need data skip cleanly when a dataset is not cached (e.g. CI without Kaggle credentials); catalog, recipe and protocol tests always run. The suite checks:
Catalog & recipe integrity — 19 datasets, all metadata fields, every dataset has a valid
download/harmonizespec, andexpected.jsonagrees with the catalog.Harmonizer/downloader internals — synthetic end-to-end harmonize,
expected.jsonvalidation, cache location.Leakage-free guards (from the audit) — rows shuffled (|ρ(position, target)| < 0.1), no
day_zero_dropcolumn survives, no surrogate-key column, no divisibility leak, no single-column AUC > 0.95.Streaming protocol — no future-label leakage, lag enforced, monotonic train growth, pre-commitment.
Data quality — no duplicate rows, no constant features, licenses and attribution present where required.
All tests must pass before a PR is merged.