X-Git-Url: https://git.auder.net/?p=talweg.git;a=blobdiff_plain;f=pkg%2FR%2FcomputeForecast.R;fp=pkg%2FR%2FcomputeForecast.R;h=082ba80d7887ea81914f47eadcf68a45e7c9c8e7;hp=e1b29b6b9c9a800e946031f663589937963e1cdf;hb=8f5671db610e1e455b33b54986ac2e57de0da0d7;hpb=97b03431891a14666e7c481523f63d46b9ccee03 diff --git a/pkg/R/computeForecast.R b/pkg/R/computeForecast.R index e1b29b6..082ba80 100644 --- a/pkg/R/computeForecast.R +++ b/pkg/R/computeForecast.R @@ -19,10 +19,9 @@ #' \itemize{ #' \item Persistence : use last (similar) day #' \item Neighbors: re-use the weights from F_Neighbors -#' \item Zero: just output 0 (no adjustment) +#' \item LastValue: start serie with last observed value +#' \item Zero: no adjustment => use shape prediction only #' } -#' If pjump=NULL, then no adjustment is performed (output of \code{predictShape()} is -#' used directly). #' @param predict_from First time step to predict. #' @param memory Data depth (in days) to be used for prediction. #' @param horizon Last time step to predict. @@ -36,7 +35,7 @@ #' ts_data <- system.file("extdata","pm10_mesures_H_loc.csv",package="talweg") #' exo_data <- system.file("extdata","meteo_extra_noNAs.csv",package="talweg") #' data <- getData(ts_data, exo_data, limit=200) -#' pred <- computeForecast(data, 100:130, "Persistence", "Zero", +#' pred <- computeForecast(data, 100:130, "Persistence", "LastValue", #' predict_from=8, memory=50, horizon=12, ncores=1) #' \dontrun{ #' #Sketch for real-time mode: @@ -77,15 +76,14 @@ computeForecast = function(data, indices, forecaster, pjump, predict_from, stop("Indices out of range") if (!is.character(forecaster)) stop("forecaster (name): character") - if (!is.null(pjump) && !is.character(pjump)) - stop("pjump (function): character or NULL") + if (!is.character(pjump)) + stop("pjump (function): character") pred = Forecast$new( sapply(indices, function(i) integerIndexToDate(i,data)) ) forecaster_class_name = getFromNamespace( paste(forecaster,"Forecaster",sep=""), "talweg") - if (!is.null(pjump)) - pjump <- getFromNamespace(paste("get",pjump,"JumpPredict",sep=""), "talweg") + pjump <- getFromNamespace(paste("get",pjump,"JumpPredict",sep=""), "talweg") forecaster = forecaster_class_name$new(pjump) computeOneForecast <- function(i)