ModelingToolkit parameter estimation tutorials, and some confusion

Hi all,

I am working to figure out how to do parameter fitting on a ModelingToolkit model, which yields an ODEProblem. I am not bringing neural nets or anything.

I am trying to figure which way to do it either following:

or Parameter Estimation of Ordinary Differential Equations · SciMLSensitivity.jl

The latter method seems nicer— but not sure if it is completely compatible with MTK.

On the examples themselves, I think something is not working right.

I notice that choosing a random guess for the initial value of the parameters for the optimizer, like in the ModelingToolkit example, doesn’t result in bringing the loss to 0, you have to make the guess closer.

In the SciMLSensitivity example, the fitted parameters just yield more or less constant solution to ODE, not matching the original parameters at all. This can be seen in the final plot itself in the example. Running it myself yields the same result. The crazy thing is that the initial guess u0 for optprob are exactly the parameters used to generate the data we are trying to fit!

julia> optprob.u0
4-element Vector{Float64}:
 1.5
 1.0
 3.0
 1.0

So perhaps something broke along the way?

The latter is exactly the same? The MTK example just shows how to effectively use the parameters of an MTK model.

The initial condition in the example is rand(4) ?

Thank you, I missed that the SciMLSensitivity example is optimizing the parameters to MAKE the ODE solution 1 for all variables, rather than fitting parameters to data. Derp.

The MTK example makes more sense after reading the FAQ sections on tunable parameters and using MTK with optimization