Question on QSIR Model and Flux.train for COVID-19 SIR data

Hello,
My name is Manuel Steele. I am a graduate student at St. Mary’s College for data science (Notre Dame, IN). I applied the model at the github site below to a smaller county in North Dakota. The model was successful for Ward County.
https://github.com/RajDandekar/MIT-Global-COVID-Modelling-Project-1
Next, I want to apply the model to a rural indigenous community in Arizona. Now, both populations from Ward County and the rural AZ data are impeded by an unexpected Flux.train error.

The snippet of code is here.
cb = function()
#println(“starting cb()…”)
x = loss_adjoint()
#println("loss_adjoint(): ", x) # display topmost applicable display
global Loss = append!(Loss, x)
global P1 = append!(P1, p3[TOTAL_PARAMETERS-2])
global P2 = append!(P2, p3[TOTAL_PARAMETERS-1])
global P3 = append!(P3, p3)
end

cb()

Train with objective function, trainable parameters of model,

collection of data, and optimizer)

println("Loss: ", Loss)
Flux.train!(loss_adjoint, ps, datan, opt, cb = cb)

The error message is here directed at the line for Flux.train! above. This error did not appear a few months ago. I ran the code many times.
ERROR: LoadError: ArgumentError: tuple must be non-empty

I need help debugging this. It was unexpected given that I had run the code many times successfully in the winter.

Manuel Steele

Hello Manuel,

May I ask what is the Julia version you are using?

Can you try running the code on Julia v1.6 ?

Add the packages Flux, DiffEqFlux, DiiferentialEquations again after installing this version of Julia. That should solve the above error.

Hello, I reinstalled the Julia to 1.6.2 and Atom. Then I ran the code. Now, there is confusion on which solver to use:

Is it best to use “solve” or “concrete_solve”?
function predict_adjoint() # Our 1-layer neural network
Array(concrete_solve(prob,Tsit5(), u0, p3, saveat=t))
end

Manuel

I think the best option is to use solve and also to use DiffEqFlux.sciml_train instead of Flux.train. I think it will speed up things a little.

To use that, you’ll need to modify some things a bit like how the nn architecture is defined etc, but the main structure of the code should remain the same.

Have a look at this: https://diffeqflux.sciml.ai/stable/examples/neural_ode_sciml/ .

We can follow up over Slack if you run into issues. Will be happy to guide you regarding your project, looks like an interesting topic.

Are you on the Julia Slack?