Skip to content

Commit

Permalink
Merge pull request #379 from CodeForPhilly/378-fit-to-pre-peak
Browse files Browse the repository at this point in the history
Don't fit the current census against forecast days past the peak
  • Loading branch information
cjbayesian authored Mar 30, 2020
2 parents e1f3aca + 3c65eef commit b0fa0e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion e2e/cypress/integration/tests/actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ context('Actions', () => {

// This gets the "first" input from the sidebar. From clicking step up,
// the Regional Population should increase from default 4119405 to 4219405.
// Updated to 3600000
cy.get('input.st-al').eq(0)
.should('has.value', '4119406')
.should('has.value', '3600000')
})
});
5 changes: 4 additions & 1 deletion src/penn_chime/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ def get_loss(self) -> float:


def get_argmin_ds(census_df: pd.DataFrame, current_hospitalized: float) -> float:
losses_df = (census_df.hospitalized - current_hospitalized) ** 2.0
# By design, this forbids choosing a day after the peak
# If that's a problem, see #381
peak_day = census_df.hospitalized.argmax()
losses_df = (census_df.hospitalized[:peak_day] - current_hospitalized) ** 2.0
return losses_df.argmin()


Expand Down

0 comments on commit b0fa0e6

Please sign in to comment.