Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as_result_data

Convert to ResultData


Description

This function allows to construct or convert to a ResultData object, the result container used by ResampleResult and BenchmarkResult. A ResampleResult or BenchmarkResult can be initialized with the returned object. Note that ResampleResults can be converted to a BenchmarkResult with as_benchmark_result() and multiple BenchmarkResults can be combined to a larger BenchmarkResult with the $combine() method of BenchmarkResult.

Usage

as_result_data(
  task,
  learners,
  resampling,
  iterations,
  predictions,
  learner_states = NULL,
  store_backends = TRUE
)

Arguments

task

(Task).

learners

(list of trained Learners).

resampling

(Resampling).

iterations

(integer()).

predictions

(list of Predictions).

learner_states

(list())
Learner states. If not provided, the states of learners are automatically extracted.

store_backends

(logical(1))
If set to FALSE, the backends of the Tasks provided in data are removed.

Value

ResultData object which can be passed to the constructor of ResampleResult.

Examples

task = tsk("penguins")
learner = lrn("classif.rpart")
resampling = rsmp("cv", folds = 2)$instantiate(task)
iterations = seq_len(resampling$iters)

# manually train two learners.
# store learners and predictions
learners = list()
predictions = list()
for (i in iterations) {
  l = learner$clone(deep = TRUE)
  learners[[i]] = l$train(task, row_ids = resampling$train_set(i))
  predictions[[i]] = l$predict(task, row_ids = resampling$test_set(i))
}

rdata = as_result_data(task, learners, resampling, iterations, predictions)
ResampleResult$new(rdata)

mlr3

Machine Learning in R - Next Generation

v0.11.0
LGPL-3
Authors
Michel Lang [cre, aut] (<https://orcid.org/0000-0001-9754-0393>), Bernd Bischl [aut] (<https://orcid.org/0000-0001-6002-6980>), Jakob Richter [aut] (<https://orcid.org/0000-0003-4481-5554>), Patrick Schratz [aut] (<https://orcid.org/0000-0003-0748-6624>), Giuseppe Casalicchio [ctb] (<https://orcid.org/0000-0001-5324-5966>), Stefan Coors [ctb] (<https://orcid.org/0000-0002-7465-2146>), Quay Au [ctb] (<https://orcid.org/0000-0002-5252-8902>), Martin Binder [aut], Marc Becker [ctb] (<https://orcid.org/0000-0002-8115-0400>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.