build_keras_net: Build a Keras Multilayer Perceptron

View source: R/helpers_keras.R

build_keras_netR Documentation

Build a Keras Multilayer Perceptron

Description

Utility function to build a Keras MLP.

Usage

build_keras_net(
  n_in,
  n_out,
  nodes = c(32L, 32L),
  layer_pars = list(),
  activation = "linear",
  act_pars = list(),
  dropout = 0.1,
  batch_norm = TRUE,
  batch_pars = list()
)

Arguments

n_in

(integer(1))
Number of input features.

n_out

(integer(1))
Number of targets.

nodes

(numeric())
Hidden nodes in network, each element in vector represents number of hidden nodes in respective layer.

layer_pars

(list())
Arguments passed to keras::layer_dense.

activation

(character(1))
Activation function passed to keras::layer_activation. Default is linear.

act_pars

(list())
Parameters for activation function, see keras::layer_activation.

dropout

(numeric(1))
Optional dropout layer, if NULL then no dropout layer added otherwise either same dropout will be added to all layers.

batch_norm

(logical(1))
If TRUE (default) then batch normalisation is applied to all layers.

batch_pars

(list())
Parameters for batch normalisation, see keras::layer_batch_normalization.

Details

This function is a helper for R users with less Python experience. Currently it is limited to simple MLPs and with identical layers. More advanced networks will require manual creation with keras.

Value

No return value.


survivalmodels documentation built on May 29, 2024, 7:26 a.m.