Code free Data science

Arun Purakkatt
8 min readMay 17, 2022

Microsoft Azure Machine Learning Studio

https://unsplash.com/
https://unsplash.com/

Azure Machine Learning Studio is a GUI-based integrated development environment for constructing and operationalizing Machine Learning workflow on Azure.ML Studio is really great and even though you still need your statistic knowledge you can build, test and even deploy a machine learning model without writing a single line of code. It allows for this by offering prebuilt building blocks that can be customized and connected together using a visual interface.

Starting an Experiment:

To get started, you first need to navigate to Azure ML Studio and sign in with a Microsoft Account. Once registered and signed in, you will see the homepage which provides you with multiple tabs.

On the left we are getting the following options:

  • Projects: Collection of experiments, web-services, data-sets and other things representing a single project
  • Experiments: ML Studio Experiment
  • Web Services: Experiments deployed as a web service
  • Notebooks: Jupyter Notebooks
  • Datasets: Datasets you have uploaded to ML Studio
  • Trained Models: Models trained and saved in experiments
  • Settings: Account Settings

To create a new experiment you need to navigate to the experiment tab and click on the New button. After clicking the button another tab will appear which not only lets you create a new blank experiment but also offers you a lot of samples ranging from basic things like downloading a data-set to classifying text or detecting fraud.

I will be using Heart Disease Data-set available on Kaggle.

To use a custom data-set in ML Studio we need to click on the New button navigate to the data-set tab and click on FROM LOCAL FILE. This will open an overlay window where you can upload the data-set.

Import data:

There are several sample datasets included in the designer for you to experiment with. here we use heart.csv.

To the left of the pipeline canvas is a palette of datasets and components. Select Sample datasets to view the available sample datasets.

Select the dataset heart.csv, and drag it onto the canvas.

import data

A really nice feature of Azure ML Studio is the ability to take a look at your data at any time in the analysis. To do this simply right click on the data-set and navigate to dataset>Visualize.

visualize

Summarizing the data:

Once you loaded in your data-set and took a quick look at it, it is a good idea to get more information about each column. This can be achieved by dragging in the Summarize Data module.

After pressing the RUN button it will give you access to some basic statistics of each column including the unique value count, mean and the standard deviation. The exact statistics will vary depending on the column type.

summarize data module added

This is a snapshot how it looks.

summarize data

Add edit meta data column and connect with the data, by double clicking onto edit metadata it will launch the properties. click launch column selector.

edit metadata

By clicking on the Edit Metadata module we launch the Properties tab. Here we need to click on the Launch column selector button. This opens a new window where we can select all columns we want to transform from numerical to categorical.

Select columns to transform

Now that we selected the columns we need to change the Data type from Unchanged to Integer and then select Make Categorical from the Categorical tab.

change data type

Similarly, to now convert the chosen columns to a one-hot encoding, drag the Convert to Indicator Values module onto the experiment canvas. Add convert to indicator values module and click on to it and open properties tab and select same columns as we selected. Check the overwrite categorical columns so that old columns get deleted while conversion happens.

one hot encoding

click run and lets try to visualize our resultant data set after encoding

data set after one hot encoding

If we now visualize the output data of the Convert to Indicator Values module we can see that instead of the 14 columns we started off with we now have 31 columns.

To split into train and test data set we have to drag the split data module into the canvas and connects its input with the convert to indicator values module. Navigate to the properties bar and specify the split percentage for train and test split.

splitting data

Training :

Let us look into the training part. As to keep it simple we will try with a logistic regression model. Drag the Two-Class Logistic Regression module onto the canvas. Also, drag the Train Model module from the Machine Learning>Train category onto the canvas, connect the output of the Logistic Regression model to the left input of the Train Model module and the left output of the Split Data module (training data) to the right input of the Train Model module as shown below.

Connect the model and data to the Train Model module

Next we need to specify a label column by opening the Launch column selector of the Train Model module. In our case, the label column is called target.

current state of experiment

Right click on Train Model module we can now access the trained model and have the option to save it for later usage as well as to visualize information about its settings and learned weights.

access trained model

Scoring and evaluating the model:

trained model details

Now that we have trained our model, we can use our validation set to see how well our model is doing. We can do this by first of making predictions using the Score Model module and then using the Evaluate Model module to get our accuracy and loss metrics.

Making Predictions:

To make predictions on the validation set we connect the trained model to the left input of the Score Model Module and the right output node of the Split data module to the right input of the Score Model Module.

score model

Right click onto the score model and visualize We have 2 new columns the Scored Labels column contains the labels represented by integers of either 0 or 1. The other column called Scored Probabilities gives us the raw probabilities of the predictions.

predictions
evaluation results

The evaluation gives us a lot of different classification metrics including ROC, AUC, Precision. It also allows us to vary the threshold of the two classes and see the increase/decrease of the given metrics immediately.

Hyper parameter tuning:

For this, we have two options. We can either left click on our model and tune it manually or we can replace the Train Model module with the Tune Model Hyperparameters module which not only trains the model but also tunes its hyperparameters whilst training.

Tune the parameters manually or use the Tune Model Hyperparameters module

The Tune Model Hyperparameters module boosts our accuracy up to over 85%.

Deploying as an Azure Web Service:

Azure ML Studio provides multiple ways to transform your experiment to a web service with just few clicks.

The easiest one is to just use the SET UP WEB SERVICE button at the bottom of the experiment.

This option converts an experiment into a predictive experiment by eliminating data summary, splits, training and other steps not needed for production.

predictive experiment

This will work fine for most projects but doesn’t work for our example. This is because when using the Convert to Indicator Values module with a web-service it must be directly connected to the Web service input.

Fixing bug with Convert to Indicator Values Module

After running the predictive experiment to ensure it’s working you can deploy it by clicking on the DEPLOY WEB SERVICE button. This will open a new window with two tabs, the dashboard, and a configuration tab.

Using the dashboard you can test your web service, access the API Key and view some general information.

web service overview

Using the Configuration tab we can set some general information and edit the input and output schema of the web service.

webservice configuration

For more information on how to access and manage the web service as well as the pricing for scaling check out the official documentation.

test web service

Stay connected with me on Linked in. Get the codes for other blogs here Github.

--

--