X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=pkg%2FR%2FForecaster.R;h=2955479007e57eb5b4a63f7d520631e651a7d0bd;hb=af3b84f4cacade7d83221ca0249b546c50ddf340;hp=2bd2e4ea0a4dae7ed32b4f695d1a17ae425e39ac;hpb=a66a84b56467194852f2faee15f4725759b24158;p=talweg.git diff --git a/pkg/R/Forecaster.R b/pkg/R/Forecaster.R index 2bd2e4e..2955479 100644 --- a/pkg/R/Forecaster.R +++ b/pkg/R/Forecaster.R @@ -13,13 +13,13 @@ #' \item{\code{initialize(data, pjump)}} #' {Initialize a Forecaster object with a Data object and a jump prediction function.} #' \item{\code{predictSerie(today,memory,horizon,...)}} -#' {Predict a new serie of \code{horizon} values at day index \code{today} using \code{memory} -#' days in the past.} +#' {Predict a new serie of \code{horizon} values at day index \code{today} +#' using \code{memory} days in the past.} #' \item{\code{predictShape(today,memory,horizon,...)}} -#' {Predict a new shape of \code{horizon} values at day index \code{today} using \code{memory} -#' days in the past.} +#' {Predict a new shape of \code{horizon} values at day index \code{today} +#' using \code{memory} days in the past.} #' \item{\code{getParameters()}} -#' {Return (internal) parameters.} } +#' {Return (internal) parameters.}} Forecaster = R6::R6Class("Forecaster", private = list( .params = list(), @@ -36,13 +36,15 @@ Forecaster = R6::R6Class("Forecaster", predictSerie = function(today, memory, horizon, ...) { # Parameters (potentially) computed during shape prediction stage - predicted_shape = o$predictShape(today, memory, horizon, ...) - predicted_delta = private$.pjump(private$.data,today,memory,horizon,private$.params,...) + predicted_shape = self$predictShape(today, memory, horizon, ...) + predicted_delta = private$.pjump( + private$.data, today, memory, horizon, private$.params, ...) # Predicted shape is aligned it on the end of current day + jump - predicted_shape+tail(private$.data$getSerie(today),1)-predicted_shape[1]+predicted_delta + predicted_shape + tail(private$.data$getSerie(today),1) - + predicted_shape[1] + predicted_delta }, predictShape = function(today, memory, horizon, ...) - #empty default implementation: to implement in inherited classes + NULL #empty default implementation: to implement in inherited classes , getParameters = function() private$.params