Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResampleResult and BenchmarkResult's $score() behave surprisingly when passing a predict_set #1006

Open
sebffischer opened this issue Feb 16, 2024 · 0 comments

Comments

@sebffischer
Copy link
Sponsor Member

sebffischer commented Feb 16, 2024

Example for the Benchmark Result is given below. In both cases, the argument predict_set is just not taken into account when scoring the measures. The problem are these lines:

Also, the $aggregate() method of both classes is missing the predict_set argument.

library(mlr3)
learner = lrn("regr.debug")
learner$predict_sets = c("test", "holdout")
task = tsk("mtcars")
row = task$data(1)
row$..row_id = 1000
row$mpg = 10000000
task$rbind(row)
task$set_row_roles(1000, "holdout")
bmr = benchmark(benchmark_grid(task, learner, rsmp("holdout")))
#> INFO  [11:11:10.706] [mlr3] Running benchmark with 1 resampling iterations
#> INFO  [11:11:10.740] [mlr3] Applying learner 'regr.debug' on task 'mtcars' (iter 1/1)
#> INFO  [11:11:10.753] [mlr3] Finished benchmark

score = bmr$score(msr("regr.mse"), predict_sets = "holdout")
(score$prediction[[1]]$truth - score$prediction[[1]]$response)^2
#> [1] 9.999962e+13
score$regr.mse
#> [1] 53.05924

Created on 2024-02-16 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant