benchmark: Benchmarking a time series prediction process

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/tspred.r

Description

benchmark is a generic function for benchmarking results based on particular metrics. The function invokes particular methods which depend on the class of the first argument.

Usage

1
2
3
4
benchmark(obj, ...)

## S3 method for class 'tspred'
benchmark(obj, bmrk_objs, rank.by = c("MSE"), ...)

Arguments

obj

An object of class tspred defining a particular time series prediction process.

...

Ignored

bmrk_objs

A list of objects of class tspred to be compared against obj.

rank.by

A vector of the given names of the metrics that should base the ranking.

Details

The function benchmark.tspred benchmarks a time series prediction process defined by a tspred object based on a particular metric. The metrics resulting from its execution are compared against the ones produced by other time series prediction processes (defined in a list of tspred objects).

Value

A list containing:

rank

A data.frame with the ranking of metrics computed for the benchmarked tspred objects.

ranked_tspred_objs

A list of the benchmarked tspred objects ordered according to the produced rank.

Author(s)

Rebecca Pontes Salles

See Also

[tspred()] for defining a particular time series prediction process.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#Obtaining objects of the processing class
proc1 <- subsetting(test_len=20)
proc2 <- BoxCoxT(lambda=NULL)
proc3 <- WT(level=1, filter="bl14")

#Obtaining objects of the modeling class
modl1 <- ARIMA()

#Obtaining objects of the evaluating class
eval1 <- MSE_eval()
eval2 <- MAPE_eval()

#Defining a time series prediction process
tspred_1 <- tspred(subsetting=proc1,
                   processing=list(BCT=proc2,
                                   WT=proc3),
                   modeling=modl1,
                   evaluating=list(MSE=eval1,
                                   MAPE=eval2)
                  )
summary(tspred_1)

#Obtaining objects of the processing class
proc4 <- SW(window_len = 6)
proc5 <- MinMax()

#Obtaining objects of the modeling class
modl2 <- NNET(size=5,sw=proc4,proc=list(MM=proc5))

#Defining a time series prediction process
tspred_2 <- tspred(subsetting=proc1,
                   processing=list(BCT=proc2,
                                   WT=proc3),
                   modeling=modl2,
                   evaluating=list(MSE=eval1,
                                   MAPE=eval2)
                  )
summary(tspred_2)

data("CATS")
data <- CATS[3]

tspred_1_run <- workflow(tspred_1,data=data,prep_test=TRUE,onestep=TRUE)
tspred_2_run <- workflow(tspred_2,data=data,prep_test=TRUE,onestep=TRUE)

b <- benchmark(tspred_1_run,list(tspred_2_run),rank.by=c("MSE"))

RebeccaSalles/TSPred documentation built on April 6, 2021, 2:44 a.m.