I tried to implement the Hierarchical linear regression in general marginal formulation on the example model page. However, when I try to run the model (copied and pasted the code from the site) it produces this error:
Error: TensorFlow hit a numerical problem that caused it to error. greta can handle these as bad proposals if you rerun mcmc() with the argument one_by_one = TRUE. This will slow down the sampler slightly.
Error in py_call_impl(callable, dots$args, dots$keywords): InvalidArgumentError: Input matrix is not invertible.
[[node mcmc_sample_chain_1/trace_scan/while/smart_for_loop/while/mh_one_step/hmc_kernel_one_step/leapfrog_integrate/while/leapfrog_integrate_one_step/maybe_call_fn_and_grads/value_and_gradients/MultivariateNormalTriL/log_prob/affine_linear_operator/inverse/LinearOperatorLowerTriangular/solve/LinearOperatorLowerTriangular/solve/MatrixTriangularSolve/MatrixTriangularSolve (defined at \Users\Chris Baldock\Anaconda3\envs\r-reticulate\lib\site-packages\tensorflow_core\python\framework\ops.py:1748) ]]
Original stack trace for 'mcmc_sample_chain_1/trace_scan/while/smart_for_loop/while/mh_one_step/hmc_kernel_one_step/leapfrog_integrate/while/leapfrog_integrate_one_step/maybe_
If I use one_by_one = true in the sampler, it gets through the warmup but then fails at sampling with this error:
Error in py_call_impl(callable, dots$args, dots$keywords): UnimplementedError: TensorArray has size zero, but element shape [?,3] is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays.
[[node mcmc_sample_chain_3/trace_scan/TensorArrayStack_9/TensorArrayGatherV3 (defined at \tensorflow_core\python\framework\ops.py:1748) ]]
Original stack trace for ‘mcmc_sample_chain_3/trace_scan/TensorArrayStack_9/TensorArrayGatherV3’:
File “\tensorflow_probability\python\mcmc\sample.py”, line 361, in sample_chain
File “\tensorflow_probability\python\mcmc\internal\util.py”, line 372, in trace_scan
stacked_trace = tf.nest.map_structure(lambda x: x.stack(), trace_arrays)
File “\tensorflow_core\python\util\nest.py”, line 536, in map_structure
structure, [func(*x) for x in entries],
File “\tensorflow_core\python\util\nest.py”, line 536, in
Error in (function (…, deparse.level = 1) :
number of rows of matrices must match (see arg 2)
If I run a multivariate normal with sigma to have diagonal elements as one and off diagonals as zero:
There is no problem.
Any ideas of what is causing this issue?
I have greta version 0.3.1. and tensorflow version 1.15.