AI Builder in Action – Binary Classification

AI Builder is a new Power Platform capability which was recently announced (in Preview right now) and you can read all about it here.

Let’s start with understanding a few basics:

Currently, there are 4 types of AI models you could use. In this blog, I’m going to explain Binary Classification with an example.

What is Binary Classification?
It is an AI model that predicts binary outcome (Yes/no) by learning about your data. With your historical data, the AI builder can learn how some factors influence the outcome and predict it for you and overtime, the AI builder will continue to learn and improve its prediction. Read about Binary Classification here:

Let’s take a simple example:

Company XYZLaptops sells laptops and the company’s sales people get leads from various avenues and with these leads, they also get some information about the lead itself like:

  • Lead details: (name, gender, Phone, Email etc.)
  • Laptop interested in: (Lead has specified the Laptops he/she would be interested in buying)
  • Asked for Quote: (Yes/No to indicate if the lead has asked for a Quote or not)
  • Lead Origin: (Origin of the lead. example: Website, Phone, Trade Show, Social media, Reference, Returning customer etc..)

Since XYZLaptops get 1000’s of leads every week, they would like to filter these leads to find the ones which have the potential to convert into a customer. This way, sales people can concentrate on these high potential leads to make a successful sale!

Here is what sample lead data looks like:


To test and understand the Binary Classification in AI builder end to end, follow the steps below:

  • Prepare your data in CDS – Since, AI builder requires the data to be in CDS and transacted from the same CDS entity, we’ll have to create a custom entity in CDS and move the data from the excel sheet into this custom CDS entity)-
      • Create a custom entity in your CDS environment called XYZLaptops – Leads, make sure to create ID as the Primary Key and save it

      • Import/Copy data from the excel sheet (in step 1) into the XYZLaptops – Leads entity
  • Create, Train and Publish the AI Model -In this step, we’ll feed the existing data to train the Model
      • Login to PowerApps, Expand AI Builder section and select Build. Select Binary Classification on the right hand side

      • Provide a Name for this Model and click on Create

      • In the wizard, first we start by selecting the field which we would like for the AI builder to predict. In this scenario, we would want the AI builder to predict if a Lead will get Converted into a customer or not. So, select the Entity and Field as shown below and click on Next

      • In the next screen, select some of the fields which may influence the outcome and click on Next

      • In the last screen, just click on Train. The Model will start training based on the data in your CDS entity

      • Once the training is complete, Click on Go to Details Page. The Details page shows the Performance of the training. Performance score values are between 0–100 percent. Generally, the higher the performance score, the better your model performs. read more about it here

      • Click on Publish to start using this capability. Once the model is published, you’ll see new fields added into your CDS entity to show the outcome:

  • Use the AI builder to Predict the Outcome: Now, every time a new lead is added into the CDS entity, the AI builder starts predicting if that lead may convert into a customer or not.
      • Let’s assume at a Trade show, we add 2 new leads using a simple PowerApps application:

      • Note that the record is being created in CDS entity using a Flow and not using SubmitForm(Formname) command in PowerApps. The AI builder prediction field (cre7e_leadconverted – predicted (xyzlaptops-leads)) and the actual outcome field (Lead Converted) are of datatype Two options. If we use SubmitForm(Formname) in PowerApps, these fields get defaulted to False. For AI builder to work, these fields have to have null data when the record is being created and this can be achieved by creating a new record using a Flow Action.
      • In XYZlaptops entity, you’ll now see 2 newly created records with No prediction yet. Notice the AI builder prediction fields and actual outcome fields are empty
      • Next, you’ll have to wait for 24 hours (since you published the model) for the AI builder to do its magic. (Alternatively, you can retrain the model and publish it again to see the prediction instantly). For every new lead that’s added the AI builder predicts the outcome.


  • The bigger Picture – Now let’s assume a lot of new leads are captured into the system and the AI builder has predicted the outcome for each of these leads. The organization uses Power BI to report on this leads data to provides insights as follows:

               Which leads would you call first!?

Binary Classification Model in AI builder has the capability to predict outcome of some of the critical parts of your business, making it easy to take quicker decisions and grow. Read more about Binary Classification and try more examples using the resources here.