Skip to content

Commit

Permalink
Fix model selection for loss=0
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Aug 10, 2022
1 parent 265efc9 commit ed5b70a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pysr/sr.py
Expand Up @@ -2157,7 +2157,7 @@ def idx_model_selection(equations: pd.DataFrame, model_selection: str) -> int:
chosen_idx = equations["loss"].idxmin()
elif model_selection == "best":
threshold = 1.5 * equations["loss"].min()
filtered_equations = equations.query(f"loss < {threshold}")
filtered_equations = equations.query(f"loss <= {threshold}")
chosen_idx = filtered_equations["score"].idxmax()
elif model_selection == "score":
chosen_idx = equations["score"].idxmax()
Expand Down

0 comments on commit ed5b70a

Please sign in to comment.