Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
593c674
1
Parent(s):
6bd5a10
Bump version with new csv format
Browse files- pysr/version.py +1 -1
- test/test.py +5 -5
- test/test_jax.py +6 -6
- test/test_torch.py +9 -9
pysr/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
__version__ = "0.
|
2 |
__symbolic_regression_jl_version__ = "0.10.0"
|
|
|
1 |
+
__version__ = "0.10.0"
|
2 |
__symbolic_regression_jl_version__ = "0.10.0"
|
test/test.py
CHANGED
@@ -288,10 +288,10 @@ class TestPipeline(unittest.TestCase):
|
|
288 |
def test_load_model(self):
|
289 |
"""See if we can load a ran model from the equation file."""
|
290 |
csv_file_data = """
|
291 |
-
Complexity
|
292 |
-
1
|
293 |
-
3
|
294 |
-
4
|
295 |
# Strip the indents:
|
296 |
csv_file_data = "\n".join([l.strip() for l in csv_file_data.split("\n")])
|
297 |
|
@@ -379,7 +379,7 @@ class TestBest(unittest.TestCase):
|
|
379 |
self.model.selection_mask_ = None
|
380 |
self.model.feature_names_in_ = np.array(["x0", "x1"], dtype=object)
|
381 |
equations["complexity loss equation".split(" ")].to_csv(
|
382 |
-
"equation_file.csv.bkup"
|
383 |
)
|
384 |
|
385 |
self.model.refresh()
|
|
|
288 |
def test_load_model(self):
|
289 |
"""See if we can load a ran model from the equation file."""
|
290 |
csv_file_data = """
|
291 |
+
Complexity,Loss,Equation
|
292 |
+
1,0.19951081,"1.9762075"
|
293 |
+
3,0.12717344,"(f0 + 1.4724599)"
|
294 |
+
4,0.104823045,"pow_abs(2.2683423, cos(f3))\""""
|
295 |
# Strip the indents:
|
296 |
csv_file_data = "\n".join([l.strip() for l in csv_file_data.split("\n")])
|
297 |
|
|
|
379 |
self.model.selection_mask_ = None
|
380 |
self.model.feature_names_in_ = np.array(["x0", "x1"], dtype=object)
|
381 |
equations["complexity loss equation".split(" ")].to_csv(
|
382 |
+
"equation_file.csv.bkup"
|
383 |
)
|
384 |
|
385 |
self.model.refresh()
|
test/test_jax.py
CHANGED
@@ -34,13 +34,13 @@ class TestJAX(unittest.TestCase):
|
|
34 |
equations = pd.DataFrame(
|
35 |
{
|
36 |
"Equation": ["1.0", "cos(x1)", "square(cos(x1))"],
|
37 |
-
"
|
38 |
"Complexity": [1, 2, 3],
|
39 |
}
|
40 |
)
|
41 |
|
42 |
-
equations["Complexity
|
43 |
-
"equation_file.csv.bkup"
|
44 |
)
|
45 |
|
46 |
model.refresh(checkpoint_file="equation_file.csv")
|
@@ -61,13 +61,13 @@ class TestJAX(unittest.TestCase):
|
|
61 |
equations = pd.DataFrame(
|
62 |
{
|
63 |
"Equation": ["1.0", "cos(x1)", "square(cos(x1))"],
|
64 |
-
"
|
65 |
"Complexity": [1, 2, 3],
|
66 |
}
|
67 |
)
|
68 |
|
69 |
-
equations["Complexity
|
70 |
-
"equation_file.csv.bkup"
|
71 |
)
|
72 |
|
73 |
model.refresh(checkpoint_file="equation_file.csv")
|
|
|
34 |
equations = pd.DataFrame(
|
35 |
{
|
36 |
"Equation": ["1.0", "cos(x1)", "square(cos(x1))"],
|
37 |
+
"Loss": [1.0, 0.1, 1e-5],
|
38 |
"Complexity": [1, 2, 3],
|
39 |
}
|
40 |
)
|
41 |
|
42 |
+
equations["Complexity Loss Equation".split(" ")].to_csv(
|
43 |
+
"equation_file.csv.bkup"
|
44 |
)
|
45 |
|
46 |
model.refresh(checkpoint_file="equation_file.csv")
|
|
|
61 |
equations = pd.DataFrame(
|
62 |
{
|
63 |
"Equation": ["1.0", "cos(x1)", "square(cos(x1))"],
|
64 |
+
"Loss": [1.0, 0.1, 1e-5],
|
65 |
"Complexity": [1, 2, 3],
|
66 |
}
|
67 |
)
|
68 |
|
69 |
+
equations["Complexity Loss Equation".split(" ")].to_csv(
|
70 |
+
"equation_file.csv.bkup"
|
71 |
)
|
72 |
|
73 |
model.refresh(checkpoint_file="equation_file.csv")
|
test/test_torch.py
CHANGED
@@ -49,13 +49,13 @@ class TestTorch(unittest.TestCase):
|
|
49 |
equations = pd.DataFrame(
|
50 |
{
|
51 |
"Equation": ["1.0", "cos(x1)", "square(cos(x1))"],
|
52 |
-
"
|
53 |
"Complexity": [1, 2, 3],
|
54 |
}
|
55 |
)
|
56 |
|
57 |
-
equations["Complexity
|
58 |
-
"equation_file.csv.bkup"
|
59 |
)
|
60 |
|
61 |
model.refresh(checkpoint_file="equation_file.csv")
|
@@ -82,13 +82,13 @@ class TestTorch(unittest.TestCase):
|
|
82 |
equations = pd.DataFrame(
|
83 |
{
|
84 |
"Equation": ["1.0", "cos(x1)", "square(cos(x1))"],
|
85 |
-
"
|
86 |
"Complexity": [1, 2, 3],
|
87 |
}
|
88 |
)
|
89 |
|
90 |
-
equations["Complexity
|
91 |
-
"equation_file.csv.bkup"
|
92 |
)
|
93 |
|
94 |
model.refresh(checkpoint_file="equation_file.csv")
|
@@ -133,13 +133,13 @@ class TestTorch(unittest.TestCase):
|
|
133 |
equations = pd.DataFrame(
|
134 |
{
|
135 |
"Equation": ["1.0", "mycustomoperator(x1)"],
|
136 |
-
"
|
137 |
"Complexity": [1, 2],
|
138 |
}
|
139 |
)
|
140 |
|
141 |
-
equations["Complexity
|
142 |
-
"equation_file_custom_operator.csv.bkup"
|
143 |
)
|
144 |
|
145 |
model.set_params(
|
|
|
49 |
equations = pd.DataFrame(
|
50 |
{
|
51 |
"Equation": ["1.0", "cos(x1)", "square(cos(x1))"],
|
52 |
+
"Loss": [1.0, 0.1, 1e-5],
|
53 |
"Complexity": [1, 2, 3],
|
54 |
}
|
55 |
)
|
56 |
|
57 |
+
equations["Complexity Loss Equation".split(" ")].to_csv(
|
58 |
+
"equation_file.csv.bkup"
|
59 |
)
|
60 |
|
61 |
model.refresh(checkpoint_file="equation_file.csv")
|
|
|
82 |
equations = pd.DataFrame(
|
83 |
{
|
84 |
"Equation": ["1.0", "cos(x1)", "square(cos(x1))"],
|
85 |
+
"Loss": [1.0, 0.1, 1e-5],
|
86 |
"Complexity": [1, 2, 3],
|
87 |
}
|
88 |
)
|
89 |
|
90 |
+
equations["Complexity Loss Equation".split(" ")].to_csv(
|
91 |
+
"equation_file.csv.bkup"
|
92 |
)
|
93 |
|
94 |
model.refresh(checkpoint_file="equation_file.csv")
|
|
|
133 |
equations = pd.DataFrame(
|
134 |
{
|
135 |
"Equation": ["1.0", "mycustomoperator(x1)"],
|
136 |
+
"Loss": [1.0, 0.1],
|
137 |
"Complexity": [1, 2],
|
138 |
}
|
139 |
)
|
140 |
|
141 |
+
equations["Complexity Loss Equation".split(" ")].to_csv(
|
142 |
+
"equation_file_custom_operator.csv.bkup"
|
143 |
)
|
144 |
|
145 |
model.set_params(
|