Predicting the development of the Corona virus with Python

  Рет қаралды 4,847

Greg Winther

Greg Winther

4 жыл бұрын

I try to predict the number of people infected by the novel coronavirus (2019-nCov) using an exponential function and a logistic function in Python. The prediction is for confirmed cases in mainland China, published by the National Health Commission. Please be advised that no one can know anything about the future, and that this is only an academic exercise. Even though I have a somewhat jovial tone in this video, I think that the outbreak of the novel coronavirus in Wuhan is a terrible and terrifying tragedy.
You can find the Jupyter notebook here:
github.com/gregwinther/youtube
UPDATE Mon 17 Feb 2020: My prediction at the end of this model has been proven incorrect. Another of many lessons I have had that one cannot predict the future. That said, my prediction that the number of confirmed cases in mainland China would plateau seems to be reality soon, as the growth in number of cases is now in low single-digit percentages per day. The daily numbers from NHC recently also includes "clinically diagnosed cases", patients that are diagnosed by symptoms and signs, without testing for the presence of a virus. It is easy enough to include such a "structural break" in a model by introducing a binary variable - equal to one after the brake, and zero before.

Пікірлер: 23
@TheIzugec
@TheIzugec 4 жыл бұрын
Neat video. Keep them coming. I would maybe like hearing why did you fit exactly those functions. I mean, in this case I know from which physical scenario these models are coming, but maybe for future ones I won't know, or some other people won't know. Cheers :)
@GregWintherArtist
@GregWintherArtist 4 жыл бұрын
Thanks for the comment! I actually meant to talk more about the reasoning for picking these models. Probably as a consequence that I simply started rolling and did it all in one take, things were forgotten along the way. The lesson for the future; write some script or talking points to make sure that I get to everything.
@anon18999
@anon18999 4 жыл бұрын
I’m just going to use Plague Inc as my calculator
@cyrw
@cyrw 4 жыл бұрын
Sadly we are not at the s part just yet
@dragonfliesandartbysophied7120
@dragonfliesandartbysophied7120 4 жыл бұрын
Greg, this is an extract from an internal document I received today. data from yesterday 12/02/2020: • "Since 31 December 2019 and as of 12 February 2020, 45 179 laboratory-confirmed cases of COVID-19 infection have been reported, including 1 115 deaths. "
@GregWintherArtist
@GregWintherArtist 4 жыл бұрын
Thanks for the update. It also appears that as of yesterday (February 12), the numbers from the National Health Commission will include "clinically diagnosed" cases not included in official accounts. There are now two different classes of cases: "clinically diagnosed active" and "confirmed active" cases. The former term will be a higher number, as it includes people not yet tested for the virus, but diagnosed by signs and symptoms.
@naufalhilmiaji6086
@naufalhilmiaji6086 4 жыл бұрын
When I changed the datasets to Italy, it says, "_1_ days until growth is less than 10. Number of cases will be 156130". I think it can't calculate the logistic function, so that the result is only 1 days, but when I used New York data, it says, "_41_ days until growth is less than 10 . Number of cases will be 237071". How do I fix this, sir?
@1990soumya
@1990soumya 4 жыл бұрын
Hi Greg, Thanks for the lovely video, I have a question I may sound stupid, can we use SIR model and predict the I(t) for Infection prediction in case of this Corona Pandemic?
@GregWintherArtist
@GregWintherArtist 4 жыл бұрын
Yes, I certainly think this is possible. Check out the Wikipedia article on Compartmental modes in epidemiology for more considerations and info: en.m.wikipedia.org/wiki/Compartmental_models_in_epidemiology
@GregWintherArtist
@GregWintherArtist 4 жыл бұрын
They do it here: www.dropbox.com/s/oxmu2rwsnhi9j9c/Draft-COVID-19-Model%20(13).pdf?dl=0
@thecryovproject
@thecryovproject 4 жыл бұрын
Me, a fifteen-year-old, watching Ph.D. and COViD19 stuff (okay, maybe the latter's not so "intriguing"). Also, it's cool to see these kinds of videos. Lastly, is that LaTeX?
@valentinlegrand694
@valentinlegrand694 3 жыл бұрын
It’s Jupiter notebook, an online version of python
@mclark23
@mclark23 3 жыл бұрын
Is there a cost for keeping you stuff in Github?
@GregWintherArtist
@GregWintherArtist 3 жыл бұрын
Nope. They have a PRO-thing that costs something.. Don't really know what that means. Assume it increases the number of collaborators on a project or something.
@PD-dg6zk
@PD-dg6zk 4 жыл бұрын
Hey, the curve fitting function yields a flat line for me. I rechecked everything with your git repository but I couldn't find any errors in my codes. Please help.
@GregWintherArtist
@GregWintherArtist 4 жыл бұрын
Hi! If you pass an initial guess to curve_fit, it should work. Curve_fit takes initial guess p0 as a list of parameter values. Making sure parameter a is high enough is important. Equal to last value in the y-array (observed cases) should do. Example: curve_fit(logistic_function, x, y, p0=[y[-1], 1, 1, 1])
@1990soumya
@1990soumya 4 жыл бұрын
One more question that if we take a log aren't we bringing in some bias.
@GregWintherArtist
@GregWintherArtist 4 жыл бұрын
I guess you might. In econometrics you take the log for various reasons. Please see this excellent discussion: stats.stackexchange.com/questions/298/in-linear-regression-when-is-it-appropriate-to-use-the-log-of-an-independent-va
Intro to the logistic function with Python 🐍  [1/2]
9:58
Greg Winther
Рет қаралды 1 М.
The Intertwined History of Physics and Finance
17:33
Greg Winther
Рет қаралды 4 М.
Can You Draw A PERFECTLY Dotted Line?
00:55
Stokes Twins
Рет қаралды 105 МЛН
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 18 МЛН
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 49 МЛН
Robotaxis | Big Ideas 2024
9:41
ARK Invest
Рет қаралды 21 М.
Collecting Stats and Initiating Quarantine [3/3]
13:47
Greg Winther
Рет қаралды 1,7 М.
My first year as a PhD student (2020)
15:01
Greg Winther
Рет қаралды 2,7 М.
Research Visit to MSU
11:05
Greg Winther
Рет қаралды 447
A Day In The Life: Computational Physics
6:30
Greg Winther
Рет қаралды 29 М.
Modelo poblacional de crecimiento logístico
2:44
Gregory Alonso
Рет қаралды 49 М.
Disease Simulation with Pygame [1/3]
17:35
Greg Winther
Рет қаралды 7 М.
PYTHON PANDAS: COVID-19,CORONA VIRUS, DATA VISUALIZATION
8:45
Unacademy Computer Science
Рет қаралды 13 М.
Solving ODEs in Python 6: Comparing RungeKutta4 and ForwardEuler
9:34
Easy Art with AR Drawing App - Step by step for Beginners
0:27
Melli Art School
Рет қаралды 9 МЛН
Красиво, но телефон жаль
0:32
Бесполезные Новости
Рет қаралды 282 М.
КРУТОЙ ТЕЛЕФОН
0:16
KINO KAIF
Рет қаралды 4,8 МЛН