Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
82fef08
1
Parent(s):
502e3ec
Update tests with fixed DQ
Browse files- pysr/test/test.py +9 -7
pysr/test/test.py
CHANGED
@@ -69,6 +69,9 @@ class TestPipeline(unittest.TestCase):
|
|
69 |
model.fit(self.X, y, weights=weights)
|
70 |
print(model.equations_)
|
71 |
self.assertLessEqual(model.get_best()["loss"], 1e-4)
|
|
|
|
|
|
|
72 |
|
73 |
def test_multiprocessing_turbo_custom_objective(self):
|
74 |
rstate = np.random.RandomState(0)
|
@@ -98,7 +101,9 @@ class TestPipeline(unittest.TestCase):
|
|
98 |
self.assertGreaterEqual(best_loss, 0.0)
|
99 |
|
100 |
# Test options stored:
|
101 |
-
self.assertEqual(
|
|
|
|
|
102 |
|
103 |
def test_multiline_seval(self):
|
104 |
# The user should be able to run multiple things in a single seval call:
|
@@ -129,7 +134,9 @@ class TestPipeline(unittest.TestCase):
|
|
129 |
self.assertTrue(jl.typeof(test_state[1]).parameters[1] == jl.Float64)
|
130 |
|
131 |
# Test options stored:
|
132 |
-
self.assertEqual(
|
|
|
|
|
133 |
|
134 |
def test_multioutput_custom_operator_quiet_custom_complexity(self):
|
135 |
y = self.X[:, [0, 1]] ** 2
|
@@ -164,10 +171,6 @@ class TestPipeline(unittest.TestCase):
|
|
164 |
self.assertLessEqual(mse1, 1e-4)
|
165 |
self.assertLessEqual(mse2, 1e-4)
|
166 |
|
167 |
-
bad_y = model.predict(self.X, index=[0, 0])
|
168 |
-
bad_mse = np.average((bad_y - y) ** 2)
|
169 |
-
self.assertGreater(bad_mse, 1e-4)
|
170 |
-
|
171 |
def test_multioutput_weighted_with_callable_temp_equation(self):
|
172 |
X = self.X.copy()
|
173 |
y = X[:, [0, 1]] ** 2
|
@@ -1105,7 +1108,6 @@ class TestDimensionalConstraints(unittest.TestCase):
|
|
1105 |
self.assertNotIn("x1", best["equation"])
|
1106 |
self.assertIn("x2", best["equation"])
|
1107 |
self.assertEqual(best["complexity"], 3)
|
1108 |
-
self.assertEqual(model.equations_.iloc[0].complexity, 1)
|
1109 |
self.assertGreater(model.equations_.iloc[0].loss, 1e-6)
|
1110 |
|
1111 |
# With pkl file:
|
|
|
69 |
model.fit(self.X, y, weights=weights)
|
70 |
print(model.equations_)
|
71 |
self.assertLessEqual(model.get_best()["loss"], 1e-4)
|
72 |
+
self.assertEqual(
|
73 |
+
jl.seval("((::Val{x}) where x) -> x")(model.julia_options_.bumper), True
|
74 |
+
)
|
75 |
|
76 |
def test_multiprocessing_turbo_custom_objective(self):
|
77 |
rstate = np.random.RandomState(0)
|
|
|
101 |
self.assertGreaterEqual(best_loss, 0.0)
|
102 |
|
103 |
# Test options stored:
|
104 |
+
self.assertEqual(
|
105 |
+
jl.seval("((::Val{x}) where x) -> x")(model.julia_options_.turbo), True
|
106 |
+
)
|
107 |
|
108 |
def test_multiline_seval(self):
|
109 |
# The user should be able to run multiple things in a single seval call:
|
|
|
134 |
self.assertTrue(jl.typeof(test_state[1]).parameters[1] == jl.Float64)
|
135 |
|
136 |
# Test options stored:
|
137 |
+
self.assertEqual(
|
138 |
+
jl.seval("((::Val{x}) where x) -> x")(model.julia_options_.turbo), False
|
139 |
+
)
|
140 |
|
141 |
def test_multioutput_custom_operator_quiet_custom_complexity(self):
|
142 |
y = self.X[:, [0, 1]] ** 2
|
|
|
171 |
self.assertLessEqual(mse1, 1e-4)
|
172 |
self.assertLessEqual(mse2, 1e-4)
|
173 |
|
|
|
|
|
|
|
|
|
174 |
def test_multioutput_weighted_with_callable_temp_equation(self):
|
175 |
X = self.X.copy()
|
176 |
y = X[:, [0, 1]] ** 2
|
|
|
1108 |
self.assertNotIn("x1", best["equation"])
|
1109 |
self.assertIn("x2", best["equation"])
|
1110 |
self.assertEqual(best["complexity"], 3)
|
|
|
1111 |
self.assertGreater(model.equations_.iloc[0].loss, 1e-6)
|
1112 |
|
1113 |
# With pkl file:
|