We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Posterior sampling over a Normal with observed nans works, while the same doesn't work with a TruncatedNormal.
import pymc as pm with pm.Model(): mu1 = pm.TruncatedNormal("mu1", mu=1, sigma=2, lower=0) pm.Normal("x1", mu=mu1, sigma=.5, observed=np.array([.1, .2, .5, np.nan, np.nan])) pm.sample() # works mu2 = pm.TruncatedNormal("mu2", mu=1, sigma=2, lower=0) pm.TruncatedNormal("x2", mu=mu2, sigma=.5, lower=0, observed=np.array([.1, .2, .5, np.nan, np.nan])) pm.sample() # does not work
<details> SamplingError Traceback (most recent call last) Cell In[155], line 8 6 mu2 = pm.TruncatedNormal("mu2", mu=1, sigma=2, lower=0) 7 pm.TruncatedNormal("x2", mu=mu2, sigma=.5, lower=0, observed=np.array([.1, .2, .5, np.nan, np.nan])) ----> 8 pm.sample() File ~/micromamba/envs/pymc5/lib/python3.11/site-packages/pymc/sampling/mcmc.py:706, in sample(draws, tune, chains, cores, random_seed, progressbar, step, nuts_sampler, initvals, init, jitter_max_retries, n_init, trace, discard_tuned_samples, compute_convergence_checks, keep_warning_stat, return_inferencedata, idata_kwargs, nuts_sampler_kwargs, callback, mp_ctx, model, **kwargs) 704 ip: Dict[str, np.ndarray] 705 for ip in initial_points: --> 706 model.check_start_vals(ip) 707 _check_start_shape(model, ip) 709 # Create trace backends for each chain File ~/micromamba/envs/pymc5/lib/python3.11/site-packages/pymc/model/core.py:1702, in Model.check_start_vals(self, start) 1699 initial_eval = self.point_logps(point=elem) 1701 if not all(np.isfinite(v) for v in initial_eval.values()): -> 1702 raise SamplingError( 1703 "Initial evaluation of model at starting point failed!\n" 1704 f"Starting values:\n{elem}\n\n" 1705 f"Logp initial evaluation results:\n{initial_eval}\n" 1706 "You can call `model.debug()` for more details." 1707 ) SamplingError: Initial evaluation of model at starting point failed! Starting values: {'mu1_interval__': array(-0.22790012), 'x1_unobserved': array([1.02430783, 0.49541385]), 'mu2_interval__': array(0.51429339), 'x2_unobserved_interval__': array([-inf, -inf])} Logp initial evaluation results: {'mu1': -1.48, 'x1_unobserved': -0.74, 'mu2': -0.79, 'x2_unobserved': -inf, 'x1_observed': -2.53, 'x2_observed': -12.71} You can call `model.debug()` for more details.
5.8.0
No response
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the issue:
Posterior sampling over a Normal with observed nans works, while the same doesn't work with a TruncatedNormal.
Reproduceable code example:
Error message:
5.8.0
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: