Skip to content

Bounded Variables appears to be broken on v4 branch #4719

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

Closed
hectormz opened this issue May 25, 2021 · 4 comments
Closed

Bounded Variables appears to be broken on v4 branch #4719

hectormz opened this issue May 25, 2021 · 4 comments

Comments

@hectormz
Copy link
Contributor

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
@ricardoV94
Copy link
Member

Yes, Bound hasn't been refactored for V4 yet.

@hectormz
Copy link
Contributor Author

Thanks @ricardoV94 . I wanted to use new Aesara so I started using v4 branch (and start to use future API). Are there large parts that are currently broken? I did look some at the Timeline wiki

@ricardoV94
Copy link
Member

Yes, v4 is still in development and many things are still missing https://github.com/pymc-devs/pymc3/issues?q=is%3Aopen+is%3Aissue+label%3Av4

@ricardoV94
Copy link
Member

Closing in favor of #4800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants