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

Flaky test: test_distributions_random.TestMvNormal #4323

Closed
MarcoGorelli opened this issue Dec 10, 2020 · 3 comments
Closed

Flaky test: test_distributions_random.TestMvNormal #4323

MarcoGorelli opened this issue Dec 10, 2020 · 3 comments
Labels

Comments

@MarcoGorelli
Copy link
Contributor

Sporadic failure:

=================================== FAILURES ===================================
_____________ TestMvNormal.test_with_chol_rv[(10, 3)-(10, 3)-(1,)] _____________

self = <pymc3.tests.test_distributions_random.TestMvNormal object at 0x7f17ff33f040>
sample_shape = (10, 3), dist_shape = (10, 3), mu_shape = (1,)

    @pytest.mark.parametrize(
        ["sample_shape", "dist_shape", "mu_shape"],
        generate_shapes(include_params=False, xfail=True),
        ids=str,
    )
    def test_with_chol_rv(self, sample_shape, dist_shape, mu_shape):
        with pm.Model() as model:
            mu = pm.Normal("mu", 0.0, 1.0, shape=mu_shape)
            sd_dist = pm.Exponential.dist(1.0, shape=3)
            chol, corr, stds = pm.LKJCholeskyCov(
                "chol_cov", n=3, eta=2, sd_dist=sd_dist, compute_corr=True
            )
            mv = pm.MvNormal("mv", mu, chol=chol, shape=dist_shape)
>           prior = pm.sample_prior_predictive(samples=sample_shape)

pymc3/tests/test_distributions_random.py:1633: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pymc3/sampling.py:1938: in sample_prior_predictive
    values = draw_values([model[name] for name in names], size=samples)
pymc3/distributions/distribution.py:783: in draw_values
    value = _draw_value(next_, point=point, givens=temp_givens, size=size)
pymc3/distributions/distribution.py:947: in _draw_value
    return param.random(point=point, size=size)
pymc3/model.py:111: in __call__
    return getattr(self.obj, self.method_name)(*args, **kwargs)
pymc3/distributions/multivariate.py:262: in random
    mu, param = draw_values([self.mu, param_attribute], point=point, size=size)
pymc3/distributions/distribution.py:826: in draw_values
    value = _draw_value(param, point=point, givens=givens.values(), size=size)
pymc3/distributions/distribution.py:998: in _draw_value
    output = func(*input_vals)
/usr/share/miniconda/envs/pymc3-dev-py38/lib/python3.8/site-packages/numpy/lib/function_base.py:2108: in __call__
    return self._vectorize_call(func=func, args=vargs)
/usr/share/miniconda/envs/pymc3-dev-py38/lib/python3.8/site-packages/numpy/lib/function_base.py:2182: in _vectorize_call
    res = self._vectorize_call_with_signature(func, args)
/usr/share/miniconda/envs/pymc3-dev-py38/lib/python3.8/site-packages/numpy/lib/function_base.py:2211: in _vectorize_call_with_signature
    broadcast_shape, dim_sizes = _parse_input_dimensions(
/usr/share/miniconda/envs/pymc3-dev-py38/lib/python3.8/site-packages/numpy/lib/function_base.py:1873: in _parse_input_dimensions
    _update_dim_sizes(dim_sizes, arg, core_dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

dim_sizes = {}, arg = array(-1.), core_dims = ('i_0_0',)

    def _update_dim_sizes(dim_sizes, arg, core_dims):
        """
        Incrementally check and update core dimension sizes for a single argument.
    
        Arguments
        ---------
        dim_sizes : Dict[str, int]
            Sizes of existing core dimensions. Will be updated in-place.
        arg : ndarray
            Argument to examine.
        core_dims : Tuple[str, ...]
            Core dimensions for this argument.
        """
        if not core_dims:
            return
    
        num_core_dims = len(core_dims)
        if arg.ndim < num_core_dims:
>           raise ValueError(
                '%d-dimensional argument does not have enough '
                'dimensions for all core dimensions %r'
                % (arg.ndim, core_dims))
E           ValueError: 0-dimensional argument does not have enough dimensions for all core dimensions ('i_0_0',)

/usr/share/miniconda/envs/pymc3-dev-py38/lib/python3.8/site-packages/numpy/lib/function_base.py:1836: ValueError
@Sayam753
Copy link
Member

That's weird. I am on current master 4fd56fd and the test passes locally on my mac. @MarcoGorelli how can I reproduce this?

@MarcoGorelli
Copy link
Contributor Author

@Sayam753 I can't reproduce it either, but it happened in this run https://github.com/pymc-devs/pymc3/runs/1529222002

@ricardoV94
Copy link
Member

Test has been refactored, closing this one

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