{"id":261,"date":"2022-01-12T14:58:56","date_gmt":"2022-01-12T14:58:56","guid":{"rendered":"https:\/\/blog.citrus-lime.com\/crmc\/?p=261"},"modified":"2022-01-12T14:58:56","modified_gmt":"2022-01-12T14:58:56","slug":"getting-started-with-the-power-platform-ai-builder","status":"publish","type":"post","link":"https:\/\/blog.citrus-lime.com\/crmc\/getting-started-with-the-power-platform-ai-builder\/","title":{"rendered":"Getting started with the Power Platform AI Builder."},"content":{"rendered":"\n<p>Before getting into the Builder itself, I find it very useful to look at the established Sales Insights App for Dynamics \u2013 as this works in many similar ways and gives a view of what a potential end-point looks like.<\/p>\n\n\n\n<p>But the real weight is in the Power Apps Maker and getting into the AI Builder proper.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image001_43ABF35C.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image001_thumb_0BF9392C.png\" alt=\"clip_image001\" title=\"clip_image001\" \/><\/a><\/figure>\n\n\n\n<p>Here we can create a new Model or examine the Test Model created in the Sandbox.<\/p>\n\n\n\n<p>As this Model has had time to analyse the data, we can click in and get an idea of how its weighted the data it is looking at:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image002_79B07269.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image002_thumb_2E50CEA5.png\" alt=\"clip_image002\" title=\"clip_image002\" \/><\/a><\/figure>\n\n\n\n<p>But if we click Edit Model, we can see how I\u2019ve set this up.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What do you want to Predict?<\/h3>\n\n\n\n<p>First off, we define our Win State and Lost State that we want the Model to analyse for:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image003_07168570.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image003_thumb_5BD1EE68.png\" alt=\"clip_image003\" title=\"clip_image003\" \/><\/a><\/figure>\n\n\n\n<p>This allows us to pick the Entity, then a Field, and define what the Win\/Loss States are for this Field.<\/p>\n\n\n\n<p>Click NEXT and then we are onto the Data we want to analyse to see how the Data affects this Win\/Lose State.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Review the Data going into your Model<\/h3>\n\n\n\n<p>This is essentially a Field Picker for the Entity we are analysing \u2013 but with the option to pull other Parent or Child fields into the mix as well.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image004_3497A533.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image004_thumb_503C3129.png\" alt=\"clip_image004\" title=\"clip_image004\" \/><\/a><\/figure>\n\n\n\n<p>My take here is that this would often go hand-in-hand with Dynamics Rollup Fields for analysing Child Entities \u2013 as MIN, MAX, SUM and COUNT fields up to the Opportunity will always be helpful in providing key metrics that are good for analysis.<\/p>\n\n\n\n<p>This will work similar to traditional reporting where Option Sets, Lookups, Numbers and Currencies as \u2018hard\u2019 fields will be best for the Model to analyse.<\/p>\n\n\n\n<p>Text is still fine, but often best when analysing segmental styles of text, such as Postcodes or City Names.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Filters<\/strong><\/h3>\n\n\n\n<p>We can then apply Filters to our Model to control which elements of Data it looks at.<\/p>\n\n\n\n<p>We can skip this and simply analyse all Opportunities everywhere \u2013 but when we run this we may want our Model to look at a particular Business Unit or Opportunity Type.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image005_3DF36A67.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image005_thumb_7DBD50EC.png\" alt=\"clip_image005\" title=\"clip_image005\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">Train it..<\/h3>\n\n\n\n<p>With the Entity, Win\/Loss States, Data and Filters set \u2013 the Model is ready to start analysing the data to compare how each Field or Metric is influencing the likelihood of leaning a record to the identified Win State or Loss State.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image006_6B748A2A.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image006_thumb_2B3E70B0.png\" alt=\"clip_image006\" title=\"clip_image006\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">What next?<\/h3>\n\n\n\n<p>Now trained, we see our model presenting which areas of the data we have provided are the most influential in predicting whether a record will hit its \u2018win\u2019 state or \u2018loss\u2019 state \u2013 probably here expressing this a a positive or negative outcome is better terminology as this is not just for Opportunities with a traditional win or lost model.<\/p>\n\n\n\n<p>We can now use the Model in a number of ways.<\/p>\n\n\n\n<p>The most immediate is using Power Automate to query the model and populate fields about a record as a result, this uses the \u2018Predict in Real Time\u2019 action in Power Automate.<\/p>\n\n\n\n<p>We call this action with a number of inputs from the record we want to predict and this then compares these values to the model we have trained:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_0DCC1FA4.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_4FD28EE5.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<p>This returns a set of values that we can insert into our record in Dynamics to describe what our Model predicts will happen .i.e. the rate of probability that the record will have a positive or negative outcome.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_289845B0.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_thumb_68622C35.png\" alt=\"image\" title=\"image\" \/><\/a><\/figure>\n\n\n\n<p>This breaks into three sets of information:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Explanation \u2013<\/strong>&nbsp;a JSON document describing the Fields in the Input that have produced the predicted outcome, and how each has been weighted in the Model for this set of Inputs:<\/p><p>[{&#8220;entityName&#8221;: &#8220;opportunity&#8221;, &#8220;attributeName&#8221;: &#8220;new_grossprofitpercentage&#8221;, &#8220;weight&#8221;: 0.3210554504840574}, {&#8220;entityName&#8221;: &#8220;crmcs_projects&#8221;, &#8220;attributeName&#8221;: &#8220;crmcs_name&#8221;, &#8220;weight&#8221;: 0.28638559308774103}, {&#8220;entityName&#8221;: &#8220;crmcs_projects&#8221;, &#8220;attributeName&#8221;: &#8220;crmcs_projecttype&#8221;, &#8220;weight&#8221;: 0.13992829903618048}]<\/p><p><strong>Likelihood \u2013&nbsp;<\/strong>the overall % chance that the model is predicting the right outcome<\/p><p>0.9806 = 98%<\/p><p><strong>Prediction \u2013&nbsp;<\/strong>the predicted outcome for our success\/failure field; for an option set, this will be the numerical value of the option set value predicted by our model.<\/p><p>2<\/p><\/blockquote>\n\n\n\n<p>Here, the way this works is that our Model is effectively a Datasource that we can query at any time.<\/p>\n\n\n\n<p>We query the Model with our combination of inputs and this consults the model to return these 3 outputs \u2013 effectively working as a typical Webservice that we can consult for information on our business and its predicted outcomes.<\/p>\n\n\n\n<p>This is why the process plugs neatly into Power Automate as most actions in Automate are effectively calling out to REST Endpoints to retrieve information or invoke certain actions.<\/p>\n\n\n\n<p>We can put this approach to use in a number of different ways.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Continue using Power Automate to read the information back and insert into Dynamics \/ Power Apps as a way of predicting in real time.<\/li><li>Call our Model via a Custom UI to present a graphical prediction in real-time.<ul><li>This could be done within a record in Dynamics as a mini-dashboard<\/li><li>Or a wider Dashboard that presents the overall Model back to us<\/li><\/ul><\/li><li>Build a number of Models and then use a Parent Model or set of Logic to crunch a number of Models into different predictions.<\/li><\/ul>\n\n\n\n<p>In these ways, we can use the Predictive Models to provide Insights back to our Dynamics Users and tailor what\u2019s likely to happen based on our past data.<br><\/p>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<h3 class=\"wp-block-heading\">Further Reading<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>The following three articles show how to use the prediction model in Power Automate:<\/strong><\/p><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><a href=\"https:\/\/docs.microsoft.com\/en-us\/ai-builder\/prediction-pwr-automate\">https:\/\/docs.microsoft.com\/en-us\/ai-builder\/prediction-pwr-automate<\/a><\/p><p><a href=\"https:\/\/docs.microsoft.com\/en-us\/ai-builder\/predict-action-pwr-automate\">https:\/\/docs.microsoft.com\/en-us\/ai-builder\/predict-action-pwr-automate<\/a><\/p><p><a href=\"https:\/\/www.crmcs.co.uk\/content\/calling-a-power-platform-ai-builder-model-via-odata.aspx\">Calling a Power Platform AI Builder Model via oData (crmcs.co.uk)<\/a>&nbsp;<\/p><p><strong>Using your Model to predict a Range of Outcomes<\/strong><\/p><p><a href=\"https:\/\/powerapps.microsoft.com\/en-us\/blog\/ai-builder-now-supports-predicting-multiple-outcomes-preview\/\">https:\/\/powerapps.microsoft.com\/en-us\/blog\/ai-builder-now-supports-predicting-multiple-outcomes-preview\/<\/a><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Before getting into the Builder itself, I find it very useful to look at the established Sales Insights App for Dynamics \u2013 as this works in many similar ways and gives a view of what a potential end-point looks like. But the real weight is in the Power Apps Maker and getting into the AI<\/p>\n","protected":false},"author":43,"featured_media":43,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_tribe_ticket_capacity":"0","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"footnotes":""},"categories":[3],"tags":[],"class_list":{"0":"post-261","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-crm"},"featured_image_src":"https:\/\/blog.citrus-lime.com\/crmc\/wp-content\/uploads\/sites\/30\/2021\/11\/Untitled-design-41.png","author_info":{"display_name":"jadesmith","author_link":"https:\/\/blog.citrus-lime.com\/crmc\/author\/jadesmith\/"},"_links":{"self":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/comments?post=261"}],"version-history":[{"count":1,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/261\/revisions"}],"predecessor-version":[{"id":262,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/261\/revisions\/262"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/media\/43"}],"wp:attachment":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/categories?post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}