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

PEtab import: Priors aren't support -> raise #384

Merged
merged 4 commits into from
Sep 16, 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
5 changes: 3 additions & 2 deletions benchmark_collection/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Borghans_BiophysChem1997
Crauste_CellSystems2017
Elowitz_Nature2000
Fujita_SciSignal2010
Schwen_PONE2014
Sneyd_PNAS2002
Weber_BMC2015
Zheng_PNAS2012
Expand Down Expand Up @@ -47,7 +46,9 @@ Zheng_PNAS2012
# Brannmark_JBC2010 FAILED: Expected llh 283.778227541074, got nllh 141.889034
# Lucarelli_CellSystems2018
# Fiedler_BMC2016 FAILED: Expected llh -117.16780323362, got nllh 109391.496205

#
# Unsupported priors:
# Schwen_PONE2014
for model_name in $expected_to_work; do
printf '=%.0s' {1..20}
printf %s "${model_name}"
Expand Down
25 changes: 22 additions & 3 deletions python/parpe/hdf5_pe_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ def __init__(self,
self.petab_problem: petab.Problem = petab_problem
self.amici_model: amici.Model = amici_model

# ensure we have valid inputs
petab.lint_problem(self.petab_problem)

# index for no reference/preequilibration condition
self.NO_PREEQ_CONDITION_IDX: int = NO_PREEQ_CONDITION_IDX

Expand All @@ -105,6 +102,28 @@ def __init__(self,
# hdf5 dataset compression
self.compression = "gzip"

self._check_support()

def _check_support(self):
"""
Check if the model is supported by parPE
"""
# ensure we have valid inputs
petab.lint_problem(self.petab_problem)

# We can't handle priors yet
# Initialization priors would work in principle when we sample
# starting points using petab. However, the current parpe C++
# resampling would ignore the initialization prior.
# And they wouldn't be supported for hierarchical optimization.
parameter_df = self.petab_problem.parameter_df
for col_id in [
ptc.INITIALIZATION_PRIOR_TYPE, ptc.INITIALIZATION_PRIOR_PARAMETERS,
ptc.OBJECTIVE_PRIOR_TYPE, ptc.OBJECTIVE_PRIOR_PARAMETERS
]:
if (col := parameter_df.get(col_id)) is not None and col.notna().any():
raise NotImplementedError("Priors are not supported yet.")

def generate_file(self, hdf5_file_name: str) -> None:
"""
Create the output file
Expand Down