Skip to content

Commit

Permalink
Merge pull request #1132 from ICB-DCM/develop
Browse files Browse the repository at this point in the history
Release 0.3.3
  • Loading branch information
PaulJonasJost committed Oct 19, 2023
2 parents f9d68ef + f6cf0d9 commit 883138a
Show file tree
Hide file tree
Showing 17 changed files with 222 additions and 96 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ Release notes
..........


0.3.3 (2023-10-19)
-------------------

* Visualize:
* Get optimization result by id (#1116)
* Storage:
* allow "{id}" in history storage filename (#1118)
* Objective:
* adjusted PEtab.jl syntax to new release (#1128, #1131)
* Documentation on PEtab importer updated (#1126)
* Ensembles
* Additional option for cutoff calculation (#1124)
* Ensembles from optimization endpoints now only takes free parameters (#1130)
* General
* Added How to Cite (#1125)
* Additional summary option (#1134)
* Speed up base tests (#1127)


0.3.2 (2023-10-02)
-------------------

Expand Down
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,29 @@ We are happy about any contributions. For more information on how to contribute
to pyPESTO check out
<https://pypesto.readthedocs.io/en/latest/contribute.html>

## Publications

**Citeable DOI for the latest pyPESTO release:**
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2553546.svg)](https://doi.org/10.5281/zenodo.2553546)

There is a list of [publications using pyPESTO](https://pypesto.readthedocs.io/en/latest/references.html).
If you used pyPESTO in your work, we are happy to include
your project, please let us know via a GitHub issue.

When using pyPESTO in your project, please cite
* Schälte, Y., Fröhlich, F., Jost, P. J., Vanhoefer, J., Pathirana, D., Stapor, P.,
Lakrisenko, P., Wang, D., Raimúndez, E., Merkt, S., Schmiester, L., Städter, P.,
Grein, S., Dudkin, E., Doresic, D., Weindl, D., & Hasenauer, J. (2023). pyPESTO: A
modular and scalable tool for parameter estimation for dynamic models [(arXiv:2305.01821)](https://doi.org/10.48550/arXiv.2305.01821).

When presenting work that employs pyPESTO, feel free to use one of the icons in
[doc/logo/](https://github.com/ICB-DCM/pyPESTO/tree/main/doc/logo):

<p align="center">
<img src="https://raw.githubusercontent.com/ICB-DCM/pyPESTO/master/doc/logo/logo.png" height="75" alt="AMICI Logo">
</p>

## References

[**PESTO**](https://github.com/ICB-DCM/PESTO/):
Parameter estimation toolbox for MATLAB. Development is discontinued, but PESTO
comes with additional features waiting to be ported to pyPESTO.
pyPESTO supersedes [**PESTO**](https://github.com/ICB-DCM/PESTO/) a parameter estimation
toolbox for MATLAB, whose development is discontinued.
14 changes: 7 additions & 7 deletions doc/example/conversion_reaction/PEtabJl_module.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ using Sundials
using PEtab

pathYaml = "/Users/pauljonasjost/Documents/GitHub_Folders/pyPESTO/test/julia/../../doc/example/conversion_reaction/conversion_reaction.yaml"
petabModel = readPEtabModel(pathYaml, verbose=true)
petabModel = PEtabModel(pathYaml, verbose=true)

# A full list of options for createPEtabODEProblem can be found at https://sebapersson.github.io/PEtab.jl/dev/API_choosen/#PEtab.setupPEtabODEProblem
petabProblem = createPEtabODEProblem(
# A full list of options for PEtabODEProblem can be found at https://sebapersson.github.io/PEtab.jl/stable/API_choosen/
petabProblem = PEtabODEProblem(
petabModel,
odeSolverOptions=ODESolverOptions(Rodas5P(), abstol=1e-08, reltol=1e-08, maxiters=Int64(1e4)),
gradientMethod=:ForwardDiff,
hessianMethod=:ForwardDiff,
sparseJacobian=nothing,
ode_solver=ODESolver(Rodas5P(), abstol=1e-08, reltol=1e-08, maxiters=Int64(1e4)),
gradient_method=:ForwardDiff,
hessian_method=:ForwardDiff,
sparse_jacobian=nothing,
verbose=true
)

Expand Down
28 changes: 28 additions & 0 deletions doc/how_to_cite.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
How to cite pyPESTO
===================

**Citeable DOI for the latest pyPESTO release:**

.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.2553546.svg
:target: https://doi.org/10.5281/zenodo.2553546
:alt: pyPESTO release DOI


There is a list of `publications using pyPESTO <https://pypesto.readthedocs.io/en/latest/references.html>`_.
If you used pyPESTO in your work, we are happy to include
your project, please let us know via a GitHub issue.

When using pyPESTO in your project, please cite

- Schälte, Y., Fröhlich, F., Jost, P. J., Vanhoefer, J., Pathirana, D., Stapor, P.,
Lakrisenko, P., Wang, D., Raimúndez, E., Merkt, S., Schmiester, L., Städter, P.,
Grein, S., Dudkin, E., Doresic, D., Weindl, D., & Hasenauer, J. (2023). pyPESTO: A
modular and scalable tool for parameter estimation for dynamic models `arXiv:2305.01821 <https://doi.org/10.48550/arXiv.2305.01821>`_.

When presenting work that employs pyPESTO, feel free to use one of the icons in
`doc/logo/ <https://github.com/ICB-DCM/pyPESTO/tree/main/doc/logo>`_:

.. image:: https://raw.githubusercontent.com/ICB-DCM/pyPESTO/master/doc/logo/logo.png
:target: https://raw.githubusercontent.com/ICB-DCM/pyPESTO/master/doc/logo/logo.png
:height: 75
:alt: pyPESTO LOGO
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pyPESTO - Parameter EStimation TOolbox for python
references
contact
license
how_to_cite
logo


Expand Down
4 changes: 2 additions & 2 deletions doc/references.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Publications using pypesto
Publications using pyPESTO
==========================

pypesto was used in the following publications:
pyPESTO was used in the following publications:

.. bibliography:: using_pypesto.bib
:list: enumerated
Expand Down
3 changes: 3 additions & 0 deletions pypesto/C.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
ENSEMBLE_TYPE = 'ensemble_type'
PREDICTIONS = 'predictions'

SIMULTANEOUS = 'simultaneous'
POINTWISE = 'pointwise'

LOWER_BOUND = 'lower_bound'
UPPER_BOUND = 'upper_bound'
PREEQUILIBRATION_CONDITION_ID = 'preequilibrationConditionId'
Expand Down
29 changes: 24 additions & 5 deletions pypesto/ensemble/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
OUTPUT,
OUTPUT_SENSI,
PERCENTILE,
POINTWISE,
PREDICTION_ARRAYS,
PREDICTION_ID,
PREDICTION_RESULTS,
PREDICTION_SUMMARY,
PREDICTIONS,
PREDICTOR,
SIMULTANEOUS,
STANDARD_DEVIATION,
SUMMARY,
TIMEPOINTS,
Expand Down Expand Up @@ -668,7 +670,7 @@ def from_optimization_endpoints(
# did not reach maximum size and the next value is still
# lower than the cutoff value
if start['fval'] <= abs_cutoff and len(x_vectors) < max_size:
x_vectors.append(start['x'])
x_vectors.append(start['x'][result.problem.x_free_indices])

# the vector tag will be a -1 to indicate it is the last step
vector_tags.append((int(start['id']), -1))
Expand Down Expand Up @@ -1204,7 +1206,11 @@ def get_percentile_label(percentile: Union[float, int, str]) -> str:
return f'{PERCENTILE} {percentile}'


def calculate_cutoff(result: Result, percentile: float = 0.95):
def calculate_cutoff(
result: Result,
percentile: float = 0.95,
cr_option: str = SIMULTANEOUS,
):
"""
Calculate the cutoff of the ensemble.
Expand All @@ -1220,6 +1226,10 @@ def calculate_cutoff(result: Result, percentile: float = 0.95):
The percentile of the chi^2 distribution. Between 0 and 100.
Higher values will result in a more lax cutoff. If the value is greater
than 100, the cutoff will be returned as np.inf.
cr_option:
The type of confidence region, which determines the degree of freedom of
the chi^2 distribution for the cutoff value. It can take 'simultaneous' or
'pointwise'.
Returns
-------
Expand All @@ -1230,10 +1240,19 @@ def calculate_cutoff(result: Result, percentile: float = 0.95):
f"percentile={percentile} is too large. Choose "
f"0<=percentile<=100."
)
if cr_option not in [SIMULTANEOUS, POINTWISE]:
raise ValueError(
"Confidence region must be either simultaneous or pointwise."
)

# optimal point as base:
fval_opt = result.optimize_result[0].fval
# degrees of freedom is equal to the number of parameters
df = result.problem.dim
range = chi2.ppf(q=percentile / 100, df=df)
if cr_option == SIMULTANEOUS:
# degrees of freedom is equal to the number of parameters
df = result.problem.dim
elif cr_option == POINTWISE:
# degrees of freedom is equal to 1
df = 1

range = chi2.ppf(q=percentile / 100, df=df)
return fval_opt + range
16 changes: 8 additions & 8 deletions pypesto/objective/julia/petabJl.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def __init__(
self.petab_jl_problem = petab_jl_problem

# get functions
fun = self.petab_jl_problem.computeCost
grad = self.petab_jl_problem.computeGradient
hess = self.petab_jl_problem.computeHessian
x_names = np.asarray(self.petab_jl_problem.θ_estNames)
fun = self.petab_jl_problem.compute_cost
grad = self.petab_jl_problem.compute_gradient
hess = self.petab_jl_problem.compute_hessian
x_names = np.asarray(self.petab_jl_problem.θ_names)

# call the super super super constructor
super(JuliaObjective, self).__init__(
Expand Down Expand Up @@ -102,10 +102,10 @@ def __setstate__(self, state):
self.petab_jl_problem = petab_jl_problem

# get functions
fun = self.petab_jl_problem.computeCost
grad = self.petab_jl_problem.computeGradient
hess = self.petab_jl_problem.computeHessian
x_names = np.asarray(self.petab_jl_problem.θ_estNames)
fun = self.petab_jl_problem.compute_cost
grad = self.petab_jl_problem.compute_gradient
hess = self.petab_jl_problem.compute_hessian
x_names = np.asarray(self.petab_jl_problem.θ_names)

# call the super super constructor
super(JuliaObjective, self).__init__(fun, grad, hess, x_names)
Expand Down
Loading

0 comments on commit 883138a

Please sign in to comment.