-
Notifications
You must be signed in to change notification settings - Fork 31
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
Compute scaled errors for accuracy by series, then summarise. #342
Comments
Bumping this. I need the accuracy function for something I'm writing. |
This unexpected behaviour is due to how the scaling term for It's not clear to me how best to handle this for MASE, and other measures which might use information that doesn't match the indices of the forecasts (such as training data). For your expected results, you would want to pass multiple scaling terms (one for each series) to Another related consideration is what is the correct So if anything, I think when |
OK. Supposing we do want to compute the MASE with a different scaling factor per series, what is the simplest way to compute it? |
Compute MASE with accuracy separately for each series, then compute the mean from the result. library(fpp3)
#> ── Attaching packages ──────────────────────────────────────────── fpp3 0.4.0 ──
#> ✓ tibble 3.1.6 ✓ tsibble 1.1.1
#> ✓ dplyr 1.0.7 ✓ tsibbledata 0.4.0.9000
#> ✓ tidyr 1.1.4 ✓ feasts 0.2.2.9000
#> ✓ lubridate 1.8.0 ✓ fable 0.3.1.9000
#> ✓ ggplot2 3.3.5.9000
#> ── Conflicts ───────────────────────────────────────────────── fpp3_conflicts ──
#> x lubridate::date() masks base::date()
#> x dplyr::filter() masks stats::filter()
#> x tsibble::intersect() masks base::intersect()
#> x tsibble::interval() masks lubridate::interval()
#> x dplyr::lag() masks stats::lag()
#> x tsibble::setdiff() masks base::setdiff()
#> x tsibble::union() masks base::union()
fc <- aus_arrivals %>%
filter(year(Quarter) <= 2009) %>%
model(
ets = ETS(Arrivals),
arima = ARIMA(Arrivals)
) %>%
forecast(h=11)
z <- fc %>%
accuracy(aus_arrivals) %>%
select(.model, Origin, MASE)
z %>%
group_by(.model) %>%
summarise(MASE = mean(MASE))
#> # A tibble: 2 × 2
#> .model MASE
#> <chr> <dbl>
#> 1 arima 2.08
#> 2 ets 1.75 Created on 2022-02-07 by the reprex package (v2.0.0) |
I think an alternative approach that would work here is reconsidering how accuracy measures are specified. Instead of always reducing the output into a single unit summary, it could be more valuable to expose the measure before combination. For instance, This would allow us to compute the An alternative |
Yes, that could be better. The problem with just averaging the results as in your first suggestion is that it only works for means. medians for example would not work. |
Right. I'll try to rework the |
This doesn't look right:
Created on 2022-01-12 by the reprex package (v2.0.1)
The second table should be the average of the results by model in the first table.
The text was updated successfully, but these errors were encountered: