Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
0020398
1
Parent(s):
91a0f71
Test __repr__ of sklearn
Browse files- pysr/sklearn.py +1 -1
- test/test.py +3 -0
pysr/sklearn.py
CHANGED
@@ -20,7 +20,7 @@ class PySRRegressor(BaseEstimator, RegressorMixin):
|
|
20 |
|
21 |
def __repr__(self):
|
22 |
if self.equations is None:
|
23 |
-
return "PySRRegressor.equations=None"
|
24 |
|
25 |
equations = self.equations
|
26 |
selected = ["" for _ in range(len(equations))]
|
|
|
20 |
|
21 |
def __repr__(self):
|
22 |
if self.equations is None:
|
23 |
+
return "PySRRegressor.equations = None"
|
24 |
|
25 |
equations = self.equations
|
26 |
selected = ["" for _ in range(len(equations))]
|
test/test.py
CHANGED
@@ -87,7 +87,10 @@ class TestPipeline(unittest.TestCase):
|
|
87 |
binary_operators=["plus"],
|
88 |
**self.default_test_kwargs,
|
89 |
)
|
|
|
90 |
regressor.fit(X, y)
|
|
|
|
|
91 |
|
92 |
self.assertLessEqual(regressor.equations.iloc[-1]["MSE"], 1e-4)
|
93 |
np.testing.assert_almost_equal(regressor.predict(X), y, decimal=1)
|
|
|
87 |
binary_operators=["plus"],
|
88 |
**self.default_test_kwargs,
|
89 |
)
|
90 |
+
self.assertTrue("None" in regressor.__repr__())
|
91 |
regressor.fit(X, y)
|
92 |
+
self.assertTrue("None" not in regressor.__repr__())
|
93 |
+
self.assertTrue(">>>>" in regressor.__repr__())
|
94 |
|
95 |
self.assertLessEqual(regressor.equations.iloc[-1]["MSE"], 1e-4)
|
96 |
np.testing.assert_almost_equal(regressor.predict(X), y, decimal=1)
|