Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nnet.Hess

Evaluates Hessian for a Neural Network


Description

Evaluates the Hessian (matrix of second derivatives) of the specified neural network. Normally called via argument Hess=TRUE to nnet or via vcov.multinom.

Usage

nnetHess(net, x, y, weights)

Arguments

net

object of class nnet as returned by nnet.

x

training data.

y

classes for training data.

weights

the (case) weights used in the nnet fit.

Value

square symmetric matrix of the Hessian evaluated at the weights stored in the net.

References

Ripley, B. D. (1996) Pattern Recognition and Neural Networks. Cambridge.

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

See Also

Examples

# use half the iris data
ir <- rbind(iris3[,,1], iris3[,,2], iris3[,,3])
targets <- matrix(c(rep(c(1,0,0),50), rep(c(0,1,0),50), rep(c(0,0,1),50)),
150, 3, byrow=TRUE)
samp <- c(sample(1:50,25), sample(51:100,25), sample(101:150,25))
ir1 <- nnet(ir[samp,], targets[samp,], size=2, rang=0.1, decay=5e-4, maxit=200)
eigen(nnetHess(ir1, ir[samp,], targets[samp,]), TRUE)$values

nnet

Feed-Forward Neural Networks and Multinomial Log-Linear Models

v7.3-16
GPL-2 | GPL-3
Authors
Brian Ripley [aut, cre, cph], William Venables [cph]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.