[R] degenerate cases in RPART
john_heumann@agilent.com
john_heumann at agilent.com
Tue Nov 26 18:20:50 CET 2002
RPART doesn't seem to handle the degenerate case when all training
samples are drawn from a single class:
> TrainType
[1] 0 0 0 0
> TrainDat
V1 V2 V3 V4 V5
1 0.6434392 0.5105860 0.3048803 0.3161728 0.5449632
2 0.1710005 0.5973921 0.1267061 0.6146834 0.7299928
3 0.6919125 0.8880789 0.9123243 0.9061885 0.9553663
4 0.3094843 0.6475508 0.7403838 0.6824748 0.8488170
> x <- rpart(as.factor(TrainType)~., data=TrainDat)
> x
Error in paste(temp, yprob[, i], sep = " ") :
subscript out of bounds
> predict(x, TrainDat)
Error in predict.rpart(x, TrainDat) : dimnames applied to non-array
>
Conversely TREE had no problem with this test case, even if the features
are also degenerate (same features for each sample).
Is this expected behavior from RPART or a bug? This is with R1.6.1 on NT4.
Thanks,
-jh-
=================================
John Heumann, Agilent Technologies, Inc.
815 14th. St. S.W., Loveland, CO 80537
Email: john_heumann at agilent.com
Phone: (970) 679-3761, Fax: (970) 679-5399
=================================
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list