This function is deprecated, use as_benchmark_aggr()
instead.
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
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_benchmark_aggr(df, task_id = "tasks", learner_id = "learners")
#> <BenchmarkAggr> of 10 rows with 2 tasks, 5 learners and 2 measures
#> tasks learners RMSE MAE
#> <fctr> <fctr> <num> <num>
#> 1: A L1 0.1984796 0.44511240
#> 2: A L2 0.4228439 0.16196023
#> 3: A L3 0.6494104 0.02696872
#> 4: A L4 0.8222587 0.91355865
#> 5: A L5 0.1681709 0.43668684
#> 6: B L1 0.3882928 0.26201793
#> 7: B L2 0.7472869 0.23902632
#> 8: B L3 0.7401535 0.10515652
#> 9: B L4 0.9602859 0.73188853
#> 10: B L5 0.8858848 0.28259907
if (requireNamespaces(c("mlr3", "rpart"))) {
library(mlr3)
task = tsks(c("pima", "spam"))
learns = lrns(c("classif.featureless", "classif.rpart"))
bm = benchmark(benchmark_grid(task, learns, rsmp("cv", folds = 2)))
# default measure
as_benchmark_aggr(bm)
# change measure
as_benchmark_aggr(bm, measures = msr("classif.acc"))
}
#> <BenchmarkAggr> of 4 rows with 2 tasks, 2 learners and 1 measure
#> task_id learner_id acc
#> <fctr> <fctr> <num>
#> 1: pima featureless 0.6510417
#> 2: pima rpart 0.7565104
#> 3: spam featureless 0.6059558
#> 4: spam rpart 0.8882842