Skip to content

Commit

Permalink
add a test for when seed=0
Browse files Browse the repository at this point in the history
  • Loading branch information
cjekel committed Dec 31, 2024
1 parent 1bb400a commit f192f2b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,13 +544,14 @@ def test_random_seed_fit(self):
self.assertTrue(same_breaks.sum() == same_breaks.size)

def test_random_seed_fitfast(self):
# specifically test for seed = 0
np.random.seed(1)
my_pwlf = pwlf.PiecewiseLinFit(self.x_small, self.y_small,
seed=123)
seed=0)
fit1 = my_pwlf.fitfast(2)
np.random.seed(2)
my_pwlf = pwlf.PiecewiseLinFit(self.x_small, self.y_small,
seed=123)
seed=0)
fit2 = my_pwlf.fitfast(2)
same_breaks = np.isclose(fit1, fit2)
self.assertTrue(same_breaks.sum() == same_breaks.size)
Expand Down

0 comments on commit f192f2b

Please sign in to comment.