Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

predict.dnnsurv

Predict Method for DNNSurv


Description

Predicted values from a fitted object of class dnnsurv.

Usage

## S3 method for class 'dnnsurv'
predict(
  object,
  newdata,
  batch_size = 32L,
  verbose = 0L,
  steps = NULL,
  callbacks = NULL,
  type = c("survival", "risk", "all"),
  distr6 = FALSE,
  ...
)

Arguments

object

(dnnsurv(1))
Object of class inheriting from "dnnsurv".

newdata

(data.frame(1))
Testing data of data.frame like object, internally is coerced with stats::model.matrix(). If missing then training data from fitted object is used.

batch_size

(integer(1))
Passed to keras::predict.keras.engine.training.Model, elements in each batch.

verbose

(integer(1))
Level of verbosity for printing, 0 or 1.

steps

(integer(1))
Number of batches before evaluation finished, see keras::predict.keras.engine.training.Model.

callbacks

(list())
Optional callbacks to apply during prediction.

type

(character(1))
Type of predicted value. Choices are survival probabilities over all time-points in training data ("survival") or a relative risk ranking ("risk"), which is the negative mean survival time so higher rank implies higher risk of event, or both ("all").

distr6

(logical(1))
If FALSE (default) and type is "survival" or "all" returns matrix of survival probabilities, otherwise returns a distr6::VectorDistribution().

...

ANY
Currently ignored.

Value

A numeric if type = "risk", a distr6::VectorDistribution() (if distr6 = TRUE) and type = "survival"; a matrix if (distr6 = FALSE) and type = "survival" where entries are survival probabilities with rows of observations and columns are time-points; or a list combining above if type = "all".

Examples

if (requireNamespaces(c("keras", "pseudo")))
  fit <- dnnsurv(data = simsurvdata(10))

  # predict survival matrix and relative risks
  predict(fit, simsurvdata(10), type = "all")

  # return as distribution
  if (requireNamespaces("distr6")) {
    predict(fit, simsurvdata(10), distr6 = TRUE)
  }

survivalmodels

Models for Survival Analysis

v0.1.11
MIT + file LICENSE
Authors
Raphael Sonabend [aut, cre] (<https://orcid.org/0000-0001-9225-4654>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.