1 #' @include Forecaster.R
3 #' @title Average Forecaster
5 #' @description Return the (pointwise) average of the all the (similar) centered day curves
6 #' in the past. Inherits \code{\link{Forecaster}}
7 AverageForecaster = setRefClass(
8 Class = "AverageForecaster",
9 contains = "Forecaster",
12 initialize = function(...)
16 predictShape = function(today, memory, horizon, ...)
18 avg = rep(0., horizon)
19 first_day = max(1, today-memory)
25 serie_on_horizon = data$getCenteredSerie(index)[1:horizon]
28 if (!any(is.na(serie_on_horizon)))
30 avg = avg + serie_on_horizon
31 nb_no_na_series = nb_no_na_series + 1
33 if (index < first_day)