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

sometimes censoring weight columns have names #1023

Closed
Tracked by #109
topepo opened this issue Nov 9, 2023 · 2 comments · Fixed by #1024
Closed
Tracked by #109

sometimes censoring weight columns have names #1023

topepo opened this issue Nov 9, 2023 · 2 comments · Fixed by #1024
Assignees
Labels
bug an unexpected problem or unintended behavior

Comments

@topepo
Copy link
Member

topepo commented Nov 9, 2023

Discovered in tidymodels/extratests#120

Only when a single row is predicted at a single time:

library(tidymodels)
library(censored)
#> Loading required package: survival
tidymodels_prefer()
theme_set(theme_bw())
options(pillar.advice = FALSE, pillar.min_title_chars = Inf)
set.seed(1)
sim_dat <- prodlim::SimSurv(500) %>%
  mutate(event_time = Surv(time, event)) %>%
  select(event_time, X1, X2)

parsnip_fit <- 
  proportional_hazards() %>% 
  fit(event_time ~ ., sim_dat)

## 

times <- c(2.0, 1.0)

##

res_2_times_2_rows <- 
  augment(parsnip_fit, new_data = head(sim_dat, 2), eval_time = times)
names(res_2_times_2_rows$.pred[[1]]$.weight_censored)
#> NULL

res_2_time_1_row <- 
  augment(parsnip_fit, new_data = head(sim_dat, 1), eval_time = times)
names(res_2_time_1_row$.pred[[1]]$.weight_censored)
#> NULL

res_1_time_2_row <- 
  augment(parsnip_fit, new_data = head(sim_dat, 2), eval_time = times[1])
names(res_1_time_2_row$.pred[[1]]$.weight_censored)
#> NULL

res_1_time_1_row <- 
  augment(parsnip_fit, new_data = head(sim_dat, 1), eval_time = times[1])
names(res_1_time_1_row$.pred[[1]]$.weight_censored)
#> [1] "time"

Created on 2023-11-09 with reprex v2.0.2

@topepo topepo self-assigned this Nov 9, 2023
@topepo topepo added the bug an unexpected problem or unintended behavior label Nov 9, 2023
@hfrick
Copy link
Member

hfrick commented Nov 9, 2023

possibly related to tidymodels/extratests#98 (comment)

topepo added a commit that referenced this issue Nov 14, 2023
* ensure survival vectors are unnamed for #1023

* move standalone tests to extratests
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 Nov 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants