Exploring AML Designer Transforms: Apply Math Operation

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

A large amount of time for machine learning tasks is spent understanding the data and getting it into the proper configuration to train the model. This is the Data Wrangling, Exploration, and Cleaning phase of the machine learning lifecycle. In Azure Machine Learning designer, many common data changing operations are provided as transform modules. In this lab, you will explore the Apply Math Operation module to gain a deeper understanding of the tools at your disposal.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Set Up the Workspace
  1. Log in and navigate to the Azure Machine Learning studio workspace provided in the lab.
  2. In Compute, create a Training Cluster:
    • Provide a unique name for the cluster.
    • Use virtual machine size Standard_D2_v2.
    • For minimum and maximum nodes, input 2.
  3. In Designer, start a new pipeline from the easy-to-use prebuilt modules:
    • Select the Training Cluster you created as the default compute for this pipeline.
    • Provide a unique name for your pipeline.
Explore Apply Math Operation
  1. From the Datasets submenu on the left, drag a CRM Upselling Labels Shared node onto the canvas. Visualize the dataset.
  2. From the Data Transformations submenu on the left, drag an Apply Math Operation node onto the canvas.
  3. Connect the output of CRM Upselling Labels Shared to the input of Apply Math Operation.
  4. Click the Apply Math Operation node to configure it:
    • Category: Compare
    • Comparison function: PairMax
    • Value to compare type: Constant
    • Second argument: 0
      With PairMax, this will take the maximum value of our provided constant 0 or the column value. For current 1 values, it will choose 1. For the current -1 values, it will choose 0.
    • On Column set, click Edit column, then select Col1 and Save.
    • Change Output mode to Inplace. This will replace the value in the column without adding another column that we’d have to manage after the operation.
  5. Select Submit to submit the pipeline, creating a new experiment.
  6. Once the pipeline completes, right-click the Apply Math Operation node and choose Visualize Result_dataset.
    • There are still 50,000 rows and 1 column, but the values that were -1 are now 0.

Additional Resources

Apply Math Operation is probably the broadest transform module with the most functionality provided in Azure Machine Learning designer. Covering everything this module can do would take an entire course by itself. This module can do basic math, generate statistics, apply trigonometric functions, compare values, round values, and compute many functions used in data science. If you need to change or evaluate parts of your data mathematically, this module can probably do it. Take a few minutes to read through the documentation for the module to see everything it can do.

We're going to take a look at one function to get a feel for what the module can do. Let's change a label column value from -1 to 0 so the column values will be 0 or 1.

Lab Goals

  1. Set up the workspace.
  2. Explore Apply Math Operation.

Logging in to the Lab Environment

To avoid issues with the lab, use a new Incognito or Private browser window to log in to the lab. This ensures your personal account credentials, which may be active in your main window, are not used for the lab.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?