Randomize parameters for test
This commit is contained in:
parent
25e001e855
commit
19587cea33
1 changed files with 11 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
from numpy.testing import assert_allclose
|
||||
import numpy as np
|
||||
|
||||
from logistic import iterate_f
|
||||
from logistic_fit import fit_r
|
||||
|
@ -9,3 +10,13 @@ def test_fit_r():
|
|||
fit_result_r = fit_r(trajectory)
|
||||
assert_allclose(r, fit_result_r)
|
||||
|
||||
|
||||
def test_fit_r_randomized():
|
||||
random_state = np.random.RandomState(42)
|
||||
x0 = 0.3
|
||||
for _ in range(100):
|
||||
r = random_state.rand()
|
||||
trajectory = iterate_f(x0, r, 23)
|
||||
fit_result_r = fit_r(trajectory)
|
||||
assert_allclose(r, fit_result_r, atol=0.1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue