# First-principles Machine Learning for COVID-19 Modeling

In recent months, the novel coronavirus disease 2019 (COVID-19) has affected nearly all corners of the globe. On January 30, 2020, the World Health Organization (WHO) declared the outbreak a Public Health Emergency of International Concern. On March 11, it recognized the outbreak as a pandemic. As of May 4 at 10:00 CEST, WHO reported 3,435,894 confirmed cases of COVID-19, 239,604 confirmed deaths [6], and cases in 215 countries. Government decisions are thus flanked by close scientific advice, perhaps now more than ever.

*Mathematical models*—which provide predictions about the evolution of the number of infected, recovered, and deceased patients—are central to official advice. The predictions’ accuracy steadily improves as researchers infer the contact rate \((\beta)\), recovery rate \((\gamma)\), and death rate \((\mu)\) from confirmed cases data. The basic reproduction number \((R_0)\)—the average number of new infections that are generated by a single infected person within a susceptible population—depends on these rates. In the absence of preventative measures, most accredited sources estimate \(R_0\) to fall within the range of 2-3 [5]. The key epidemic parameters \((\beta, \gamma, \mu, R_0)\) are crucial in helping governments take appropriate measures to combat the epidemic and *flatten the curve*. Most measures are meant to reduce \(R_0\), which one can achieve by decreasing the contact rate \(\beta\) or increasing the recovery rate \(\gamma\) [2]. The latter is obtainable with a vaccine or cure, neither of which are currently available. Therefore, governments are presently striving to control COVID-19 by minimizing the contact rate through lockdowns and social distancing. But how can we control a phenomenon about which we know very little?

To start, we must predict the epidemic to stay one step ahead of it — and can do so with modeling techniques. However, how can we model a disease when we only have partial and inaccurate information? The answer to this question is more difficult. Here, we employ a method developed for the prediction of chaotic dynamical systems [1] and apply it to COVID-19 [4]. We combine two sources of past and present knowledge—first principles of an epidemic model and data on COVID-19 confirmed cases from official databases—to predict the future. While (some) human brains are well suited to capture the first principles that govern a problem, machine learning is more effective at identifying quantitative correlations in data. *First-principles machine learning* synergistically combines the strengths of human brains and machines. We showcase the method on a prototypical epidemic model, but one can apply the technique to more sophisticated models.

### A Bit of Maths

To model an epidemic (as with any other phenomenon), we must capture the first principles—assumptions, constraints, laws, and so forth—that govern the dynamics. These principles serve as the “game rules” and should not be violated. We divide a country’s entire population into mutually exclusive groups: population \((N) = \) susceptible \((S) + \) infected \((I) + \) deceased \((D) +\) recovered \((R)\). We assume that the population is constant but the other variables change in time. Each group therefore possesses the same characteristics—i.e., groups are homogeneous—and every susceptible person can contract the virus. One can relax these working assumptions in more complex models [2]. This approach is known as the SIR epidemic model with vital dynamics and constant population [3]; we refer to it as the SIRD model for brevity. We use four ordinary differential equations with time-varying parameters (a nonlinear, non-autonomous dynamical system) to mathematically describe the first principles:

\[\dot{S} = -\beta(t) \frac{I}{N} S, \;\;\;\;\;\;

\dot{I} =-\dot{S} - \dot{R} - \dot{D}, \;\;\;\;\;\;

\dot{R} = \gamma(t) I,\;\;\;\;\;\;

\dot{D} = \mu(t) I \label{eq:d}. \tag1 \]

These equations are subject to initial conditions. The parameters depend on governmental policies (lockdown, school closures, social distancing, etc.), population heterogeneity (age, lifestyle, herd immunity, hygiene standards, etc.), and the epidemic’s properties (virus genome, spreading mechanisms, etc.). The basic reproduction ratio is \(R_0\equiv\beta/(\gamma+\mu)\). If \(R_0>1\), the number of infected individuals increases; if \(R_0<1\), the number of infected individuals decreases on average.

### Formalizing the Problem

