docs(tutorials): fix broken Oregon tutorial code - #139
Merged
Conversation
Three issues that prevented the Oregon tutorial from running end-to-end: - The LPTE bar plots (both costs and visits) used outcome_ed_*_locations[1:] as the x-axis (n-1 points) against a PTE vector of length n returned by predict_lpte, causing a broadcast shape mismatch inside ax.bar. Dropping the [1:] slice matches the shape returned by predict_lpte. - The Visits section rebound ldte_simple/lower/upper/ldte_ml/... and lpte_simple/... to the visits values, clobbering the earlier ED costs values. The final "Overall Population vs Individual Strata" visualization then plotted the visits arrays against the costs locations (a shape mismatch, and semantically wrong even if the shapes had matched). Rename the visits arrays to *_visits_* so the costs arrays stay in scope for the final comparison plot. Verified by running the tutorial end-to-end against a local copy of the OHIE Public Use Files. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to #137 for the second tutorial. Verified end-to-end against a local copy of the OHIE Public Use Files.
Summary
plot(outcome_ed_costs_locations[1:], lpte_...)(n-1 points) against apredict_lpteresult of length n (len(locations)-1for the prepended-1boundary) crashed insideax.barwith a broadcast-shape error. Dropped the[1:]on both the costs and visits LPTE plots.ldte_simple,lower_simple,upper_simple,ldte_ml,lower_ml,upper_ml(and the LPTE analogues) to the visits values, clobbering the ED costs versions computed earlier. The final "Overall Population vs Individual Strata" plot then combined the visits LDTE arrays withoutcome_ed_costs_locations, which (a) crashed with a shape mismatch, and (b) would have shown wrong data even if the shapes had matched. Renamed the visits arrays to*_visits_*so the costs arrays stay in scope for the strata comparison plot.Test plan
🤖 Generated with Claude Code