Building End to End COVID-19 Forecast Model using Azure ML

Step 1: Get your Azure Account

First thing first, we need to get an Azure Account to get started. If you have one, that’s well and good. If not, don’t worry, Microsoft is giving a free trial to access Azure Cloud. Register and sign up here: https://azure.microsoft.com/free

Step 2: Setting up the Workspace

We need to create a workspace for our project. Workspaces are Azure resources, and as such, they are defined within a resource group in an Azure subscription, along with other related Azure resources that are required to support the workspace.

Azure Workspace Creation
Compute Instance Creation

Step 3: Creating an experiment

We need to connect our load our workspace and set up a new experiment, say “covid_exp”. This can be done as shown below

Step 4: Creating a Pipeline script file

We are going to create a script file which will be the input to the ML Pipelines. ( Don’t worry, we will come to back to Pipelines in the later section of the article)

  1. Import the COVID-19 Indian Data.
  2. Train the forecasting model
  3. Upload the forecast data to Azure Storage.

Import the COVID-19 Indian Data

First, we will create a new python script file called prediction.py and import all necessary libraries. You can run these lines of code in our .ipynb Python Notebook we are working on.

Train the forecasting model

We can infer that this is a typical Time Series Forecast Problem BUT it is not. To model the spread(infection) and control(recovered) of infectious diseases, a mathematical model such as SIR (Susceptible-Infected- Recovered) Model. This section of the article is the playground of Data Scientists, you can come up with the models for this data.

Upload the forecast data to Azure Storage

The forecast data is available in covid_pred.txt must be uploaded to Azure Storage as a blob. This blob can we be accessed by Anonymous request to use the forecast data. The following steps need to be done to create a storage account and upload the blob.

  1. Go to Azure Portal homepage and click “Storage Account”. Click “Add”. Enter the required details to create an account. Be sure to mention the same Resource Group name.
  2. We need to create a container to store our file. Click the storage account we created and then click “Containers”.
  3. Create a new Container named “covidprediction”. Set the access level to “Blob”

Step 5 Creating and scheduling the Pipeline

A Pipeline object contains an ordered sequence of one or more PipelineStep objects. The pipeline is going to execute the script prediction.py

Step 6: RUN IT ALLLLLLLLLL!

Now execute all the cells in pipelinescript.ipynb. You can view the execution details in the output cell. Once the execution is over, we can notice two results

  1. Blob file contains the forecast data
  2. The Pipeline is scheduled to be run every day.

Step 7: Access forecast data

Now we need to make the blob to be accessible by applications. This can be done by an HTTP request. To make sure the data access safe, we need to modify CORS policy such that our application can access the blob.

Step 8: Visualization of Output

The plot of trends of daily confirmed cases + forecast and Daily recovered + forecast can be seen in the below two graphs hosted in the website

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vivek Raja

Vivek Raja

Microsoft Certified Azure Data Scientist, AI Engineer, Data Engineer Associate | Tech Speaker, mentor & Researcher| 15x Hackathon Winner|