Skip to content

Commit b0fa0e6

Browse files
authored
Merge pull request #379 from CodeForPhilly/378-fit-to-pre-peak
Don't fit the current census against forecast days past the peak
2 parents e1f3aca + 3c65eef commit b0fa0e6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

e2e/cypress/integration/tests/actions.spec.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ context('Actions', () => {
1010

1111
// This gets the "first" input from the sidebar. From clicking step up,
1212
// the Regional Population should increase from default 4119405 to 4219405.
13+
// Updated to 3600000
1314
cy.get('input.st-al').eq(0)
14-
.should('has.value', '4119406')
15+
.should('has.value', '3600000')
1516
})
1617
});

src/penn_chime/models.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ def get_loss(self) -> float:
182182

183183

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

188191

0 commit comments

Comments
 (0)