Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
1d19a08
1
Parent(s):
eccee44
Add test for custom loss string
Browse files- pysr/test/test.py +2 -1
pysr/test/test.py
CHANGED
@@ -87,11 +87,12 @@ class TestPipeline(unittest.TestCase):
|
|
87 |
print(model.equations_)
|
88 |
self.assertLessEqual(model.equations_.iloc[-1]["loss"], 1e-4)
|
89 |
|
90 |
-
def
|
91 |
y = 1.23456789 * self.X[:, 0]
|
92 |
model = PySRRegressor(
|
93 |
**self.default_test_kwargs,
|
94 |
early_stop_condition="stop_if(loss, complexity) = loss < 1e-4 && complexity == 3",
|
|
|
95 |
precision=64,
|
96 |
parsimony=0.01,
|
97 |
warm_start=True,
|
|
|
87 |
print(model.equations_)
|
88 |
self.assertLessEqual(model.equations_.iloc[-1]["loss"], 1e-4)
|
89 |
|
90 |
+
def test_high_precision_search_custom_loss(self):
|
91 |
y = 1.23456789 * self.X[:, 0]
|
92 |
model = PySRRegressor(
|
93 |
**self.default_test_kwargs,
|
94 |
early_stop_condition="stop_if(loss, complexity) = loss < 1e-4 && complexity == 3",
|
95 |
+
loss="my_loss(prediction, target) = (prediction - target)^2",
|
96 |
precision=64,
|
97 |
parsimony=0.01,
|
98 |
warm_start=True,
|