R中的回归误差

R中的回归误差,r,regression,R,Regression,我尝试使用插入符号包进行feautre选择,这是我使用的命令: titanicDF3 = read.table("combo.txt", header = TRUE) View(titanicDF3) require(caret) require(fscaret) splitIndex <- createDataPartition(titanicDF3$Survived, p = .75, list = FALSE, times = 1) train

我尝试使用插入符号包进行feautre选择,这是我使用的命令:

    titanicDF3 = read.table("combo.txt", header = TRUE)
    View(titanicDF3)
    require(caret)
require(fscaret)
    splitIndex <- createDataPartition(titanicDF3$Survived, p = .75, list = FALSE, times = 1)
    trainDF <- titanicDF3[ splitIndex,]
    testDF  <- titanicDF3[-splitIndex,]

    fsModels <- c("glm", "gbm", "treebag", "ridge", "lasso")
    myFS<-fscaret(trainDF, testDF, myTimeLimit = 40, preprocessData=TRUE,
                  Used.funcRegPred = 'gbm', with.labels=TRUE,
                  supress.output=FALSE, no.cores=2)
由于我是R的新手,我不确定是什么导致了这一点。欢迎提出任何想法或建议

作为参考,我的文本文件如下所示

Gene    Start   end Item1   Item2   Item3   Item4   Item5   Survived
100 1   56  3123    2149    3211    5000    300 0
100 34  78  3456    2345    1210    5462    321 0
100 43  98  4312    3210    2894    5487    350 0
100 54  102 4671    4310    3106    6579    390 0
100 98  121 5601    4450    4123    6792    352 0
140 130 280 7699    8790    8791    2122    768 1
140 160 321 6590    7680    8612    1278    779 1
140 210 345 8680    6712    7689    3128    987 1
140 260 431 8981    7781    9761    2199    453 1
140 324 540 9791    9941    8634    2679    410 1
我还尝试使用不同的模型。当我使用glm模型时,我得到了一种新的错误

fsModels <- c("glm", "knn", "svmPoly", "svmLinear")
myFS<-fscaret(trainDF, testDF, myTimeLimit = 40, preprocessData=TRUE,
              Used.funcRegPred = 'glm', with.labels=TRUE,
              supress.output=FALSE, no.cores=2)

----Processing files:----
[1] "1in_default_REGControl_glm.RData"
[1] ""
[1] "Calculating error for model:"
[1] "1in_default_REGControl_glm.RData"
[1] ""

----Processing files:----
[1] "1in_default_REGControl_VarImp_glm.txt"
Error in `[<-.data.frame`(`*tmp*`, rows, ncol(matrycaVarImp.RMSE), value = numeric(0)) : 
  replacement has length zero

我是不是遗漏了什么?有人能解释一下吗?

您的代码的问题是,您试图在回归模式下使用
fscaret()
函数,但是您的数据显然被分解了(如果不是您有意的话,也不是通过
read.table()
或内部通过
fscaret()
函数)。 对于您为以下代码提供的
fsModels
示例,仅
glm
运行时不带NaN:

titanicDF3 = read.table("combo.txt", header = TRUE)
View(titanicDF3)
require(caret)
require(fscaret)

    splitIndex <- createDataPartition(titanicDF3$Survived, p = .75, list = FALSE, times = 1)
    trainDF <- titanicDF3[ splitIndex,]
    testDF  <- titanicDF3[-splitIndex,]

    fsModels <- c("glm", "gbm", "treebag", "ridge", "lasso")

    myFS<-fscaret(trainDF, testDF, myTimeLimit = 40, preprocessData=TRUE, classPred = TRUE, regPred = FALSE,
                  Used.funcClassPred = fsModels, with.labels=TRUE,
                  supress.output=FALSE, no.cores=2)
titanicDF3=read.table(“combo.txt”,header=TRUE)
视图(titanicDF3)
需要(插入符号)
需要(fscaret)

splitIndex是否只在一个内核上运行过?是的!我已将核心数更改为1并进行了检查,但错误仍然存在!如果我能做一个小的、可复制的例子,那就太好了。我已经在我的问题中添加了代码和文本文件,以防你想试试。。
Error in checkForRemoteErrors(val) : 
  one node produced an error: incorrect number of dimensions
titanicDF3 = read.table("combo.txt", header = TRUE)
View(titanicDF3)
require(caret)
require(fscaret)

    splitIndex <- createDataPartition(titanicDF3$Survived, p = .75, list = FALSE, times = 1)
    trainDF <- titanicDF3[ splitIndex,]
    testDF  <- titanicDF3[-splitIndex,]

    fsModels <- c("glm", "gbm", "treebag", "ridge", "lasso")

    myFS<-fscaret(trainDF, testDF, myTimeLimit = 40, preprocessData=TRUE, classPred = TRUE, regPred = FALSE,
                  Used.funcClassPred = fsModels, with.labels=TRUE,
                  supress.output=FALSE, no.cores=2)