MilesCranmer commited on
Commit
ae0b11e
1 Parent(s): ed35c4e

Force array copy in test to try to prevent error

Browse files
Files changed (1) hide show
  1. test/test.py +5 -4
test/test.py CHANGED
@@ -72,7 +72,8 @@ class TestPipeline(unittest.TestCase):
72
  self.assertGreater(bad_mse, 1e-4)
73
 
74
  def test_multioutput_weighted_with_callable_temp_equation(self):
75
- y = self.X[:, [0, 1]] ** 2
 
76
  w = self.rstate.rand(*y.shape)
77
  w[w < 0.5] = 0.0
78
  w[w >= 0.5] = 1.0
@@ -90,13 +91,13 @@ class TestPipeline(unittest.TestCase):
90
  temp_equation_file=True,
91
  delete_tempfiles=False,
92
  )
93
- model.fit(self.X, y, weights=w)
94
 
95
  np.testing.assert_almost_equal(
96
- model.predict(self.X)[:, 0], self.X[:, 0] ** 2, decimal=4
97
  )
98
  np.testing.assert_almost_equal(
99
- model.predict(self.X)[:, 1], self.X[:, 1] ** 2, decimal=4
100
  )
101
 
102
  def test_empty_operators_single_input_multirun(self):
 
72
  self.assertGreater(bad_mse, 1e-4)
73
 
74
  def test_multioutput_weighted_with_callable_temp_equation(self):
75
+ X = self.X.copy()
76
+ y = X[:, [0, 1]] ** 2
77
  w = self.rstate.rand(*y.shape)
78
  w[w < 0.5] = 0.0
79
  w[w >= 0.5] = 1.0
 
91
  temp_equation_file=True,
92
  delete_tempfiles=False,
93
  )
94
+ model.fit(X.copy(), y, weights=w)
95
 
96
  np.testing.assert_almost_equal(
97
+ model.predict(X.copy())[:, 0], X[:, 0] ** 2, decimal=4
98
  )
99
  np.testing.assert_almost_equal(
100
+ model.predict(X.copy())[:, 1], X[:, 1] ** 2, decimal=4
101
  )
102
 
103
  def test_empty_operators_single_input_multirun(self):