From: Benjamin Auder Date: Thu, 6 Apr 2017 21:47:33 +0000 (+0200) Subject: save current state X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/css/user/pieces/current/git-favicon.png?a=commitdiff_plain;h=c1be989885d1e402569d55a34aef01b57d6aea1c;p=talweg.git save current state --- diff --git a/pkg/R/Data.R b/pkg/R/Data.R index 53a8d5b..610c0c4 100644 --- a/pkg/R/Data.R +++ b/pkg/R/Data.R @@ -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) diff --git a/pkg/R/computeForecast.R b/pkg/R/computeForecast.R index 35372b3..53dbc14 100644 --- a/pkg/R/computeForecast.R +++ b/pkg/R/computeForecast.R @@ -38,14 +38,12 @@ #' 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 #' }} diff --git a/pkg/R/getData.R b/pkg/R/getData.R index b095d01..4e2e3fd 100644 --- a/pkg/R/getData.R +++ b/pkg/R/getData.R @@ -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