Initial commit
[talweg.git] / R / ShapeForecaster.R
1 #' @title Shape Forecaster
2 #'
3 #' @description Generic class to represent a shape forecaster
4 #'
5 #' @field params List of computed parameters, potentially useful for some DeltaForecasters
6 #' @field data Dataset, object of class Data
7 ShapeForecaster = setRefClass(
8 Class = "ShapeForecaster",
9
10 fields = list(
11 params = "list",
12 data = "Data"
13 ),
14
15 methods = list(
16 initialize = function(...)
17 {
18 "Initialize (generic) ShapeForecaster object"
19
20 callSuper(...)
21 if (!hasArg(data))
22 stop("ShapeForecaster must be initialized with a Data object")
23 params <<- list()
24 },
25 predict = function(today, memory, horizon, ...)
26 {
27 "Obtain a new forecasted time-serie (+ side-effect: compute parameters)"
28
29 #empty default implementation: to implement in inherited classes
30 },
31 getParameters = function()
32 {
33 params
34 }
35 )
36 )
37