tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
89 stars 31 forks source link

Reconcilation fails #104

Closed brunocarlin closed 5 years ago

brunocarlin commented 5 years ago

I can not provide my own data but I have received this message when forecasting reconciled models.

ds_aggregated <- ds1 %>%
  fabletools::aggregate_key((category/sub_category), SI = sum(value_si))

library(future)
plan(multiprocess)
results <- ds_aggregated %>%
  filter(YEAR_MONTH < yearmonth("2019 MAY")) %>% 
  model(
    ets = ETS(SI),
    arima = ARIMA(SI),
    tslm = TSLM(SI),
    snaive = SNAIVE(SI)
    ) %>%
  mutate(combn = (arima + snaive + ets +tslm)/4) %>%
  reconcile(coherent = min_trace(combn, method = "shrink"))

forecasts <- results %>% 
  forecast(h = "3 months")

Error in if (xi > xj) 1L else -1L : missing value where TRUE/FALSE needed

I think that adding runif() to the predictions could possibly solve this issue but I am not sure how to do that,, it is very similar to the problem of the hts package where sometimes things break when using Mint, I have checked and I do have predictions that stay the same for multiple months, as far as I understand this breaks the MinT reconciliation.

mitchelloharawild commented 5 years ago

Are you able to reproduce this issue using a publically available or generated data set?