suiji / Arborist

Scalable decision tree training and inference.
Other
82 stars 14 forks source link

Bug: when using a vector in x it crashes R! #18

Closed talgalili closed 8 years ago

talgalili commented 8 years ago

Example:

# require2(Rborist)
library(Rborist)
x <- rnorm(100)
y <- ifelse(x>0, 1,0)
Rborist(as.matrix(x), y) # won't crash R
Rborist(x, y) # crashes R!
suiji commented 8 years ago

The Rborist manual indicates that 'x' should be a matrix or data frame and 'y' a conforming vector, but you are right that it should not simply crash.

My proposed solution is to improve the error-handling mechanism to catch such cases.

talgalili commented 8 years ago

I also suspect that using "as.matrix" will give the desired result for the rare cases someone wanted to use just one dimension x (which was my case) :)

suiji commented 8 years ago

I have fixed this particular error in a local copy and should have it on Github as soon as some other changes are folded in.

The main reason Rborist does not perform type wrangling is to minimize language-dependent behavior.

There is still the larger issue of not appropriately trapping errors thrown by Rcpp. This should have been caught and handled by the Bridge code as an Rcpp error of unknown provenance. This will go onto the TO-DO list.

Thank you for catching this one.

talgalili commented 8 years ago

Thanks :)