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

"test_consistency" test cases failing on servers #59

Closed
ggand0 opened this issue Mar 3, 2017 · 0 comments
Closed

"test_consistency" test cases failing on servers #59

ggand0 opened this issue Mar 3, 2017 · 0 comments
Assignees
Labels

Comments

@ggand0
Copy link
Collaborator

ggand0 commented Mar 3, 2017

def test_consistency(self):
    # Ensure that returned values stay the same when setting a fixed seed.
    mu, beta = 0, 1
    gumbel_sample = Gumbel_sample(temp=0.01, seed=1234567890)
    actual = TestGumbelSample.get_sample(mu, beta, gumbel_sample, 5)
    desired = [
        1.7462246417999268,
        0.2874840497970581,
        0.9974965453147888,
        0.3290553689002991,
        -1.0215276479721069
    ]
    assert_array_almost_equal(actual, desired, decimal=15)

Added test cases ensuring the consistency of sampling methods, and they all passed on the local environment.
However, if we set the decimals more than 6 or 7, test cases other than Gaussian and Gumbel distributions will fail when run on other machines including servers.

Example log on travis ci:

_____________________ TestBernoulliSample.test_consistency _____________________
self = <Tars.tests.test_distribution_samples.TestBernoulliSample testMethod=test_consistency>
    def test_consistency(self):
        # Ensure that returned values stay the same when setting a fixed seed.
        mean = 0.5
        bernoulli_sample = Bernoulli_sample(temp=0.1, seed=1234567890)
        actual = TestBernoulliSample.get_sample(mean, bernoulli_sample, 5)
        desired = [
            0.9999971508356551,
            0.9101269246280252,
            0.0248156363467501,
            0.3538078165724645,
            0.1615775890919983
        ]
>       assert_array_almost_equal(actual, desired, decimal=15)
E       AssertionError: 
E       Arrays are not almost equal to 15 decimals
E       
E       (mismatch 20.0%)
E        x: array([ 0.999997150839051,  0.910126924628025,  0.02481563634675 ,
E               0.353807816572465,  0.161577589091998])
E        y: array([ 0.999997150835655,  0.910126924628025,  0.02481563634675 ,
E               0.353807816572465,  0.161577589091998])
Tars/tests/test_distribution_samples.py:97: AssertionError
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

1 participant