/netlab3.3/nethess.m

http://pmtksupport.googlecode.com/ · MATLAB · 31 lines · 9 code · 5 blank · 17 comment · 1 complexity · a9762b0e3c8770a54ba578970980e0c4 MD5 · raw file

  1. function [h, varargout] = nethess(w, net, x, t, varargin)
  2. %NETHESS Evaluate network Hessian
  3. %
  4. % Description
  5. %
  6. % H = NETHESS(W, NET, X, T) takes a weight vector W and a network data
  7. % structure NET, together with the matrix X of input vectors and the
  8. % matrix T of target vectors, and returns the value of the Hessian
  9. % evaluated at W.
  10. %
  11. % [E, VARARGOUT] = NETHESS(W, NET, X, T, VARARGIN) also returns any
  12. % additional return values from the network Hessian function, and
  13. % passes additional arguments to that function.
  14. %
  15. % See also
  16. % NETERR, NETGRAD, NETOPT
  17. %
  18. % Copyright (c) Ian T Nabney (1996-2001)
  19. hess_str = [net.type, 'hess'];
  20. net = netunpak(net, w);
  21. [s{1:nargout}] = feval(hess_str, net, x, t, varargin{:});
  22. h = s{1};
  23. for i = 2:nargout
  24. varargout{i-1} = s{i};
  25. end
  26. end