Bug#1030210: statsmodels FTBFS on 32bit

Adrian Bunk bunk at debian.org
Wed Feb 1 07:59:23 GMT 2023


Source: statsmodels
Version: 0.13.5+dfsg-4
Severity: serious
Tags: ftbfs

https://buildd.debian.org/status/logs.php?pkg=statsmodels&ver=0.13.5%2Bdfsg-4%2Bb1

...
=================================== FAILURES ===================================
_______________________ TestDiscretizedGamma.test_basic ________________________

self = <statsmodels.distributions.tests.test_discrete.TestDiscretizedGamma object at 0xefb687f0>

    def test_basic(self):
        d_offset = self.d_offset
        ddistr = self.ddistr
        paramg = self.paramg
        paramd = self.paramd
        shapes = self.shapes
        start_params = self.start_params
    
        np.random.seed(987146)
    
        dp = DiscretizedCount(ddistr, d_offset)
        assert dp.shapes == shapes
        xi = np.arange(5)
        p = dp._pmf(xi, *paramd)
    
        cdf1 = ddistr.cdf(xi, *paramg)
        p1 = np.diff(cdf1)
        assert_allclose(p[: len(p1)], p1, rtol=1e-13)
        cdf = dp._cdf(xi, *paramd)
        assert_allclose(cdf[: len(cdf1) - 1], cdf1[1:], rtol=1e-13)
    
        # check that scipy dispatch methods work
        p2 = dp.pmf(xi, *paramd)
        assert_allclose(p2, p, rtol=1e-13)
        cdf2 = dp.cdf(xi, *paramd)
        assert_allclose(cdf2, cdf, rtol=1e-13)
        sf = dp.sf(xi, *paramd)
        assert_allclose(sf, 1 - cdf, rtol=1e-13)
    
        nobs = 2000
    
        xx = dp.rvs(*paramd, size=nobs)  # , random_state=987146)
        # check that we go a non-trivial rvs
        assert len(xx) == nobs
        assert xx.var() > 0.001
        mod = DiscretizedModel(xx, distr=dp)
        res = mod.fit(start_params=start_params)
        p = mod.predict(res.params, which="probs")
        args = self.convert_params(res.params)
        p1 = -np.diff(ddistr.sf(np.arange(21), *args))
        assert_allclose(p, p1, rtol=1e-13)
    
        # using cdf limits precision to computation around 1
        p1 = np.diff(ddistr.cdf(np.arange(21), *args))
        assert_allclose(p, p1, rtol=1e-13, atol=1e-15)
        freq = np.bincount(xx.astype(int))
        # truncate at last observed
        k = len(freq)
        if k > 10:
            # reduce low count bins for heavy tailed distributions
            k = 10
            freq[k - 1] += freq[k:].sum()
            freq = freq[:k]
        p = mod.predict(res.params, which="probs", k_max=k)
        p[k - 1] += 1 - p[:k].sum()
        tchi2 = stats.chisquare(freq, p[:k] * nobs)
        assert tchi2.pvalue > 0.01
    
        # estimated distribution methods rvs, ppf
        # frozen distribution with estimated parameters
        # Todo results method
        dfr = mod.get_distr(res.params)
        nobs_rvs = 500
        rvs = dfr.rvs(size=nobs_rvs)
>       freq = np.bincount(rvs)

../.pybuild/cpython3_3.11_statsmodels/build/statsmodels/distributions/tests/test_discrete.py:302: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (array([2, 0, 3, 1, 1, 2, 2, 5, 1, 1, 1, 3, 2, 1, 2, 0, 2, 2, 4, 2, 2, 1,
       3, 2, 1, 1, 1, 1, 4, 2, 4, 2, 1, 1, 2... 2, 4, 1, 2, 1, 2, 0, 1, 1, 2, 1, 2, 2, 2, 4, 0,
       4, 1, 1, 2, 2, 1, 1, 3, 2, 3, 2, 1, 3, 1, 1, 2], dtype=int64),)
kwargs = {}
relevant_args = (array([2, 0, 3, 1, 1, 2, 2, 5, 1, 1, 1, 3, 2, 1, 2, 0, 2, 2, 4, 2, 2, 1,
       3, 2, 1, 1, 1, 1, 4, 2, 4, 2, 1, 1, 2..., 1, 2, 1, 2, 0, 1, 1, 2, 1, 2, 2, 2, 4, 0,
       4, 1, 1, 2, 2, 1, 1, 3, 2, 3, 2, 1, 3, 1, 1, 2], dtype=int64), None)

