def approx_hessian(point, vars=None, model=None):
 from numdifftools import Jacobian
 model = modelcontext(model)
 if (vars is None):
  vars = model.cont_vars
 vars = inputvars(vars)
 point = Point(point, model=model)
 bij = DictToArrayBijection(ArrayOrdering(vars), point)
 dlogp = bij.mapf(model.fastdlogp(vars))
 def grad_logp(point):
  return np.nan_to_num(dlogp(point))
 '\n    Find the jacobian of the gradient function at the current position\n    this should be the Hessian; invert it to find the approximate\n    covariance matrix.\n    '
 return (- Jacobian(grad_logp)(bij.map(point)))

def approx_hessian ( point , vars = None , model = None ) : from numdifftools import Jacobian model = modelcontext ( model ) if ( vars is None ) : vars = model . cont_vars vars = inputvars ( vars ) point = Point ( point , model = model ) bij = DictToArrayBijection ( ArrayOrdering ( vars ) , point ) dlogp = bij . mapf ( model . fastdlogp ( vars ) ) def grad_logp ( point ) : return np . nan_to_num ( dlogp ( point ) ) '\n    Find the jacobian of the gradient function at the current position\n    this should be the Hessian; invert it to find the approximate\n    covariance matrix.\n    ' return ( - Jacobian ( grad_logp ) ( bij . map ( point ) ) )
returns an approximation of the hessian at the current chain location .