MilesCranmer commited on
Commit
ed5b70a
1 Parent(s): 265efc9

Fix model selection for loss=0

Browse files
Files changed (1) hide show
  1. pysr/sr.py +1 -1
pysr/sr.py CHANGED
@@ -2157,7 +2157,7 @@ def idx_model_selection(equations: pd.DataFrame, model_selection: str) -> int:
2157
  chosen_idx = equations["loss"].idxmin()
2158
  elif model_selection == "best":
2159
  threshold = 1.5 * equations["loss"].min()
2160
- filtered_equations = equations.query(f"loss < {threshold}")
2161
  chosen_idx = filtered_equations["score"].idxmax()
2162
  elif model_selection == "score":
2163
  chosen_idx = equations["score"].idxmax()
 
2157
  chosen_idx = equations["loss"].idxmin()
2158
  elif model_selection == "best":
2159
  threshold = 1.5 * equations["loss"].min()
2160
+ filtered_equations = equations.query(f"loss <= {threshold}")
2161
  chosen_idx = filtered_equations["score"].idxmax()
2162
  elif model_selection == "score":
2163
  chosen_idx = equations["score"].idxmax()