>   ???
E   TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'

<__array_function__ internals>:200: TypeError
----------------------------- Captured stdout call -----------------------------
Optimization terminated successfully.
         Current function value: 1.491508
         Iterations: 64
         Function evaluations: 122
____________________ TestDiscretizedExponential.test_basic _____________________

self = <statsmodels.distributions.tests.test_discrete.TestDiscretizedExponential object at 0xef920d90>

    def test_basic(self):
        d_offset = self.d_offset
        ddistr = self.ddistr
        paramg = self.paramg
        paramd = self.paramd
        shapes = self.shapes
        start_params = self.start_params
    
        np.random.seed(987146)
    
        dp = DiscretizedCount(ddistr, d_offset)
        assert dp.shapes == shapes
        xi = np.arange(5)
        p = dp._pmf(xi, *paramd)
    
        cdf1 = ddistr.cdf(xi, *paramg)
        p1 = np.diff(cdf1)
        assert_allclose(p[: len(p1)], p1, rtol=1e-13)
        cdf = dp._cdf(xi, *paramd)
        assert_allclose(cdf[: len(cdf1) - 1], cdf1[1:], rtol=1e-13)
    
        # check that scipy dispatch methods work
        p2 = dp.pmf(xi, *paramd)
        assert_allclose(p2, p, rtol=1e-13)
        cdf2 = dp.cdf(xi, *paramd)
        assert_allclose(cdf2, cdf, rtol=1e-13)
        sf = dp.sf(xi, *paramd)
        assert_allclose(sf, 1 - cdf, rtol=1e-13)
    
        nobs = 2000
    
        xx = dp.rvs(*paramd, size=nobs)  # , random_state=987146)
        # check that we go a non-trivial rvs
        assert len(xx) == nobs
        assert xx.var() > 0.001
        mod = DiscretizedModel(xx, distr=dp)
        res = mod.fit(start_params=start_params)
        p = mod.predict(res.params, which="probs")
        args = self.convert_params(res.params)
        p1 = -np.diff(ddistr.sf(np.arange(21), *args))
        assert_allclose(p, p1, rtol=1e-13)
    
        # using cdf limits precision to computation around 1
        p1 = np.diff(ddistr.cdf(np.arange(21), *args))
        assert_allclose(p, p1, rtol=1e-13, atol=1e-15)
        freq = np.bincount(xx.astype(int))
        # truncate at last observed
        k = len(freq)
        if k > 10:
            # reduce low count bins for heavy tailed distributions
            k = 10
            freq[k - 1] += freq[k:].sum()
            freq = freq[:k]
        p = mod.predict(res.params, which="probs", k_max=k)
        p[k - 1] += 1 - p[:k].sum()
        tchi2 = stats.chisquare(freq, p[:k] * nobs)
        assert tchi2.pvalue > 0.01
    
        # estimated distribution methods rvs, ppf
        # frozen distribution with estimated parameters
        # Todo results method
        dfr = mod.get_distr(res.params)
        nobs_rvs = 500
        rvs = dfr.rvs(size=nobs_rvs)
>       freq = np.bincount(rvs)

../.pybuild/cpython3_3.11_statsmodels/build/statsmodels/distributions/tests/test_discrete.py:302: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (array([ 0,  0,  5,  2,  1,  1,  6,  1,  2,  1,  3,  3,  1,  2,  1,  9,  1,
       10,  4,  1,  7,  1,  2, 13,  1,  4,...  2,  0, 10, 11,  5,  0,  7,  1,  8,  1,  6,  0,  1,  1,  3,  0,  2,
        1,  4,  1,  7,  0,  7,  9], dtype=int64),)
kwargs = {}
relevant_args = (array([ 0,  0,  5,  2,  1,  1,  6,  1,  2,  1,  3,  3,  1,  2,  1,  9,  1,
       10,  4,  1,  7,  1,  2, 13,  1,  4,... 0, 10, 11,  5,  0,  7,  1,  8,  1,  6,  0,  1,  1,  3,  0,  2,
        1,  4,  1,  7,  0,  7,  9], dtype=int64), None)

>   ???
E   TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'

<__array_function__ internals>:200: TypeError
----------------------------- Captured stdout call -----------------------------
Optimization terminated successfully.
         Current function value: 2.617352
         Iterations: 22
         Function evaluations: 44
