Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SSR as criterion #108

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions petab_select/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ class Criterion(str, Enum):
LLH = "LLH"
#: The negative log-likelihood.
NLLH = "NLLH"
#: The sum of squared residuals.
SSR = "SSR"


#: Methods that move through model space by taking steps away from some model.
Expand Down
7 changes: 5 additions & 2 deletions petab_select/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,11 @@ def compute_criterion(
criterion_value = self.criterion_computer(criterion)
self.set_criterion(criterion, criterion_value)
result = criterion_value
except ValueError:
except ValueError as err:
if raise_on_failure:
raise
raise ValueError(
f"Insufficient information to compute criterion `{criterion}`."
) from err
result = None
return result

Expand Down Expand Up @@ -684,6 +686,7 @@ def default_compare(
Criterion.AICC,
Criterion.BIC,
Criterion.NLLH,
Criterion.SSR,
]:
return (
model1.get_criterion(criterion)
Expand Down
Loading