| .fit.nnet {tidyfit} | R Documentation |
Neural Network regression for tidyfit
Description
Fits a single-hidden-layer neural network regression on a 'tidyFit' R6 class.
The function can be used with regress and classify.
Usage
## S3 method for class 'nnet'
.fit(self, data = NULL)
Arguments
self |
a 'tidyFit' R6 class. |
data |
a data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr). |
Details
Hyperparameters:
-
size(number of units in the hidden layer) -
decay(parameter for weight decay) -
maxit(maximum number of iterations)
Important method arguments (passed to m)
The function provides a wrapper for nnet::nnet.formula. See ?nnet for more details.
Implementation
For regress, linear output units (linout=True) are used, while classify implements
the default logic of nnet (entropy=TRUE for 2 target classes and softmax=TRUE for more classes).
Value
A fitted 'tidyFit' class model.
Author(s)
Phil Holzmeister
Examples
# Load data
data <- tidyfit::Factor_Industry_Returns
# Stand-alone function
fit <- m("nnet", Return ~ ., data)
fit
# Within 'regress' function
fit <- regress(data, Return ~ ., m("nnet", decay=0.5, size = 8),
.mask = c("Date", "Industry"))
# Within 'classify' function
fit <- classify(iris, Species ~ ., m("nnet", decay=0.5, size = 8))