You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
diagnose: the error argument is sent as epsilon; the output directory is never removed #871
cmdstanpy/model.py, CmdStanModel.diagnose, on develop:
ifepsilonisnotNone:
cmd.append(f"epsilon={epsilon}")
iferrorisnotNone:
cmd.append(f"epsilon={error}") # should be f"error={error}"
...
output_dir=tempfile.mkdtemp(prefix=self.name, dir=_TMPDIR) # never removed
CmdStan 2.40.0's argument tree accepts both sub-arguments under diagnose test=gradient (output of <model> diagnose help-all):
gradient
Valid subarguments: epsilon, error
epsilon=<double> Finite difference step size Defaults to 1e-6
error=<double> Error threshold Defaults to 1e-6
Effect
diagnose(error=x) silently sets the finite-difference step to x, and the error threshold stays at its default 1e-6. The gradient check then judges against a threshold the caller did not ask for, using a step size the caller did not ask for.
Add a test asserting that the command carries error= (the logged command, as the log_prob tests do) and that _TMPDIR's entry count is unchanged after calls on both the success path and the failure path.
We can fold this into #869, or open a separate PR, whichever you prefer.
Versions
cmdstanpy develop (also 1.3.0), CmdStan 2.40.0, Python 3.12, Linux x86_64.
Activity
WardBrian commentedon Oct 9, 2026
This would be welcome as a second PR.