I'm trying to build a random forest using model based regression trees in partykit package. I have built a model based tree using mob()
function with a user defined fit()
function which returns an object at the terminal node.
In partykit there is cforest()
which uses only ctree()
type trees. I want to know if it is possible to modify cforest()
or write a new function which builds random forests from model based trees which returns objects at the terminal node. I want to use the objects in the terminal node for predictions. Any help is much appreciated. Thank you in advance.
Edit: The tree I have built is similar to the one here -> https://stackoverflow.com/a/37059827/14168775
How do I build a random forest using a tree similar to the one in above answer?
At the moment, there is no canned solution for general model-based forests using mob()
although most of the building blocks are available. However, we are currently reimplementing the backend of mob()
so that we can leverage the infrastructure underlying cforest()
more easily. Also, mob()
is quite a bit slower than ctree()
which is somewhat inconvenient in learning forests.
The best alternative, currently, is to use cforest()
with a custom ytrafo
. These can also accomodate model-based transformations, very much like the scores in mob()
. In fact, in many situations ctree()
and mob()
yield very similar results when provided with the same score function as the transformation.
A worked example is available in this conference presentation:
Heidi Seibold, Achim Zeileis, Torsten Hothorn (2017). "Individual Treatment Effect Prediction Using Model-Based Random Forests." Presented at Workshop "Psychoco 2017 - International Workshop on Psychometric Computing", WU Wirtschaftsuniversität Wien, Austria. URL https://eeecon.uibk.ac.at/~zeileis/papers/Psychoco-2017.pdf
The special case of model-based random forests for individual treatment effect prediction was also implemented in a dedicated package model4you
that uses the approach from the presentation above and is available from CRAN. See also:
Heidi Seibold, Achim Zeileis, Torsten Hothorn (2019). "
model4you
: An R Package for Personalised Treatment Effect Estimation." Journal of Open Research Software, 7(17), 1-6. doi:10.5334/jors.219