Skip to content

Commit

Permalink
Merge branch 'develop' into fix_1448_plist
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl authored Oct 23, 2024
2 parents 59f78ed + 47ae5d5 commit ee11bd6
Show file tree
Hide file tree
Showing 14 changed files with 515 additions and 143 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,14 @@ jobs:
- name: Install julia
uses: julia-actions/setup-julia@v2
with:
version: 1.9

- name: Cache Julia
uses: julia-actions/cache@v2
version: 1.11

- name: Install dependencies
run: .github/workflows/install_deps.sh

- name: Install PEtabJL dependencies
run: >
julia -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name="PEtab", version="2.5.0"));
julia -e 'using Pkg; Pkg.add("PEtab");
Pkg.add("OrdinaryDiffEq"); Pkg.add("Sundials")'
- name: Run tests
Expand Down
16 changes: 9 additions & 7 deletions doc/using_pypesto.bib
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,18 @@ @Misc{LakrisenkoPat2024
primaryclass = {q-bio.QM},
}

@Misc{PhilippsKoe2024,
@Article{PhilippsKoe2024,
author = {Maren Philipps and Antonia Körner and Jakob Vanhoefer and Dilan Pathirana and Jan Hasenauer},
title = {Non-Negative Universal Differential Equations With Applications in Systems Biology},
year = {2024},
archiveprefix = {arXiv},
creationdate = {2024-06-28T08:40:06},
eprint = {2406.14246},
modificationdate = {2024-06-28T08:40:06},
primaryclass = {q-bio.QM},
url = {https://arxiv.org/abs/2406.14246},
journal = {IFAC-PapersOnLine},
volume = {58},
number = {23},
pages = {25-30},
issn = {2405-8963},
doi = {https://doi.org/10.1016/j.ifacol.2024.10.005},
url = {https://www.sciencedirect.com/science/article/pii/S2405896324017518},
abstract = {Universal differential equations (UDEs) leverage the respective advantages of mechanistic models and artificial neural networks and combine them into one dynamic model. However, these hybrid models can suffer from unrealistic solutions, such as negative values for biochemical quantities. We present non-negative UDE (nUDEs), a constrained UDE variant that guarantees non-negative values. Furthermore, we explore regularisation techniques to improve generalisation and interpretability of UDEs.}
}

@Article{SchmiesterBra2024,
Expand Down
16 changes: 8 additions & 8 deletions pypesto/objective/julia/petabJl.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def __init__(
self.petab_jl_problem = petab_jl_problem

# get functions
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)
fun = self.petab_jl_problem.nllh
grad = self.petab_jl_problem.grad
hess = self.petab_jl_problem.hess
x_names = np.asarray(self.petab_jl_problem.xnames)

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

# get functions
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)
fun = self.petab_jl_problem.nllh
grad = self.petab_jl_problem.grad
hess = self.petab_jl_problem.hess
x_names = np.asarray(self.petab_jl_problem.xnames)

# call the super super constructor
super(JuliaObjective, self).__init__(fun, grad, hess, x_names)
Expand Down
2 changes: 1 addition & 1 deletion pypesto/objective/julia/petab_jl_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def _write_julia_file(
f"found at {link_to_options}\n"
f"petabProblem = PEtabODEProblem(\n\t"
f"petabModel,\n\t"
f"ode_solver=ODESolver({odeSolvOpt_str}),\n\t"
f"odesolver=ODESolver({odeSolvOpt_str}),\n\t"
f"gradient_method=:{options['gradient_method']},\n\t"
f"hessian_method=:{options['hessian_method']},\n\t"
f"sparse_jacobian={options['sparse_jacobian']},\n\t"
Expand Down
16 changes: 8 additions & 8 deletions pypesto/profile/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class ProfileOptions(dict):
reg_order:
Maximum degree of regression polynomial used in regression based
adaptive profile points proposal.
magic_factor_obj_value:
There is this magic factor in the old profiling code which slows down
profiling at small ratios (must be >= 0 and < 1).
adaptive_target_scaling_factor:
The scaling factor of the next_obj_target in next guess generation.
Larger values result in larger next_guess step size (must be > 1).
whole_path:
Whether to profile the whole bounds or only till we get below the
ratio.
Expand All @@ -44,13 +44,13 @@ def __init__(
self,
default_step_size: float = 0.01,
min_step_size: float = 0.001,
max_step_size: float = 1.0,
max_step_size: float = 0.1,
step_size_factor: float = 1.25,
delta_ratio_max: float = 0.1,
ratio_min: float = 0.145,
reg_points: int = 10,
reg_order: int = 4,
magic_factor_obj_value: float = 0.5,
adaptive_target_scaling_factor: float = 1.5,
whole_path: bool = False,
):
super().__init__()
Expand All @@ -63,7 +63,7 @@ def __init__(
self.delta_ratio_max = delta_ratio_max
self.reg_points = reg_points
self.reg_order = reg_order
self.magic_factor_obj_value = magic_factor_obj_value
self.adaptive_target_scaling_factor = adaptive_target_scaling_factor
self.whole_path = whole_path

self.validate()
Expand Down Expand Up @@ -112,5 +112,5 @@ def validate(self):
if self.default_step_size < self.min_step_size:
raise ValueError("default_step_size must be >= min_step_size.")

if self.magic_factor_obj_value < 0 or self.magic_factor_obj_value >= 1:
raise ValueError("magic_factor_obj_value must be >= 0 and < 1.")
if self.adaptive_target_scaling_factor < 1:
raise ValueError("adaptive_target_scaling_factor must be > 1.")
10 changes: 8 additions & 2 deletions pypesto/profile/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def parameter_profile(
profile_index: Iterable[int] = None,
profile_list: int = None,
result_index: int = 0,
next_guess_method: Union[Callable, str] = "adaptive_step_regression",
next_guess_method: Union[Callable, str] = "adaptive_step_order_1",
profile_options: ProfileOptions = None,
progress_bar: bool = None,
filename: Union[str, Callable, None] = None,
Expand Down Expand Up @@ -93,7 +93,9 @@ def parameter_profile(
profile_options = ProfileOptions.create_instance(profile_options)
profile_options.validate()

# create a function handle that will be called later to get the next point
# Create a function handle that will be called later to get the next point.
# This function will be used to generate the initial points of optimization
# steps in profiling in `walk_along_profile.py`
if isinstance(next_guess_method, str):

def create_next_guess(
Expand All @@ -104,6 +106,8 @@ def create_next_guess(
current_profile_,
problem_,
global_opt_,
min_step_increase_factor_,
max_step_reduce_factor_,
):
return next_guess(
x,
Expand All @@ -114,6 +118,8 @@ def create_next_guess(
current_profile_,
problem_,
global_opt_,
min_step_increase_factor_,
max_step_reduce_factor_,
)

elif callable(next_guess_method):
Expand Down
Loading

0 comments on commit ee11bd6

Please sign in to comment.