pymc icon indicating copy to clipboard operation
pymc copied to clipboard

Further explanation when Potentials have impact on posterior sampling

Open williambdean opened this issue 8 months ago • 2 comments

When does the use of Potential have an impact on posterior predictive sampling?

https://github.com/pymc-devs/pymc/blob/6ef135b6cbeaee3c3be1efb7a5af1ddfdbc3c861/pymc/model/core.py?plain=1#L2274-L2278

It seems like sampling distributions only given InferenceData.posterior samples would not be affected by Potentials. Is it possible to refrain from warning given the variables being sampled?

williambdean avatar Mar 31 '25 13:03 williambdean

It seems like sampling distributions only given InferenceData.posterior samples would not be affected by Potentials.

What does this mean?

I guess Potentials can only affect what is in their graph, so we could do a fancier check. However, if you have a model with Potentials and know it's safe you can also suppress the warning on your end? We can define a warning subclass to make it easier to filter.

ricardoV94 avatar Mar 31 '25 17:03 ricardoV94

For instance, examples that use the potential to add a constraint to the parameters of the model. However, this is still a likelihood of the model

https://github.com/pymc-devs/pymc/blob/af81955f799e1fba1adcf839454ccc0be851008a/pymc/model/core.py?plain=1#L2344-L2353

In comparison, the last example which uses the potential as the primary lielihood of the model

https://github.com/pymc-devs/pymc/blob/af81955f799e1fba1adcf839454ccc0be851008a/pymc/model/core.py?plain=1#L2359-L2371

Is it correct to think the effect of sampling with posterior is different in these two cases? And the first one would not be affected if just looking at the likelihood variable?

williambdean avatar Apr 02 '25 20:04 williambdean