Closed hfrick closed 10 months ago
In addition to the usage for decision_tree()
with the rpart
engine mentioned above, it would also be used for the aorsf
engine for rand_forest()
if we would just call the predict method by the engine package directly.
For similar reformatting of the predictions, see also https://github.com/tidymodels/censored/blob/f7309a5805f66d892ac33ee7758b4f25ff7f568b/R/boost_tree-mboost.R#L123-L134
Other changes necessary: we need to explicitly pass on the time arg for survival_reg(engine = "survival")
here
https://github.com/tidymodels/censored/blob/f7309a5805f66d892ac33ee7758b4f25ff7f568b/R/survival_reg-data.R#L120-L124
Note: also check the functions for predictions of type = "hazard"
since parsnip has also this:
decision_tree(engine = "rpart")
.mboost
is different (transposed) so not directly relevant here. survival_reg(engine = "survival")
.If we remove adding the argument in parsnip::predict_survival.model_fit()
and parsnip::predict_hazard.model_fit()
, we would not be able to push formatting into the post hook because we need the values of eval_time
there, not just the length. This means that this comment is then in correct and should be removed:
https://github.com/tidymodels/censored/blob/d8b30c0429809c1dec5de33fd91828c0c99f6c1b/R/rand_forest-aorsf.R#L24-L26
We should still remove the argument injection in parsnip though, it just feels really hacky.
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.
Patterns like this https://github.com/tidymodels/censored/blob/f7309a5805f66d892ac33ee7758b4f25ff7f568b/R/decision_tree-data.R#L71-L74
necessitate this in parsnip: https://github.com/tidymodels/parsnip/blob/0b6b85fbae972a489638887a15787c5ea4e9c623/R/predict_survival.R#L23-L24
Maybe we can find a way around this pattern. It causes a need for a wrapper function
survival_prob_orsf()
aroundaorsf::predict.orsf_fit()
because this predict method requires empty dots (and parsnip puts thetime
arg into the dots).If we do, we can remove the lines in parsnip and use the
predict()
method fororsf_fit
objects directly and simplify/remove https://github.com/tidymodels/censored/blob/f7309a5805f66d892ac33ee7758b4f25ff7f568b/R/rand_forest-aorsf.R#L14-L31