HiSTAR-DRO: code for evidence-gated, hierarchy-aware robust selection of association-rule portfolios
Description
This dataset contains the complete Python implementation of HiSTAR-DRO (Hierarchy-informed, STAbility-gated Rule portfolios with Distributionally Robust Optimisation), the method proposed in the article "Which basket rules deserve scarce retail capacity? Evidence-gated, hierarchy-aware robust selection of association-rule portfolios". Research question. Association-rule mining yields thousands of statistically credible rules, while a retailer can act on only a few. The code formulates the selection of rules for scarce action slots as a robust knapsack problem with conflicts. An evidence gate (customer-cluster bootstrap recovery, Kish effective support, context portability and taxonomic coherence) decides which rules may compete; a lineage conflict graph derived from the product hierarchy prevents refinements of one co-purchase relation from occupying several slots; and a total-variation ambiguity set over context-stratified scenarios is solved as an exact compact mixed-integer linear programme with HiGHS. Contents. (i) Study 1 scripts (00-09) for a single grocery store with a locked evaluation month, a rolling-origin design and a customer-mix stress test; (ii) Study 2 scripts (s2_00-s2_05) for a frozen-protocol replication on the public dunnhumby panel "The Complete Journey" (2,500 households, 556 stores, ten origins and four regimes: thin evidence, larger capacity, specific portfolios and transport to an unseen store tier); (iii) shared modules for hierarchy-preserving mining, evidence dossiers, scenario construction, the lineage conflict graph, the robust MILP and de-duplicated portfolio valuation; (iv) figure scripts with an automatic layout check. All random seeds are fixed, and running the scripts in the order given in README.md reproduces every number, table and figure in the article and its Supporting Information. Data. No transaction data are included. The Study 1 data are available from the corresponding author on reasonable request. The Study 2 data are publicly available from dunnhumby (https://dunnhumby.com/sourcefiles); place transaction_data.csv and product.csv in data/dh/. Requirements. Python 3.11 or later with NumPy, pandas, SciPy, statsmodels, scikit-learn, matplotlib, Pillow, openpyxl and highspy (HiGHS 1.15). Study 2 needs about 8 GB of memory; one origin runs in about seven minutes on two cores.
Files
Steps to reproduce
1. Install Python 3.11 or later and run: pip install -r requirements.txt 2. Study 2 (public data): download The Complete Journey from https://dunnhumby.com/sourcefiles and copy transaction_data.csv and product.csv to data/dh/. 3. Run every script from the package root. Study 2: python code/s2_00_prepare.py python code/s2_01_rolling.py 4 main python code/s2_01_rolling.py 2 thin python code/s2_02_transport.py 0,2,4,6,8 trA python code/s2_05_deep.py 4 deep4 python code/s2_05_deep.py 2 deep2 python code/s2_03_analysis.py python code/fig7.py python code/fig8.py python code/s2_04_values.py 4. Study 1 (data on request): place retail.xlsx in data/ and run code/00_load.py to code/09_stats.py in the order listed in README.md, then code/fig1.py to code/fig6.py. 5. Results are written to out/ and out/s2/, figures to figs/. The Study 2 scripts resume where they stopped if interrupted; run them one after another rather than in parallel.
Institutions
- Istanbul Health and Technology UniversityIstanbul, Istanbul