How to choose which parameters to estimate in parameter estimation when using diffeqflux.sciml_train and BBO?

Hey everyone, I am trying to do parameter estimation for a set of differential equations using diffeqflux_sciml_train and BBO. However, I would like to choose which parameters I want to estimate and which ones I don’t want to. I will illustrate this here:

function rober(du,u,p,t)
    y₁,y₂,y₃ = u
    k₁,k₂,k₃ = p
    du[1] = -k₁*y₁+k₃*y₂*y₃
    du[2] =  k₁*y₁-k₂*y₂^2-k₃*y₂*y₃
    du[3] =  k₂*y₂^2
    nothing
end

p = [0.04,3e7,1e4]
u0 = [1.0,0.0,0.0]
prob = ODEProblem(rober,u0,(0.0,1e5),p)
sol = solve(prob,Rosenbrock23())
ts = sol.t
Js = map(u->I + 0.1*ForwardDiff.jacobian(UJacobianWrapper(rober, 0.0, p), u), sol.u)

function loss_adjoint(p)
  "Insert loss function"
end

initp = ones(3)
res = DiffEqFlux.sciml_train(loss_adjoint, initp, BBO(),....)

So let’s say that I only want to estimate k2 and k3 while changing the k1 with a discrete callback based on some time stops. k1 will keep changing every second.
How can something like this be achieved?

My actual problem is related to finding parameters of the battery physics model and I would like to have a dynamic current. I have tried training with constant current and it doesn’t work very well. So now I want to do global optimisation with the dynamic current to get a better fit.

Just make your cost function only be a function of the two parameters and pass in the other as a constant.

2 Likes