MilesCranmer commited on
Commit
3a9acd3
β€’
2 Parent(s): 875c5aa c7cea75

Merge pull request #393 from MilesCranmer/MilesCranmer/issue392

Browse files
Files changed (2) hide show
  1. pysr/sr.py +11 -1
  2. 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_ = _check_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.0"
2
  __symbolic_regression_jl_version__ = "0.21.3"
 
1
+ __version__ = "0.15.1"
2
  __symbolic_regression_jl_version__ = "0.21.3"