mlr3benchmark (version 0.1.1)

as.BenchmarkAggr: Coercions to BenchmarkAggr

Description

Coercion methods to BenchmarkAggr. For mlr3::BenchmarkResult this is a simple wrapper around the BenchmarkAggr constructor called with mlr3::BenchmarkResult$aggregate().

Usage

as.BenchmarkAggr(
  obj,
  task_id = "task_id",
  learner_id = "learner_id",
  independent = TRUE,
  strip_prefix = TRUE,
  ...
)

Arguments

obj

(mlr3::BenchmarkResult|matrix(1)) Passed to BenchmarkAggr$new().

task_id, learner_id, independent, strip_prefix

See BenchmarkAggr$initialize().

...

ANY Passed to mlr3::BenchmarkResult$aggregate().

Examples

Run this code
# NOT RUN {
df = data.frame(tasks = rep(c("A", "B"), each = 5),
                learners = paste0("L", 1:5),
                RMSE = runif(10), MAE = runif(10))

as.BenchmarkAggr(df, task_id = "tasks", learner_id = "learners")


if (requireNamespaces(c("mlr3", "rpart"))) {
  library(mlr3)
  task = tsks(c("boston_housing", "mtcars"))
  learns = lrns(c("regr.featureless", "regr.rpart"))
  bm = benchmark(benchmark_grid(task, learns, rsmp("cv", folds = 2)))

  # default measure
  as.BenchmarkAggr(bm)

  # change measure
  as.BenchmarkAggr(bm, measures = msr("regr.rmse"))
}

# }

Run the code above in your browser using DataLab