Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rand_forest() models #8

Closed
3 of 5 tasks
EmilHvitfeldt opened this issue Aug 6, 2020 · 3 comments
Closed
3 of 5 tasks

rand_forest() models #8

EmilHvitfeldt opened this issue Aug 6, 2020 · 3 comments
Labels
feature a feature request or enhancement
Projects

Comments

@EmilHvitfeldt
Copy link
Member

EmilHvitfeldt commented Aug 6, 2020

  • party time
  • party survival
  • randomForestSRC time
  • party parameters
  • randomForestSRC parameters
library(party)
#> Loading required package: grid
#> Loading required package: mvtnorm
#> Loading required package: modeltools
#> Loading required package: stats4
#> Loading required package: strucchange
#> Loading required package: zoo
#> 
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#> 
#>     as.Date, as.Date.numeric
#> Loading required package: sandwich
library(survival)
library(pec)
#> Loading required package: prodlim

set.seed(342)
cforest_mod <-
  cforest(Surv(time, status) ~ age + ph.ecog, data = lung,
          controls = cforest_unbiased(ntree = 100, mtry = 1))

# time
predict(cforest_mod, newdata = lung)
#>   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20 
#> 306 353 428 306 558 306 288 222 286 177 306 288 371 305 306 283 345 222 180 306 
#>  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40 
#> 283 371 305 433 350 345 558 239 286 208 371 199 199 177 177 177 285 283 208 345 
#>  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60 
#> 345 199 433 177 371 201 350 345 350 305 301 477 353 433 345 455 350 177 348 345 
#>  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80 
#> 208 305 285 283 371 288 285 433 353 283 477 305 208 353 286 310 371 363 303 320 
#>  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 
#> 433 363 353 353 353 310 310 455 353 201 477 345 283 306 353 201 371 310 345 353 
#> 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 
#> 433 371 363 345 177 283 363 283 363 208 353 353 283 348 363 201 199 288 285 283 
#> 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 
#> 348 177 371 201 353 283 305 345 201 371 345 286 371 363 350 208 348 180 363 428 
#> 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 
#> 199 306 201 283 306 286 353 363 303 433 345 558 455 286 180 288 371 177 345 363 
#> 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 
#> 455 353 288 345 345 394 301 371 301 350 301 433 363 433 286 345 180 363 286 350 
#> 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 
#> 558 433 350 283 371 428 201 433 345 371 301 180 305 345 310 353 345 345 371 301 
#> 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 
#> 345 285 477 371 477 177 394 199 371 345 558 283 371 285 283 283 353 201 239 394 
#> 221 222 223 224 225 226 227 228 
#> 283 310 283 283 433 208 283 348

# survival
set.seed(342)
pec_cforest_mod <-
  pecCforest(Surv(time, status) ~ age + ph.ecog, data = lung,
             controls = cforest_unbiased(ntree = 100, mtry = 1))

str(predictSurvProb(pec_cforest_mod, newdata = lung, times = c(100, 200)))
#>  num [1:228, 1:2] 0.869 0.839 0.936 0.895 0.93 ...

Created on 2020-08-06 by the reprex package (v0.3.0)

randomForestSRC

library(randomForestSRC)
#> 
#>  randomForestSRC 2.9.3 
#>  
#>  Type rfsrc.news() to see new features, changes, and bug fixes. 
#> 
library(survival)
library(pec)
#> Loading required package: prodlim

rfsrce_mod <- rfsrc(Surv(time, status) ~ age + ph.ecog, data = lung, ntree = 1000)
# The predict function generates an object with classes "rfsrc", "predict", and "surv". It is unclear what is being predicted:

# time?
str(predict(rfsrce_mod, lung)$predicted)
#>  num [1:227, 1:2] 163 145 344 170 328 ...
#>  - attr(*, "dimnames")=List of 2
#>   ..$ : NULL
#>   ..$ : chr [1:2] "event.1" "event.2"

Created on 2020-08-06 by the reprex package (v0.3.0)

@hfrick hfrick added the feature a feature request or enhancement label Apr 16, 2021
@hfrick
Copy link
Member

hfrick commented Oct 12, 2021

Party parameters were added to dials in tidymodels/dials#162

@hfrick hfrick added this to To do in v1.0.0 Dec 2, 2021
@hfrick
Copy link
Member

hfrick commented Dec 2, 2021

closing in favour of #130

@hfrick hfrick closed this as completed Dec 2, 2021
v1.0.0 automation moved this from To do to Done Dec 2, 2021
@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature a feature request or enhancement
Projects
Development

No branches or pull requests

2 participants