Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
44aefe9
1
Parent(s):
edb2cd6
Create unittest for explicit names
Browse files- test/test.py +9 -0
test/test.py
CHANGED
@@ -43,6 +43,15 @@ class TestPipeline(unittest.TestCase):
|
|
43 |
print(model.equations_)
|
44 |
self.assertLessEqual(model.get_best()["loss"], 1e-4)
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
def test_linear_relation_weighted(self):
|
47 |
y = self.X[:, 0]
|
48 |
weights = np.ones_like(y)
|
|
|
43 |
print(model.equations_)
|
44 |
self.assertLessEqual(model.get_best()["loss"], 1e-4)
|
45 |
|
46 |
+
def test_linear_relation_named(self):
|
47 |
+
y = self.X[:, 0]
|
48 |
+
model = PySRRegressor(
|
49 |
+
**self.default_test_kwargs,
|
50 |
+
early_stop_condition="stop_if(loss, complexity) = loss < 1e-4 && complexity == 1",
|
51 |
+
)
|
52 |
+
model.fit(self.X, y, variable_names=["c1", "c2", "c3", "c4", "c5"])
|
53 |
+
self.assertIn("c1", model.equations_.iloc[-1]["equation"])
|
54 |
+
|
55 |
def test_linear_relation_weighted(self):
|
56 |
y = self.X[:, 0]
|
57 |
weights = np.ones_like(y)
|