-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: should we require users to call as_forecast()
before score()
?
#507
Comments
I personally like the extra convenience. |
The upside of forcing conversion prior to using score is it will be clear why things are failing (and encourage checking) and that we can have default arguments for score such as It would also reduce code complexity. The downside is as @nikosbosse says its a slight reduction in convenience. |
Could the generic not have these arguments? It may be a minefield but I thought it was possible. |
Copied from #399: We can't easily have
or metrics can't be empty and it will error if it's missing, as in this case:
The latter case is problematic because We can still have the description be "an optional list", but I'm not sure adding metrics as an argument to score() works very well / we'd have to make it work in a way that I'm not sure adds that much |
The lazy solution to this would be to have none of them have a default but instead detect when |
This might be dodgy and I suspect having different default arguments for different S3 methods could create trouble I'm not foreseeing but you could manipulate score <- function(x, metrics, ...) {
UseMethod("score")
}
score.default <- function(x, metrics, ...) {
if (x %in% c(0L, 1L)) {
.Class <- "binary"
} else if (x %% 1 == 0) {
.Class <- "discrete"
} else {
.Class<- "continuous"
}
NextMethod()
}
score.binary <- function(x, metrics = "brier", ...) {
message("I'm binary and my metrics are ", metrics)
}
score.discrete <- function(x, metrics = "RPS", ...) {
message("I'm discrete and my metrics are ", metrics)
}
score.continuous <- function(x, metrics = "CRPS", ...) {
message("I'm continuous and my metrics are ", metrics)
}
score(0L)
#> I'm binary and my metrics are brier
score(7L)
#> I'm discrete and my metrics are RPS
score(3.5)
#> I'm continuous and my metrics are CRPS Created on 2023-11-29 with reprex v2.0.2 |
yup I think this is a nice solution but probably want to keep the internal conversion from @nikosbosse see here: http://adv-r.had.co.nz/S3.html |
Where are we on this? Do we have a decision? |
To me, it seems like the discussion in this issue is dealing with two separate (albeit related) questions. 1) Should the generic be
|
Maybe we should get an initial picture via a vote on question 2) in the comment above. Pinging a few devs and users @seabbs @sbfnk @kathsherratt @toshiakiasakura @jhellewell14 @nickreich @Bisaloo @bsweger @dylanhmorris @jonathonmellor @OvertonC
|
Agree this is a nice feature of having @nikosbosse I made some light edits to your outline to slightly shift the bias ;) |
I'm on the fence 🤔. As an R package maintainer, I would vote for requiring an explicit call to As a potential user, I have been annoyed by overly strict requirements in terms of object class and format in the past. I'm not completely sure we would be in this scenario here since calling If I may bring another viewpoint to the table that may not be terribly helpful here since it doesn't bring an immediate solution to this specific question: |
There is only currently a custom print method (which is helpful for checking) and the custom get_ methods that also need a score object). I think you are right that could imagine another package that plots forecast objects. My main worry is that for new users the current workflow doesn't really confront them with what kind of forecast they have so they may get a false sense of security when chucking their forecasts into score (and also not take the time to use the get_ functions or explore non-default metric options). |
Adding another vote for explicitly calling |
as_forecast()
before score()
?as_forecast()
before score()
?
Interesting discussion! Have voted for upfront When we onboard colleagues in our team to using |
Thank you all for your input, this was really helpful!
Do you agree with that? |
I agree because socringutils currently supports the renaming and validation arguments in |
Issue #507: Require users to call `as_forecast()`
At the moment we allow users to do something like
which internally dispatches to
score.default()
which callsas_forecast()
and then callsscore()
again, dispatching to the correct method.Alternatively, we could just force users to call
as_forecast()
beforescore()
. This would be cleaner, but less convenient. What do you think?@seabbs mentioned this in the following issue: #399
The text was updated successfully, but these errors were encountered: