[R] rpart: which is correct?

2009-08-02 Thread Shawn Rutledge
I am using rpart in classification mode and am confused about this particular model's predictions. > predict(fit, train[8,]) -1 1 8 0.5974089 0.4025911 > predict(fit, train[8,], type="class") 1 Levels: -1 1 So, it seems like there is a 60% change of being class -1 according th

[R] cut with floating point, a bug?

2009-06-18 Thread Shawn Rutledge
With floating point numbers I'm seeing 'cut' putting values in the wrong bands. An example below places 0.3 in (0.3,0.6] i.e. 0.3 > 0.3. > x = 1:5*.1 > x [1] 0.1 0.2 0.3 0.4 0.5 > cut(x, br=c(0,.3,.6)) [1] (0,0.3] (0,0.3] (0.3,0.6] (0.3,0.6] (0.3,0.6] Levels: (0,0.3] (0.3,0.6] I'm sure this i