Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small agg model bug #99

Merged
merged 7 commits into from
Aug 20, 2024
Merged

Small agg model bug #99

merged 7 commits into from
Aug 20, 2024

Conversation

lennybronner
Copy link
Collaborator

@lennybronner lennybronner commented Aug 19, 2024

Description

As part of the hunt for the 2023 agg model bug we identified a different, smaller bug that effects the intervals only (not the point prediction). On occasion the double sampling can create intervals that are slightly too wide.

We max the agg model predictions with the number of contests won by the LHS party since that is the minimum number of contests that party can win. We also min with the number of contests won by the RHS party since that is the maximum number they can win.

Also small change to finding the uncalled races to avoid floating point issues.

Jira Ticket

https://arcpublishing.atlassian.net/browse/ELEX-4453

Test Steps

python run.py 2023-11-07_VA_G redo --office_id Y --geographic_unit_type county-district --pi_method bootstrap --estimands "['margin']" --features "['baseline_normalized_margin']" --start_timestamp "2023-11-07 19:00:00+01:00" --current_run_name va-y-test --percent_ev_threshold 95 --agg_model_preds --base_to_add 20

in the testbed

@lennybronner lennybronner requested a review from a team as a code owner August 19, 2024 22:19
@dmnapolitano dmnapolitano self-assigned this Aug 20, 2024
Copy link
Contributor

@dmnapolitano dmnapolitano left a comment

Choose a reason for hiding this comment

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

This LGTM! Thanks for tracking this problem down 😄 👏🏻

agg_pred = min(max(aggregate_dem_vals_pred, called_values_lhs), called_values_rhs) + base_to_add
agg_lower = min(max(interval_lower, called_values_lhs), called_values_rhs) + base_to_add
agg_upper = min(max(interval_upper, called_values_lhs), called_values_rhs) + base_to_add
national_summary_estimates = {"margin": [agg_pred, agg_lower, agg_upper]}
Copy link
Contributor

Choose a reason for hiding this comment

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

Very helpful explanation! 🎉

@lennybronner lennybronner changed the title pushed change Small agg model bug Aug 20, 2024
@lennybronner lennybronner merged commit 6d60433 into develop Aug 20, 2024
3 checks passed
@lennybronner lennybronner deleted the elex-4453-agg-model-bug branch August 20, 2024 19:49
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