Making fast and accurate decisions are vital these days and especially now when the world is facing such a phenomenon as COVID-19, therefore, counting on current as well as projected information is decisive for this process.
In this matter, we have applied a model in which is possible to observe the peak in specific country cases, using current statistical information, hoping it can be used as foundation support to take action in this scenario. To accomplish this objective, Non-linear regression has been applied to the model, using a logistic function. This process consists of:
- Data Cleaning
- Choosing the most suitable equation which can be graphically adapted to the data, in this case, Logistic Function (Sigmoid)
- Database Normalization
- Fitting of the model to our dataset using “curve_fit” process, obtaining new reference beta.
- Model evaluation
Dataset is public, and it is available at Data.europa.eu following this link: DATASET
Data Cleaning: The data available has been originally labelled. We were able to identify two countries which did not mention geographical location, this information was added however it wouldn´t contribute to the model significantly. A new column is added to the dataset named “n-day” to show the consecutive number of days.
Code: Importing Libraries
Code: Usign data
Code: Choosing the model
We apply logistic function, a specific case of sigmoid functions, considering that the original curve starts with slow growth remaining nearly flat for a time before increasing, eventually it could descend or maintain its growth in the way of an exponential curve.
The formula for the logistic function is:
Y = 1/(1+e^B1(X-B2))
Code: Construction of the model
Data Normalization: Here, variables x and y are normalized assigning them a 0 to 1 range (depending on each case). So both can be interpreted in equal relevance.
Reference – information
The objective is to obtain new B optimal parameters, to adjust the model to our data. We use “curve_fit” which uses non-linear least squares to fit the sigmoid function. Being “popt” our optimized parameters.
beta_1 = 9.833364, beta_2 = 0.777140
Code: New Beta values are applied to the model
Model Evaluation: The model is ready to be evaluated. The data is split in at 80:20, for training and testing respectively. The data is applied to the model obtaining the corresponding statistical means to evaluate the distance of the resulting data from the regression line.
Mean Absolute Error: 0.06 Mean Square Error (MSE): 0.01 R2-score: 0.93
- ML | Heart Disease Prediction Using Logistic Regression .
- Build a COVID19 Vaccine Tracker Using Python
- How to create a COVID19 Data Representation GUI?
- Identifying handwritten digits using Logistic Regression in PyTorch
- ML | Logistic Regression using Tensorflow
- ML | Logistic Regression using Python
- ML | Kaggle Breast Cancer Wisconsin Diagnosis using Logistic Regression
- Logistic Regression using Statsmodels
- ML | Rainfall prediction using Linear regression
- Prediction of Wine type using Deep Learning
- Word Prediction using concepts of N - grams and CDF
- Heart Disease Prediction using ANN
- Link Prediction - Predict edges in a network using Networkx
- Scrapping Weather prediction Data using Python and BS4
- Prediction using ColumnTransformer, OneHotEncoder and Pipeline
- ML | Cost function in Logistic Regression
- Python | Peak Signal-to-Noise Ratio (PSNR)
- Understanding Logistic Regression
- ML | Why Logistic Regression in Classification ?
- ML | Logistic Regression v/s Decision Tree Classification
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.