DOC: pymc.CustomDist example does not work in the documentation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9.8k
- Forks
- 2.3k
- Avg merge
- 21h 39m
- Merged PRs (30d)
- 5
Description
Issue with current documentation:
When trying to run the following example code from the PYMC.CustomDist documentation, I get the error message "Core implementation of CustomDist_custom_dist_rv{"()->()"} not implemented":
from typing import Optional, Tuple
import numpy as np
import pymc as pm
from pytensor.tensor import TensorVariable
def logp(value: TensorVariable, mu: TensorVariable) -> TensorVariable:
return -(value - mu)**2
def random(
mu: np.ndarray | float,
rng: Optional[np.random.Generator] = None,
size : Optional[Tuple[int]]=None,
) -> np.ndarray | float :
return rng.normal(loc=mu, scale=1, size=size)
with pm.Model():
mu = pm.Normal('mu', 0 , 1)
pm.CustomDist(
'custom_dist',
mu,
logp=logp,
random=random,
signature="()->()",
observed=np.random.randn(100, 3),
size=(100, 3),
)
prior = pm.sample_prior_predictive(10)
Idea or request for content:
I do not know enough about PYMC to determine if this is a bug, my leaving something out, or the code not being correctly written in the documentation. If it is a bug, I will gladly report it as such. If if is not, please let me know what the correction is.
Contributor 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.
Research direction
Start from the CustomDist documentation example shown in the issue and run it to reproduce the CustomDist_custom_dist_rv error. Check the documented CustomDist API and example context to determine whether the snippet is incomplete or incorrect; done when the published example runs successfully or clearly documents the required correction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100