Skip to content

Commit

Permalink
Merge pull request #837 from MilesCranmer/remove-feature-warning
Browse files Browse the repository at this point in the history
Remove warning about many features, as not really relevant anymore
  • Loading branch information
MilesCranmer authored Feb 24, 2025
2 parents 0f448b5 + 5ccd427 commit 94a74db
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
10 changes: 0 additions & 10 deletions pysr/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2263,16 +2263,6 @@ def fit(
)
)

# Warn about large feature counts (still warn if feature count is large
# after running feature selection)
if self.n_features_in_ >= 10:
warnings.warn(
"Note: you are running with 10 features or more. "
"Genetic algorithms like used in PySR scale poorly with large numbers of features. "
"You should run PySR for more `niterations` to ensure it can find "
"the correct variables, and consider using a larger `maxsize`."
)

# Assertion checks
use_custom_variable_names = variable_names is not None
# TODO: this is always true.
Expand Down
11 changes: 0 additions & 11 deletions pysr/test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,17 +1045,6 @@ def test_size_warning(self):
model.fit(X, y)
self.assertIn("more than 10,000", str(context.exception))

def test_feature_warning(self):
"""Ensure that a warning is given for large number of features."""
model = PySRRegressor()
X = np.random.randn(100, 10)
y = np.random.randn(100)
with warnings.catch_warnings():
warnings.simplefilter("error")
with self.assertRaises(Exception) as context:
model.fit(X, y)
self.assertIn("with 10 features or more", str(context.exception))

def test_deterministic_warnings(self):
"""Ensure that warnings are given for determinism"""
model = PySRRegressor(random_state=0)
Expand Down

0 comments on commit 94a74db

Please sign in to comment.