stan-dev / httpstan

HTTP interface to Stan, a package for Bayesian inference.
ISC License
39 stars 15 forks source link

Save output of `print`s if init fails #595

Closed riddell-stan closed 2 years ago

riddell-stan commented 2 years ago

Minimal example:

import stan

stan_code = """
parameters { 
  real<upper=0.0> y; 
}
model{
  print(y);
  target += log(y);
}
"""
posterior = stan.build(stan_code, data={})
fit = posterior.sample(num_chains=1, num_samples=1)

See forum discussion https://discourse.mc-stan.org/t/debugging-pystan3/27280

When addressing this, it might also be a good idea to see if the verbosity of the error message (on the pystan side) could be reduced.