The Power of Azure ML and Power BI: Dataflows and Model Deployment

Kaushikrch Last Updated : 23 Nov, 2020
5 min read

Overview

  • Learn about the integration capabilities of Power BI with Azure Machine Learning (ML)
  • Understand how to deploy machine learning models in a production environment

 

Introduction

It’s not news anymore that Machine Learning (ML) models have excellent predictive capabilities. However,

With more power comes more responsibilities.

Although data scientists train a considerable amount of data to come up with predictions for the future, it is a challenge to present the results comprehensively. Moreover, it is a significant challenge to deploy the models in a production environment. While Azure helps you build powerful ML models without any coding, Power BI offers capabilities to incorporate insights from an ML model in BI reports.

In previous posts(links given at the end of the article), we have explored how Power BI can help businesses analyze data and how to create reports and dashboards in an undemanding manner. In this post, we will understand how to use Power BI and Azure ML to deploy results from an ML model.

This post assumes readers have a basic knowledge of ML models. To understand how ML models can be deployed in a production environment using Flask, you can read this fantastic introductory text:

 

Table of Contents

  1. What is Azure ML?
  2. Peep into the Azure ML Studio (Classic)
  3. Building and deploying the model as a web service
  4. Deploying the ML model from Azure ML platform to Power BI
  5. Visualizing the results to create actionable business insights

 

What is Azure ML?

Data scientists are well aware of the complex and gruesome pipeline of machine learning models. Firstly, solving a business problem starts with the formulation of the problem statement. Secondly, the team generates specific hypotheses to list down all possible variables affecting the objective. Then, data is extracted or collected from relevant sources.

In the next step, we perform data experimentation as a step-by-step process to derive insights on missing values, data distribution, and analysis commonly referred to as exploratory data analysis (EDA).  Fifth, we develop a set of predictive models with the evaluation of a relevant error metric for a train-test split using a preferred validation technique.

Further, these models are tuned using hyperparameter to arrive at the optimal results. Finally, we select the best performing model for deployment with real-time scoring or batch scoring.

This task requires writing lines of codes in software like R or Python. However, Azure ML helps simplify this complex process of building predictive models.

 

Peep into the Azure ML Studio (Classic)

Azure ML Studio (classic) allows you to build, train, optimize, and deploy ML models using a GUI. It is a no-code environment. Therefore, you can create complex ML models for clustering, regression, classification, anomaly detection, and recommendation models as well as data, statistical, and text analysis.

Azure ML Studio (Classic)

You can build your ML models with a functional connection of graphs. Thus, even a beginner with just a theoretical background in machine learning can easily use it. Multiple tutorials are provided for the untrained. For instance, the screenshot below shows the comparison of two-class classification models to predict whether the income of an adult would be above or below $50,000 using socio-demographic variables as the features.

Azure ML Studio (Classic)

 

Building and deploying the model as a web service

Once the workflow of building an ML model is ready, the model is trained with a click of a button (RUN). As the models run, the virtual environment and parallel computing make the training time faster.

The screenshot below shows the results error metrics of cross-validation across various folds.

Cross Validation

Finally, after running the Predictive Experiment (training the model) from the sample, we deploy the model as a web-service using the “Deploy Web Service” option.

 

Deploying the ML model from Azure ML platform to Power BI

Deploying and operationalizing the ML model is the next step in the pipeline. In this step, test the model on live data in production. The live data can lie inside a Power BI environment. Power BI is an on-premise service using which business intelligence functions are performed. Thus, a report or a dashboard displaying the current business scenario along with real-time predictions from an ML model can add significant value to organizations.

Suppose, a company wants to score the income of individuals based on their socio-demographic characteristics. To perform this task, we have to add the entity we want to score (predict the probability of earning more or less than $50,000.

Clicking on the Azure Machine Learning button under the AI insights tab of the PowerQuery editor connects to the Azure ML platform with the same account.

Azure ML Toolbar

Power BI will list down all the Azure ML web-services that you can access. Select the appropriate web-service; the UI will map all the columns of your entity to the inputs of the web-service by matching their names and types. Click “Apply” to see a preview of the scoring. Thus, the scored probabilities show up as a new column in the table.

 

Visualizing the results to create actionable business insights

Till now, we have applied the ML model on live data loaded in the Power BI environment. You can use the predicted probabilities from the Azure ML model to refresh the business report/dashboard displayed in Power BI.

 

Power BI Visualization

Source: Power BI Community Blog, Azure Machine Learning in Power BI Dataflows, retrieved from https://community.powerbi.com/t5/Community-Blog/Azure-Machine-Learning-in-Power-BI-Dataflows/ba-p/709744#

 

In other words, it gives the decision-makers a view into not only the historical context of the business problem but also how does the business evolves in the future using predictive modeling.

 

End Notes

In this article, we learned about the training and deployment of models in the Azure ML platform. We also understood how the predictive capabilities of Azure ML could be leveraged to generate insights into the future in a live environment.

To conclude, this integrated environment gives more power into the hands of data scientists, business intelligence professionals, and strategic decision-makers. They can quickly capitalize on the beneficial aspects of these integrated environments so that a business problem can be solved through collaboration and not in a silo.

Further, to learn about the capabilities of Power BI, you can read these posts:

I hope this article was valuable. Reach out to us if you have any queries in the comment section below.

Responses From Readers

Clear

Ryan
Ryan

Hi, i tried following the steps above but somehow my Power BI desktop said it cannot find any machine learning model. Do I need to have Azure subscription and paid workspace to deploy Azure ML in Power BI? Thanks

Kaushik
Kaushik

Hi Ryan - Are you using the same account for Microsoft Azure as for Power BI? Also, are you logged in to Power BI when trying to implement this step? You can check the top-right corner of Power BI Desktop. I used the free account for Microsoft to perform this exercise. Regards, Kaushik

Congratulations, You Did It!
Well Done on Completing Your Learning Journey. Stay curious and keep exploring!

We use cookies essential for this site to function well. Please click to help us improve its usefulness with additional cookies. Learn about our use of cookies in our Privacy Policy & Cookies Policy.

Show details