pymc-devs / pymc-devs/pymc

Allow partial imputation with `pm.observe`

Open
#7,204 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

One tricky thing will be to work in conjunction with #6932

Partial imputation is a model transformation that happens usually at model.register_rv and creates two model RVs (the observed and unobserved components) that are the joined together in a deterministic (with the original name) to look like a single entity in case the variable is used downstream elsewhere (or just so it shows in the trace)

We could read nan in constant values and do the same automatic imputation as observe does.

Besides this, and what I think is a better API, we could add a mask kwarg, that specifies which subset dimensions of the variable are to be observed, and then trigger the same kind of model transformation that observe=[x, np.nan]) does. This could be done without a warning because it's explicit.

The second approach as the benefit that the mask can be a shared variable (i.e., pm.Data) that can be updated later. See #6626

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 by reviewing model.register_rv and pm.observe, then read the interactions described in #6932 and #6626. The work is complete when partial observations can be handled through the proposed nan behavior or explicit mask, including a mask backed by pm.Data, without breaking downstream model use.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.