Skip to content

Commit

Permalink
fix hard thresholding comparison bug and make hard threshold the default
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcherian committed Oct 22, 2024
1 parent 7178312 commit bb350bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/elexmodel/models/BootstrapElectionModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, model_settings={}):
self.strata = model_settings.get("strata", ["county_classification"]) # columns to stratify the data by
self.T = model_settings.get("T", 5000) # temperature for aggregate model
self.hard_threshold = model_settings.get(
"agg_model_hard_threshold", False
"agg_model_hard_threshold", True
) # use sigmoid or hard thresold when calculating agg model
self.district_election = model_settings.get("district_election", False)

Expand Down Expand Up @@ -1490,7 +1490,7 @@ def get_national_summary_estimates(self, nat_sum_data_dict: dict, base_to_add: i

# we also need a national aggregate point prediction
if self.hard_threshold:
aggregate_dem_probs_total = self.aggregate_pred_margin > 0.5
aggregate_dem_probs_total = self.aggregate_pred_margin > 0
else:
aggregate_dem_probs_total = expit(self.T * self.aggregate_pred_margin)

Expand Down

0 comments on commit bb350bd

Please sign in to comment.