Katrina Bennett
2013-May-04 21:33 UTC
[R] Error running caret's gbm train function with new version of caret
I am running caret for model exploration. I developed my code a number of months ago and I've been running it with no issues. Recently, I updated my version of caret however, and now I am getting a new error. I'm wondering if this is due to the new release. The error I am getting is when I am running GBM. print(paste("calculating GBM for", i)) #gbm runs over and over again set.seed(1) trainModelGBM <- train(trainClass3, trainAsym, "gbm", metric="RMSE", tuneLength = 5, trControl = con) The error I am getting is at the end of the run once all the iterations have been processed: Error in { : task 1 failed - "arguments imply differing number of rows: 5, 121" trainClass3 and trainAsym have 311 values in them. I'm using 5 variables in my matrix. I'm not sure where the 117 is coming from. I found solutions online that suggested that updated the version of glmnet, Matrix and doing something with cv.folds would work. None of these solutions have worked for me. Here is my R session info. R version 2.15.1 (2012-06-22) Platform: x86_64-unknown-linux-gnu (64-bit) caret version 5.15-61 Thank you, Katrina [[alternative HTML version deleted]]
Max Kuhn
2013-May-06 14:19 UTC
[R] Error running caret's gbm train function with new version of caret
Katrina, I made some changes to accomidate gbm's new feature for 3+ categories, then had to "harmonize" how gbm and caret work together. I have a new version of caret that is not released yet (maybe within a month), but you should get it from: install.packages("caret", repos="http://R-Forge.R-project.org") You may also need to ungrade gbm. That package page is: https://code.google.com/p/gradientboostedmodels/downloads/list Let me know if you have any issues. Max On Sat, May 4, 2013 at 5:33 PM, Katrina Bennett <kebennett at alaska.edu> wrote:> I am running caret for model exploration. I developed my code a number of > months ago and I've been running it with no issues. Recently, I updated my > version of caret however, and now I am getting a new error. I'm wondering > if this is due to the new release. > > The error I am getting is when I am running GBM. > > print(paste("calculating GBM for", i)) > #gbm runs over and over again > set.seed(1) > trainModelGBM <- train(trainClass3, trainAsym, "gbm", metric="RMSE", > tuneLength = 5, trControl = con) > > The error I am getting is at the end of the run once all the iterations > have been processed: > Error in { : > task 1 failed - "arguments imply differing number of rows: 5, 121" > > trainClass3 and trainAsym have 311 values in them. I'm using 5 variables in > my matrix. I'm not sure where the 117 is coming from. > > I found solutions online that suggested that updated the version of glmnet, > Matrix and doing something with cv.folds would work. None of these > solutions have worked for me. > > Here is my R session info. > > R version 2.15.1 (2012-06-22) > Platform: x86_64-unknown-linux-gnu (64-bit) > > caret version 5.15-61 > > Thank you, > > Katrina > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Max