From 7dfde7345d8a3b30789ad5ecf553415bafa1415d Mon Sep 17 00:00:00 2001 From: Phil Miller Date: Mon, 30 Mar 2020 16:13:06 -0400 Subject: [PATCH 1/3] Don't fit the current census against forecast days past the peak --- src/penn_chime/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/penn_chime/models.py b/src/penn_chime/models.py index 19d1fe1e..5c09f168 100644 --- a/src/penn_chime/models.py +++ b/src/penn_chime/models.py @@ -182,7 +182,8 @@ 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 + peak_day = census_df.hospitalized.argmax() + losses_df = (census_df.hospitalized[:peak_day] - current_hospitalized) ** 2.0 return losses_df.argmin() From 318cf1309a96ab98482bb8e4d350fc23beee5b20 Mon Sep 17 00:00:00 2001 From: Jason Lubken Date: Mon, 30 Mar 2020 16:22:01 -0400 Subject: [PATCH 2/3] Update regional population test --- e2e/cypress/integration/tests/actions.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/e2e/cypress/integration/tests/actions.spec.js b/e2e/cypress/integration/tests/actions.spec.js index 78d4436c..d622ff1f 100644 --- a/e2e/cypress/integration/tests/actions.spec.js +++ b/e2e/cypress/integration/tests/actions.spec.js @@ -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. - cy.get('input.st-al').eq(1) - .should('has.value', '4119406') + // Updated to 3600001 + cy.get('input.st-al').eq(0) + .should('has.value', '360001') }) }); From 3c65eef4397d12a5a2df870256eac99d85c35f4d Mon Sep 17 00:00:00 2001 From: Phil Miller Date: Mon, 30 Mar 2020 16:24:36 -0400 Subject: [PATCH 3/3] Comment with link to #381 --- src/penn_chime/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/penn_chime/models.py b/src/penn_chime/models.py index 5c09f168..457f4df2 100644 --- a/src/penn_chime/models.py +++ b/src/penn_chime/models.py @@ -182,6 +182,8 @@ def get_loss(self) -> float: def get_argmin_ds(census_df: pd.DataFrame, current_hospitalized: float) -> float: + # 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()