Skip to content

Instantly share code, notes, and snippets.

@cindyangelira
Last active January 9, 2023 11:57
Show Gist options
  • Save cindyangelira/eb8643175e176042c62302ed7260884b to your computer and use it in GitHub Desktop.
Save cindyangelira/eb8643175e176042c62302ed7260884b to your computer and use it in GitHub Desktop.
survival learners R
# Create learners----
learners <- lrns(
paste0("surv.", c("coxtime","deephit", "deepsurv", "loghaz", "pchazard")),
frac = 0.3, activation = "relu",
dropout = 0.1,
early_stopping = TRUE,
epochs = 10,
batch_size = 32L
)
learners <- c(learners, lrns(c("surv.kaplan", "surv.coxph")))
# Create pipeline----
pipeline <- function(learner){
po("scale") %>>% po("learner", learner)
}
learners <- lapply(learners, pipeline)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment