1 #' @include ShapeForecaster.R
3 #' @title Average Shape Forecaster
5 #' @description Return the (pointwise) average of the all the (similar) centered day curves
6 #' in the past. Inherits \code{\link{ShapeForecaster}}
7 AverageShapeForecaster = setRefClass(
8 Class = "AverageShapeForecaster",
9 contains = "ShapeForecaster",
12 initialize = function(...)
16 predict = 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)