I need to write my custom splitting function using rpart package and I found basic official guide:
https://cran.r-project.org/web/packages/rpart/vignettes/usercode.pdf
It is shown how to write splitting functions with an example of the ANOVA method. As far as I understood, those functions operates on current node level, meaning that I have an access only to a subset of training examples and I don't "see" global structure of a tree.
Does anyone know how to get e.g. number of leafs in the whole tree or mapping leaf_id -> training_example_id when tree is being built?