build_dnn: Build a Deep Neural Network for Survival Analysis

View source: R/survdnn.R

build_dnnR Documentation

Build a Deep Neural Network for Survival Analysis

Description

Constructs a multilayer perceptron (MLP) with optional batch normalization and dropout. Used internally by [survdnn()] to define the model architecture.

Usage

build_dnn(
  input_dim,
  hidden,
  activation = "relu",
  output_dim = 1L,
  dropout = 0.3,
  batch_norm = TRUE
)

Arguments

input_dim

Integer. Number of input features.

hidden

Integer vector. Sizes of the hidden layers (e.g., c(32, 16)).

activation

Character. Name of the activation function to use in each layer. Supported options: '"relu"', '"leaky_relu"', '"tanh"', '"sigmoid"', '"gelu"', '"elu"', '"softplus"'.

output_dim

Integer. Output layer dimension (default = 1).

dropout

Numeric between 0 and 1. Dropout rate after each hidden layer (default = 0.3). Set to 0 to disable dropout.

batch_norm

Logical; whether to add 'nn_batch_norm1d()' after each hidden linear layer (default = TRUE).

Value

A 'nn_sequential' object representing the network.


survdnn documentation built on Jan. 8, 2026, 9:07 a.m.