Spaces:
Sleeping
Sleeping
Remove use of `julia_kwargs`
Browse files- pysr/sr.py +6 -18
pysr/sr.py
CHANGED
|
@@ -575,11 +575,6 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
| 575 |
before passing to the symbolic regression code. None means no
|
| 576 |
feature selection; an int means select that many features.
|
| 577 |
Default is `None`.
|
| 578 |
-
julia_kwargs : dict
|
| 579 |
-
Keyword arguments to pass to `julia.core.Julia(...)` to initialize
|
| 580 |
-
the Julia runtime. The default, when `None`, is to set `threads` equal
|
| 581 |
-
to `procs`, and `optimize` to 3.
|
| 582 |
-
Default is `None`.
|
| 583 |
**kwargs : dict
|
| 584 |
Supports deprecated keyword arguments. Other arguments will
|
| 585 |
result in an error.
|
|
@@ -743,7 +738,6 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
| 743 |
extra_jax_mappings: Optional[Dict[Callable, str]] = None,
|
| 744 |
denoise: bool = False,
|
| 745 |
select_k_features: Optional[int] = None,
|
| 746 |
-
julia_kwargs: Optional[Dict] = None,
|
| 747 |
**kwargs,
|
| 748 |
):
|
| 749 |
# Hyperparameters
|
|
@@ -843,7 +837,6 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
| 843 |
# Pre-modelling transformation
|
| 844 |
self.denoise = denoise
|
| 845 |
self.select_k_features = select_k_features
|
| 846 |
-
self.julia_kwargs = julia_kwargs
|
| 847 |
|
| 848 |
# Once all valid parameters have been assigned handle the
|
| 849 |
# deprecated kwargs
|
|
@@ -878,6 +871,12 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
| 878 |
"PySR repository root.\n"
|
| 879 |
"You should now be able to use the custom julia project.",
|
| 880 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 881 |
else:
|
| 882 |
raise TypeError(
|
| 883 |
f"{k} is not a valid keyword argument for PySRRegressor."
|
|
@@ -1300,16 +1299,6 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
| 1300 |
> 0
|
| 1301 |
)
|
| 1302 |
|
| 1303 |
-
julia_kwargs = {}
|
| 1304 |
-
if self.julia_kwargs is not None:
|
| 1305 |
-
for key, value in self.julia_kwargs.items():
|
| 1306 |
-
julia_kwargs[key] = value
|
| 1307 |
-
if "optimize" not in julia_kwargs:
|
| 1308 |
-
julia_kwargs["optimize"] = 3
|
| 1309 |
-
if "threads" not in julia_kwargs and packed_modified_params["multithreading"]:
|
| 1310 |
-
julia_kwargs["threads"] = self.procs
|
| 1311 |
-
packed_modified_params["julia_kwargs"] = julia_kwargs
|
| 1312 |
-
|
| 1313 |
return packed_modified_params
|
| 1314 |
|
| 1315 |
def _validate_and_set_fit_params(
|
|
@@ -1551,7 +1540,6 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
| 1551 |
batch_size = mutated_params["batch_size"]
|
| 1552 |
update_verbosity = mutated_params["update_verbosity"]
|
| 1553 |
progress = mutated_params["progress"]
|
| 1554 |
-
julia_kwargs = mutated_params["julia_kwargs"]
|
| 1555 |
|
| 1556 |
# Start julia backend processes
|
| 1557 |
if not already_ran and update_verbosity != 0:
|
|
|
|
| 575 |
before passing to the symbolic regression code. None means no
|
| 576 |
feature selection; an int means select that many features.
|
| 577 |
Default is `None`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 578 |
**kwargs : dict
|
| 579 |
Supports deprecated keyword arguments. Other arguments will
|
| 580 |
result in an error.
|
|
|
|
| 738 |
extra_jax_mappings: Optional[Dict[Callable, str]] = None,
|
| 739 |
denoise: bool = False,
|
| 740 |
select_k_features: Optional[int] = None,
|
|
|
|
| 741 |
**kwargs,
|
| 742 |
):
|
| 743 |
# Hyperparameters
|
|
|
|
| 837 |
# Pre-modelling transformation
|
| 838 |
self.denoise = denoise
|
| 839 |
self.select_k_features = select_k_features
|
|
|
|
| 840 |
|
| 841 |
# Once all valid parameters have been assigned handle the
|
| 842 |
# deprecated kwargs
|
|
|
|
| 871 |
"PySR repository root.\n"
|
| 872 |
"You should now be able to use the custom julia project.",
|
| 873 |
)
|
| 874 |
+
elif k == "julia_kwargs":
|
| 875 |
+
warnings.warn(
|
| 876 |
+
"The `julia_kwargs` parameter has been deprecated. To pass custom "
|
| 877 |
+
"keyword arguments to the julia backend, you should use environment variables. "
|
| 878 |
+
"See the Julia documentation for more information.",
|
| 879 |
+
)
|
| 880 |
else:
|
| 881 |
raise TypeError(
|
| 882 |
f"{k} is not a valid keyword argument for PySRRegressor."
|
|
|
|
| 1299 |
> 0
|
| 1300 |
)
|
| 1301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1302 |
return packed_modified_params
|
| 1303 |
|
| 1304 |
def _validate_and_set_fit_params(
|
|
|
|
| 1540 |
batch_size = mutated_params["batch_size"]
|
| 1541 |
update_verbosity = mutated_params["update_verbosity"]
|
| 1542 |
progress = mutated_params["progress"]
|
|
|
|
| 1543 |
|
| 1544 |
# Start julia backend processes
|
| 1545 |
if not already_ran and update_verbosity != 0:
|