I've decided to put this package into public archive, which means you can keep using it but I'm not maintaining it. I've made this decision as almost all issues that have been opened recently relate to problems in the pycox backend, which are outside my control. I am open to new maintainers taking over if they want to fix any R problems that occur, but I believe what must happen is this package needs to be re-written using R keras directly.
survivalmodels
implements models for survival analysis that are either
not already implemented in R, or novel implementations for speed
improvements. Currently implemented are five neural networks from the
Python packages pycox, DNNSurv, and
the Akritas non-parametric conditional estimator. Further updates will
include implementations of novel survival models.
For a hands-on demonstration of model training, tuning, and comparison
see this
article
I wrote, which uses the
mlr3proba interface with models
from survivalmodels
.
# load dependencies
library(survival)
train <- simsurvdata(100)
test <- simsurvdata(50)
fit <- akritas(Surv(time, status) ~ ., data = train)
predict(fit, newdata = test)
# Use distr6 = TRUE to return a distribution
predict_distr <- predict(fit, newdata = test, distr6 = TRUE)
predict_distr$survival(100)
# Return a relative risk ranking with type = "risk"
predict(fit, newdata = test, type = "risk")
Or both survival probabilities and a rank
predict(fit, newdata = test, type = "all", distr6 = TRUE)
survivalmodels
implements models from Python using
reticulate. In order to
use these models, the required Python packages must be installed
following with
reticulate::py_install.
survivalmodels
includes a helper function to install the required
pycox
function (with pytorch if also required). Before running any
models in this package, if you have not already installed pycox
please
run
install_pycox(pip = TRUE, install_torch = FALSE)
With the arguments changed as you require, see ?install_pycox for more.
For DNNSurv
the model depends on keras
and tensorflow
, which
require installation via:
install_keras(pip = TRUE, install_tensorflow = FALSE)
Install the latest release from CRAN:
install.packages("survivalmodels")
Install the development version from GitHub:
remotes::install_github("RaphaelS1/survivalmodels")