Real-time Prediction using Azure Machine Learning with Stream Analytics and Power BI

Azure Stream Analytics (ASA) and Power BI integration provide us to analyze high volume streaming data in a real-time. We know already how we can integrate an Azure Stream Analytics job output to a Power BI dataset.

Now lets make this more interesting, how about doing a Real-time prediction for your streaming data and display the result in a Power BI Dashboard. This is a typical scenario when your business model need to apply Artificial Intelligence in your data and perform real time data analytics using machine learning algorithms.

The overall data integration show below:

Following are the steps to be followed to configure AML web service with Azure Stream analytics:

(Note: Assuming that you are already aware of how to configure ASA with Power BI, and you have already deployed your Azure Machine Learning model as a Web service)

  1. Create a New Azure Stream analytics job
  2. Define the Job Topology Input as appropriate. I have used Source as Event hub with Source type as Stream
  3. Define the Job Topology Output as Sink to Power BI so that it will automatically create the dataset in Power BI portal
  4. Here is the most important step where you will define a Function for calling the Azure Machine Learning Web Service. Click on Function on left pane of the Stream Analytic job and Add New -> Function Alias -> Function Type as Azure ML -> Subscription-> URL of your Azure Web Service-> API KPI. Once its make the successful call to the Azure ML Web Service it will automatically populate the function Signature
  5. Finally define the Job Topology Query for the ASA job, you need to call the AML function in the Select clause which you have created in the query as show below:
  6. Save the query and you can now Start the job, this will create a Power BI dataset along with AML function output prediction.

I hope this blog will help you to know how to configure and perform Real time prediction using Azure Machine Learning and integrating it to a Power BI dashboard.

Gaurav Agarwal