gradchek(w, func, grad) [gradient, delta] = gradchek(w, func, grad) gradchek(w, func, grad, p1, p2, ...)
gradchek(w, func, grad)
checks how accurate the gradient
grad
of a function func
is at a parameter vector x
.
A central
difference formula with step size 1.0e-6 is used, and the results
for both gradient function and finite difference approximation are
printed.
The optional return value gradient
is the gradient calculated
using the function grad
and the return value delta
is the
difference between the functional and finite difference methods of
calculating the graident.
gradchek(x, func, grad, p1, p2, ...)
allows additional arguments
to be passed to func
and grad
.
conjgrad
, graddesc
, hmc
, olgd
, quasinew
, scg
Copyright (c) Ian T Nabney (1996-9)