You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deftest_consistency(self):
# Ensure that returned values stay the same when setting a fixed seed.mu, beta=0, 1gumbel_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
The text was updated successfully, but these errors were encountered:
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:
The text was updated successfully, but these errors were encountered: