Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
β’
c7cea75
1
Parent(s):
875c5aa
Fix compat with old scikit-learn versions
Browse files- pysr/sr.py +11 -1
- pysr/version.py +1 -1
pysr/sr.py
CHANGED
@@ -1438,7 +1438,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
1438 |
weights = check_array(weights, ensure_2d=False)
|
1439 |
check_consistent_length(weights, y)
|
1440 |
X, y = self._validate_data(X=X, y=y, reset=True, multi_output=True)
|
1441 |
-
self.feature_names_in_ =
|
1442 |
self, variable_names, generate_names=False
|
1443 |
)
|
1444 |
|
@@ -2549,3 +2549,13 @@ def _subscriptify(i: int) -> str:
|
|
2549 |
For example, 123 -> "βββ".
|
2550 |
"""
|
2551 |
return "".join([chr(0x2080 + int(c)) for c in str(i)])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1438 |
weights = check_array(weights, ensure_2d=False)
|
1439 |
check_consistent_length(weights, y)
|
1440 |
X, y = self._validate_data(X=X, y=y, reset=True, multi_output=True)
|
1441 |
+
self.feature_names_in_ = _safe_check_feature_names_in(
|
1442 |
self, variable_names, generate_names=False
|
1443 |
)
|
1444 |
|
|
|
2549 |
For example, 123 -> "βββ".
|
2550 |
"""
|
2551 |
return "".join([chr(0x2080 + int(c)) for c in str(i)])
|
2552 |
+
|
2553 |
+
|
2554 |
+
def _safe_check_feature_names_in(self, variable_names, generate_names=True):
|
2555 |
+
"""_check_feature_names_in with compat for old versions."""
|
2556 |
+
try:
|
2557 |
+
return _check_feature_names_in(
|
2558 |
+
self, variable_names, generate_names=generate_names
|
2559 |
+
)
|
2560 |
+
except TypeError:
|
2561 |
+
return _check_feature_names_in(self, variable_names)
|
pysr/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
__version__ = "0.15.
|
2 |
__symbolic_regression_jl_version__ = "0.21.3"
|
|
|
1 |
+
__version__ = "0.15.1"
|
2 |
__symbolic_regression_jl_version__ = "0.21.3"
|