mlr-org / mlr3

mlr3: Machine Learning in R - next generation
https://mlr3.mlr-org.com
GNU Lesser General Public License v3.0
914 stars 84 forks source link

get column names used to train a learner? #988

Closed tdhock closed 6 months ago

tdhock commented 6 months ago

Hi! First of all thanks for maintaining mlr3, which I find very useful. I see in recent NEWS.md https://github.com/mlr-org/mlr3/commit/410ec0346a10de63c8963bb30852ee03e59282df#diff-51920e95310ebfbc1ae31709f3b95f89afffbf4f1a6e38e8b2b406e2fb6197ea "Remove data_prototype when resampling from learner$state to reduce memory consumption." I was using data_prototype in a vignette, to determine what were the column names of the data used to train. Now the vignette is failing to build, https://cloud.r-project.org/web/checks/check_results_mlr3resampling.html Is there a recommended way to determine, given a learner that has been trained, what are the column names that were used for training, using the new code? Thanks!

be-marc commented 6 months ago

Hey, yes there is $feature_names in the state now.

rr = resample(tsk("pima"), lrn("classif.rpart"), rsmp("cv", folds = 3))
rr$learners[[1]]$state$feature_names
tdhock commented 6 months ago

thanks