-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Feature Request: Out-Of-Bag Error should not require storing the model. #1158
Comments
We could solve this with callbacks. library(mlr3learners)
task = tsk("pima")
learner = lrn("classif.ranger")
resampling = rsmp("cv", folds = 3)
callback = clbk("mlr3.score_measures", measures = msr("oob_error"))
rr = resample(task, learner, resampling = resampling, store_models = FALSE, callbacks = callback)
rr$data_extra
# [[1]]
# [[1]]$score_measures
# oob_error
# 0.2597656
# [[2]]
# [[2]]$score_measures
# oob_error
# 0.2402344
# [[3]]
# [[3]]$score_measures
# oob_error
# 0.2480469
# aggregate
mean(mlr3misc::map_dbl(rr$data_extra, function(x) {
x$score_measures["oob_error"]
})) |
this does not allow for tuning i assume? |
Yes, it would be cool if |
@berndbischl decided that the output of a callback is an end point. So |
but we use the oob error tuning example in the book so we need to fix this |
in "Predict Sets, Validation and Internal Tuning"? |
yes |
It is currently necessary to store the
$model
of a learner in order to access itsoob_error
.An example for this is the random forest:
The code below will err if we don't specify
store_models = TRUE
because the out-of-bag error active binding extracts this information fromlearner$model
, which will fail of the model is not stored.Instead of making the out-of-bag error active binding access the learner's
$model
, we can instead support the private function$.extract_oob_error()
which will add the out-of-bag error score to the learner's$state
, which is even accessible whenstore_models = FALSE
.This is already implemented for internal validation scores and internal tuned values:
mlr3/R/worker.R
Lines 94 to 100 in 5ffcfee
The text was updated successfully, but these errors were encountered: