Issue with example in DiffEqParamEstim.jl

Hi,
I am excited to try parameter estimation on my model using DiffEqParamEstim.jl package. I thought of trying out some examples in the documentation and then choose the best method for my model. But I found some of those examples not working for me.

Example of Lotka-Volterra Equation with 4 parameters is the one I have tried. But after optimization using the package Optim.jl with BFGS algorithm, rendered status failure as the line search failed. Can I get a helping hand on this?

Also can I know if the same strategy in this example can be extended to a large system of differential equations with around 15 parameters to estimate?

Thanks in advance!

Here is the code in detail with the package versions I deal with.

Julia 1.7.1
DiffEqParamEstim v1.23.1
DifferentialEquations v7.1.0
Optim v1.7.0
RecursiveArrayTools v2.29.2

using DiffEqParamEstim, DifferentialEquations,RecursiveArrayTools, Optim

function f2(du,u,p,t)
  du[1] = dx = p[1]*u[1] - p[2]*u[1]*u[2]
  du[2] = dy = -p[3]*u[2] + p[4]*u[1]*u[2]
end

u0 = [1.0;1.0]
tspan = (0.0,10.0)
p = [1.5,1.0,3.0,1.0]
prob = ODEProblem(f2,u0,tspan,p)
sol = solve(prob,Tsit5())

t = collect(range(0,stop=10,length=200))
randomized = VectorOfArray([(sol(t[i]) + .01randn(2)) for i in 1:length(t)])
data = convert(Array,randomized)

cost_function = build_loss_objective(prob,Tsit5(),L2Loss(t,data),
                                      maxiters=10000,verbose=false)
result_bfgs = Optim.optimize(cost_function, [1.3,0.8,2.8,1.2], Optim.BFGS())

Did the optimization actually fail? Or did Optim just return a fail status? The latter tends to happen, Optim.jl does that but it doesn’t really mean it :person_shrugging: .

15 parameters is still very small. This will be fine for it. For more advanced stuff you’d want to directly use DiffEqSensitivity.jl, but for such small models with single datasets this should be fine.

Thanks a lot. Yes it was Optim returning status failure. Even then we can access accurate estimates in case of Lotka Volterra example.