makeBmrsExtraction: Compute and extract relevant information from a batch of...

Description Usage Arguments Value Author(s) Examples

View source: R/makeBmrsExtraction.R

Description

Compute and extract relevant information from a batch of benchmark experiments. This extraction can then be used to produce various plots.

Usage

1
makeBmrsExtraction(benchmarkResult, tasks, tasks_sids, as.df = TRUE)

Arguments

benchmarkResult

an object of class mlr::benchmark() produced by agrometeoR::makeBrmsBatch

tasks

a list which elements are of class mlr::makeRegrTask(). These tasks must be the same that were passed to makeBmrsBatch

tasks_sids

a list which elements are integer vectors containing the sids of the used stations of each task. This list is provided as an output element of the agrometeoR::makeTaks() function.

as.df

a boolean specifying if the result must be returned as a single dataframe rather than list of lists. Default is TRUE

Value

A 2 elements named list

Author(s)

Thomas Goossens

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
47
48
49
50
## Not run: 
# load magrittr for pipe use : %>%
library(magrittr)

# create the dataset
myDataset = makeDataset(
  dfrom = "2017-03-04T15:00:00Z",
  dto = "2017-03-04T18:00:00Z",
  sensor = "tsa")

# extract the list of hourly sets of records
myDataset = myDataset$output$value

# create the tasks
myTasks = purrr::map(myDataset, makeTask, target = "tsa")

# extract the used sids of each task from the outputs
myUsedSids = myTasks %>% purrr::modify_depth(1, ~.$output$stations$used)

# extract the tasks from the outputs
myTasks = myTasks %>% purrr::modify_depth(1, ~.$output$value$task)

# Conduct a batch of benchmarks experiments without saving temp files
myBmrsBatch = makeBmrsBatch(
tasks = myTasks,
learners = agrometeorLearners,
measures = list(mlr::rmse),
keep.pred = TRUE,
models = FALSE,
groupSize  = NULL,
level = "mlr.benchmark",
resamplings = "LOO",
cpus = 1,
prefix = NULL,
temp_dir = NULL,
removeTemp = FALSE)

# Keep the relevant information
myBmrsBatch = myBmrsBatch$output$value

# Get the extraction from myBmrsBatch
myBmrsExtraction = makeBmrsExtraction(myBmrsBatch, myTasks, myUsedSids, as.df = TRUE)

# Keeping the relevant information
myBmrsExtraction = myBmrsExtraction$output$value

# Get an excerpt of the output
head(myBmrsExtraction)

## End(Not run)

pokyah/agrometeoR documentation built on May 26, 2019, 7 p.m.