Skip to content

Commit

Permalink
Support SSR as criterion (#108)
Browse files Browse the repository at this point in the history
* closes #44
  • Loading branch information
dilpath authored Nov 18, 2024
1 parent 05ed5d7 commit 068fb64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit 068fb64

Please sign in to comment.