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

resample$score(predict_sets = 'test') gives same output as resample$score(predict_sets = 'train'). Also, is there any functionality where results from both train and test can be accessed? #951

Open
mermast opened this issue Jul 24, 2023 · 1 comment

Comments

@mermast
Copy link

mermast commented Jul 24, 2023

Description

In both the situations, i think it just outputs test results ...

Reproducible example

tasks = tsks(c("german_credit", "sonar"))
learners = lrns(c("classif.rpart", "classif.ranger","classif.featureless"), predict_type = "prob")
rsmp_cv5 = rsmp("cv", folds = 5)
set.seed(1234)
design = benchmark_grid(tasks, learners, rsmp_cv5)
bmr = benchmark(design)
bmr$score(predict_sets = 'train')
bmr$score(predict_sets = 'test')

@be-marc
Copy link
Member

be-marc commented Jul 25, 2023

It looks like you found two bugs at once. The following code works.

library(mlr3)
library(mlr3learners)
set.seed(1234)

tasks = tsks(c("german_credit", "sonar"))
learners = lrns(c("classif.rpart", "classif.ranger","classif.featureless"), predict_type = "prob")

mlr3misc::walk(learners, function(learner) learner$predict_sets = c("train", "test"))

rsmp_cv5 = rsmp("cv", folds = 5)
design = benchmark_grid(tasks, learners, rsmp_cv5)
bmr = benchmark(design)
measures = list(
  msr("classif.ce", id = "ce.train", predict_sets = "train"),
  msr("classif.ce", id = "ce.test", predict_sets = "test"))

bmr$score(measures)

(1) You have to set the predict sets in the learners (Line 8). We should throw an error if the measure requests an non-existent predict set. (2) The predict_sets argument seems not to work in $score(). You have to define the measures like in the example above (Line 13-15).

Thanks for your comment!

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

2 participants