pymc-devs / pymc-devs/nutpie

Nutpie fails to sample when RV changes shape following `with_data`

Open
#267 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
207
Forks
28
Avg merge
7d 21h
Merged PRs (30d)
1

Description

import pymc as pm
import nutpie

with pm.Model() as model:
    x = pm.Data('x', [0,1,2])
    beta = pm.Normal('beta', mu=0, sigma=1)
    y = pm.Normal("y", mu=beta * x, sigma=1)   # fine if it's observed and we also change it's data

compiled_model = nutpie.compile_pymc_model(model)

compiled_model_set = compiled_model.with_data(x=[1,2])
nutpie.sample(compiled_model_set, chains=1)
# RuntimeError: All initialization points failed

# Caused by:
#     Logp function returned error: ErrorCode(1)

Contributor guide

No contributing guide indexed for this repository

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 running the reproducer using nutpie.compile_pymc_model, compiled_model.with_data, and nutpie.sample with the changed x shape. Trace how with_data handles the shape change and how sampling initialization reports the log-probability error. Done means the shown model samples successfully after x changes from three to two values, with regression coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.