【问题标题】:cforest in package party returning Inf for all predictions包裹派对中的 cforest 为所有预测返回 Inf
【发布时间】:2018-12-05 07:37:40
【问题描述】:

我正在尝试使用 R 包方中的 cforest 函数来分析一些右删失的生存数据。每次我使用 predict 函数时,我都会得到每个值的 Inf,这意味着无法生成一致性索引。

我的数据可以在这里下载:https://www.dropbox.com/s/nt9s3p1rdafq465/test_data.csv?dl=0

例子:

library(party)
library(survival)

mydata <- read.csv(file="test_data.csv", header=TRUE, sep=",",row.names=NULL)    
train<-head(mydata, n=800)
test<-tail(mydata, n=37)

cif_result <- cforest(Surv(timeToEvent, status) ~ V1 + V2 + V3 + V4 + V5 + V6, 
                    data = train,
                    control=cforest_classical())

cforest_pred <- predict(object = cif_result, newdata = test) 
cforest_pred

837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 
Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf 
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 
Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf 

我做错了吗?为什么 cforest 只根据这些数据预测 Inf?

【问题讨论】:

    标签: r random-forest party


    【解决方案1】:

    party 包中的生存树/森林的predict() 方法返回中位生存时间。由于少于 20% 的观察有观察到的事件,因此无法计算有限的中位生存时间。因此它是Inf。以全样本拟合为例:

    m <- survfit(Surv(timeToEvent, status) ~ 1, data = train)
    plot(m)
    

    【讨论】:

      猜你喜欢
      • 2018-09-28
      • 2014-12-11
      • 1970-01-01
      • 1970-01-01
      • 2020-05-26
      • 2022-07-19
      • 2013-01-23
      • 2016-02-01
      相关资源
      最近更新 更多