Visualizing Your Models with Power BI
Building predictive models is essential. However, explaining the results is just as important. Even an excellent predictive model can be seriously undermined by a failure to effectively communicate the results. Data visualization helps data scientists explain the results of predictive models to their stakeholders and end users. In this chapter, we show how you can share the results of your models through Power BI.
Overview
There is a large body of literature on data visualization that is beyond the scope of this book. This chapter focuses on Microsoft’s Power BI. You will learn how to use it to share the results of your model through visualization. You will explore three approaches for visualizing your results with Power BI.
Introducing Power BI
This section presents a brief introduction to Power BI. We provide the information you need to visualize the results of your predictive models in Power BI. For more in-depth coverage of Power BI, please see the resources listed at the end of this section.
Power BI provides exciting new ways to visualize data, share results, and collaborate in new ways. The new experience of Power BI is based on powerbi.com, an online service that you can use to create and share reports and dashboards seamlessly. Both the old and new Power BI experiences are deeply integrated with Excel, which is Microsoft’s leading tool for business analysts. The new Power BI service at powerbi.com was released into general availability on July 24th. Let’s review the key components of Power BI.
The focal point of the new powerbi.com is a dashboard that allows you to visualize all your data in one place. Figure 8-1 shows an example of the dashboard that ships with powerbi.com. The live dashboard allows you to load data from several sources including your Excel workbooks. You can also visualize data from SQL Server Analysis (SSAS) on premises. In addition, powerbi.com ships with out-of-the box connectors for cloud Software as a Service (SaaS) solutions such as Salesforce, Zendesk, Marketo, SendGrid, GitHub, Dynamics CRM Online, and Dynamics AX. With these connectors you can visualize your data from any of these products through dashboards in powerbi.com. The dashboard supports several chart types, from the standard bar charts and pie charts to combo charts, maps, gauges, and new funnel charts.
Figure 8-1. A sampe dashboard in powerbi.com
Microsoft ships Power BI Designer, a desktop version of Power BI that you can use to create your reports and dashboards in an offline mode. You can connect to the same data sources as the Power BI service to load data and create reports and dashboards. When you are done, you can share these with others by publishing to the Power BI Service. This allows you to do personal BI in a safe environment before sharing broadly online. For those without Excel 2013 this is a good way to create reports quickly and cheaply. So if you just need to build a BI dashboard that loads data from sources other than Excel, the Power BI Designer is a great choice. However, if you already own a license for Excel 2013 or have a lot of your data in Excel, then you can simply build your data models in Excel and share the results as dashboards in PowerBI.com.
The best authoring experience on premises is in Excel, which is Microsoft’s leading tool for business analysis. Excel has rich BI capabilities such as Power Query, PowerPivot, Power View, and Power Map. You can create rich BI models on your desktop and then share these by publishing to the Power BI service (powerbi.com). Let’s review the key BI features in Excel 2013:
Note Please refer to http://powerbi.com and www.youtube.com/user/mspowerbi for more details on Power BI.
Three Approaches for Visualizing with Power BI
Now let’s explore the three approaches for visualizing your data with Power BI. Your first visualization approach will be to score a test dataset in Azure Machine Learning Studio and then visualize it with Power BI tools in Excel.
Note In this chapter, you will use the Bike Buyer model from Chapter 2. This model is published as the Buyer Propensity Model in the Azure Machine Learning Gallery. You can access the Gallery at http://gallery.azureml.net/.
Download this experiment to your workspace in Azure Machine Learning for the rest of the experiment. Figure 8-2 shows the Buyer Propensity model in Azure Machine Learning Studio.
Figure 8-2. The Buyer Propensity Model in Azure Machine Learning Studio
Scoring Your Data in Azure Machine Learning and Visualizing in Excel
To start with, you will modify the Buyer Propensity Model to include geospatial fields such as latitude, longitude, address, city, and country. These fields were excluded from the model since they were not statistically relevant. Now you are adding them back because you will need them to visualize the results on a map.
Modify the Buyer Propensity Model to include geospatial fields with the following steps.
Figure 8-3. Output of the first Project Columns module showing the list of excluded variables
Figure 8-4. The Buyer Propensity Model modified to add geospatial data
Figure 8-5. Adding ID and geospatial variables to the Project Columns module
Figure 8-6. Parameters in the Join module
Now that you have a scored dataset that contains a geospatial variable, you need to map your data. Next, let’s switch to Excel where you will visualize your scored dataset. To this, follow these instructions.
Figure 8-7. Setting parameters in Power Map
Congratulations! You have just completed your first visualization in Power BI. Your map should appear as shown in Figure 8-8. This map plots customers’ propensity to buy by city. At each city, you can see the number of customers predicted to buy (shown in blue bars) or not buy (shown in orange bars). The overlaid 2D chart shows a list of cities sorted by their propensity to buy (sorted by Yes). You can see that the top cities by propensity are West Jordan (Utah), Spokane (Washington), and Nampa (Idaho).
Figure 8-8. A 3D plot of the Scored Labels in Power Map
Scoring and Visualizing Your Data in Excel
The second way to visualize your results is to score your model and visualize the results in Excel. In Chapter 2, you saw how to publish your experiment to run as a web service in Azure Machine Learning. Follow the steps in Chapter 2 to publish the Buyer Propensity Model as a web service in Azure Machine Learning. Name your experiment BikeTestModelScore. When you publish your model, Azure Machine Learning will automatically create an Excel spreadsheet containing an API key that you will need to access your mode. Now follow these steps to access the Excel spreadsheet containing code for calling the REST API.
Figure 8-9. Details of the published Buyer Propensity Model in Azure Machine Learning
Figure 8-10. Testing a model from Excel
Scoring Your Data in Azure Machine Learning and Visualizing in powerbi.com
The third approach to visualizing your results is to use powerbi.com. As you saw earlier, powerbi.com is an online service that you can use to visualize your data that resides on premises or in the cloud. The centerpiece of powerbi.com is the dashboard. The dashboard enables you to visualize your data using several chart types in exciting ways. Through its Q&A feature you can also search your data easily using English text. This is great for your users since they do not need to learn SQL to query the data. Also, powerbi.com offers a desktop tool called Power BI Designer that you can use to create your reports and dashboards offline. When you are ready, you can publish it online at powerbi.com. Power BI is also available as an iOS app that runs on iPads and iPhones.
Let’s get started. To use powerbi.com you need to sign up at www.powerbi.com/, which is now available as a free preview service. When you first sign up, you will see the Retail dashboard shown in Figure 8-1. Your goal is to create your own dashboards and reports using the results of the Buyer Propensity Model.
To create your own dashboard in powerbi.com you have to load your results dataset. Let’s learn how to do this.
In the first approach to visualization you saved a scored dataset in the file named BikeBuyerwithLocation2_Scored_dataset.xlsx. You will now load this file from your local filesystem using the following steps.
Figure 8-11. Showing the data sources for powerbi.com
Building Your Dashboard
When your dataset is loaded, you will see a new dashboard named BikeBuyerwithLocation2_Scored_dataset.xlsx under the Dashboard menu on the left pane. This is a blank canvas you will use to create your new dashboard. Figure 8-12 shows this blank canvas. Now create your own dashboard with this dataset through the following steps.
Figure 8-12. A blank canvas ready for your first dashboard
Figure 8-13. Details of the second chart that plots the count of Scored Labels by Education
At the end of these steps, your dashboard should appear as shown in Figure 8-14. This dashboard has two charts: the first is a 2D map showing propensity to buy by country, while the second shows propensity to buy by level of education.
Figure 8-14. Complete dashboard with two charts
Summary
Data visualization is a critical tool for a data scientist because it helps to communicate the results of modeling to stakeholders. Even after creating an excellent predictive model, you need to communicate the insights obtained from the model to your stakeholders. In this chapter, you learned how to visualize the results of your models with Power BI. This chapter started with an introduction to Power BI from Microsoft. You gained essential skills to help you visualize your results with Power BI in three ways.
You are now ready to create rich visualizations of your results with Power BI. With the knowledge you gained from this chapter you can now impress your stakeholders with dazzling dashboards that communicate the findings from your Machine Learning models. Now go forth and impress!
3.138.37.191