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

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

df = data.frame(tasks = factor(rep(c("A", "B"), each = 5), levels = c("A", "B")), learners = factor(paste0("L", 1:5)), RMSE = runif(10), MAE = runif(10)) as.BenchmarkAggr(df, task_id = "tasks", learner_id = "learners")
#> <BenchmarkAggr> of 10 rows with 2 tasks, 5 learners and 2 measures #> tasks learners RMSE MAE #> 1: A L1 0.1218646 0.62292278 #> 2: A L2 0.3188480 0.46074751 #> 3: A L3 0.6230610 0.16341228 #> 4: A L4 0.4469974 0.51386686 #> 5: A L5 0.7082934 0.14326644 #> 6: B L1 0.8900290 0.65029870 #> 7: B L2 0.1043065 0.15529453 #> 8: B L3 0.6304117 0.50830986 #> 9: B L4 0.8415589 0.08587044 #> 10: B L5 0.3642624 0.50302666
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")) }
#> <BenchmarkAggr> of 4 rows with 2 tasks, 2 learners and 1 measure #> task_id learner_id rmse #> 1: boston_housing featureless 9.284509 #> 2: boston_housing rpart 1.710210 #> 3: mtcars featureless 5.973315 #> 4: mtcars rpart 5.973315