BUG: Unexpected keyword arguments like `sd=10` are dropped
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- backend, machine-learning
Research direction
Start by reading Normal.dist and HalfNormal.dist in PyMC alongside RandomVariable.__call__ in pytensor/tensor/random/op.py, the path named in the issue. Trace how sd and unknown keyword arguments reach the random variable call, then check the relevant tests for distribution arguments. Done means sd=10 no longer silently produces the default sigma and unsupported keywords such as bogus are handled explicitly.
Written by the indexing model from the issue text.
Description
Describe the issue:
pm.Normal("x", mu=0, sd=10) builds Normal(0, 1): Normal.dist forwards sd through **kwargs, and RandomVariable.__call__ in pytensor/tensor/random/op.py drops it. bogus=10 is dropped too, and pm.HalfNormal("x", sd=10) gets sigma 1.
Reproduceable code example:
import pymc as pm
with pm.Model() as m:
stated = pm.Normal("stated", mu=0, sd=10) # means: standard deviation 10
correct = pm.Normal("correct", mu=0, sigma=10) # means: standard deviation 10
default = pm.Normal("default", mu=0) # means: standard deviation 1
print([p.eval() for p in stated.owner.inputs[2:]]) # [0, 1.0] <- sd=10 was dropped
print([p.eval() for p in correct.owner.inputs[2:]]) # [0, 10]
print([p.eval() for p in default.owner.inputs[2:]]) # [0, 1.0]
Error message:
No error and no warning.
PyMC version information:
PyMC 6.3.2 (PyTensor 3.3.4) and 6.4.0 (PyTensor 3.3.7), Python 3.12.13
Context for the issue:
Older PyMC raised a TypeError for sd=, so code that used to fail now builds a different model.
- Dominant language
- Python
- Stars
- 9.9k
- Forks
- 2.4k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 12
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pymc-devs/pymc
-
BUG: ZarrTrace fails in init_trace for models with datetime coordinates (object dtype coord array)Possibly taken @vladosskins178 claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 3 days
-
BUG: DEMetropolis/DEMetropolisZ crash when vars is a subset of the model variablesPossibly taken @Souravrajvi0 claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 3 days
-
BUG: logp of pt.max/pt.min over a multi-dimensional i.i.d. variable has shape x.shape[1:] instead of being a scalarPossibly taken @saifmodan2006 claimed this 11 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
pymc-devs/pymc#8635 · 2 comments ·
Maintainers usually reply within 3 days
-
ENH: permit cachetools >= 7May be free again @shupandee claimed this 9 days ago, and no pull request is open. Openfeature request
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
pymc-devs/pymc#8633 · 1 comment ·
Maintainers usually reply within 3 days
-
DOC: Document how to call `DifferentialEquation` in a model (`y0`, `theta`, output shape)Possibly taken @saheli56 claimed this 16 days ago. Opendocs
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
pymc-devs/pymc#8616 · 3 comments ·
Maintainers usually reply within 3 days
Similar issues
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
kornia/kornia-rs#1416 · 1 comment ·
Maintainers usually reply within 2 days
-
ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PolicyEngine/ai-inequality#64 ·
Maintainers usually reply within 1 day
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over timePossibly taken @PabloRoque claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pymc-devs/pymc-extras#839 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day