Learn R Programming

survdnn (version 0.6.0)

build_dnn: Build a Deep Neural Network for Survival Analysis

Description

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

Usage

build_dnn(input_dim, hidden, activation = "relu", output_dim = 1L)

Value

A `nn_sequential` object representing the network.

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).

Examples

Run this code
net <- build_dnn(10, hidden = c(64, 32), activation = "relu")

Run the code above in your browser using DataLab