Skip to content

Provide better error/recovery when test lags don't exist ("zero-length inputs [...]") #333

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

Closed
brookslogan opened this issue May 14, 2024 · 3 comments · Fixed by #452
Closed

Comments

@brookslogan
Copy link
Contributor

brookslogan commented May 14, 2024

[Please see later comments for actual examples.]

@brookslogan brookslogan changed the title Provide better error/recovery in residual quantiles ("zero-length inputs [...]") Provide better error/recovery when test lags don't exist ("zero-length inputs [...]") May 14, 2024
@brookslogan
Copy link
Contributor Author

The difference between this and #332 is that this is dealing with a lagset being bad for test data, while #332 is about a shiftset being bad for training data.

@dajmcdon
Copy link
Contributor

Can you make a simple example without the slide?

@brookslogan
Copy link
Contributor Author

brookslogan commented Jul 25, 2024

Here's an example. Like with #332, I'm hoping for better error messages that spell out that I'm missing test-time predictors.

library(tibble)
library(dplyr)
library(workflows)
library(epiprocess)
library(epipredict)
# [message spam on the above removed]

edf <- tibble(
  geo_value = "ct",
  time_value = seq(as.Date("2020-10-01"), as.Date("2023-05-31"), by = "day"),
  ) %>%
  mutate(value = seq_len(nrow(.)) + rnorm(nrow(.))) %>%
  # Oct to May (flu season, ish) only:
  filter(!between(as.POSIXlt(time_value)$mon + 1L, 6L, 9L)) %>%
  # and actually, pretend we're around mid-October 2022:
  filter(time_value <= as.Date("2022-10-12")) %>%
  as_epi_df()

edf %>% arx_forecaster(
  "value",
  args_list = arx_args_list(lags = c(0L, 7L, 14L)) # (the current default)
)
#> Error in `as_list_of()`:
#> ! Can't find common type for elements of `x`.

edf %>% arx_forecaster(
  "value",
  trainer = quantile_reg(),
  args_list = arx_args_list(lags = c(0L, 7L, 14L)) # (the current default)
)
#> Error in (function (values = double(), quantile_levels = double()) : length(values) == length(quantile_levels) is not TRUE

Created on 2024-07-25 with reprex v2.1.1

[#362 has another example.]

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 a pull request may close this issue.

2 participants