X-Git-Url: https://git.auder.net/images/pieces/%22%20%20V.getPpath%28board%5Bi%5D%5Bj%5D%29%20%20%20%22.svg?a=blobdiff_plain;f=talweg%2FR%2FForecaster.R;fp=talweg%2FR%2FForecaster.R;h=0000000000000000000000000000000000000000;hb=ff5df8e310b73883565761ab4b1aa5a0672e9f27;hp=da8579b7312bfcc520d8e2a8504202bb68ff2cbd;hpb=63ff1ecbd80adfe347faa0d954f526d15f033c22;p=talweg.git diff --git a/talweg/R/Forecaster.R b/talweg/R/Forecaster.R deleted file mode 100644 index da8579b..0000000 --- a/talweg/R/Forecaster.R +++ /dev/null @@ -1,48 +0,0 @@ -#' Forecaster -#' -#' Forecaster (abstract class, implemented by all forecasters) -#' -#' @docType class -#' @importFrom R6 R6Class -#' -#' @field .params List of computed parameters, for post-run analysis (dev) -#' @field .pjump Function: how to predict the jump at day interface ? -#' -#' @section Methods: -#' \describe{ -#' \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.} -#' \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.} -#' \item{\code{getParameters()}}{ -#' Return (internal) parameters.}} -Forecaster = R6::R6Class("Forecaster", - private = list( - .params = list(), - .pjump = NULL - ), - public = list( - initialize = function(pjump) - { - private$.pjump <- pjump - invisible(self) - }, - predictSerie = function(data, today, memory, horizon, ...) - { - # Parameters (potentially) computed during shape prediction stage - predicted_shape = self$predictShape(data, today, memory, horizon, ...) - predicted_delta = private$.pjump(data,today,memory,horizon,private$.params,...) - # Predicted shape is aligned it on the end of current day + jump - predicted_shape+tail(data$getSerie(today),1)-predicted_shape[1]+predicted_delta - }, - predictShape = function(data, today, memory, horizon, ...) - NULL #empty default implementation: to implement in inherited classes - , - getParameters = function() - private$.params - ) -)