| .fit.nnet | R Documentation |
tidyfitFits a single-hidden-layer neural network regression on a 'tidyFit' R6 class.
The function can be used with regress and classify.
## S3 method for class 'nnet'
.fit(self, data = NULL)
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). |
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).
A fitted 'tidyFit' class model.
Phil Holzmeister
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.