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

TestBeta.test_beta_regression fails with latest pytensor #888

Open
GaetanLepage opened this issue Feb 22, 2025 · 0 comments
Open

TestBeta.test_beta_regression fails with latest pytensor #888

GaetanLepage opened this issue Feb 22, 2025 · 0 comments

Comments

@GaetanLepage
Copy link

When updating to pytensor 2.28.0, this test from the bambi suite started failing:

________________________ TestBeta.test_beta_regression _________________________

self = <test_models.TestBeta object at 0xfffee3080d40>
gasoline_data =     yield  gravity  pressure  temp10  temp  batch
0   0.122     50.8       8.6     190   205      1
1   0.223     50.8...   316   365     10
30  0.147     31.8       0.2     316   379     10
31  0.180     31.8       0.2     316   428     10

    def test_beta_regression(self, gasoline_data):
        model = bmb.Model(
            "yield ~  temp + batch", gasoline_data, family="beta", categorical="batch"
        )
        idata = self.fit(model, target_accept=0.9, random_seed=1234)
    
        # To Do: Could be adjusted but this is what we had before
        model.predict(idata, kind="response_params")
        model.predict(idata, kind="response")
    
        assert (0 < idata.posterior["mu"]).all() & (idata.posterior["mu"] < 1).all()
>       assert (0 < idata.posterior_predictive["yield"]).all() & (
            idata.posterior_predictive["yield"] < 1
        ).all()
E       AssertionError: assert (<xarray.DataArray 'yield' ()> Size: 1B\narray(False) & <xarray.DataArray 'yield' ()> Size: 1B\narray(False))
E        +  where <xarray.DataArray 'yield' ()> Size: 1B\narray(False) = all()
E        +    where all = 0 < <xarray.DataArray 'yield' (chain: 4, draw: 50, __obs__: 32)> Size: 51kB\narray([[[0.00000000e+00, 0.00000000e+00, 6.748... 5 6 7 8 ... 41 42 43 44 45 46 47 48 49\n  * __obs__  (__obs__) int64 256B 0 1 2 3 4 5 6 7 8 ... 24 25 26 27 28 29 30 31.all
E        +  and   <xarray.DataArray 'yield' ()> Size: 1B\narray(False) = all()
E        +    where all = <xarray.DataArray 'yield' (chain: 4, draw: 50, __obs__: 32)> Size: 51kB\narray([[[0.00000000e+00, 0.00000000e+00, 6.748... 5 6 7 8 ... 41 42 43 44 45 46 47 48 49\n  * __obs__  (__obs__) int64 256B 0 1 2 3 4 5 6 7 8 ... 24 25 26 27 28 29 30 31 < 1.all

Context: bumping pytensor in nixpkgs
NixOS/nixpkgs#383783

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