Daniel@0: Daniel@0: Daniel@0: Daniel@0: Netlab Reference Manual gradchek Daniel@0: Daniel@0: Daniel@0: Daniel@0:

gradchek Daniel@0:

Daniel@0:

Daniel@0: Purpose Daniel@0:

Daniel@0: Checks a user-defined gradient function using finite differences. Daniel@0: Daniel@0:

Daniel@0: Synopsis Daniel@0:

Daniel@0:
Daniel@0: 
Daniel@0: gradchek(w, func, grad)
Daniel@0: [gradient, delta] = gradchek(w, func, grad)
Daniel@0: gradchek(w, func, grad, p1, p2, ...)
Daniel@0: 
Daniel@0: Daniel@0: Daniel@0:

Daniel@0: Description Daniel@0:

Daniel@0: This function is intended as a utility for other netlab functions Daniel@0: (particularly optimisation functions) to use. It enables the user Daniel@0: to check whether a gradient calculation has been correctly implmented Daniel@0: for a given function. Daniel@0: gradchek(w, func, grad) checks how accurate the gradient Daniel@0: grad of a function func is at a parameter vector x. Daniel@0: A central Daniel@0: difference formula with step size 1.0e-6 is used, and the results Daniel@0: for both gradient function and finite difference approximation are Daniel@0: printed. Daniel@0: The optional return value gradient is the gradient calculated Daniel@0: using the function grad and the return value delta is the Daniel@0: difference between the functional and finite difference methods of Daniel@0: calculating the graident. Daniel@0: Daniel@0:

gradchek(x, func, grad, p1, p2, ...) allows additional arguments Daniel@0: to be passed to func and grad. Daniel@0: Daniel@0:

Daniel@0: See Also Daniel@0:

Daniel@0: conjgrad, graddesc, hmc, olgd, quasinew, scg
Daniel@0: Pages: Daniel@0: Index Daniel@0:
Daniel@0:

Copyright (c) Ian T Nabney (1996-9) Daniel@0: Daniel@0: Daniel@0: Daniel@0: