save current state
authorBenjamin Auder <benjamin.auder@somewhere>
Thu, 6 Apr 2017 21:47:33 +0000 (23:47 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Thu, 6 Apr 2017 21:47:33 +0000 (23:47 +0200)
pkg/R/Data.R
pkg/R/computeForecast.R
pkg/R/getData.R

index 53a8d5b..610c0c4 100644 (file)
@@ -57,7 +57,7 @@ Data = R6::R6Class("Data",
                getStdHorizon = function()
                        24 - as.POSIXlt( private$.data[[1]]$time[1] )$hour + 1
                ,
-               appendHat = function(time, exo_hat)
+               append = function(time, exo_hat)
                        private$.data[[length(private$.data)+1]] <- list("time"=time,"exo_hat"=exo_hat)
                ,
                append = function(time, serie, exo)
index 35372b3..53dbc14 100644 (file)
 #' data$initialize()
 #' forecaster <- MyForecaster$new(myJumpPredictFunc)
 #' repeat {
-#'   # During the night between days j and j+1:
-#'   data$appendExoHat(exogenous_predictions)
 #'   # In the morning 7am+ or afternoon 1pm+:
-#'   data$setMeasures(
-#'     data$getSize()-1,
+#'   data$append(
 #'     times_from_H+1_yersteday_to_Hnow,
 #'     PM10_values_of_last_24h,
-#'     exogenous_measures_for_yersteday)
+#'     exogenous_measures_of_last_24h,
+#'     exogenous_predictions_for_next_24h)
 #'   pred <- forecaster$predictSerie(data, data$getSize()-1, ...)
 #'   #do_something_with_pred
 #' }}
index b095d01..4e2e3fd 100644 (file)
@@ -85,10 +85,9 @@ getData = function(ts_data, exo_data, input_tz="GMT", date_format="%d/%m/%Y %H:%
                        }
                }
 
-               hat_exo = as.data.frame( exo_df[i,(1+nb_exos+1):(1+2*nb_exos)] )
                exo = as.data.frame( exo_df[i,2:(1+nb_exos)] )
-               data$appendHat(time, hat_exo)
-               data$append(serie, exo) #in realtime, this call comes hours later
+               exo_hat = as.data.frame( exo_df[i,(1+nb_exos+1):(1+2*nb_exos)] )
+               data$append(time, serie, exo, exo_hat)
                if (i >= limit)
                        break
                i = i + 1