Add confidence intervals to IRV charts - #55
Conversation
There was a problem hiding this comment.
Sorry @fsargent, your pull request is larger than the review limit of 150000 diff characters
|
Warning Review limit reached
Next review available in: 38 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
f03e4da to
f115e27
Compare
f115e27 to
3851689
Compare
Reviewer's GuideAdds computation and propagation of 95% normal-approximation confidence intervals for IRV/RCV VSE results, writes them to the IRV reproducible CSV, and renders them as error bars on static VSE charts while updating tests and docs accordingly. Sequence diagram for propagating IRV/RCV confidence intervals into static VSE chartssequenceDiagram
participant main
participant recalculate
participant render_vse
participant matplotlib_axis
main->>recalculate: recalculate(elections, seed, workers)
recalculate-->>main: results, outcomes, scenario_results, scenario_outcomes, intervals
main->>render_vse: render_vse(data, vse_png_path, size, intervals)
render_vse->>matplotlib_axis: axis.scatter(value, positions[method])
render_vse->>matplotlib_axis: axis.errorbar(value, positions[method], xerr=intervals[IRV_CHOOSERS[strategy]])
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The use of
[count, total, total_squared]lists insummary/scenario_summarywith positional indexing is getting a bit brittle; consider wrapping these in a small dataclass/namedtuple or helper functions to make the statistics fields self-documenting and less error-prone to extend. - In
render_vse,intervals[IRV_CHOOSERS[strategy]]assumes every plotted IRV/RCV strategy has a corresponding interval; it may be safer to use.get(or gate on membership) so chart rendering degrades gracefully if a mapping or interval entry is missing.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The use of `[count, total, total_squared]` lists in `summary`/`scenario_summary` with positional indexing is getting a bit brittle; consider wrapping these in a small dataclass/namedtuple or helper functions to make the statistics fields self-documenting and less error-prone to extend.
- In `render_vse`, `intervals[IRV_CHOOSERS[strategy]]` assumes every plotted IRV/RCV strategy has a corresponding interval; it may be safer to use `.get` (or gate on membership) so chart rendering degrades gracefully if a mapping or interval entry is missing.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Addresses #47.
Computes 95% normal-approximation confidence intervals from election-level IRV VSE observations, writes interval fields to the reproducible CSV, and renders interval bars for IRV/RCV points in the static charts.
The companion #54 adds the reproducible full-method CSV path needed to extend intervals across every chart series.
Validation:
uv run python scripts/recalculate_irv_pages.py --elections 20 --workers 1 --output /tmp/irv-ci-smoke.csvuv run python -m pytest -quv run --group dev python scripts/regenerate_pages_images.py --workers 10Summary by Sourcery
Add calculation and export of 95% confidence intervals for IRV VSE results and render them in static charts.
New Features:
Enhancements:
Tests: