Questions about the DiffEqFlux multiple shooting example

Hi,
I am training a neural ODE on a periodic function and wanted to try out DiffEqFlux.multiple_shoot(). After reviewing the online example @ docs.sciml.ai/DiffEqFlux/stable/examples/multiple_shooting/, I was hoping someone could answer a couple of basic questions for me. The questions are:

  1. Why was the ComponentArray p_init separated into its data and axes? Why not just provide a ComponentArray to OptimizationProblem() which would be used by loss_multiple_shooting() directly?
ps = ComponentArray(p_init)
pd, pax = getdata(ps), getaxes(ps)
...

function loss_multiple_shooting(p)
    ps = ComponentArray(p, pax)
...
end

optprob = Optimization.OptimizationProblem(optf, pd)
  1. It looks like neuralode was created but never used. Is this intentional?
  2. Inside the callback function, why is a global variable used to track the iteration number? Couldn’t you use state.iter if state is an OptimizationState object ?
  3. Up to now, I have been using the Lux training API to train my models. Is there a version of multiple shooting or some similar training scheme implemented in Lux?

Thanks in advance for your help.

I think the tl;dr is that this tutorial needs an update.

The tutorial is just old, it should just work using the componentarray

No we should update the tutorial.

Yes, this tutorial was just written before that existed, so it’s another sign this tutorial needs an update.

If you grab the optprob.f you can use it in the Lux training API.

@ChrisRackauckas - Thank you for the reply.

That is really cool. Thanks for pointing this out.

Out of curiosity, can people contribute updates to the tutorials on GitHub?

Yes

There’s an edit button up there which brings you to the .md file:

the docs are all generated from the Documenter.jl .md files. So if you make a pull request to change those the docs will get updated based on the code in there.

The Documenter.jl docs explain the syntax on the .md files: