Skip to content
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

calc_errors() returns inconsistent results errors #6

Open
chintan-sd opened this issue Aug 5, 2018 · 1 comment
Open

calc_errors() returns inconsistent results errors #6

chintan-sd opened this issue Aug 5, 2018 · 1 comment

Comments

@chintan-sd
Copy link

chintan-sd commented Aug 5, 2018

calc_errors() sometimes returns NA for $errors, while sometimes returns valid errors
I have observed this particularly happening depending on the batch size

Ex 1: $errors has errors

z1 <- list(list(x=ts(c(20000,40000,10000,150000,650000), frequency = 4), h = 2))
z1 <- temp_holdout(z1)
z1 <- calc_forecasts(z1, forec_methods(), n.cores=4)
z1 <- calc_errors(z1)

Ex 2: using same series as in earlier example, with an additional series errors are now valid

z2 <- list(list(x=ts(c(20000,40000,10000,150000,650000), frequency = 4), h = 2),list(x=ts(c(20000,40000,10000,150000,650000,130000,125000,325000,160000,150000), frequency = 4), h = 2))
z2 <- temp_holdout(z2)
z2 <- calc_forecasts(z2, forec_methods(), n.cores=4)
z2 <- calc_errors(z2)

this seems to be happening, coz total_snaive_errors is an average across all values in the dataset. However, if there is an issue in any one of the series then all $errors values are NA, causing the subsequent code to fail.

Ex 3: to series from Ex 2, we add one more series. Resulting errors for all three series will be NA

z2 <- list(
          list(x=ts(c(20000,40000,10000,150000,650000), frequency = 4), h = 2),
          list(x=ts(c(20000,40000,10000,150000,650000,130000,125000,325000,160000,150000), frequency = 4), h = 2),
          list(x=ts(c(50,50,50,50,50,50,50,50,50,50), frequency = 4), h = 2)
      )
z2 <- temp_holdout(z2)
z2 <- calc_forecasts(z2, forec_methods(), n.cores=4)
z2 <- calc_errors(z2)
@HamidM6
Copy link

HamidM6 commented Jun 27, 2019

in https://github.com/robjhyndman/M4metalearning/blob/master/R/process_dataset.R line number 95 and 96

total_snaive_errors <- total_snaive_errors + c(mean(lentry$snaive_mase), mean(lentry$snaive_smape))

I have added na.rm = TRUE to mean function to hack around the issue but not sure how that affects the results.

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

No branches or pull requests

2 participants