# Parameter estimation for ODEs with scarce ground truth data

**URL:** https://discourse.julialang.org/t/parameter-estimation-for-odes-with-scarce-ground-truth-data/91685
**Category:** New to Julia
**Tags:** question
**Created:** [December 15, 2022, 8:51am UTC](https://discourse.julialang.org/t/parameter-estimation-for-odes-with-scarce-ground-truth-data/91685 "2022-12-15T08:51:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![magnumopus94](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@magnumopus94](https://discourse.julialang.org/u/magnumopus94)
#### Post date: [December 15, 2022, 8:51am UTC](https://discourse.julialang.org/t/parameter-estimation-for-odes-with-scarce-ground-truth-data/91685/1 "2022-12-15T08:51:09Z")

</div>

Hello all, I’m relatively new to Julia.

A brief background about my problem: I have an ODE scheme that gives me the concentration profile over time for 10 compounds and the model contains 11 parameters. However, I am trying to estimate the 11 parameters based on the ground truth data of just 4 of these 10 compounds, that are available only at four different time intervals.

I have tried using Optim.jl for the parameter estimation to search locally around the initial guess but this gives me a result that is worse/not too different than the initial guess.

[note: one of the 4 concentrations evolves to large values (by at least an order of magnitude) compared to the other 3.]

I’d like to know if anyone has worked on similar problems or know how to handle parameter estimation problems when you have scarce data to fit the model on.

I’m sorry if this is a repeat of earlier queries. I’d be happy to provide more context in case I am not clear.

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [December 15, 2022, 12:36pm UTC](https://discourse.julialang.org/t/parameter-estimation-for-odes-with-scarce-ground-truth-data/91685/2 "2022-12-15T12:36:56Z")

</div>

> [@magnumopus94](#):
>
> I have tried using Optim.jl for the parameter estimation to search locally around the initial guess but this gives me a result that is worse/not too different than the initial guess.

What optimizer? Did you try global optimizers from BlackBoxOptim? The following is usually my go-to for checking global optimization results:

> **[BlackBoxOptim.jl · Optimization.jl](https://docs.sciml.ai/Optimization/stable/optimization_packages/blackboxoptim/#Example)**
>
> Documentation for Optimization.jl.

If you’re wondering whether in principle your data is sufficient for estimating your model, you can do a structural identifiability analysis:

[https://docs.sciml.ai/StructuralIdentifiability/stable/tutorials/local\_identifiability/](https://docs.sciml.ai/StructuralIdentifiability/stable/tutorials/local_identifiability/)

This an be done without rewriting your code by using `modelingtoolkitize` and using the MTK form:

> **[Modelingtoolkitize: Automatically Translating Numerical to Symbolic Code ·...](https://docs.sciml.ai/ModelingToolkit/stable/tutorials/modelingtoolkitize/)**
>
> Documentation for ModelingToolkit.jl.

> **[Parameter Identifiability in ODE Models · ModelingToolkit.jl](https://docs.sciml.ai/ModelingToolkit/stable/tutorials/parameter_identifiability/)**
>
> Documentation for ModelingToolkit.jl.

---

<div class="post-metadata">

### Author: ![magnumopus94](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@magnumopus94](https://discourse.julialang.org/u/magnumopus94)
#### Post date: [December 15, 2022, 1:47pm UTC](https://discourse.julialang.org/t/parameter-estimation-for-odes-with-scarce-ground-truth-data/91685/3 "2022-12-15T13:47:37Z")

</div>

Hello Chris, thanks for your reply.

> [@ChrisRackauckas](#):
>
> What optimizer? Did you try global optimizers from BlackBoxOptim?

Yes, I tried a few global optimizers from BBO. But they were returning negative values of the parameters I’m interested in, when they’re supposed to \>=0 always. Then, I started using Fminbox() after defining the lower and upper bounds as I wanted to search locally.

> [@ChrisRackauckas](#):
>
> If you’re wondering whether in principle your data is sufficient for estimating your model, you can do a structural identifiability analysis:

> [@ChrisRackauckas](#):
>
> This an be done without rewriting your code by using `modelingtoolkitize` and using the MTK form:

Okay, these are things I’ve not tried yet. Thanks for the suggestions.

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [December 15, 2022, 1:57pm UTC](https://discourse.julialang.org/t/parameter-estimation-for-odes-with-scarce-ground-truth-data/91685/4 "2022-12-15T13:57:33Z")

</div>

> [@magnumopus94](#):
>
> Yes, I tried a few global optimizers from BBO. But they were returning negative values of the parameters I’m interested in, when they’re supposed to \>=0 always.

did you set the box constraints? The example I posted used box constraints.

---

<div class="post-metadata">

### Author: ![magnumopus94](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@magnumopus94](https://discourse.julialang.org/u/magnumopus94)
#### Post date: [January 4, 2023, 2:26am UTC](https://discourse.julialang.org/t/parameter-estimation-for-odes-with-scarce-ground-truth-data/91685/5 "2023-01-04T02:26:58Z")

</div>

Hello Chris,

No, I hadn’t set the box constraints back then.
