The PowerApps AI Builder product team did a great job of creating Labs for PowerApps AI Builder. The challenge I found is they actually put the content in a couple of different locations: Two different GitHub Repos with two different locations in docs that need to be knit together to get it all working. This post simply brings all that content to a single location until the Team makes the demo an installable component.
PowerApps AI Builder needs a large enough dataset size as to train your models. This being the case to get started you need to import data into your CDS instance.
Binary classification uses historical data to predict whether new data falls into one of two categories. You can use these insights to develop actionable intelligence for your business.
In this lab, we will build and train a binary classification model. We will also review the level of influence of the selected criteria. Finally, we will make a model-driven application to review this data prediction.
The data used here will help us predict online shopper intentions. We have details of a shopper’s site visit as well as if that visit resulted in a sale (revenue). Once we have the prediction information, we can use that to help guide marketing plans, website updates, promotional communications, and more.
Note: If you are building the first model in an environment, click on Explore Templates to get started.
In the first exercise you will build and train your model.
From the left navigation, expand AI Builder and select Build.
Select Binary Classification.
Name your model. Because you are working in a shared environment make sure to include your name as part of the model name. This will make it easier to find later. Click create.
Your screen should look like the following image.
Notice the progress indicator on the left.
You will see Quick tips on the right.
In the center we will build our model. Click in the Entity field and select Online Shopper Intention. This is a custom entity that collects the data we are storing regarding the online shopper’s visit to our site.
From the selected entity we will now see available binary fields for prediction. The only fields we will see here are of type “Two option.” Select Revenue. Click Next.
The next screen will show us available fields on the entity. Each field selected will be evaluated by the model for the fields influence on the end result. By default, all fields will be selected, do not remove any fields. Click Next.
Notice our progress indicator has moved to the next item. Click Train.
Your Binary Classification model will now train. Go to Models.
Locate and open your saved model. If you need help finding it, type your name into the search box.
After each training, AI Builder uses the test data set to evaluate the quality and accuracy of the new model. A summary page for your model shows your model training result, including a Performance score. The score we have is 65% and we should expect it to change over time. And now we can view some details about our trained model. Click on View Details.
Our details report will show the data influencers and how much influence that data has on our prediction model. Close the details.
Publish your model. Once published the data will get scored, and scoring will happen daily for a published model.
About that score
Performance score calculations
AI Builder calculates the performance score for your model based on the precision and recall of the prediction results:
Performance score: This is the harmonic mean of precision and recall. It balances both for an imbalanced class distribution. Performance score values are between 0 – 100. Generally, the higher the performance score, the better your model performs.
Precision: The fraction of correct predictions among all the positive predictions.
Recall: The fraction of correct predictions among all true positive cases.
We will make a small model driven application to view the data. This approach allows us a quick look at the data. You could also make a canvas app that allows users to interact with the data from a mobile device.
For the purposes of this lab, we have taken some shortcuts in the interest of time. In general, you should always be working in a specific solution, you should rename items with smart names for better team development and more. A full lesson on customization and solution strategy is beyond the scope of these labs. However, Microsoft has many learning choices available. Please ask your instructor if you’d like more information.
In your PowerApps maker portal, from the left side navigation, navigate to Apps and select Create an app and select Model-driven.
If this is your first time connecting to a canvas app in this environment, you might be prompted to choose your region. Select the default.
Give your app a name, remember to include your own name as part of it. Leave all other options as they are and click Done.
You should see something like the image below.
We will now add our online shopper intention entity to the site map. Click the edit icon on the Site Map.
With focus set on the Area give the area a name such as Online Shopper Intentions. Select and name the Group as well.
With the New Subarea selected select Type of Entity and Online Shopper Intention as the entity. Leave other fields as defaults.
Save your Site Map and go back to the App Designer.
You should now see the assets needed for the Online Shopper Intention entity are included in our model-driven app.
Let’s add a view to our app so we can better see the prediction data. Click on Views and then Create New.
If prompted with unsaved changes, you can dismiss by clicking OK (assuming you’ve followed our steps so far!).
Click Column Attributes Primary Entity.
Drag and drop the following fields to the view: revenue-predicted(modelname); revenue-probability(modelname); and revenue.Note:
You will see fields added for the models of all of the students working in the same environment, look for the ones with your model name in the field name.
Adjust column widths to make them wider and easier to view. With the column selected, increase the width using the options on the right side of the view designer.
Save your view, remember to include your name as part of the view name.
Return to App Designer. Save your app and publish it.
Play your app.
You should now be in your new model-driven app. Select the view you just created.
View the data. You can see the prediction score, and the prediction that follows. With this information you can create automation such as a flow that would trigger based on a customer’s expected revenue and send discount emails to customers likely to complete a purchase. Creating such automation is beyond the scope of this workshop.