Skip to content

Add state poverty rates notebook with memory optimizations#128

Open
DTrim99 wants to merge 3 commits intoPolicyEngine:mainfrom
DTrim99:issue-127-state-poverty-rates
Open

Add state poverty rates notebook with memory optimizations#128
DTrim99 wants to merge 3 commits intoPolicyEngine:mainfrom
DTrim99:issue-127-state-poverty-rates

Conversation

@DTrim99
Copy link
Copy Markdown
Contributor

@DTrim99 DTrim99 commented Mar 24, 2026

Summary

  • Adds notebook to calculate SPM poverty and child poverty rates for all 50 US states + DC
  • Includes memory optimizations to handle large state datasets without kernel crashes:
    • Garbage collection after each state
    • Float32 dtype to reduce memory footprint
    • States ordered by population (smallest first)
    • Checkpoint/resume functionality for crash recovery
  • Exports results to CSV with year in filename

Test plan

  • Run notebook with fresh kernel (RESUME=False)
  • Verify all 51 jurisdictions complete successfully
  • Check CSV output contains all states with valid poverty rates
  • If kernel crashes on large states, set RESUME=True and continue

🤖 Generated with Claude Code

@DTrim99
Copy link
Copy Markdown
Contributor Author

DTrim99 commented Mar 24, 2026

Added CSV output file with complete results for all 51 jurisdictions (50 states + DC).

DTrim99 and others added 3 commits March 24, 2026 13:01
Implements PolicyEngine#127: Calculate SPM poverty and child poverty rates for all
50 US states plus DC using PolicyEngine microsimulation with state-specific
datasets.

Features:
- Downloads state datasets from HuggingFace
- Calculates person_in_poverty rates (SPM definition)
- Child poverty filtering (age < 18)
- Summary statistics and national averages
- Choropleth map visualizations
- CSV export of results

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add garbage collection after each state to prevent memory buildup
- Use float32 dtype to reduce memory footprint by 50%
- Reorder states by population (smallest first) to reduce early memory pressure
- Add checkpoint/resume functionality to recover from kernel crashes
- Include year in output CSV filename for clarity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@DTrim99 DTrim99 force-pushed the issue-127-state-poverty-rates branch from ca19c8e to 4506e0b Compare March 24, 2026 17:01
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