create.mlp: Initialize a Neural Network.

View source: R/create.mlp.R View source: R/.ipynb_checkpoints/create.mlp-checkpoint.R

create.mlpR Documentation

Initialize a Neural Network.

Description

Create a new neural network to fitting tabular data. The network is initialized randomized weights and should be trained with the 'train()' function.

Usage

create.mlp(
  formula,
  data = NULL,
  hidden = c(),
  type = NULL,
  activation = "leaky.relu",
  valid.split = 0.25,
  randomize = TRUE,
  learning.rate = 0.001,
  momentum.beta = 0.9,
  rmsprop.beta = 0.999,
  batch.size = 64
)

Arguments

formula

An object of class 'formula' describing the model to be fit.

data

A 'data.frame' object containing the training and validation data.

hidden

A vector indicating how many layers and hidden notes the network will have. Passing c(4,5,2) creates a network with 3 hidden layers with 4, 5, and 2 nodes, respectively.

type

One of "regression", "logistic", or "classification".

activation

The name of a function to be used for activations in the hidden layers. "leaky.relu", "relu", "tanh", and "sigmoid" are included in the package.

valid.split

The fraction of the data to be used for validation.

randomize

If TRUE, the data frame will be randomly sampled before train/validation split. If not, the final rows are the validation data.

learning.rate

The learning rate of the network.

momentum.beta

Beta parameter for gradient descent with momentum.

batch.size

Minibatch size. Choosing 1 is equivalent to stochastic gradient descent.

rmpsprop.beta

Beta parameter for RMSprop gradient descent.

Value

An object of class 'mlp'

Examples

 create.mlp(Species ~ ., data=iris, hidden=c(5,5,5), type="classification")

Greg-Hallenbeck/easy.mlp documentation built on March 10, 2023, 6:31 a.m.