nn_fit: Fits various tracks (different random starting values) and...

View source: R/nn_fit.R

nn_fitR Documentation

Fits various tracks (different random starting values) and chooses best model

Description

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

Usage

nn_fit(...)

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

## S3 method for class '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

A list with estimates and estimated standard errors.

  • W_opt - vector of optimal weights.

  • value - value of best information criterion.

  • inf_crit_vec - value of information criterion for each initialisation.

  • convergence - value of network convergence for each initialisation (1 if maxmium iterations reached, 0 if not).

  • nn - optimal nnet object.

interpretnn object


andrew-mcinerney/statnn documentation built on June 30, 2024, 4:09 p.m.