Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
22c66be
1
Parent(s):
542657a
Let `equation_search` make default variable if not given
Browse files- pysr/sr.py +10 -1
pysr/sr.py
CHANGED
@@ -1706,7 +1706,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
1706 |
Main.y,
|
1707 |
weights=Main.weights,
|
1708 |
niterations=int(self.niterations),
|
1709 |
-
variable_names=self.feature_names_in_
|
1710 |
options=options,
|
1711 |
numprocs=cprocs,
|
1712 |
parallelism=parallelism,
|
@@ -2409,3 +2409,12 @@ def _preprocess_julia_floats(s: str) -> str:
|
|
2409 |
s = _apply_regexp_im_sci(s)
|
2410 |
s = _apply_regexp_sci(s)
|
2411 |
return s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1706 |
Main.y,
|
1707 |
weights=Main.weights,
|
1708 |
niterations=int(self.niterations),
|
1709 |
+
variable_names=_format_feature_names(self.feature_names_in_),
|
1710 |
options=options,
|
1711 |
numprocs=cprocs,
|
1712 |
parallelism=parallelism,
|
|
|
2409 |
s = _apply_regexp_im_sci(s)
|
2410 |
s = _apply_regexp_sci(s)
|
2411 |
return s
|
2412 |
+
|
2413 |
+
|
2414 |
+
def _format_feature_names(feature_names_in):
|
2415 |
+
if all([f"x{i}" == feature_names_in[i] for i in range(len(feature_names_in))]):
|
2416 |
+
# Use `equation_search` defaults, which are
|
2417 |
+
# just the unicode versions
|
2418 |
+
return None
|
2419 |
+
else:
|
2420 |
+
return feature_names_in.tolist()
|