zhihua li
2005-Aug-26 07:56 UTC
[R] learning decision trees with one's own scoring functins
Hi netters, I want to learn a decision tree from a series of instances (learning data). The packages tree or rpart can do this quite well, but the scoring functions (splitting criteria) are fixed in these packages, like gini or something. However, I'm going to use another scoring function. At first I wanna modify the R code of tree or rpart and put my own scoring function in. But it seems that tree and rpart perform the splitting procedure by calling external C functions, which I have no access to. So do I have to write R code from scratch to build the tree with my own scoring functions? It's a really tough task. Or r there other R packages that can do similar things with more flexible and extensible code? Thanks a lot!
Philippe Grosjean
2005-Aug-26 08:14 UTC
[R] learning decision trees with one's own scoring functins
Hello, You have access to the C code of the function in the *source* of the package. You can modify it and recompile the package and function (its better then to give a different name!). Best, Philippe Grosjean ..............................................<仭併}))><........ ) ) ) ) ) ( ( ( ( ( Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( ( Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons-Hainaut University, Pentagone (3D08) ( ( ( ( ( Academie Universitaire Wallonie-Bruxelles ) ) ) ) ) 8, av du Champ de Mars, 7000 Mons, Belgium ( ( ( ( ( ) ) ) ) ) phone: + 32.65.37.34.97, fax: + 32.65.37.30.54 ( ( ( ( ( email: Philippe.Grosjean at umh.ac.be ) ) ) ) ) ( ( ( ( ( web: http://www.umh.ac.be/~econum ) ) ) ) ) http://www.sciviews.org ( ( ( ( ( .............................................................. zhihua li wrote:> Hi netters, > > I want to learn a decision tree from a series of instances (learning > data). The packages > tree or rpart can do this quite well, but the scoring functions > (splitting criteria) are > fixed in these packages, like gini or something. However, I'm going to > use another scoring > function. > At first I wanna modify the R code of tree or rpart and put my own > scoring function in. But it seems that tree and rpart perform the > splitting procedure by calling external C functions, which I have no > access to. So do I have to write R code from scratch to build the tree > with my own scoring functions? It's a really tough task. Or r there > other R packages that can do similar things with more flexible and > extensible code? > > Thanks a lot! > > > ------------------------------------------------------------------------ > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Prof Brian Ripley
2005-Aug-26 10:52 UTC
[R] learning decision trees with one's own scoring functins
Please do study the packages you mention a great deal more carefully before posting such negative remarks about them. In particular, rpart is already fully user-extensible (and comes with a worked example), and both packages are supplied in source code on CRAN. On Fri, 26 Aug 2005, zhihua li wrote:> Hi netters, > > I want to learn a decision tree from a series of instances (learning data). > The packages > tree or rpart can do this quite well, but the scoring functions (splitting > criteria) are > fixed in these packages, like gini or something. However, I'm going to use > another scoring > function. > At first I wanna modify the R code of tree or rpart and put my own scoring > function in. But it seems that tree and rpart perform the splitting procedure > by calling external C functions, which I have no access to. So do I have to > write R code from scratch to build the tree with my own scoring functions? > It's a really tough task. Or r there other R packages that can do similar > things with more flexible and extensible code? > > Thanks a lot! > >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Reasonably Related Threads
- locate the rows in a dataframe with some criteria
- Error: evaluation nested too deeply when doing heatmap with binary distfunction
- An R clause to bind dataframes under certain contions
- how to "singlify" entries
- Comparison of aggregate in R and group by in mysql