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

autoplot not producing different plots when imputted with different predict_sets #124

Open
jpconnel opened this issue Aug 15, 2023 · 1 comment

Comments

@jpconnel
Copy link

jpconnel commented Aug 15, 2023

Description

predict_sets parameter in 'autoplot' for type = 'roc' seems to change nothing in the resulting plots

Reproducible example

task = tsks("german_credit")
learner = lrns("classif.ranger", predict_type = "prob")
learner$classif.ranger$predict_sets <- c("test", "train")
rsmp_cv5 = rsmp("cv", folds = 5)
set.seed(1234)
res = resample(task = task[[1]], learner = learner[[1]], resampling =rsmp_cv5)
autoplot(res, type = 'roc', predict_sets = c("train", "test"))
autoplot(res, type = 'roc', predict_sets = "train")
autoplot(res, type = 'roc', predict_sets = "test")
@jpconnel jpconnel changed the title autoplot not producing different plots when imputted with different predict_setes autoplot not producing different plots when imputted with different predict_sets Aug 15, 2023
@bblodfon
Copy link
Contributor

bblodfon commented Jul 2, 2024

Hi @jpconnel,

Sorry for the late reply!

Please check the corresponding documentation page => https://mlr3viz.mlr-org.com/reference/autoplot.ResampleResult.html. This only works with 2 features and type = "prediction". type = 'roc' is not different no matter what is the predict_sets.

library(mlr3)
library(mlr3learners)
library(mlr3viz)
task = tsk("german_credit")
task$select(cols = c("savings", "age"))

learner = lrn("classif.ranger", predict_type = "prob", predict_sets = c("test", "train"))
cv = rsmp("cv", folds = 5)
res = resample(task = task, learner = learner, resampling = cv, store_models = TRUE)
#> INFO  [15:03:25.252] [mlr3] Applying learner 'classif.ranger' on task 'german_credit' (iter 1/5)
#> INFO  [15:03:26.722] [mlr3] Applying learner 'classif.ranger' on task 'german_credit' (iter 2/5)
#> INFO  [15:03:26.915] [mlr3] Applying learner 'classif.ranger' on task 'german_credit' (iter 3/5)
#> INFO  [15:03:27.096] [mlr3] Applying learner 'classif.ranger' on task 'german_credit' (iter 4/5)
#> INFO  [15:03:27.281] [mlr3] Applying learner 'classif.ranger' on task 'german_credit' (iter 5/5)

autoplot(res, type = 'prediction', predict_sets = c("train", "test"))

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

@be-marc maybe adding predict_sets in type = roc or pr is a good idea?

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

No branches or pull requests

2 participants