Skip to content

Conversation

rachlobay
Copy link
Contributor

@rachlobay rachlobay commented Jun 18, 2022

Addressed Issue #38 by making layer_add_forecast_date() and layer_add_target_date() as well as tests for each. I wasn't 100% sure about what was intended for the target date, so I defined it as in the simple-forecasts.Rmd vignette (where target_date = time_value + ahead), but perhaps that wasn't quite what was intended... Let me know and I can update it.

Update: Currently, I don't think the preprocessor is passed along (so that, for ex., ahead doesn't need to be provided by the user to be accessed in these postprocessing functions)... Please hold off on reviewing for now until that is done and I have updated these two functions accordingly.

@rachlobay rachlobay requested a review from brookslogan June 18, 2022 09:48
@rachlobay rachlobay linked an issue Jun 18, 2022 that may be closed by this pull request
@rachlobay rachlobay marked this pull request as ready for review June 18, 2022 10:11
@rachlobay rachlobay requested a review from dajmcdon as a code owner June 18, 2022 10:11
@rachlobay rachlobay marked this pull request as draft June 22, 2022 07:05
@rachlobay rachlobay marked this pull request as ready for review July 2, 2022 08:18
Copy link
Contributor

@dajmcdon dajmcdon left a comment

Choose a reason for hiding this comment

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

I think this review is perhaps still premature? Ignore if so.

Copy link
Contributor

@dajmcdon dajmcdon left a comment

Choose a reason for hiding this comment

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

You'll have to merge frosting to get the tests to pass.

@rachlobay rachlobay requested a review from dajmcdon July 8, 2022 05:53
#' Postprocessing step to add the forecast date
#'
#' @param frosting a `frosting` postprocessor
#' @param forecast_date The forecast date to add as a column to the `epi_df`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops. Sorry, I missed this. To my mind the forecast_date is the date on which the forecast is made. So, by default, it should be max(time_value) from the training data. The target_date should be "the date the forecast is for". So that one should be max(time_value) + ahead by default.

It looks like they're both the same currently right?

Copy link
Contributor Author

@rachlobay rachlobay Jul 8, 2022

Choose a reason for hiding this comment

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

Almost… Current defaults: forecast_date = max_time_value + ahead (where max_time_value is for test data), target_date = time_value + ahead (based on simple.forecasts.Rmd). But I will change to what you specified. A couple qs for that...

For forecast_date, to get the max time value from the training data, is that using mold from components? Then, I check if the forecast_date < as_of_date of the test data and throw a warning there (that says "forecast_date is less than the most recent update date of the data.”, yes?

For target_date, by default, that is the max time value in the in the test data + ahead or no?

Copy link
Contributor

Choose a reason for hiding this comment

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

The difficulty here is that leading/lagging increments the time_value. So this could all be a bit dangerous. In an ideal setting:

  1. target_date would be the max time value in the test data + ahead, as you said.
  2. forecast_date would be the max time value in the test data. (So seemingly, the date of the most recent data available to you). Acting like we have data up to (and including) today, and we produce a forecast today, then this should work.
    However, lots of weird crud can happen that would screw these up. If data isn't available for today but only for yesterday, then that would throw things off. If we accidentally lead the test data, then it'll produce "future" time_values.

@dajmcdon dajmcdon removed the request for review from brookslogan July 8, 2022 06:00
admin added 3 commits July 18, 2022 16:18
…gin frosting)

Merge branch 'frosting' of https://github.com/cmu-delphi/epipredict into 38-post_add_forecast_date-_add_target_date

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
Merge branch 'frosting' of https://github.com/cmu-delphi/epipredict into 38-post_add_forecast_date-_add_target_date

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@rachlobay rachlobay merged commit 86a1126 into frosting Jul 19, 2022
@dajmcdon dajmcdon deleted the 38-post_add_forecast_date-_add_target_date branch February 12, 2023 07:12
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.

post_add_forecast_date(), *_add_target_date()

2 participants