Skip to content

sometimes censoring weight columns have names #1023

Closed

Description

@topepo

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

Activity

  1. self-assigned this
    on Nov 9, 2023
  2. added
    bugan unexpected problem or unintended behavior
    on Nov 9, 2023
  3. hfrick commented on Nov 9, 2023

    @hfrick
    Member
  4. github-actions commented on Nov 29, 2023

    @github-actions
    Contributor

    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.

  5. locked and limited conversation to collaborators on Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugan unexpected problem or unintended behavior

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions