[R] Rpart - user defined split functions
paolo.radaelli at unimib.it
Thu May 14 18:11:20 CEST 2009
I'm writing my own method to be used in Rpart by defining the list of
functions named init, split and eval. I'm following the example given in the
file 'tests/usersplits.R' in the sources.
By now I'm able to define the split function (and it works correctly in the
tree construction) while I have some problems with the init and the eval
The task I'm facing with is a classification task and I'd like the eval
function to produce an output similar to the one obtained for method="class"
node), split, n, loss, yval, (yprob)
I'd also like the summary.rpart function to produce an output reporting
class counts and probabilities rows for each node and this is done modifying
the summary function in the init one.
Unfortunately the example reported in 'tests/usersplits.R' does not consider
this case and the other examples I found in: Therneau, Atkinson - "An
Introduction to Recursive Partitioning Using the RPART Routines" do not help
me to solve the problem.
I also tried to have a look to the source code of the functions rpart.s and
rpart.class.s but it is quite hard for me to understand which part of the
code I should include in definining my own eval and init functions.
Does anyone can suggest me how to proceed ?
Any input would be highly appreciated.
Dipartimento di Metodi Quantitativi per le Scienze Economiche ed Aziendali
Facoltà di Economia
Università degli Studi di Milano-Bicocca
Via Bicocca degli Arcimboldi, 8
e-mail paolo.radaelli at unimib.it
Tel +39 02 6448 3163
Fax +39 02 6448 3105
More information about the R-help