MAINT: Cor nearest factor tests #1851

Merged
merged 2 commits into from Jul 29, 2014

Projects

None yet

3 participants

@kshedden
Contributor

Change bare asserts to numpy asserts.

kshedden added some commits Jul 29, 2014
@kshedden kshedden Change bare asserts to numpy asserts 3d74707
@kshedden kshedden Fix assert
7374fbb
@coveralls

Coverage Status

Coverage remained the same when pulling 7374fbb on kshedden:cor_nearest_maint into 48f7a21 on statsmodels:master.

@kshedden kshedden changed the title from Cor nearest maint to MAINT: Cor nearest factor tests Jul 29, 2014
@josef-pkt josef-pkt commented on the diff Jul 29, 2014
statsmodels/stats/tests/test_corrpsd.py
@@ -293,7 +293,7 @@ def project(x):
x = np.random.normal(size=dm)
rslt = _spg_optim(obj, grad, x, project)
xnew = rslt.params
- assert(obj(xnew) < 1e-4)
+ assert_almost_equal(obj(xnew), 0, decimal=3)
@josef-pkt
josef-pkt Jul 29, 2014 Member

assert_allclose allows better control over tolerance
i.e, atol=5e-3 and rtol=0 or irrelevant in this case

I think assert_almost_equal is now only interesting in the case when we have reference numbers with a printed precision given by the number of decimals.

@josef-pkt
Member

I'm merging this to see what the results on Ubuntu are.
Trying out the test case on my computer, the tests would pass at atol=5e-5.

If we loose a lot of precision on some machines, then there might be some other problems in the code.

@josef-pkt josef-pkt merged commit 15975a7 into statsmodels:master Jul 29, 2014

2 checks passed

continuous-integration/appveyor AppVeyor build succeeded
Details
continuous-integration/travis-ci The Travis CI build passed
Details
@josef-pkt josef-pkt added the PR label Aug 11, 2014
@josef-pkt josef-pkt added the type-test label Aug 24, 2014
@josef-pkt josef-pkt added this to the 0.6 milestone Aug 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment