Coronavirus outbreak prediction project using Machine Learning

Published on . Written by

Coronavirus outbreak prediction project using Machine Learning

Machine learning is a technique that teaches the computer to perform the actions done by humans or animals (basically learning from experience). Using machine learning you can able to analyse large amounts of data with almost accurate results.


Skyfi Labs Projects
In this machine learning project, you will get an idea about how to use machine learning to predict the coronavirus/COVID-19 outbreak. You can also use the same method to predict other epidemic diseases like malaria, dengue, swine flu, SARS, etc. Recently coronavirus has created a huge impact worldwide by infecting lakhs of people and killing thousands.

Read more..

SLNOTE
In machine learning there are two types one is supervised learning and unsupervised learning. Supervised learning builds the model which makes the predictions based on the input and the output. Unsupervised learning develops the model from the input data alone.

Outline: Here we are going to use the SVM model and linear regression method to predict the outbreak of coronavirus for the upcoming 10 days across different regions by using charts and graphs.

Coronavirus doesn’t have the ability to mobilize themselves from one host to another host. But it can able to multiply themselves once it gets into a host. So by considering the above scenario, we can come to a conclusion that it spreads via the physical network.

Here in our case there two factors that create the physical network:

  1. Population density
  2. Hotspot

SLLATEST
Population density: High population density areas like metro cities creates more contact between humans and increases the risk of disease transmission from one person to another.

Hotspot: It is a place which has more human attraction places like, shopping malls, theatres, amusement parks, airports, etc.

Project Implementation

1. Import the necessary libraries to the jupyter notebook. Libraries such as

numpy, pandas - for numerical computation and manipulation

Matplotlib - for visualising the data

math, time, sklearn, datetime, operator, etc.

2. Import the datasets - confirmed_cases, deaths_reported, recovered_cases (you can download the datasets from www.kaggle.com)

3. Extract all the column names from the confirmed_cases dataset using .keys() function

4. Using .loc() function extract only the date column from all the three datasets.

5. Find the total confirmed, death and recovered cases and calculate the total mortality rate.

6. Now convert all the dates and cases in the form of numpy array using np.array function.

7. Since we are going to predict the cases for the next 10 days add the last 10 days to the total number of days that we have.

8. Visualise the data using different charts and graphs to check the impact of coronavirus, for visualization extract the last column values of all the three datasets.

9. Find the list of unique countries using .unique()  function and calculate the total number of confirmed cases country wise.

10. Now find the number of confirmed cases for each province/state/city before that remove the countries which have been marked as provinces or state by classifying them as outliers.

11. Plot the graph to see the total number of confirmed cases across different countries.

12. You can also compare the confirmed cases between china and outside china by plotting another graph.

13. Now visualise the top 10 countries that have the most number of confirmed coronavirus cases by using bar graph or pie chart.

14. Let’s start building the model using the Support Vector Machine algorithm. It uses different parameters to build the model such as kernel, c, gamma, epsilon, shrinking and svm_grid.

kernel - it specifies the kernel type to be used in the algorithm (linear, poly, rbf, sigmoid

c - regularisation parameter

gamma - kernel coefficient of rbf, sigmoid, gamma, etc.

15. Using the RandomizedSearchCV function build the model by passing necessary parameters. Finally, fit the data using svm.search.fit() function.

16. You can find the best estimator using svm_search.best_estimator_ function and predict future forecast using svm_confirmed.predict function

17. Check the values of the testing data by creating a plot between svm_test_pred data and y_test_confirmed data then print the mean absolute error and mean squared values.

18. Then plot the total number of coronavirus cases over time as per your wish. Next plot a graph between total confirmed coronavirus cases and svm predicted cases.

19. Using the SVM algorithm predict the number of cases for the upcoming 10 days.

Using Linear regression model

  1. Import the linear regression function from the sci-kit learn library and fit the model using x_train_confirmed and y_train_confirmed data.
  2. For prediction use x_test_confirmed data and future_forecast data
  3. Print the MAE (Mean Absolute Error) and MSE (Mean Squared Error).
  4. Plot the confirmed values from y_test_confirmed data and test_linear_pred data
  5. Now predict the number of coronavirus cases for the next 10 days.
  6. Try plotting graphs for coronavirus recovered over time, mortality rate over time, number of deaths over time
By using machine learning you can able to visualise the data and graphs for many things but here the disadvantage is the high error susceptibility which leads to giving an error in the predictions.


SLDYK
Kit required to develop Coronavirus outbreak prediction project using Machine Learning:
Technologies you will learn by working on Coronavirus outbreak prediction project using Machine Learning:


Any Questions?


Subscribe for more project ideas