Skip to content

Uninformative error for predict() when default type isn't available #480

Closed
@EmilHvitfeldt

Description

@EmilHvitfeldt

The glmnet engine doesn't at this time have a time prediction module, which is the default. The error message is not quite clear.

It was initially unclear to me what prediction module was referring to and that it could be fixed by setting a different type.

library(censored)
library(survival)

lung2 <- lung[-14, ]

  # penalty specification: in predict()
  cox_spec <- proportional_hazards() %>%
    set_mode("censored regression") %>%
    set_engine("glmnet")

f_fit <- fit(cox_spec, Surv(time, status) ~ age + ph.ecog, data = lung2)

predict(f_fit, 
        new_data = lung2[1, ], 
         penalty = 0.123)
#> Error: No prediction module defined for this model.

Created on 2021-04-27 by the reprex package (v1.0.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions