In R, whenever I try using the safs/gafs interface via. caret I keep running into this specific error:
Here is a link to the data I am using, stored as a .csv file. The .csv file given has a column with the row number which I have removed.
The code I've used is below. Please note that I have the packages caret and randomForest enabled.
I've gotten this code to work with rfe based feature selection in caret, which seems a bit odd to me considering all I am doing is passing my functions to train, except with SAF/GAF based feature selection instead. That being said, they are different algorithms and I would not be surprised if I have missed a command or have not passed correctly to train.
Thanks for any help, I've been waiting for responses on stack exchange with no luck.
Code:
Error in { : task 1 failed - "replacement has 1 row, data has 0"
The code I've used is below. Please note that I have the packages caret and randomForest enabled.
Code:
saf1 = safs(x=FS3mat[ ,1:289], y=FS3mat[,290], iters = 10,
safsControl = safsControl(functions =caretSA, method = "cv", number=5, repeats=10, verbose=TRUE, allowParallel=TRUE, improve=20, metric=c(internal= "Rsquared", external="Rsquared"), maximize = c(internal=TRUE, external=TRUE)),
trControl = trainControl(method="none", allowParallel = FALSE), method =
"rf",importance=TRUE, tuneGrid = expand.grid(.mtry=15))
Thanks for any help, I've been waiting for responses on stack exchange with no luck.