One can formulate the calculation of the groups’ time evolution and the time-varying epidemic parameters as a constrained optimization problem (or equivalently, a data assimilation problem): *Calculate the number of infected, recovered, deceased, and susceptible individuals; contact rate; recovery rate; and death rate to minimize the error between data and predictions from the epidemic model.* We want to accept only those candidate solutions that are consistent with the epidemic model. More details on the loss function are available in [4].

### Solving the Problem

Our proposed first-principles machine learning epidemic model is based on a combination of an ordinary differential equation solver that time-advances the epidemic model (first principles), and a feedforward neural network (machine learning) that assimilates the data into the epidemic model to learn the parameters and state (see Figure 1). To begin, the neural network (NN) receives as an input the time histories of the cumulative confirmed infected cases and confirmed deaths up until May 4, 2020. This data is accessible online. Using the time histories of the confirmed cases, the NN next infers the time evolution of the epidemic model’s parameters. We minimize the loss function—which measures the error between the candidate solution and data—to train the network. We then feed the inferred epidemic parameters into the SIRD model’s time integration. This time integration provides the state’s evolution (number of infected, recovered, deceased, and susceptible individuals).

**Figure 1.**First-principles machine learning for epidemic modeling. Figure adapted from [4].

Figure 2 depicts the results. At the epidemic’s inception and in the absence of preventative measures, COVID-19 cases grow exponentially. Implementation of preemptive measures significantly impacts \(R_0\), which decreases to values that are close to unity. Although the results are consistent with the employed first principles, they are affected by uncertainty because of biases in the data — such as errors in reporting, changes in case definition and testing regime, and, of course, modeling assumptions. However, the fast growth rate and large numbers likely make small biases negligible [5], and multiplicative corrections—such as constant underreporting—only weakly affect the observed trend. Our proposed data-driven and model-informed methodology reveals new possibilities for inferring an epidemic’s evolution from data (see Figure 1) [4]. Future researchers should utilize more detailed epidemic models and data to improve predictions.

**Figure 2.**The epidemicâ€™s evolution.

**2a.**The left axis represents estimated infected individuals. Crosses indicate data and solid lines indicate the model. The right axis represents deceased cases. Circles indicate data and dashed lines indicate the model. The three dotted vertical lines designate the beginning of lockdown for each country.

**2b.**The left axis represents inferred recovered individuals (solid lines). The right axis represents susceptible individuals (dashed lines).

**2c.**Basic reproduction rate.

**2d.**Contact rate.

**2e.**Recovery rate.

**2f.**Death rate. Dates are in month/day format. Figure adapted from [4].

**References**

[1] Doan, N.A.K., Polifke, W., & Magri, L. (2019). Physics-informed echo state networks for chaotic systems forecasting. In *Lecture notes in computer science (including subseries lecture notes in artificial intelligence and lecture notes in bioinformatics)* (pp. 192-198).

[2] Ferguson, N.M. Laydon, D., Nedjati-Gilani, G., Imai, N., Ainslie, K., Baguelin, M., …, Ghani, A.C. (2020). *Report 9: Impact of non-pharmaceutical interventions (NPIs) to reduce COVID-19 mortality and healthcare demand*. Imperial College COVID-19 Response Team.

[3] Grassly, N.C., & Fraser, C. (2008). Mathematical models of infectious disease transmission. *Nat. Rev. Microbiol., 6*(6), 477-487.

[4] Magri, L., & Doan, N.A.K. (2020). First-principles machine learning modelling of COVID-19. Preprint, *arXiv:2004.09478*.

[5] Pellis, L., Scarabel, F., Stage, H.B., Overton, C.E., Chappell, L.H.K., Lythgoe, K.A., …, Hall. I. (2020). Challenges in control of Covid-19: short doubling time and long delay to effect of interventions. Preprint, *arXiv:2004.00117*.

[6] World Health Organization. (2020). *Coronavirus disease (COVID-19)* (Situation Report – 105). Retrieved from https://www.who.int/docs/default-source/coronaviruse/ situation-reports/20200504-covid-19-sitrep-105.pdf?sfvrsn= 4cdda8af{_}2.