horizon = as.integer(horizon)[1]
if (horizon<=0 || horizon>length(data$getCenteredSerie(2)))
stop("Horizon too short or too long")
- indices = as.integer(indices)
+ indices = sapply( seq_along(indices), function(i) dateIndexToInteger(indices[i], data) )
if (any(indices<=0 | indices>data$getSize()))
stop("Indices out of range")
indices = sapply(indices, dateIndexToInteger, data)
pred = list()
for (today in indices)
{
- #NOTE: To estimate timing...
-# print(paste("Predict until index",today))
-
#shape always predicted first (on centered series, no scaling taken into account),
#with side-effect: optimize some parameters (h, weights, ...)
predicted_shape = shape_forecaster$predict(today, memory, horizon, ...)
#TODO: this way is faster than a call to append(); why ?
pred[[length(pred)+1]] = list(
# Predict shape and align it on end of current day
- serie = predicted_shape + tail( data$getSerie(today), 1 ) - predicted_shape[1],
+ serie = predicted_shape + tail( data$getSerie(today), 1 ) - predicted_shape[1] +
predicted_delta, #add predicted jump
params = shape_forecaster$getParameters(),
index = today )