Learn R Programming

survivalSL (version 0.98)

tunePLANN: Tune a Survival Neural Network Based on the PLANN Method

Description

This function finds the optimal inter, size, decay, maxit, and MaxNWts parameters for the survival neural network.

Usage

tunePLANN(formula, data, cv=10, inter=1, size=c(2, 4, 6, 8, 10),
decay=c(0.001, 0.01, 0.02, 0.05), maxit=100, MaxNWts=10000, maxtime=NULL,
seed=NULL,metric="auc", pro.time=NULL,
ROC.precision=seq(.01, .99, by=.01))

Value

optimal

The value of inter, size, decay, maxit, and MaxNWts that optimizes the cross-validated value of the metric/loss function.

results

The data frame with the cross-validated value of the metric/loss function according to inter, size, decay, maxit, and MaxNWts.

Arguments

formula

A formula object, with the response on the left of a ~ operator, and the terms on the right. The response must be a survival object as returned by the Surv function.

data

A data frame for training the model with the same covariates as in the formula.

cv

The value of the number of folds. The default value is 10.

metric

The loss function or metric. See details. Default metric is Area Under ROC ("auc").

inter

The length of the intervals.

size

The number of units in the hidden layer.

decay

The parameter for weight decay.

maxit

The maximum number of iterations.

MaxNWts

The maximum allowable number of weights.

maxtime

A numeric value with the maximum prognostic. If NULL, the maximum prognostic time is the highest time observed in the data + 1.

pro.time

This optional value of prognostic time represents the maximum delay for which the capacity of the variable is evaluated. The same unit than the one used in the argument times. Not used for the following metrics: "ll", "ibs", and "ibll". Default value is the time at which half of the subjects are still at risk.

seed

A random seed to ensure reproducibility during the cv process. If NULL, a seed is randomly assigned.

ROC.precision

The percentiles (between 0 and 1) of the prognostic variable used for computing each point of the time dependent ROC curve. Only used when metric="auc". 0 (min) and 1 (max) are not allowed. By default: seq(.01,.99,.01).

Details

The function runs the flexsurvspline function of the flexsurv package. The following metrics can be used : "bs" for the Brier score at the prognostic time pro.time, "p_ci" and "uno_ci" for the concordance index at the prognostic time pro.time (Pencina and Uno versions), "ll" for the log-likelihood, "ibs" for the integrated Brier score up to the last observed time in the training data, "ibll" for the integrated binomial log-likelihood up to the last observed time in the training data, "ribs" for the restricted integrated Brier score up to the prognostic time pro.time, "ribll" for the restricted integrated binomial log-likelihood up to the prognostic time pro.time, "bll" for the binomial log-likelihood, "auc" for the area under the time-dependent ROC curve up to the prognostic time pro.time.

References

Biganzoli E, Boracchi P, Mariani L, and et al. Feed forward neural networks for the analysis of censored survival data: a partial logistic regression approach. Stat Med, 17:1169-86, 1998.

Examples

Run this code
data("dataDIVAT2")

formula<-Surv(times,failures) ~ age + hla + retransplant + ecd
tune.model <- tunePLANN(formula=formula, data=dataDIVAT2[1:150,],
cv=5, inter=c(2,1), size=c(16,32), decay=0.01, maxit=100, MaxNWts=1000,
maxtime=NULL,seed=123,metric="auc",
pro.time=NULL,ROC.precision=seq(.01, .99, by=.01))

tune.model$optimal # the optimal hyperparameters

tune.model$results

Run the code above in your browser using DataLab