nnetHess                package:nnet                R Documentation

_E_v_a_l_u_a_t_e_s _H_e_s_s_i_a_n _f_o_r _a _N_e_u_r_a_l _N_e_t_w_o_r_k

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

     nnetHess(net, x, y, weights)

_A_r_g_u_m_e_n_t_s:

     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. 

_V_a_l_u_e:

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

_R_e_f_e_r_e_n_c_e_s:

     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.

_S_e_e _A_l_s_o:

     'nnet', 'predict.nnet'

_E_x_a_m_p_l_e_s:

     data(iris3)
     # 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

