Skip to contents

Fits n_init tracks with different initial values and decides on best model based on information criteria.

Usage

nn_fit(...)

# S3 method for default
nn_fit(
  x,
  y,
  q,
  n_init,
  inf_crit = "BIC",
  lambda = 0,
  response = "continuous",
  unif = 3,
  maxit = 1000,
  pkg = "nnet",
  ...
)

# S3 method for formula
nn_fit(
  formula,
  data,
  q,
  n_init,
  inf_crit = "BIC",
  lambda = 0,
  response = "continuous",
  unif = 3,
  maxit = 1000,
  pkg = "nnet",
  ...
)

Arguments

...

additional argument for nnet

x

Matrix of covariates

y

Vector of response

q

Number of hidden nodes

n_init

Number of random initialisations (tracks)

inf_crit

Information criterion: "BIC" (default), "AIC" or "AICc"

lambda

Ridge penalty

response

Response type: "continuous" (default) or "binary"

unif

Random initial values max value

maxit

Maximum number of iterations for nnet (default = 100)

pkg

Package for fitting neural network. One of nnet (default) or torch

formula

An object of class "formula": a two-sided object with response on the left hand side and the model variables on the right hand side.

data

A data frame containing the variables in the model

Value

The best model from the different initialisations

interpretnn object