Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign uppredict.train fails with single observation in new data for gbms #274
Comments
|
It is a bug. I've fixed the model file. Until the next release, you can source this file and use the new code via: gbmMod <- train(iris[, 1:2], iris[, 5], method = modelInfo,
trControl=trainControl(method="cv", number=2,
savePredictions=TRUE, classProbs=TRUE)) |
|
Awesome thanks Max! |
I have found an odd bug on both the current CRAN and
devversions ofcaretwhich is related to zachmayer/caretEnsemble#171. The error is thatpredict.train(model, newdata, type = 'prob')does not work consistently for single case values of newdata forgbmmodels. Here's an MWE using theirisdataset:This nicely produces:
And if we pass in newdata, that works too:
predict(gbmMod, type = "prob", newdata = iris[100:105, c(1:2)]):But, if newdata only has 1 row:
predict(gbmMod, type = "prob", newdata = iris[100, c(1:2)]):