Skip to content

docs(tutorials): fix broken Hillstrom tutorial code - #137

Merged
TomeHirata merged 1 commit into
mainfrom
docs/fix-hillstrom-tutorial
Aug 30, 2026
Merged

docs(tutorials): fix broken Hillstrom tutorial code#137
TomeHirata merged 1 commit into
mainfrom
docs/fix-hillstrom-tutorial

Conversation

@TomeHirata

@TomeHirata TomeHirata commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

While verifying the tutorials referenced in the JOSS paper's Research Impact Statement, two bugs in docs/docs/tutorials/hillstrom.md prevented it from running end-to-end.

Summary

  • Treatment mapping typo. The mapping used 'Women E-Mail' but the CSV segment label is 'Womens E-Mail'. As a result D=2 was NaN for the Women's Email arm and every subsequent Women's-vs-anything analysis silently produced zero samples for that arm.
  • PTE plot x-axis length mismatch. The overall-population PTE plots used revenue_locations[1:] (50 points) against a PTE vector of length 51 returned by predict_pte (len(locations)-1), which crashed with a broadcast-shape error inside ax.bar. Dropping the slice matches the (correct) convention already used in the subgroup section further down the tutorial.

Verified by running the tutorial end-to-end against the live Hillstrom CSV; the ATE numbers now match the "Expected output" block in the tutorial exactly.

Test plan

  • Ran the full tutorial locally via a scripted extract; all code blocks executed without error and the Average Treatment Effects match the tutorial's Expected output.

Two issues that prevented the tutorial from running end-to-end:

- Treatment mapping used 'Women E-Mail', but the CSV segment label is
  'Womens E-Mail'. As a result D=2 was NaN for the Women's Email arm
  and every subsequent Women's-vs-anything analysis silently produced
  no samples.
- The overall-population PTE plots used revenue_locations[1:] as the
  x-axis (50 points) against a PTE vector of length 51 returned by
  predict_pte(len(locations)-1), causing a broadcast shape mismatch.
  Dropping the slice matches the (correct) convention already used in
  the subgroup section.

Verified by running the tutorial end-to-end on the live Hillstrom CSV;
ATE numbers now match the "Expected output" block in the tutorial.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 30, 2026 00:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@TomeHirata
TomeHirata merged commit f0919b5 into main Aug 30, 2026
10 checks passed
@TomeHirata
TomeHirata deleted the docs/fix-hillstrom-tutorial branch August 30, 2026 01:05
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.

2 participants