Machine Learning

Tutorial: Train Machine Learning Models with Automated ML Feature of Azure ML

29 May 2020 11:00am, by

This is the final part of a series using AzureML where we explore AutoML capabilities of the platform.

Similar to the last two tutorials (part 2 and part 3), we will apply logistic regression on the Pima Indian Diabetes dataset. Instead of training the model by ourselves, we will use the AutoML SDK to let Azure ML choose the best algorithm.

You can run the code in a Jupyter Notebook on your workstation but the AutoML job runs in a remote compute cluster provisioned in Azure.

Follow to steps described in the previous tutorial to create a workspace in Azure and installing the Python AzureML SDK in your local development machine.

Start by importing the relevant Python modules.

Let’s initialize the Azure ML workspace. Make sure you have the config.json file in the same directory.

Let’s load the CSV file, add headers and save it back.

We can now upload the CSV file and register that as a dataset in AzureML

With the dataset in place, we will now define the compute environment based on the cluster in AzureML.

The next step is to define the AutoML configuration.

This instructs Azure AutoML to run 20 iterations before settling for the best algorithm. Each algorithm is ranked based on the accuracy metric.

We are now ready to kick off the AutoML job.

We choose classification as the task type and point the column that represents the label in the dataset. This step connects the dots across the dataset, compute, and problem type.

The whole process takes about 30 minutes. You see the below output in the Jupyter Notebook cell.

We can also use the widget from the AzureML Python SDK which provides an insight into the training job.

Finally, you can retrieve the best model based on accuracy.

Follow the steps from this tutorial to register and deploy the model.

Janakiram MSV’s Webinar series, “Machine Intelligence and Modern Infrastructure (MI2)” offers informative and insightful sessions covering cutting-edge technologies. Sign up for the upcoming MI2 webinar at http://mi2.live.

Feature ihoto by Lucas Myers on Unsplash.

A newsletter digest of the week’s most important stories & analyses.