dnnet: Multilayer Perceptron Model for Regression or Classification

View source: R/2-2-dnnet.R

dnnetR Documentation

Multilayer Perceptron Model for Regression or Classification

Description

Fit a Multilayer Perceptron Model for Regression or Classification

Usage

dnnet(
  train,
  validate = NULL,
  load.param = FALSE,
  initial.param = NULL,
  family = c("gaussin", "binomial", "multinomial", "poisson", "negbin", "coxph",
    "poisson-nonzero", "negbin-nonzero", "zip", "zinb")[1],
  norm.x = TRUE,
  norm.y = ifelse(is.factor(train@y) || (class(train) == "dnnetSurvInput") || (family
    %in% c("poisson", "poisson-nonzero", "zip", "zinb")), FALSE, TRUE),
  activate = "relu",
  n.hidden = c(10, 10),
  learning.rate = ifelse(learning.rate.adaptive %in% c("adam"), 0.001, 0.01),
  l1.reg = 0,
  l2.reg = 0,
  n.batch = 100,
  n.epoch = 100,
  early.stop = ifelse(is.null(validate), FALSE, TRUE),
  early.stop.det = 1000,
  plot = FALSE,
  accel = c("rcpp", "none")[1],
  learning.rate.adaptive = c("constant", "adadelta", "adagrad", "momentum", "adam",
    "amsgrad")[5],
  rho = c(0.9, 0.95, 0.99, 0.999)[ifelse(learning.rate.adaptive == "momentum", 1, 3)],
  epsilon = c(10^-10, 10^-8, 10^-6, 10^-4)[2],
  beta1 = 0.9,
  beta2 = 0.999,
  loss.f = ifelse(is.factor(train@y), "logit", "mse"),
  pathway = FALSE,
  pathway.list = NULL,
  pathway.active = "identity",
  l1.pathway = 0,
  l2.pathway = 0
)

Arguments

train

A dnnetInput or a dnnetSurvInput object, the training set.

validate

A dnnetInput or a dnnetSurvInput object, the validation set, optional.

load.param

Whether initial parameters are loaded into the model.

initial.param

The initial parameters to be loaded.

family

If it's specified as Poisson, a poisson model with log link will be fitted.

norm.x

A boolean variable indicating whether to normalize the input matrix.

norm.y

A boolean variable indicating whether to normalize the response (if continuous).

activate

Activation Function. One of the following, "sigmoid", "tanh", "relu", "prelu", "elu", "celu".

n.hidden

A numeric vector for numbers of nodes for all hidden layers.

learning.rate

Initial learning rate, 0.001 by default; If "adam" is chosen as an adaptive learning rate adjustment method, 0.1 by defalut.

l1.reg

weight for l1 regularization, optional.

l2.reg

weight for l2 regularization, optional.

n.batch

Batch size for batch gradient descent.

n.epoch

Maximum number of epochs.

early.stop

Indicate whether early stop is used (only if there exists a validation set).

early.stop.det

Number of epochs of increasing loss to determine the early stop.

plot

Indicate whether to plot the loss.

accel

"rcpp" to use the Rcpp version and "none" (default) to use the R version for back propagation.

learning.rate.adaptive

Adaptive learning rate adjustment methods, one of the following, "constant", "adam", "amsgrad", "adadelta", "adagrad".

rho

A parameter used in momentum.

epsilon

A parameter used in Adagrad and Adam.

beta1

A parameter used in Adam.

beta2

A parameter used in Adam.

loss.f

Loss function of choice.

pathway

If pathway.

pathway.list

Pathway list.

pathway.active

Activation function for the pathway layer.

l1.pathway

The weight for l1-panelty for the pathway layer.

l2.pathway

The weight for l2-panelty for the pathway layer.

Value

Returns a DnnModelObj object.

See Also

dnnet-class
dnnetInput-class
actF


SkadiEye/deepTL documentation built on Nov. 17, 2022, 1:41 p.m.