_______________________ TestDiscretizedLomax.test_basic ________________________

self = <statsmodels.distributions.tests.test_discrete.TestDiscretizedLomax object at 0xef9209d0>

    def test_basic(self):
        d_offset = self.d_offset
        ddistr = self.ddistr
        paramg = self.paramg
        paramd = self.paramd
        shapes = self.shapes
        start_params = self.start_params
    
        np.random.seed(987146)
    
        dp = DiscretizedCount(ddistr, d_offset)
        assert dp.shapes == shapes
        xi = np.arange(5)
        p = dp._pmf(xi, *paramd)
    
        cdf1 = ddistr.cdf(xi, *paramg)
        p1 = np.diff(cdf1)
        assert_allclose(p[: len(p1)], p1, rtol=1e-13)
        cdf = dp._cdf(xi, *paramd)
        assert_allclose(cdf[: len(cdf1) - 1], cdf1[1:], rtol=1e-13)
    
        # check that scipy dispatch methods work
        p2 = dp.pmf(xi, *paramd)
        assert_allclose(p2, p, rtol=1e-13)
        cdf2 = dp.cdf(xi, *paramd)
        assert_allclose(cdf2, cdf, rtol=1e-13)
        sf = dp.sf(xi, *paramd)
        assert_allclose(sf, 1 - cdf, rtol=1e-13)
    
        nobs = 2000
    
        xx = dp.rvs(*paramd, size=nobs)  # , random_state=987146)
        # check that we go a non-trivial rvs
        assert len(xx) == nobs
        assert xx.var() > 0.001
        mod = DiscretizedModel(xx, distr=dp)
        res = mod.fit(start_params=start_params)
        p = mod.predict(res.params, which="probs")
        args = self.convert_params(res.params)
        p1 = -np.diff(ddistr.sf(np.arange(21), *args))
        assert_allclose(p, p1, rtol=1e-13)
    
        # using cdf limits precision to computation around 1
        p1 = np.diff(ddistr.cdf(np.arange(21), *args))
        assert_allclose(p, p1, rtol=1e-13, atol=1e-15)
        freq = np.bincount(xx.astype(int))
        # truncate at last observed
        k = len(freq)
        if k > 10:
            # reduce low count bins for heavy tailed distributions
            k = 10
            freq[k - 1] += freq[k:].sum()
            freq = freq[:k]
        p = mod.predict(res.params, which="probs", k_max=k)
        p[k - 1] += 1 - p[:k].sum()
        tchi2 = stats.chisquare(freq, p[:k] * nobs)
        assert tchi2.pvalue > 0.01
    
        # estimated distribution methods rvs, ppf
        # frozen distribution with estimated parameters
        # Todo results method
        dfr = mod.get_distr(res.params)
        nobs_rvs = 500
        rvs = dfr.rvs(size=nobs_rvs)
>       freq = np.bincount(rvs)

../.pybuild/cpython3_3.11_statsmodels/build/statsmodels/distributions/tests/test_discrete.py:302: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (array([ 0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,
        2,  0,  0,  1,  0,  0,  4,  0,  0,...  0,  0,  2,  3,  1,  0,  1,  0,  2,  0,  1,  0,  0,  0,  0,  0,  0,
        0,  0,  0,  1,  0,  1,  2], dtype=int64),)
kwargs = {}
relevant_args = (array([ 0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,
        2,  0,  0,  1,  0,  0,  4,  0,  0,... 0,  2,  3,  1,  0,  1,  0,  2,  0,  1,  0,  0,  0,  0,  0,  0,
        0,  0,  0,  1,  0,  1,  2], dtype=int64), None)

>   ???
E   TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'

<__array_function__ internals>:200: TypeError
----------------------------- Captured stdout call -----------------------------
Optimization terminated successfully.
         Current function value: 1.294980
         Iterations: 51
         Function evaluations: 101
_______________________ TestDiscretizedBurr12.test_basic _______________________

