Hi all,
I am running R1.5.0 under Unix.
I am repeating my earlier question with a few details added.
I have the following tree fitted as the tree object 'my.tree':
node), split, n, deviance, yval
* denotes terminal node
1) root 5807 0.9998 0.0001722
2) V604 < 0.5 5798 0.0000 0.0000000 *
3) V604 > 0.5 9 0.8889 0.1111000 *
And I have a data.frame called 'new.temp' for which I want to make
predictions with this tree. new.temp is a data.frame with a single row and
the required number of columns.
When I run:
predict.tree(my.tree, new.temp)
it takes 60 to 70 seconds to get the output. I had expected it to take far
less because the tree is very small and the new data contains just 1 row.
My question is: Does this function 'predict.tree' provided in the library
package 'tree' really consume so much time even for minor calculations or
is something wrong?
Thanks in advance,
-Saket.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
timing predict.tree()
2 messages · Saket Joshi, Martin Maechler
"Saket" == Saket Joshi <joshi at engr.orst.edu> writes:
Saket> Hi all,
Saket> I am running R1.5.0 under Unix.
Saket> I am repeating my earlier question with a few details added.
Saket> I have the following tree fitted as the tree object 'my.tree':
Saket> node), split, n, deviance, yval
Saket> * denotes terminal node
Saket> 1) root 5807 0.9998 0.0001722
Saket> 2) V604 < 0.5 5798 0.0000 0.0000000 *
Saket> 3) V604 > 0.5 9 0.8889 0.1111000 *
Saket> And I have a data.frame called 'new.temp' for which I
Saket> want to make predictions with this tree. new.temp is
Saket> a data.frame with a single row and the required
Saket> number of columns.
Saket> When I run:
Saket> predict.tree(my.tree, new.temp)
Saket> it takes 60 to 70 seconds to get the output. I had
Saket> expected it to take far less because the tree is very
Saket> small and the new data contains just 1 row.
Saket> My question is: Does this function 'predict.tree'
Saket> provided in the library package 'tree' really consume
Saket> so much time even for minor calculations or is
Saket> something wrong?
there is something wrong with your situation and you still gave not enough
details for us to find out.
For me, the three statements
library(tree)
example(predict.tree)
predict(shuttle.tr, shuttle[254,,drop = FALSE])
all give output very quickly.
BTW : Note that the use of the `tree' package is not really
recommended, but rather use the recommended package
`rpart'
Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._