getStdHorizon = function()
24 - as.POSIXlt( private$.data[[1]]$time[1] )$hour + 1
,
- append = function(time, exo_hat)
- private$.data[[length(private$.data)+1]] <- list("time"=time,"exo_hat"=exo_hat)
- ,
- append = function(time, serie, exo)
+ append = function(time, serie, exo, exo_hat)
{
- index <- length(private$.data)
level = mean(serie, na.rm=TRUE)
centered_serie = serie - level
- private$.data[[index]]$time <- time
- private$.data[[index]]$centered_serie <- centered_serie
- private$.data[[index]]$level <- level
- private$.data[[index]]$exo <- exo
+ private$.data[[length(private$.data)+1]] <- list(
+ "time"=time, #H-24 --> H-1
+ "centered_serie"=centered_serie, #at 'time'
+ "level"=level, #at 'time'
+ "exo"=exo, #at 'time' (yersteday 0am to last midnight)
+ "exo_hat"=exo_hat) #today 0am to next midnight
},
getTime = function(index)
{
#' memory=500, horizon=12, ncores=1)
#' \dontrun{#Sketch for real-time mode:
#' data <- Data$new()
-#' # Initialize: first day has no predictions attached
-#' data$initialize()
#' forecaster <- MyForecaster$new(myJumpPredictFunc)
#' repeat {
#' # In the morning 7am+ or afternoon 1pm+:
}
exo = as.data.frame( exo_df[i,2:(1+nb_exos)] )
- exo_hat = as.data.frame( exo_df[i,(1+nb_exos+1):(1+2*nb_exos)] )
+ exo_hat =
+ if (i < nrow(exo_df))
+ as.data.frame( exo_df[i+1,(1+nb_exos+1):(1+2*nb_exos)] )
+ else
+ NA #exogenous prediction for next day are useless on last day
data$append(time, serie, exo, exo_hat)
if (i >= limit)
break