Package paramz :: Package core :: Module gradcheckable :: Class Gradcheckable
[hide private]
[frames] | no frames]

Class Gradcheckable

source code


Adds the functionality for an object to be gradcheckable. It is just a thin wrapper of a call to the highest parent for now. TODO: Can be done better, by only changing parameters of the current parameter handle, such that object hierarchy only has to change for those.

Instance Methods [hide private]
 
__init__(self, *a, **kw)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
checkgrad(self, verbose=0, step=1e-06, tolerance=0.001, df_tolerance=1e-12)
Check the gradient of this parameter with respect to the highest parent's objective function.
source code
 
_checkgrad(self, param, verbose=0, step=1e-06, tolerance=0.001, df_tolerance=1e-12)
Perform the checkgrad on the model.
source code

Inherited from pickleable.Pickleable: __deepcopy__, __getstate__, __setstate__, copy, pickle

Inherited from parentable.Parentable: has_parent

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from parentable.Parentable: _parent_, _parent_index_

Properties [hide private]

Inherited from parentable.Parentable: _highest_parent_

Inherited from object: __class__

Method Details [hide private]

__init__(self, *a, **kw)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

checkgrad(self, verbose=0, step=1e-06, tolerance=0.001, df_tolerance=1e-12)

source code 

Check the gradient of this parameter with respect to the highest parent's objective function. This is a three point estimate of the gradient, wiggling at the parameters with a stepsize step. The check passes if either the ratio or the difference between numerical and analytical gradient is smaller then tolerance.

:param bool verbose: whether each parameter shall be checked individually. :param float step: the stepsize for the numerical three point gradient estimate. :param float tolerance: the tolerance for the gradient ratio or difference. :param float df_tolerance: the tolerance for df_tolerance

.. note:

  The *dF_ratio* indicates the limit of accuracy of numerical gradients.
  If it is too small, e.g., smaller than 1e-12, the numerical gradients
  are usually not accurate enough for the tests (shown with blue).

_checkgrad(self, param, verbose=0, step=1e-06, tolerance=0.001, df_tolerance=1e-12)

source code 

Perform the checkgrad on the model. TODO: this can be done more efficiently, when doing it inside here