pymc-devs / pymc-devs/pymc

Consider accepting observed in sample_posterior_prodective `freeze_vars`

Open
#8,341 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

request discussion samplers
Dominant language
Python
Stars
9.8k
Forks
2.3k
Avg merge
21h 39m
Merged PRs (30d)
5

Description

Description

This would mean that observed RVs in sampled graphs should be replaced by their observed data.

If you try that now you get something like ValueError - freeze_vars ['obs'] are not present in the trace. Cannot freeze variables without stored values.

This showed up when implementing model.conditional in pymc-extras, as we want the conditional variables to depend on the observed values, to get the proper conditional posterior distribution. The natural way was to make them depend on the observed RV and then freeze the RVs during posterior_predictive, but this is exactly what's not supported.

I'm not sure though, specially with the behavior when not set, do we issue warnings on dependents? Probably not.

I'd leave this as a discussion issue until demand is more clear.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at sample_posterior_predictive handling of freeze_vars and reproduce the ValueError when an observed RV is passed. Compare the behavior needed by model.conditional: observed RVs should be replaced by their observed data, while the behavior when freeze_vars is unset remains to be decided.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.