self = <statsmodels.distributions.tests.test_discrete.TestDiscretizedBurr12 object at 0xef920990>

    def test_basic(self):
        d_offset = self.d_offset
        ddistr = self.ddistr
        paramg = self.paramg
        paramd = self.paramd
        shapes = self.shapes
        start_params = self.start_params
    
        np.random.seed(987146)
    
        dp = DiscretizedCount(ddistr, d_offset)
        assert dp.shapes == shapes
        xi = np.arange(5)
        p = dp._pmf(xi, *paramd)
    
        cdf1 = ddistr.cdf(xi, *paramg)
        p1 = np.diff(cdf1)
        assert_allclose(p[: len(p1)], p1, rtol=1e-13)
        cdf = dp._cdf(xi, *paramd)
        assert_allclose(cdf[: len(cdf1) - 1], cdf1[1:], rtol=1e-13)
    
        # check that scipy dispatch methods work
        p2 = dp.pmf(xi, *paramd)
        assert_allclose(p2, p, rtol=1e-13)
        cdf2 = dp.cdf(xi, *paramd)
        assert_allclose(cdf2, cdf, rtol=1e-13)
        sf = dp.sf(xi, *paramd)
        assert_allclose(sf, 1 - cdf, rtol=1e-13)
    
        nobs = 2000
    
        xx = dp.rvs(*paramd, size=nobs)  # , random_state=987146)
        # check that we go a non-trivial rvs
        assert len(xx) == nobs
        assert xx.var() > 0.001
        mod = DiscretizedModel(xx, distr=dp)
        res = mod.fit(start_params=start_params)
        p = mod.predict(res.params, which="probs")
        args = self.convert_params(res.params)
        p1 = -np.diff(ddistr.sf(np.arange(21), *args))
        assert_allclose(p, p1, rtol=1e-13)
    
        # using cdf limits precision to computation around 1
        p1 = np.diff(ddistr.cdf(np.arange(21), *args))
        assert_allclose(p, p1, rtol=1e-13, atol=1e-15)
        freq = np.bincount(xx.astype(int))
        # truncate at last observed
        k = len(freq)
        if k > 10:
            # reduce low count bins for heavy tailed distributions
            k = 10
            freq[k - 1] += freq[k:].sum()
            freq = freq[:k]
        p = mod.predict(res.params, which="probs", k_max=k)
        p[k - 1] += 1 - p[:k].sum()
        tchi2 = stats.chisquare(freq, p[:k] * nobs)
        assert tchi2.pvalue > 0.01
    
        # estimated distribution methods rvs, ppf
        # frozen distribution with estimated parameters
        # Todo results method
        dfr = mod.get_distr(res.params)
        nobs_rvs = 500
        rvs = dfr.rvs(size=nobs_rvs)
>       freq = np.bincount(rvs)

../.pybuild/cpython3_3.11_statsmodels/build/statsmodels/distributions/tests/test_discrete.py:302: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (array([ 0,  0,  2,  1,  0,  1,  2,  0,  1,  0,  1,  1,  0,  1,  0,  3,  0,
        4,  1,  0,  2,  0,  1,  5,  0,  1,...  1,  0,  4,  4,  2,  0,  2,  1,  3,  0,  2,  0,  0,  0,  1,  0,  1,
        0,  1,  1,  2,  0,  2,  3], dtype=int64),)
kwargs = {}
relevant_args = (array([ 0,  0,  2,  1,  0,  1,  2,  0,  1,  0,  1,  1,  0,  1,  0,  3,  0,
        4,  1,  0,  2,  0,  1,  5,  0,  1,... 0,  4,  4,  2,  0,  2,  1,  3,  0,  2,  0,  0,  0,  1,  0,  1,
        0,  1,  1,  2,  0,  2,  3], dtype=int64), None)

>   ???
E   TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'

<__array_function__ internals>:200: TypeError
...
=========================== short test summary info ============================
FAILED ../.pybuild/cpython3_3.11_statsmodels/build/statsmodels/distributions/tests/test_discrete.py::TestDiscretizedGamma::test_basic
FAILED ../.pybuild/cpython3_3.11_statsmodels/build/statsmodels/distributions/tests/test_discrete.py::TestDiscretizedExponential::test_basic
FAILED ../.pybuild/cpython3_3.11_statsmodels/build/statsmodels/distributions/tests/test_discrete.py::TestDiscretizedLomax::test_basic
FAILED ../.pybuild/cpython3_3.11_statsmodels/build/statsmodels/distributions/tests/test_discrete.py::TestDiscretizedBurr12::test_basic
= 4 failed, 16442 passed, 292 skipped, 142 xfailed, 10 xpassed, 307 warnings in 3029.45s (0:50:29) =
make[1]: *** [debian/rules:105: override_dh_auto_test] Error 1



More information about the debian-science-maintainers mailing list