tidymodels / tidymodels.org

Source of tidymodels.org
https://www.tidymodels.org/
19 stars 15 forks source link

Problem in "Accounting for Censoring in Performance Metrics for Event Time Data" #49

Closed errants closed 10 months ago

errants commented 10 months ago

Hi.

In this article, you have written how to fit a bagged survival tree model, then use augment() function to return a dataset that augmented with predictions. However, I run the code you posted online, it returns an error "Error in augment(): ! Unknown mode: censored regression

Backtrace: ▆

  1. ├─generics::augment(bag_tree_fit, sim_val, eval_time = time_points)
  2. └─parsnip:::augment.model_fit(bag_tree_fit, sim_val, eval_time = time_points)"

I don't know how to do with it, can you give me some advice?

The code I have problem with:

"bag_tree_fit <- bag_tree() %>% set_mode("censored regression") %>% set_engine("rpart") %>% fit(event_time ~ ., data = sim_tr)

val_pred <- augment(bag_tree_fit, sim_val, eval_time = time_points)"

Thank you. Shao

hfrick commented 10 months ago

Hi! This looks like you might not have the development versions installed. For this particular article, you need to install the development versions of parsnip and censored. You can do so for example via the pak package:

#install.packages("pak")

pak::pak(c("tidymodels/censored", "tidymodels/parsnip"))

Does this solve your problem?

errants commented 10 months ago

Yes! I solved problem by updating parsnip to 1.1.1, originally my version was 1.1.0. Thank you very much. I’ll check the change log of the package first. Thank you again, have a nice day.

---- Replied Message ---- | From | Hannah @.> | | Date | 11/17/2023 17:36 | | To | @.> | | Cc | errants @.>, Author @.> | | Subject | Re: [tidymodels/tidymodels.org] Problem in "Accounting for Censoring in Performance Metrics for Event Time Data" (Issue #49) |

Hi! This looks like you might not have the development versions installed. For this particular article, you need to install the development versions of parsnip and censored. You can do so for example via the pak package:

install.packages("pak")

pak::pak(c("tidymodels/censored", "tidymodels/parsnip"))

Does this solve your problem?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

hfrick commented 10 months ago

I'm gonna go ahead and close this. Let us know if you run into further problems!

errants commented 10 months ago

Ok, sorry, I don’t realized I have to close it on GitHub

---- Replied Message ---- | From | Hannah @.> | | Date | 11/28/2023 18:40 | | To | @.> | | Cc | errants @.>, Author @.> | | Subject | Re: [tidymodels/tidymodels.org] Problem in "Accounting for Censoring in Performance Metrics for Event Time Data" (Issue #49) |

Closed #49 as completed.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

hfrick commented 10 months ago

No worries! You don't have to :)

errants commented 10 months ago

🫰

---- Replied Message ---- | From | Hannah @.> | | Date | 11/28/2023 19:28 | | To | @.> | | Cc | errants @.>, Author @.> | | Subject | Re: [tidymodels/tidymodels.org] Problem in "Accounting for Censoring in Performance Metrics for Event Time Data" (Issue #49) |

No worries! You don't have to :)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>