Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in examples/survival_analysis/weibull_aft.ipynb #746

Open
wd60622 opened this issue Nov 19, 2024 · 0 comments
Open

Error in examples/survival_analysis/weibull_aft.ipynb #746

wd60622 opened this issue Nov 19, 2024 · 0 comments

Comments

@wd60622
Copy link

wd60622 commented Nov 19, 2024

The deprecated testval argument is being used.

─────────────────────────────────────────── Error running examples/survival_analysis/weibull_aft.ipynb ───────────────────────────────────────────

---------------------------------------------------------------------------
Exception encountered at "In [12]":
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[12], line 3
      1 with pm.Model() as model_2:
      2     alpha = pm.Normal("alpha", mu=0, sigma=10)
----> 3     r = pm.Gamma("r", alpha=1, beta=0.001, testval=0.25)
      4     beta = pm.Deterministic("beta", pt.exp(-alpha / r))
      6     y_obs = pm.Weibull("y_obs", alpha=r, beta=beta, observed=y[~censored])

File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/distributions/distribution.py:511, in Distribution.__new__(cls, name, rng,
dims, initval, observed, total_size, transform, default_transform, *args, **kwargs)
    508     elif observed is not None:
    509         kwargs["shape"] = tuple(observed.shape)
--> 511 rv_out = cls.dist(*args, **kwargs)
    513 rv_out = model.register_rv(
    514     rv_out,
    515     name,
   (...)
    521     initval=initval,
    522 )
    524 # add in pretty-printing support

File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/distributions/continuous.py:2371, in Gamma.dist(cls, alpha, beta, mu,
sigma, **kwargs)
   2369 # PyTensor gamma op is parametrized in terms of scale (1/beta)
   2370 scale = pt.reciprocal(beta)
-> 2371 return super().dist(, **kwargs)

File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pymc/distributions/distribution.py:580, in Distribution.dist(cls, dist_params,
shape, **kwargs)
    577     ndim_supp = cls.rv_op(*dist_params, **kwargs).owner.op.ndim_supp
    579 create_size = find_size(shape=shape, size=size, ndim_supp=ndim_supp)
--> 580 rv_out = cls.rv_op(*dist_params, size=create_size, **kwargs)
    582 _add_future_warning_tag(rv_out)
    583 return rv_out

File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pytensor/tensor/random/basic.py:450, in GammaRV.__call__(self, shape, scale,
size, **kwargs)
    429 def __call__(self, shape, scale, size=None, **kwargs):
    430     r"""Draw samples from a gamma distribution.
    431
    432     Signature
   (...)
    448
    449     """
--> 450     return super().__call__(shape, scale, size=size, **kwargs)

File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pytensor/tensor/random/op.py:312, in RandomVariable.__call__(self, size, name,
rng, dtype, *args, **kwargs)
    310     props["dtype"] = dtype
    311     new_op = type(self)(**props)
--> 312     return new_op.__call__(
    313         *args, size=size, name=name, rng=rng, dtype=dtype, **kwargs
    314     )
    316 res = super().__call__(rng, size, *args, **kwargs)
    318 if name is not None:

File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pytensor/tensor/random/basic.py:450, in GammaRV.__call__(self, shape, scale,
size, **kwargs)
    429 def __call__(self, shape, scale, size=None, **kwargs):
    430     r"""Draw samples from a gamma distribution.
    431
    432     Signature
   (...)
    448
    449     """
--> 450     return super().__call__(shape, scale, size=size, **kwargs)

File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pytensor/tensor/random/op.py:316, in RandomVariable.__call__(self, size, name,
rng, dtype, *args, **kwargs)
    311     new_op = type(self)(**props)
    312     return new_op.__call__(
    313         *args, size=size, name=name, rng=rng, dtype=dtype, **kwargs
    314     )
--> 316 res = super().__call__(rng, size, *args, **kwargs)
    318 if name is not None:
    319     res.name = name

File ~/micromamba/envs/pymc-examples/lib/python3.11/site-packages/pytensor/graph/op.py:293, in Op.__call__(self, name, return_list, *inputs,
**kwargs)
    249 def __call__(
    250     self, *inputs: Any, name=None, return_list=False, **kwargs
    251 ) -> Variable | list[Variable]:
    252     r"""Construct an `Apply` node using :meth:`Op.make_node` and return its outputs.
    253
    254     This method is just a wrapper around :meth:`Op.make_node`.
   (...)
    291
    292     """
--> 293     node = self.make_node(*inputs, **kwargs)
    294     if name is not None:
    295         if len(node.outputs) == 1:

TypeError: RandomVariable.make_node() got an unexpected keyword argument 'testval'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant