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

**URL:** <https://discourse.julialang.org/t/question-on-qsir-model-and-flux-train-for-covid-19-sir-data/66422>\
**Category:** Machine Learning\
**Created:** [August 15, 2021, 5:29am UTC](https://discourse.julialang.org/t/question-on-qsir-model-and-flux-train-for-covid-19-sir-data/66422 "2021-08-15T05:29:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![msteele-uofa-ece](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/msteele-uofa-ece/32/28192_2.png) [@msteele-uofa-ece](https://discourse.julialang.org/u/msteele-uofa-ece)\
**Post date:** [August 15, 2021, 5:29am UTC](https://discourse.julialang.org/t/question-on-qsir-model-and-flux-train-for-covid-19-sir-data/66422/1 "2021-08-15T05:29:46Z")

</div>

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.

> **[GitHub - RajDandekar/MIT-Global-COVID-Modelling-Project-1](https://github.com/RajDandekar/MIT-Global-COVID-Modelling-Project-1)**
>
> Contribute to RajDandekar/MIT-Global-COVID-Modelling-Project-1 development by creating an account on GitHub.

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

---

<div class="post-metadata">

**Author:** ![RajDandekar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rajdandekar/32/28199_2.png) [@RajDandekar](https://discourse.julialang.org/u/RajDandekar)\
**Post date:** [August 15, 2021, 12:20pm UTC](https://discourse.julialang.org/t/question-on-qsir-model-and-flux-train-for-covid-19-sir-data/66422/2 "2021-08-15T12:20:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![msteele-uofa-ece](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/msteele-uofa-ece/32/28192_2.png) [@msteele-uofa-ece](https://discourse.julialang.org/u/msteele-uofa-ece)\
**Post date:** [August 16, 2021, 12:35am UTC](https://discourse.julialang.org/t/question-on-qsir-model-and-flux-train-for-covid-19-sir-data/66422/3 "2021-08-16T00:35:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RajDandekar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rajdandekar/32/28199_2.png) [@RajDandekar](https://discourse.julialang.org/u/RajDandekar)\
**Post date:** [August 16, 2021, 9:33pm UTC](https://discourse.julialang.org/t/question-on-qsir-model-and-flux-train-for-covid-19-sir-data/66422/4 "2021-08-16T21:33:32Z")

</div>

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/](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?

> **[The Julia Language Slack](https://julialang.org/slack/)**
>
> The official website for the Julia Language. Julia is a language that is fast, dynamic, easy to use, and open source. Click here to learn more.
