build_keras_net: Build a Keras Multilayer Perceptron

Description Usage Arguments Details Examples

View source: R/build_keras_net.R

Description

Utility function to build a Keras MLP.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
build_keras_net(
  n_in,
  n_out,
  nodes = c(32, 32),
  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.

Examples

1
2
3
build_keras_net(10, 1)

build_keras_net(n_in = 10, n_out = 1, nodes = c(4, 4, 4), activation = "elu")

mlr3learners/mlr3learners.proba documentation built on Aug. 9, 2020, 12:50 a.m.