Error in recursive removal of function using carriage

I try to use curt to select a variable, and I get an error at the same point with some types of models. I reproduce below one error: "Error in {: task 1 failed - subscript out of bounds", but I also get with other data "Error in {: task 1 failed -" the replacement has XXX lines, the data has YYY "".

I am interested in solving this specific error, as well as suggestions on how to approach its debugging. Thank you

library(caret) data(iris) predictors <- names(iris)[names(iris)!="Species"] split <- createDataPartition(iris$Species, p = .8, list = FALSE) irisData <- iris[,predictors] irisData$Class <- iris$Species training <- irisData[ split, ] testing <- irisData[-split, ] times <- 1 folds <- 5 prednumSeq <- seq(1, length(predictors)-1, by = 1) ctrl <- rfeControl(method = "repeatedcv", timingSamps = 2, number = folds, repeats = times, saveDetails = TRUE, verbose = TRUE, allowParallel = FALSE) rfRFE <- rfe(training[,predictors], training$Class, sizes = prednumSeq, rfeControl = ctrl) 

This leads to:

 +(rfe) fit Fold1.Rep1 size: 4 -(rfe) fit Fold1.Rep1 size: 4 +(rfe) imp Fold1.Rep1 +(rfe) fit Fold2.Rep1 size: 4 -(rfe) fit Fold2.Rep1 size: 4 +(rfe) imp Fold2.Rep1 +(rfe) fit Fold3.Rep1 size: 4 -(rfe) fit Fold3.Rep1 size: 4 +(rfe) imp Fold3.Rep1 +(rfe) fit Fold4.Rep1 size: 4 -(rfe) fit Fold4.Rep1 size: 4 +(rfe) imp Fold4.Rep1 +(rfe) fit Fold5.Rep1 size: 4 -(rfe) fit Fold5.Rep1 size: 4 +(rfe) imp Fold5.Rep1 Error in { : task 1 failed - "subscript out of bounds" 

Details from sessionInfo ():

 R version 3.0.0 (2013-04-03) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] MASS_7.3-26 randomForest_4.6-7 e1071_1.6-1 class_7.3-7 [5] pROC_1.5.4 caret_5.15-61 reshape2_1.2.2 plyr_1.8 [9] lattice_0.20-15 foreach_1.4.0 cluster_1.14.4 loaded via a namespace (and not attached): [1] codetools_0.2-8 compiler_3.0.0 grid_3.0.0 iterators_1.0.6 stringr_0.6.2 [6] tools_3.0.0 
+4
source share

Source: https://habr.com/ru/post/1486167/


All Articles