epiforecasts / scoringutils

Utilities for Scoring and Assessing Predictions
https://epiforecasts.io/scoringutils/
Other
48 stars 20 forks source link

Issue 432: Add some basic functions for as_point and as_quantile #790

Closed seabbs closed 3 months ago

seabbs commented 4 months ago

Description

This PR closes #432. It adds basic s3 methods for as_point and as_quantile to map from sample and quantile forecasts to quantile and point forecasts.

It also adds an option to as_forecast to skip checks as these are a bit annoying and adds an internal function remake_forecast to reclass a forecast and then use assert_forecast. Potentially we may want to expose the latter.

Do we have an issue for refactoring as_forecast.default in a later release as the current monolithic approach will probably make user class extensions hard/annoying.

@pearsonca this is a good example of having to reinvent the wheel quantile wise (i.e your epinowcast community post)

Note: Several of these implementations could be more efficient but I see this as putting the groundwork and I think improving them etc. are topics for their own issues.

Checklist

seabbs commented 4 months ago

would have expected perhaps also to see an as_quantile.forecast_point (setting the 0.5 quantile to the point forecast)?

Given the original issue was just for as_point I think this might be a new feature request.

seabbs commented 4 months ago

My main points are the duplication of the as_quantile() function for sample-based forecasts and the changes to as_forecast() which I'm not sure I completely understand.

Hoopefully the responses cover the rational here and the proposed actions.

seabbs commented 3 months ago

Once #813 has been implemented I can revisit this