Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
e957e34
1
Parent(s):
62ecf50
Export SymbolicRegression.jl module
Browse files- pysr/__init__.py +3 -2
- pysr/julia_import.py +3 -0
- pysr/sr.py +1 -4
pysr/__init__.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
# This must be imported as early as possible to prevent
|
2 |
# library linking issues caused by numpy/pytorch/etc. importing
|
3 |
# old libraries:
|
4 |
-
from .julia_import import jl # isort:skip
|
5 |
|
6 |
from . import sklearn_monkeypatch
|
7 |
from .deprecated import best, best_callable, best_row, best_tex, pysr
|
@@ -14,6 +14,8 @@ from .sr import PySRRegressor
|
|
14 |
from .version import __version__
|
15 |
|
16 |
__all__ = [
|
|
|
|
|
17 |
"sklearn_monkeypatch",
|
18 |
"sympy2jax",
|
19 |
"sympy2torch",
|
@@ -26,6 +28,5 @@ __all__ = [
|
|
26 |
"best_tex",
|
27 |
"pysr",
|
28 |
"__version__",
|
29 |
-
"jl",
|
30 |
"install",
|
31 |
]
|
|
|
1 |
# This must be imported as early as possible to prevent
|
2 |
# library linking issues caused by numpy/pytorch/etc. importing
|
3 |
# old libraries:
|
4 |
+
from .julia_import import jl, SymbolicRegression # isort:skip
|
5 |
|
6 |
from . import sklearn_monkeypatch
|
7 |
from .deprecated import best, best_callable, best_row, best_tex, pysr
|
|
|
14 |
from .version import __version__
|
15 |
|
16 |
__all__ = [
|
17 |
+
"jl",
|
18 |
+
"SymbolicRegression",
|
19 |
"sklearn_monkeypatch",
|
20 |
"sympy2jax",
|
21 |
"sympy2torch",
|
|
|
28 |
"best_tex",
|
29 |
"pysr",
|
30 |
"__version__",
|
|
|
31 |
"install",
|
32 |
]
|
pysr/julia_import.py
CHANGED
@@ -66,3 +66,6 @@ if jl.seval('VERSION >= v"1.9.0-DEV.0"'):
|
|
66 |
return jl.eval(jl.Meta.parseall(s))
|
67 |
|
68 |
jl.seval = seval
|
|
|
|
|
|
|
|
66 |
return jl.eval(jl.Meta.parseall(s))
|
67 |
|
68 |
jl.seval = seval
|
69 |
+
|
70 |
+
jl.seval("using SymbolicRegression")
|
71 |
+
SymbolicRegression = jl.SymbolicRegression
|
pysr/sr.py
CHANGED
@@ -38,7 +38,7 @@ from .julia_helpers import (
|
|
38 |
jl_array,
|
39 |
jl_deserialize_s,
|
40 |
)
|
41 |
-
from .julia_import import jl
|
42 |
from .utils import (
|
43 |
_csv_filename_to_pkl_filename,
|
44 |
_preprocess_julia_floats,
|
@@ -1550,9 +1550,6 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
1550 |
if cluster_manager is not None:
|
1551 |
cluster_manager = _load_cluster_manager(cluster_manager)
|
1552 |
|
1553 |
-
jl.seval("using SymbolicRegression")
|
1554 |
-
SymbolicRegression = jl.SymbolicRegression
|
1555 |
-
|
1556 |
jl.plus = jl.seval("(+)")
|
1557 |
jl.sub = jl.seval("(-)")
|
1558 |
jl.mult = jl.seval("(*)")
|
|
|
38 |
jl_array,
|
39 |
jl_deserialize_s,
|
40 |
)
|
41 |
+
from .julia_import import SymbolicRegression, jl
|
42 |
from .utils import (
|
43 |
_csv_filename_to_pkl_filename,
|
44 |
_preprocess_julia_floats,
|
|
|
1550 |
if cluster_manager is not None:
|
1551 |
cluster_manager = _load_cluster_manager(cluster_manager)
|
1552 |
|
|
|
|
|
|
|
1553 |
jl.plus = jl.seval("(+)")
|
1554 |
jl.sub = jl.seval("(-)")
|
1555 |
jl.mult = jl.seval("(*)")
|