I write a function named gram_schmidt and have a reject
statement in it for detecting whether eigenvalues are legal. When I run the stan code by pystan in Jupyter, sometimes the reject
works as expected ( just stops the iteration) and sometimes it stops the program, like the last Exception in the following pystan feedbacks, and a RuntimeError shown in Jupyter.
Rejecting initial value:
Gradient evaluated at the initial value is not finite.
Stan can't start sampling from this initial value.
Rejecting initial value:
Error evaluating the log probability at the initial value.
Exception: Exception: gram_schmidt: Eigen values must not be negative; (in 'symx-r-init-pdf.stan' at line 70)
(in 'symx-r-init-pdf.stan' at line 398)
Rejecting initial value:
Error evaluating the log probability at the initial value.
Exception: Exception: gram_schmidt: Eigen values must not be negative; (in 'symx-r-init-pdf.stan' at line 70)
(in 'symx-r-init-pdf.stan' at line 398)
Rejecting initial value:
Error evaluating the log probability at the initial value.
Exception: Exception: gram_schmidt: Eigen values must not be negative; (in 'symx-r-init-pdf.stan' at line 70)
(in 'symx-r-init-pdf.stan' at line 398)
Rejecting initial value:
Error evaluating the log probability at the initial value.
Exception: Exception: gram_schmidt: Eigen values must not be negative; (in 'symx-r-init-pdf.stan' at line 70)
(in 'symx-r-init-pdf.stan' at line 398)
Exception: Exception: gram_schmidt: Eigen values must not be negative; (in 'symx-r-init-pdf.stan' at line 70)
(in 'symx-r-init-pdf.stan' at line 398)
Is it an expected behavior of the reject
statement? I use pystan 2.19.1.1