MLR3 model includes a lot of redundant data not needed when applying the model. The traditional R approach is to save all the data used for model training. It leads to the growth of used memory. What leads to the growth of used memory. In the traditional R model, it usually can be fixed easily by just assigning NULL to redundant fields. But it is not so clear for mlr3.
Asked
Active
Viewed 49 times
1
-
I think the close vote is not warranted here. The question is clear and it is possible to answer it here with code. In fact it would be great if there was a method to strip the model object from anything that is not needed for prediction. @Taras Hishchak perhaps add a little example of training a model with mlr3 and without and the difference in sizes the corresponding objects produce? – missuse Mar 17 '22 at 22:11
1 Answers
0
You can directly access the underlying model in mlr3
using the $model
slot, see e.g. the basics chapter in the mlr3 book. This is where the trained model is put and what's used to make the predictions, so you can modify this in exactly the same way as you would modify the model directly.
Of course, some of this may break other mlr3
functionality, e.g. information on feature importance that is used by some other functions. But in principle, you can perform exactly the same model customization that you can do for the "raw" model.

Lars Kotthoff
- 107,425
- 16
- 204
- 204