{"id":9798,"date":"2020-05-05T13:47:23","date_gmt":"2020-05-05T20:47:23","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-apps\/ai-builder-now-supports-predicting-multiple-outcomes-preview\/"},"modified":"2020-05-05T13:47:23","modified_gmt":"2020-05-05T20:47:23","slug":"ai-builder-now-supports-predicting-multiple-outcomes-preview","status":"publish","type":"power-apps","link":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-apps\/ai-builder-now-supports-predicting-multiple-outcomes-preview\/","title":{"rendered":"AI Builder now supports predicting multiple outcomes (Preview)"},"content":{"rendered":"
AI Builder prediction models now support a preview capability to predict multiple outcomes. Now you can use AI builder intelligence to predict things like is shipping going to be early, on time or late. Or will the business flow be completed as a success, a failure or cancelled.<\/p>\n
In this post, we demonstrate how multiple outcomes prediction works by building an example of an end to end scenario for how AI Builder can help to optimize delivery performance and improve customer satisfaction for an e-commerce company.<\/p>\n
Let\u2019s say I\u2019m a maker in a typical e-commerce company in Brazil. My CDS database contains typical entities like Order, Product, Customer, etc. I\u2019m noticing that there have been a lot of complaints about delivery delays. But the cost of upgrading shipping from regular to express is very high so I don\u2019t want to upgrade every order that is likely to be late. Instead, I just want to upgrade orders that are going to be late for more than 2 days and for the rest likely to be late orders, I\u2019ll offer some coupons to the customers.<\/p>\n
To meet this business goal, I need to create a prediction model which can tell me which orders are going to be late and which are going to be very late (more than 2 days).<\/p>\n
I\u2019m going to create an output field to denote what constitutes a delayed delivery. In my Order entity, I have the estimated delivery date and the actual delivery date. Every record where actual delivery date is later than estimated delivery date is considered as a late delivery, and if actual delivery date is more than 2 days later than estimated, the order is considered as very late.<\/p>\n
I will create two calculated fields:<\/p>\n
Delivery Delta<\/strong>\u00a0\u2013 this is the difference in days between\u00a0Delivered Date<\/strong>\u00a0and\u00a0Estimated Delivery Date<\/strong>.<\/p>\n \u00a0<\/p>\n And I\u2019m going to user Delivery timeliness<\/strong> as my target outcome.<\/p>\n First, let\u2019s create a new prediction model from AI Builder section of Power Apps. More information about how to do this: Creating a prediction model<\/a>.<\/p>\n We use my\u00a0<\/span>BC_orders<\/strong>\u00a0entity and the\u00a0<\/span>Delivery timeliness<\/strong>\u00a0field. Note, multiple outcomes prediction is still in preview. You can also click Manage outcomes\u00a0<\/strong>on the top navigation bar and select group to two outcomes to switch to binary prediction if needed.<\/span><\/p>\n Next, I select my related entities,\u00a0Customer<\/strong>\u00a0and\u00a0Product<\/strong>.<\/p>\n Also, make sure that Delivery Date<\/strong> and Delivery Delta<\/strong> are not selected, because the model should not have information that is only known after the product has been delivered. If you do keep it selected, then the model will show that it has 100% accuracy, but it will not be able to properly predict new orders. This is known in machine learning as target leak, and you can learn more about it\u00a0here<\/a>.<\/p>\n <\/p>\n Here, let\u2019s skip adding a filter as this data should be sufficient to train the model.<\/p>\n Once all that is done, it is time to train the model. For this model, we have a performance grade of B, which means it\u2019s correct most of the time. The most influential data is also reasonable. I know I can keep improving my model to reach an A grade. However, I decide to use this B model for now to unblock my business.<\/p>\n <\/p>\n As part of publishing, we actually create three outputs:<\/p>\n \u00a0<\/p>\n After model is published, select Use model<\/strong>, and then select Run now<\/strong> to get the prediction results immediately. Let\u2019s give it a few minutes to let the model run on our data set. \u00a0The model will predict for any records with empty Delivery timeliness<\/strong> field.<\/p>\n After above step is done, we can use the view feature to quickly see the predicted output. Refer to\u00a0this<\/a>\u00a0document for more info.<\/p>\n <\/p>\n Now, we\u2019re ready to connect the prediction model to our Power Automate flow. For this example, we can set the flow to be triggered when the Delivery timeliness<\/strong> is Late<\/strong> then send this customer a coupon.<\/p>\n Now, go ahead and try this scenario on your own!\u00a0 Your feedback will \u00a0help us continue to build on and improve AI Builder. We want to hear from you<\/a>!<\/p>\n
\nDelivery timeliness<\/strong>\u00a0\u2013 this field categorizes the\u00a0Delivery Delta<\/strong>\u00a0column into\u00a0Early<\/strong>,\u00a0On time<\/strong>, Late and Very Late<\/strong>.<\/p>\nCreate prediction model<\/h2>\n
Publish and use your model<\/h2>\n
\n