1. Home
  2. Training Library
  3. Microsoft Azure
  4. Courses
  5. Introduction to Azure Machine Learning Studio

Adding Custom Code


Using Azure ML Studio
Training a Model

The course is part of this learning path

Introduction to Azure Machine Learning
Start course


Machine learning is a notoriously complex subject, which usually requires a great deal of advanced math and software development skills. That’s why it’s so amazing that Azure Machine Learning Studio lets you train and deploy machine learning models without any coding, using a drag-and-drop interface. With this web-based software, you can create applications for predicting everything from customer churn rates, to image classifications, to compelling product recommendations.

In this course, you will learn the basic concepts of machine learning, and then follow hands-on examples of choosing an algorithm, running data through a model, and deploying a trained model as a predictive web service.

Learning Objectives

  • Prepare data for use by an Azure Machine Learning Studio experiment
  • Train a machine learning model in Azure Machine Learning Studio
  • Deploy a trained model to make predictions

Intended Audience

  • Anyone who is interested in machine learning


  • No mandatory prerequisites
  • Azure account recommended (sign up for free trial at https://azure.microsoft.com/free if you don’t have an account)

This Course Includes

  • 54 minutes of high-definition video
  • Many hands-on demos



Although ML Engine has a lot of pre-built modules for a wide variety of tasks, there will probably be times when you need something a bit different. In those situations, you can either add scripts to your experiments or you can create your own custom modules. I’m not going to take you through an end-to-end example of adding code to an experiment, but I will give you an overview of what tools are available.

ML Engine supports two scripting languages: R and Python. The “Execute Python Script” module has two input ports for datasets and one for a zip bundle. If you need to import Python resources, you can put them in a zip bundle and add them through this port.

It has two output ports. The first outputs a results dataset and the second is for console output and visualizations. You click here to write your script. It helpfully includes some sample code. A word of warning, though: ML Engine doesn’t provide tools for development and debugging, so you should do your development in a different environment, and then just paste the code here.

The “Execute R Script” module is the same except that, of course, it’s for R rather than Python. You can see an example by going to the Cortana Intelligence Gallery. Then search for “R script”.

There are quite a few examples, but here’s a really simple one. You can create your own copy of this experiment by clicking “Open in Studio”. It asks you to verify the region and the workspace where you want this experiment to reside.

This experiment shows you how to create a custom visualization of some data. ML Studio does provide some pretty decent visualization tools out of the box, though, so why did the author write this custom script? I’ll show you.

If you click Visualize on the forest fires data, then as you know, you can choose a column and get a histogram of the values in that column. You can also open the “compare to” menu and select another column and it’ll show you a scatterplot with the first column, temperature, on the x axis, and the second column, area, on the y axis.

You can do the same thing with another column, such as wind. What you can’t do is display the two graphs side by side. That’s what the R script is for. It makes the graphs bigger and displays them side by side.

Run the experiment. Let’s take a look at the code. Even if you haven’t used R before, it should be fairly easy to understand at a high level. It reads the data, creates the canvas, and then puts the two plots onto the canvas.

Let’s see these plots. Right-click on the second output port and select “Visualize”. First, it shows the console output from the R script, then the errors. There aren’t any in this case. Then it shows the graphics, so if you scroll down, you can see the two graphs side by side.

ML Engine also provides a way to create your own custom modules using R. These are different from the R script modules because you have complete control over how they work. The most noticeable difference is that you can define the input and output ports for the module. For example, if you wanted to have a module with input ports for five different datasets, you could create one.

To create a custom R module, you need to upload both the R code itself and also an XML definition file that describes the characteristics of the module, such as the input and output ports. If you’re interested in building your own custom R modules, then you can read the documentation at this URL.

And that’s it for this lesson.

Writing Custom R Modules: https://docs.microsoft.com/en-us/azure/machine-learning/studio/custom-r-modules

About the Author
Learning paths63

Guy launched his first training website in 1995 and he's been helping people learn IT technologies ever since. He has been a sysadmin, instructor, sales engineer, IT manager, and entrepreneur. In his most recent venture, he founded and led a cloud-based training infrastructure company that provided virtual labs for some of the largest software vendors in the world. Guy’s passion is making complex technology easy to understand. His activities outside of work have included riding an elephant and skydiving (although not at the same time).