Skip to content

init_nuts not used when CompoundStep is used #5658

Description

@ricardoV94

Work in #5622 revealed this issue that we seem to have had for a long time:

import pymc as pm

with pm.Model() as m:
  x = pm.Normal("x")
  y = pm.Bernoulli("y", p=0.5)
  trace = pm.sample()   # <- will not use `init_nuts` to initialize NUTS

This is actually enforced in here:

pymc/pymc/sampling.py

Lines 2278 to 2279 in 80b5e86

if set(vars) != set(model.value_vars):
raise ValueError("Must use init_nuts on all variables of a model.")

It seems that we should find a solution to initialize nuts robustly when it only applies to a subset of variables, unless there are good reasons not to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions