No Code Data Enhancement with Azure Synapse Analytics and Azure Auto ML
Tags: azuresynapseanalytic, azure, automl, machinelearning
Published: 2020-12-22 22:45:00

---
title: No Code Data Enhancement with Azure Synapse Analytics and Azure Auto ML
published: true
date: 2020-12-10 13:36:56 UTC
tags: azuresynapseanalytic,azure,automl,machinelearning
canonical_url: https://medium.com/microsoftazure/no-code-data-enhancement-with-azure-synapse-analytics-and-azure-auto-ml-cb9d97fb0c26
---

![](https://cdn-images-1.medium.com/max/1024/1*8MpN2vjW3wFiR9g3RsvwZQ.png)

TLDR; This post will walk through how to train and evaluate Azure ML AutoML Regression model on your data using Azure Synapse Analytics Spark and SQL pools.

Before we get started let’s make sure we are all on the same page with the core Azure concepts needed to take your data to the next level.

If you are new to [Azure](https://azure.microsoft.com/en-us/overview/what-is-azure/?WT.mc_id=aiml-0000-abornst) you can get started a free subscription using the link below.

[Create your Azure free account today | Microsoft Azure](https://azure.microsoft.com/en-us/free/?WT.mc_id=aiml-0000-abornst)

### What is Azure Synapse Analytics?

[Azure Synapse Analytics](https://azure.microsoft.com/en-us/services/synapse-analytics/?WT.mc_id=aiml-0000-abornst) is an integrated service that accelerates extracting insightful across data warehouses and big data systems.

![](https://cdn-images-1.medium.com/max/1024/0*9H_HZyN5vor_EUH8.png)

Azure Synapse ties together traditional relational SQL enterprise data warehousing, unstructured data stores and serverless [Apache Spark](https://docs.microsoft.com/en-us/azure/synapse-analytics/spark/apache-spark-overview?WT.mc_id=aiml-0000-abornst) , to enable limitless pipelines for [ETL](https://en.wikipedia.org/wiki/Extract,_transform,_load) and [ELT](https://en.wikipedia.org/wiki/Extract,_load,_transform) operations. Furthermore [Synapse Studio](https://docs.microsoft.com/en-us/azure/synapse-analytics/get-started-create-workspace?WT.mc_id=aiml-0000-abornst) provides a unified interface for data monitoring, coding, and security.

![](https://cdn-images-1.medium.com/max/910/0*MJjt-e_T8mqNkpep.jpg)<figcaption>Synapse has deep integration with other Azure services such as <a href="https://docs.microsoft.com/en-us/power-bi/?WT.mc_id=aiml-0000-abornst">Power BI</a>, <a href="https://docs.microsoft.com/en-us/azure/cosmos-db/introduction?WT.mc_id=aiml-0000-abornst">CosmosDB</a>, and <a href="https://azure.microsoft.com/en-us/services/machine-learning/?WT.mc_id=aiml-0000-abornst">AzureML</a> which makes it perfect for wrangling insight out of your data.</figcaption>

### What is Azure Machine Learning Auto ML?

![](https://cdn-images-1.medium.com/max/707/0*UXLolBZuO7_76m3T.png)<figcaption><a href="https://docs.microsoft.com/en-us/azure/machine-learning/concept-automated-ml?WT.mc_id=aiml-0000-abornst">Auto ML</a>, is the process of automating the time consuming, iterative tasks of machine learning model development.</figcaption>

[Azure Machine Learning](https://docs.microsoft.com/en-us/azure/machine-learning/overview-what-is-azure-ml?WT.mc_id=aiml-0000-abornst) (Azure ML) is a cloud-based service for creating and managing machine learning solutions. It’s designed to help data scientists and machine learning engineers to leverage their existing data processing and model development skills & frameworks.

![](https://cdn-images-1.medium.com/max/810/0*AUObBNfjiEKQcRl_.png)<figcaption>What is <a href="https://docs.microsoft.com/en-us/azure/machine-learning/overview-what-is-azure-ml?WT.mc_id=aiml-0000-abornst">Azure Machine Learning</a></figcaption>

In [Azure Machine Learning](https://docs.microsoft.com/en-us/azure/machine-learning/overview-what-is-azure-ml?WT.mc_id=aiml-0000-abornst), [Auto ML](https://docs.microsoft.com/en-us/azure/machine-learning/concept-automated-ml?WT.mc_id=aiml-0000-abornst) allows data scientists, analysts, and developers to build ML models with high scale, efficiency, and productivity all while sustaining model quality.

With [Auto ML](https://docs.microsoft.com/en-us/azure/machine-learning/concept-automated-ml?WT.mc_id=aiml-0000-abornst) we can transform Synapse Analytics Data into actionable baseline models to enrich datasets at scale without writing a single line of machine learning code.

[Regression](https://docs.microsoft.com/en-us/azure/machine-learning/tutorial-auto-train-models?WT.mc_id=aiml-0000-abornst) is used to build models to forecast numeric values such as taxi fares based on learned input features.

In the next section, I will walk you through an end to end example of how to enrich you Synapse data by training and evaluating a model with the [NYC Taxi Dataset](https://docs.microsoft.com/en-us/azure/machine-learning/tutorial-auto-train-models?WT.mc_id=aiml-0000-abornst). Once you get preform these steps you’ll be able to train and run your own Auto ML on models on any tabular dataset of your choosing.

### Getting Started

![](https://cdn-images-1.medium.com/max/728/0*IYBdJqaULYeuL__S.jpg)<figcaption>Let’s ingest, train a model and enhance some data to predict taxi fares with the</figcaption>

#### Step 1: Set Up Azure Machine Learning and Synapse Workspaces

First if you do not have them already we need to create our Azure ML and Synapse workspaces.

![](https://cdn-images-1.medium.com/max/1024/0*JH1qxL6rTRHMVfUg.gif)<figcaption>Create Azure ML Workspace from the <a href="https://docs.microsoft.com/en-us/azure/machine-learning/how-to-manage-workspace?WT.mc_id=aiml-0000-abornst">Portal</a> or use the <a href="https://docs.microsoft.com/en-us/azure/machine-learning/how-to-manage-workspace-cli?WT.mc_id=aiml-0000-abornst">Azure CLI</a></figcaption>

{% youtube IQ9tkAywBlA %}

#### Step 2: Link Azure Machine Learning Workspace to Synapse Service

Once we have deployed our two workspaces we need to link them. Full steps for linking Azure ML and Synapse Workspaces can be found [here](https://github.com/NelGson/azure-docs-pr-ml/blob/nellie-ga%C2%A0upstream/release-synapse-ga/articles/synapse-analytics/machine-learning/quickstart-integrate-azure-machine-learning.md)

![](https://cdn-images-1.medium.com/max/1024/1*zWyQZTbTxjXkFskkSC5Ydg.png)<figcaption>Follow <a href="https://github.com/NelGson/azure-docs-pr-ml/blob/nellie-ga%C2%A0upstream/release-synapse-ga/articles/synapse-analytics/machine-learning/quickstart-integrate-azure-machine-learning.md">these steps</a> to create a service principle and link the azure ml and machine learning workspaces.</figcaption>

#### Step 3: Create Dedicated Serverless Apache Spark Spark and SQL Pools

To actually ingest and process our data we need to use pools. Azure Synapse Analytics offers various analytics engines to help you ingest, transform, model, analyze, and serve your data.

For this tutorial since we are using a toy dataset we can use the cheapest pools available for you own data you may want to configure your pools accordingly.

The serverless Apache Spark pools offers open-source big data compute capabilities. This is where the majority of our data processing and Auto ML code will run.

![](https://cdn-images-1.medium.com/max/903/0*oWuuz3RoapPLPCeY.png)<figcaption>Steps for creating a Dedicated Spark Pool can be found <a href="https://docs.microsoft.com/en-us/azure/synapse-analytics/quickstart-create-apache-spark-pool-studio?WT.mc_id=aiml-0000-abornst">here</a></figcaption>

A dedicated serverless SQL pool offers T-SQL based compute and storage capabilities. We will use this pool to store the data we want to enhance with our AutoML model.

![](https://cdn-images-1.medium.com/max/1024/1*jQr3SIi90ZMZtgNyHxZa9w.png)<figcaption>Steps for creating a dedicated sql pool can be found <a href="https://docs.microsoft.com/en-us/azure/synapse-analytics/quickstart-create-sql-pool-studio?WT.mc_id=aiml-0000-abornst">here</a></figcaption>

One key advantage of Azure Synapse Analytics is if you configure a time out you only pay for the compute when it’s in use.

#### Step 4: Upload and run the Spark Taxi Data Notebook to create Spark Database and SQL Test Database

Once we have our serverless Spark and SQL pools up and running we can now ingest our data setup our Spark and SQL tables for training and testing respectively.

Download this Spark [Create-Spark-Table-NYCTaxi- Data.ipynb](https://go.microsoft.com/fwlink/?linkid=2149229) notebook and import it into your workspace.

![](https://cdn-images-1.medium.com/max/1024/1*St8zzgN5ffvaLFVpdsA0AQ.png)

![](https://cdn-images-1.medium.com/max/1024/1*rt_2VuOj2-GhrQ-aP7KxmA.png)

Once the notebook is uploaded, change the sql\_pool\_name value to match the name of your sql pool and then select the desired spark pool and run click all.

#### Step 5: Launch Auto ML Wizard and Train Regression Model with AutoML using NYC Taxi Spark Table.

Once the data is ingested we can use our spark nyc\_taxi and Spark Pool to train an AutoML regression model for forecasting taxi fares.

![](https://cdn-images-1.medium.com/max/1024/1*dm5s27gLk17vr9VuxpdChA.png)

Follow the three steps in wizard below to train your model.

![](https://cdn-images-1.medium.com/max/1024/1*aFmaEyWjWeQFJ8OvnK68TQ.png)

![](https://cdn-images-1.medium.com/max/1024/1*lul9c7QPqMJ0vdP8m-zXlA.png)

![](https://cdn-images-1.medium.com/max/1024/1*KXsYgN1QOTUzSzeCYq9qtQ.png)<figcaption>Note: Be sure to set the target column to fareAmount and use the onnx model model compatibility option. For a more in depth explanation of the training steps check out the documentation <a href="https://github.com/NelGson/azure-docs-pr-ml/blob/nellie-ga%C2%A0upstream/release-synapse-ga/articles/synapse-analytics/machine-learning/tutorial-automl.md">here</a></figcaption>

This will kick off your Auto ML Regression training job. It should take about 2hrs to run when it is complete we can then evaluate it on our SQL test table.

![](https://cdn-images-1.medium.com/max/1024/1*4wrC9dmsiEJ_aO5pt1QOSA.png)

![](https://cdn-images-1.medium.com/max/1024/1*ycnBXAwasWNTEMHGv_vHIw.png)

#### Step 6: Enhance SQL Table with Trained Auto ML Model

Once we have the best model we can now evaluate it on our test SQL table using our SQL Pool.

First we need to select the table we want to enhance with the model we just trained.

![](https://cdn-images-1.medium.com/max/862/1*wCP3RTZowmPdTsh2cqzq9w.png)

Then we select our new Auto ML model, map the our input table columns to what the model is expecting and choose or create a table for storing our model locally.

![](https://cdn-images-1.medium.com/max/588/1*3sLKu8lJAuXRgfuvkTyAlg.png)

![](https://cdn-images-1.medium.com/max/765/1*wyjK6hBcvIJD6_kGw3CZ6A.png)

![](https://cdn-images-1.medium.com/max/767/1*ZYdxr-Pa-0DMCaBaVy1w9Q.png)

The wizard will generate a T-SQL script that evaluate our model against the test data and outputs the fare predictions.

![](https://cdn-images-1.medium.com/max/1024/1*SdWu8AiUir7qBPAbhBUzUw.png)

There you have it all you need to know to train and test you own AutoML models and make them actionable.

### Next Steps

![](https://cdn-images-1.medium.com/max/1024/0*55u5Xp5aHVVm87nX.jpg)

Additional Synapse Documentation and Walkthroughs worth checking out can be found below:

- [Machine Learning in Azure Synapse Analytics - Azure Synapse Analytics](https://docs.microsoft.com/en-us/azure/synapse-analytics/machine-learning/what-is-machine-learning?WT.mc_id=aiml-0000-abornst)
- [Tutorial: Machine learning model training using AutoML - Azure Synapse Analytics](https://docs.microsoft.com/en-us/azure/synapse-analytics/machine-learning/tutorial-automl?WT.mc_id=aiml-0000-abornst)
- [Tutorial: Machine learning model scoring wizard for dedicated SQL pools - Azure Synapse Analytics](https://docs.microsoft.com/en-us/azure/synapse-analytics/machine-learning/tutorial-sql-pool-model-scoring-wizard?WT.mc_id=aiml-0000-abornst)
- [Tutorial: Sentiment analysis with Cognitive Services - Azure Synapse Analytics](https://docs.microsoft.com/en-us/azure/synapse-analytics/machine-learning/tutorial-cognitive-services-sentiment?WT.mc_id=aiml-0000-abornst)
- [Unleash the power of predictive analytics in Azure Synapse with machine learning and AI](https://techcommunity.microsoft.com/t5/azure-synapse-analytics/unleash-the-power-of-predictive-analytics-in-azure-synapse-with/ba-p/1961252?WT.mc_id=aiml-0000-abornst)

Now that you’ve finished the steps above it is time to try them out on you own synapse data. Feel free to post in the comments if you have any questions and to share the cool models you make!

{% youtube xf3Lej-MWCk %}

Look forward to seeing what AutoML and Azure Synapse can do for you!!

### Acknowledgments

Thanks to Nellie Gustafsson, Yifan Song and Chang Xu from the Azure Synapse product team for their great documentation and support during the writing this post.

### About the Author

[**Aaron (Ari) Bornstein**](https://www.linkedin.com/in/aaron-ari-bornstein-22aa7a77/) is an AI researcher with a passion for history, engaging with new technologies and computational medicine. As an Open Source Engineer at Microsoft’s Cloud Developer Advocacy team, he collaborates with the Israeli Hi-Tech Community, to solve real world problems with game changing technologies that are then documented, open sourced, and shared with the rest of the world.

* * *