It's survival_time_coxnet() which breaks because the training data object$training_data$x carries an intercept column when going into survival::survfit().
This happens because fit.workflow() creates a mold that includes the intercept because the encoding in censored says compute_intercept = TRUE.
That intercept column is still part of x when it reaches fit_xy.proportional_hazards() where it gets written into the object$training_data$x mentioned earlier.
The intercept column does not make it to the actual call to glmnet (so no bug when fitting) because we set remove_intercept = TRUE in the encodings which gets picked up in xy_form() which passes it to .convert_xy_to_form_fit() and the column is removed.
That means everything is okay here inside of censored::coxnet_train() and inside of fit_xy.proportional_hazards() we should take the training data as returned from coxnet_train(), like we do in fit.proportional_hazards().
This pull request 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.
Closes #263
It's
survival_time_coxnet()
which breaks because the training dataobject$training_data$x
carries an intercept column when going intosurvival::survfit()
.This happens because
fit.workflow()
creates a mold that includes the intercept because the encoding in censored sayscompute_intercept = TRUE
.That intercept column is still part of
x
when it reachesfit_xy.proportional_hazards()
where it gets written into theobject$training_data$x
mentioned earlier.The intercept column does not make it to the actual call to glmnet (so no bug when fitting) because we set
remove_intercept = TRUE
in the encodings which gets picked up inxy_form()
which passes it to.convert_xy_to_form_fit()
and the column is removed.That means everything is okay here inside of
censored::coxnet_train()
and inside offit_xy.proportional_hazards()
we should take the training data as returned fromcoxnet_train()
, like we do infit.proportional_hazards()
.Created on 2023-04-26 with reprex v2.0.2