【问题标题】:R FFTrees Error Possibly Due to MissingnessR FFTrees 错误可能是由于缺失
【发布时间】:2019-01-05 01:51:55
【问题描述】:

我在尝试在 FFTrees 中构建模型时收到错误消息。我相信这是由于失踪。

最少的代表:

library(FFTrees)

heartdisease2 <- heartdisease

heart.fft <- FFTrees(formula = diagnosis ~., 
                 data = heartdisease2)

以上工作正常。但是,当我在预测列中模拟缺失时,模型会失败:

for(i in 2:ncol(heartdisease2)){
  missingrows <- sample(1:nrow(heartdisease2), .2*nrow(heartdisease2))
  heartdisease2[missingrows,i] <- NA
}


heart.fft <- FFTrees(formula = diagnosis ~., 
                 data = heartdisease2)

出现以下错误:

>Error in if (is.na(best.result.index)) { : argument is of length zero
>In addition: Warning message:
>In max(c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,  :
  no non-missing arguments to max; returning -Inf

根据包的说法,最新版本的FFTrees应该可以处理缺失了。还有其他人遇到此错误吗?

【问题讨论】:

    标签: r


    【解决方案1】:

    我在这里阅读包更新:https://cran.r-project.org/web/packages/FFTrees/readme/README.html

    我没有看到任何提及处理 NA 的最新版本。你能指出我在哪里看到这个吗?

    【讨论】:

    猜你喜欢
    • 2015-03-26
    • 1970-01-01
    • 2019-11-23
    • 2021-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-15
    • 2021-02-03
    相关资源
    最近更新 更多