MilesCranmer commited on
Commit
4f7e6cf
1 Parent(s): 04454ac

Fix select_k_features + units

Browse files
Files changed (2) hide show
  1. pysr/sr.py +0 -3
  2. pysr/test/test.py +1 -0
pysr/sr.py CHANGED
@@ -1521,9 +1521,6 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1521
  if X_units is not None:
1522
  X_units = [X_units[i] for i in self.selection_mask_]
1523
  self.X_units_ = copy.deepcopy(X_units)
1524
- if y_units is not None:
1525
- y_units = [y_units[i] for i in self.selection_mask_]
1526
- self.y_units_ = copy.deepcopy(y_units)
1527
 
1528
  # Re-perform data validation and feature name updating
1529
  X, y = self._validate_data(X=X, y=y, reset=True, multi_output=True)
 
1521
  if X_units is not None:
1522
  X_units = [X_units[i] for i in self.selection_mask_]
1523
  self.X_units_ = copy.deepcopy(X_units)
 
 
 
1524
 
1525
  # Re-perform data validation and feature name updating
1526
  X, y = self._validate_data(X=X, y=y, reset=True, multi_output=True)
pysr/test/test.py CHANGED
@@ -925,6 +925,7 @@ class TestDimensionalConstraints(unittest.TestCase):
925
  unary_operators=["cos"],
926
  **self.default_test_kwargs,
927
  early_stop_condition=1e-8,
 
928
  )
929
  model.fit(self.X, y, X_units=["m", "m", "m", "m", "m"], y_units="m")
930
 
 
925
  unary_operators=["cos"],
926
  **self.default_test_kwargs,
927
  early_stop_condition=1e-8,
928
+ select_k_features=3,
929
  )
930
  model.fit(self.X, y, X_units=["m", "m", "m", "m", "m"], y_units="m")
931