Skip to content

Bounded Variables appears to be broken on v4 branch #4719

Closed
@hectormz

Description

@hectormz

Description of your problem

Use of pm.Bound() does not seem to work on the v4 branch. This has been tested on PyPI version (3.10.0) which still works. Due to the evolving changes on the v4 branch and aesara version changes, I haven't pinpointed when this stopped working. I'm using Python 3.6 as comparison so I can run properly on PyPI version (On Windows).

I've also verified the same error on Ubuntu w/ python 3.7 & 3.8.

Please provide a minimal, self-contained, and reproducible example.

import numpy as np
import pymc3 as pm

xx = np.array([4.0, 4.0, 4.0, 5.0, 5.0, 5.0, 6.0, 3.0])


model_gamma = pm.Model()

with model_gamma:
    BoundedHalfNormal = pm.Bound(pm.HalfNormal, lower=0.0)

    mu = BoundedHalfNormal("μ", sigma=10)
    sigma= BoundedHalfNormal("σ", sigma=10)

    obs = pm.Gamma("obs", mu=mu, sigma=sigma, observed=xx)
    idata_gamma = pm.sample(
        draws=2_000, tune=2_000, cores=1, chains=1, return_inferencedata=True
    )

Please provide the full traceback.

WARNING (aesara.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
Traceback (most recent call last):
  File "bounded_test.py", line 12, in <module>
    mu = BoundedHalfNormal("μ", sigma=10)                                         tions.
  File "c:\users\hectormz\projects\tools\pymc3\pymc3\distributions\bound.py", line 290, in __call__
    return _ContinuousBounded(
  File "c:\users\hectormz\projects\tools\pymc3\pymc3\distributions\distribution.py",90, in __call__ line 247, in __new__
    rv_out = cls.dist(*args, rng=rng, testval=None, **kwargs)                      line 247, in __new__
TypeError: dist() takes 2 positional arguments but 5 positional arguments (and 1 keyword-only argument) were given  

Please provide any additional information below.

Working versions and main components

  • PyMC3 Version: pymc3==3.10.0
  • Aesara Version: Theano-PyMC==1.0.11
  • Python Version: 3.6
  • Operating system: Windows 10
  • How did you install PyMC3: pip

Broken versions and main components

  • PyMC3 Version: 0970af0
  • Aesara Version: aesara==2.0.10
  • Python Version: 3.6
  • Operating system: Windows 10
  • How did you install PyMC3: local pip install from repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions