Parameter estimation with DifferentialEquations.jl for a subset of parameters

If I have defined an ODEFunction with a parameter vector p according to the DifferentialEquations.jl package.
Is it possible to build a loss objective, i.e. using build_loss_objective for only a subset of parameters specified by indices? And does it also work for an EnsembleProblem?

In the docs about parameter estimation I could only find examples where the full parameter vector was used for estimation and if only a subset was used, the parameter elements were replaced by their known values directly in the definition of the ODEFunction.

1 Like

It does work on en EnsembleProblem, but doing just a subset of parameters is tricky. We are re-working this interface this summer towards that of DiffEqFlux to fix these issues. One way to handle this is to enclose the parameters you don’t want to estimate in the diffeq function itself, and then have your parameter vector be just the other subset.

I’ve used such an approach, but would love it if you’ve reworked this. Any progress?

In my case, I’ve got many (~50) parameters, three of which I estimate (with Turing.jl), and I’d love to be able to use a NamedTuple for the parameters, perhaps one for the fixed and one for the estimated parameters.

Edit: Found Chris’ advice on another topic* to use closures**. I’m not much of a programmer, so didn’t know what this was, but looked it up and its everything I needed. I was searching for a long time on how to handle these ~50 named parameters in a safe way, and think closures are the solution.

NamedTuple is a bad idea for that. Just use ComponentArrays with DiffEqFlux. This is a nice example:

https://jonniedie.github.io/ComponentArrays.jl/dev/examples/DiffEqFlux/