#'
#' @section Methods:
#' \describe{
-#' \item{\code{initialize(data, pjump)}}{
-#' Initialize a Forecaster object with a Data object and a jump prediction function,
-#' or NULL if \code{predictShape()} returns an adjusted curve.}
+#' \item{\code{initialize(pjump)}}{
+#' Initialize a Forecaster object with a jump prediction function.}
#' \item{\code{predictSerie(data,today,memory,predict_from,horizon,...)}}{
#' Predict the next curve (at index today) from predict_from to horizon (hours), using
#' \code{memory} days in the past.}
if (is.na(predicted_shape))
return (NA)
- predicted_delta <-
- if (is.null(private$.pjump))
- NULL
- else
- private$.pjump(data,today,memory,predict_from,horizon,private$.params,...)
+ predicted_delta <- private$.pjump(data, today, memory, predict_from,
+ horizon, private$.params, first_pred=predicted_shape[1], ...)
- # Predicted shape is aligned on the end of current day + jump (if jump!=NULL)
+ # Predicted shape is aligned on the end of current day + jump
c( data$getSerie(today)[if (predict_from>=2) 1:(predict_from-1) else c()],
- predicted_shape + ifelse( is.null(private$.pjump),
- 0,
- predicted_delta - predicted_shape[1] +
- ifelse(predict_from>=2,
- data$getSerie(today)[predict_from-1], tail(data$getSerie(today-1),1)) ) )
+ (predicted_shape - predicted_shape[1]) + #shape with first_pred = 0
+ ifelse(predict_from>=2, #last observed value
+ data$getSerie(today)[predict_from-1], tail(data$getSerie(today-1),1)) +
+ predicted_delta ) #jump
},
predictShape = function(data, today, memory, predict_from, horizon, ...)
NULL #empty default implementation: to implement in inherited classes