tidymodels / censored

Parsnip wrappers for survival models
https://censored.tidymodels.org/
Other
123 stars 12 forks source link

Implement Accelerated Failure Time model and Cox method from xgboost #161

Open brunocarlin opened 2 years ago

brunocarlin commented 2 years ago

The main idea here is to get the output from those two modes of xgboost to stack it into another more standard model like Cox or Weibull similar to the idea of this package, https://loft-br.github.io/xgboost-survival-embeddings/how_xgbse_works.html#xgbsestackedweibull-xgboost-as-risk-estimator-weibull-aft-for-survival-curve

hfrick commented 2 years ago

We likely won't implement this immediately but are open to it and would welcome a PR!

brunocarlin commented 2 years ago

Can you help me a little bit with this pr, I don't know if I should start by modifying the file https://github.com/tidymodels/parsnip/blob/main/R/boost_tree.R or if I can just extend it, we just need to be able to set labels and the xgboost parnsip wrapper already has everything set up

# Associate ranged labels with the data matrix.
# This example shows each kind of censored labels.
#                   uncensored  right  left  interval
y_lower_bound <- c(        2.,    3.,   0.,       4.)
y_upper_bound <- c(        2.,  +Inf,   4.,       5.)
setinfo(dtrain, 'label_lower_bound', y_lower_bound)
setinfo(dtrain, 'label_upper_bound', y_upper_bound)

to work with Surv() notation we are golden

brunocarlin commented 2 years ago

Also where would the stacking live, in stacks or here? There may be two good ways to stack models using proportional_hazards with engine set to glmnet allow for easy porting we can also try to use survival_reg

hfrick commented 2 years ago

The goal is to leave the model definition boost_tree() in parsnip untouched and only add an engine in censored. Are you already familiar with the article on creating a parnsip model from scratch on tidymodels.org? It has a section on adding an engine but the part on creating a model also provides useful context. Stacking would most likely go into stacks.

brunocarlin commented 2 years ago

Not really, in this case, I am adding another mode to the existing engine and model right?