X-Git-Url: https://git.auder.net/?p=talweg.git;a=blobdiff_plain;f=pkg%2FR%2FcomputeError.R;h=0b1771f2e1769b16603c9837291f5b916facf881;hp=3aa028fb88282b41a4f55b92545f1de030e8dd94;hb=d2ab47a744d8fb29c03a76a7ca2368dae53f9a57;hpb=4d376294a6286ca1548d978055731dac175ffa3a diff --git a/pkg/R/computeError.R b/pkg/R/computeError.R index 3aa028f..0b1771f 100644 --- a/pkg/R/computeError.R +++ b/pkg/R/computeError.R @@ -13,7 +13,7 @@ #' step, averaged on the L forecasting days. #' #' @export -computeError = function(data, pred, horizon=data$getStdHorizon()) +computeError = function(data, pred, predict_from, horizon=length(data$getSerie(1))) { L = pred$getSize() mape_day = rep(0, horizon) @@ -25,8 +25,8 @@ computeError = function(data, pred, horizon=data$getStdHorizon()) for (i in seq_len(L)) { index = pred$getIndexInData(i) - serie = data$getSerie(index+1)[1:horizon] - forecast = pred$getForecast(i)[1:horizon] + serie = data$getSerie(index)[predict_from:horizon] + forecast = pred$getForecast(i)[predict_from:horizon] if (!any(is.na(serie)) && !any(is.na(forecast))) { nb_no_NA_data = nb_no_NA_data + 1