Skip to content

TST: new test failures with scipy 0.8 #3128

Closed

Description

@josef-pkt

The first test run that uses newly released scipy 0.8 has two new test failures in old code

https://travis-ci.org/statsmodels/statsmodels/jobs/147587982

======================================================================
FAIL: statsmodels.miscmodels.tests.test_tmodel.TestTModel.test_basic
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/statsmodels-0.8.0-py2.7-linux-x86_64.egg/statsmodels/miscmodels/tests/test_tmodel.py", line 86, in test_basic
    assert_allclose(res1.params[-2], res2.dof, rtol=1e-5)
  File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 1395, in assert_allclose
    verbose=verbose, header=header)
  File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 737, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-05, atol=0
(mismatch 100.0%)
 x: array(2.837219360564396)
 y: array(2.837183)
======================================================================
FAIL: statsmodels.tools.tests.test_rootfinding.test_brentq_expanding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/statsmodels-0.8.0-py2.7-linux-x86_64.egg/statsmodels/tools/tests/test_rootfinding.py", line 84, in test_brentq_expanding
    assert_equal(info1[k], info.__dict__[k])
  File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 379, in assert_equal
    raise AssertionError(msg)
AssertionError: 
Items are not equal:
 ACTUAL: 63
 DESIRED: 66

Activity

  1. bashtage commented on Jul 27, 2016

    @bashtage
    Member

    I hope you mean 0.18.

  2. josef-pkt commented on Jul 27, 2016

    @josef-pkt
    MemberAuthor

    Yes, 0.18.0
    conda switched to using it as the latest version. I guess there was no other upgrade at the same time.

    I haven't looked yet but I guess at some changes in scipy.optimize.

  3. bashtage commented on Aug 5, 2016

    @bashtage
    Member

    From scipy:

    The convergence criterion for optimize.bisect, optimize.brentq, optimize.brenth, and optimize.ridder  
    now works the same as numpy.allclose.
    
  4. josef-pkt commented on Aug 9, 2016

    @josef-pkt
    MemberAuthor

    nelder-mead had some changes to the termination criteria maxiter verses maxfval

    another one I'm seeing now with scipy 0.18
    https://travis-ci.org/statsmodels/statsmodels/jobs/151013680

    My guess is that the B-matrix with opposite "matrix sign" is the same model, i.e. linear transformation of a symmetric distribution (normal) -x ~ x if x is symmetric/normal distributed

    (not sure yet what to do: adjust test, check for scipy problems, or renormalize estimate)

    ======================================================================
    FAIL: statsmodels.tsa.vector_ar.tests.test_svar.TestSVAR.test_B
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
        self.test(*self.arg)
      File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/statsmodels-0.8.0-py2.7-linux-x86_64.egg/statsmodels/tsa/vector_ar/tests/test_svar.py", line 42, in test_B
        assert_almost_equal(self.res1.B, self.res2.B, DECIMAL_4)
      File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 521, in assert_almost_equal
        return assert_array_almost_equal(actual, desired, decimal, err_msg)
      File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 916, in assert_array_almost_equal
        precision=decimal)
      File "/home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 737, in assert_array_compare
        raise AssertionError(msg)
    AssertionError: 
    Arrays are not almost equal to 4 decimals
    (mismatch 33.3333333333%)
     x: array([[-0.0076,  0.    ,  0.    ],
           [ 0.    , -0.0051,  0.    ],
           [ 0.    ,  0.    , -0.0207]])
     y: array([[ 0.0076,  0.    ,  0.    ],
           [ 0.    ,  0.0051,  0.    ],
           [ 0.    ,  0.    ,  0.0207]])
    
  5. josef-pkt commented on Aug 9, 2016

    @josef-pkt
    MemberAuthor

    maybe:

    >>> val, vec = np.linalg.eig((-x).T.dot(-x))
    >>> vec.dot(np.sqrt(val)[:,None] * vec)
    array([[ 0.0076,  0.    ,  0.    ],
           [ 0.    ,  0.0051,  0.    ],
           [ 0.    ,  0.    ,  0.0207]])
    >>> val, vec = np.linalg.eig((x).T.dot(x))
    >>> vec.dot(np.sqrt(val)[:,None] * vec)
    array([[ 0.0076,  0.    ,  0.    ],
           [ 0.    ,  0.0051,  0.    ],
           [ 0.    ,  0.    ,  0.0207]])
    

    But SVAR doesn't have enough unit tests to change without checking the background.

  6. josef-pkt commented on Aug 9, 2016

    @josef-pkt
    MemberAuthor

    I'm pretty sure the above is right. This corresponds to a standard deviation in the univariate case which could come out as negative in an optimization. variance or covariance matrix would be the same with either sign. The Stata documentation for SVAR doesn't mention anything about it.

    -> adjust unit test to use abs for now, and leave proper solution for later when SVAR is fully supported.

  7. added a commit that references this issue on Aug 19, 2016
    2d6d64a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions