Skip to content

Commit

Permalink
fix seed
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Saves committed Jan 7, 2025
1 parent ad96b92 commit 2843dfc
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions smt/utils/test/test_misc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,35 @@ def prepare_tests_errors(self):
ndim = 2
fun = Sphere(ndim=ndim)

sampling = LHS(xlimits=fun.xlimits, criterion="m")
xe = sampling(20)
sampling = LHS(xlimits=fun.xlimits, criterion="ese", random_state=42)
xt = sampling(40)
yt = fun(xt)
xe = sampling(120)
ye = fun(xe)
return xe, ye
return xt, yt, xe, ye

def test_pva_error(self):
xe, ye = self.prepare_tests_errors()
xt, yt, xe, ye = self.prepare_tests_errors()
sm = KRG(print_global=False, random_state=42)
sm.set_training_values(xe, ye)
sm.set_training_values(xt, yt)
sm.train()

pva = compute_pva(sm, xe, ye)
self.assertLess(pva, 0.7)
self.assertAlmostEqual(pva, 2.314, delta=1e-3)

def test_rmse_error(self):
xe, ye = self.prepare_tests_errors()
xt, yt, xe, ye = self.prepare_tests_errors()
sm = KRG(print_global=False, random_state=42)
sm.set_training_values(xe, ye)
sm.set_training_values(xt, yt)
sm.train()

rmse = compute_rmse(sm, xe, ye)
self.assertLess(rmse, 0.1)
self.assertAlmostEqual(rmse, 0.0, delta=1e-3)

def test_q2_error(self):
xe, ye = self.prepare_tests_errors()
xt, yt, xe, ye = self.prepare_tests_errors()
sm = KRG(print_global=False, random_state=42)
sm.set_training_values(xe, ye)
sm.set_training_values(xt, yt)
sm.train()

q2 = compute_q2(sm, xe, ye)
Expand Down

0 comments on commit 2843dfc

Please sign in to comment.