<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[analytics - Alexander Development]]></title><description><![CDATA[analytics - Alexander Development]]></description><link>https://alexanderdevelopment.net/</link><image><url>https://alexanderdevelopment.net/favicon.png</url><title>analytics - Alexander Development</title><link>https://alexanderdevelopment.net/</link></image><generator>Ghost 1.20</generator><lastBuildDate>Fri, 24 Apr 2026 14:15:44 GMT</lastBuildDate><atom:link href="https://alexanderdevelopment.net/tag/analytics/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Azure Text Analytics sentiment analysis with North52]]></title><description><![CDATA[<div class="kg-card-markdown"><p>For the last several months I've been working on an enterprise Dynamics CRM project where one of our goals is to minimize the amount of custom code we write by using <a href="http://www.north52.com/business-process-activities/">North52's Business Process Activities</a>. I had not been exposed to North52 before working on this project, but I have</p></div>]]></description><link>https://alexanderdevelopment.net/post/2016/05/17/azure-text-analytics-sentiment-analysis-with-north52/</link><guid isPermaLink="false">5a5837236636a30001b9782d</guid><category><![CDATA[Microsoft Dynamics CRM]]></category><category><![CDATA[text analysis]]></category><category><![CDATA[integration]]></category><category><![CDATA[Azure]]></category><category><![CDATA[analytics]]></category><category><![CDATA[web services]]></category><category><![CDATA[North52]]></category><dc:creator><![CDATA[Lucas Alexander]]></dc:creator><pubDate>Tue, 17 May 2016 13:19:37 GMT</pubDate><media:content url="https://alexanderdevelopment.net/content/images/2016/05/2016-05-17_08-51-04.png" medium="image"/><content:encoded><![CDATA[<div class="kg-card-markdown"><img src="https://alexanderdevelopment.net/content/images/2016/05/2016-05-17_08-51-04.png" alt="Azure Text Analytics sentiment analysis with North52"><p>For the last several months I've been working on an enterprise Dynamics CRM project where one of our goals is to minimize the amount of custom code we write by using <a href="http://www.north52.com/business-process-activities/">North52's Business Process Activities</a>. I had not been exposed to North52 before working on this project, but I have been pleasantly surprised with how much it has allowed our mostly functional resources to achieve without needing technical assistance.</p>
<p>While looking through North52's documentation a while back, I noticed it could be used to <a href="http://support.north52.com/knowledgebase/articles/488697-introduction-to-north52-s-webfusion">call a REST web service</a>. This got me thinking about how I could rework my <a href="https://alexanderdevelopment.net/post/2015/10/12/sentiment-analysis-in-dynamics-crm-using-azure-text-analytics/">Sentiment analysis in Dynamics CRM using Azure Text Analytics</a> sample using North52 instead of a custom workflow activity.</p>
<p>I found I was able to replace the custom workflow activity with a North52 <a href="http://www.north52.com/business-process-activities/process-genie-for-microsoft-dynamics-crm-xrm/">Process Genie</a>. It executes a <a href="https://datamarket.azure.com/dataset/amla/text-analytics">Smart Flow</a> to call the Azure Machine Learning <a href="https://datamarket.azure.com/dataset/amla/text-analytics">Text Analytics API</a> and then return the result to the calling CRM dialog.</p>
<p>Here's the formula I used in my Process Genie:</p>
<pre><code>SmartFlow(
  SetVar('jsoninput', CreateJObject( 
     CreateJProperty('Inputs', 
           CreateJArray(CreateJObject(
                           CreateJProperty('Id', '1'),  
                           CreateJProperty('Text', [account.texttoanalyze]) 
                              )
                        )
                     )
               )
          ),

  CallRestAPI(
      SetRequestBaseURL('https://api.datamarket.azure.com/data.ashx/amla/text-analytics/v1'),
      SetRequestResource('/GetSentimentBatch'),
      SetRequestDetails('POST'),
      SetRequestHeaders(),
      SetRequestParams('RawContentTextJSON',GetVar('jsoninput')),
      SetRequestAuthenticationBasic('AccountKey','YOUR_AZURE_ML_API_KEY_HERE'),
      SetRequestFiles(),
      SetRequestExpected('OK'),
      SetRequestActionPass(SetVar('result', GetVarJsonValue('SentimentBatch{0}.Score'))),
      SetRequestActionFail(SetVar('result', 'ERROR' + GetVarJsonValue('Errors{0}.Message')))
    ), 

   SmartFlowReturn(GetVar('result'))
)
</code></pre>
<p>Here's a screenshot of my CRM dialog:<br>
<img src="https://alexanderdevelopment.net/content/images/2016/05/2016-05-16_19-30-01.png#img-thumbnail" alt="Azure Text Analytics sentiment analysis with North52"></p>
<p>To execute the Process Genie, you use a North52 N52 Process Genie step like this:<br>
<img src="https://alexanderdevelopment.net/content/images/2016/05/2016-05-16_19-32-09.png#img-thumbnail" alt="Azure Text Analytics sentiment analysis with North52"></p>
<p>The Formula ShortCode value is the short code of the North52 Process Genie. The Formula Parameter Xml value contains the text to analyze from the dialog input in the format expected by the formula:</p>
<p><code>&lt;account&gt;&lt;texttoanalyze&gt;{Response Text(Get text)}&lt;/texttoanalyze&gt;&lt;/account&gt;</code></p>
<p>If were going to use this in real solution, I would not hardcore the Azure ML API key directly in the formula. Other than that I think this is a production-ready approach.</p>
<p>What do you think? Would you consider using something like this as an alternative to writing your own custom code?</p>
</div>]]></content:encoded></item><item><title><![CDATA[Predictions in Dynamics CRM with custom Azure Machine Learning integrations]]></title><description><![CDATA[<div class="kg-card-markdown"><p>Earlier this year I wrote a <a href="https://alexanderdevelopment.net/post/2015/10/12/sentiment-analysis-in-dynamics-crm-using-azure-text-analytics/">post</a> that showed how to perform sentiment analysis in Dynamics CRM using <a href="https://datamarket.azure.com/dataset/amla/text-analytics">Microsoft Azure Text Analytics</a>. Azure Text Analytics makes it incredibly easy to use sentiment analysis (with English text only), but the full Azure Machine Learning offering is much more powerful. In today's</p></div>]]></description><link>https://alexanderdevelopment.net/post/2015/11/30/using-azure-machine-learning-predictive-data-models-in-dynamics-crm/</link><guid isPermaLink="false">5a5837236636a30001b977df</guid><category><![CDATA[Microsoft Dynamics CRM]]></category><category><![CDATA[CRM 2015]]></category><category><![CDATA[Azure]]></category><category><![CDATA[machine learning]]></category><category><![CDATA[data mining]]></category><category><![CDATA[analytics]]></category><category><![CDATA[web services]]></category><dc:creator><![CDATA[Lucas Alexander]]></dc:creator><pubDate>Tue, 01 Dec 2015 03:08:34 GMT</pubDate><media:content url="https://alexanderdevelopment.net/content/images/2015/11/ml-03-1.png" medium="image"/><content:encoded><![CDATA[<div class="kg-card-markdown"><img src="https://alexanderdevelopment.net/content/images/2015/11/ml-03-1.png" alt="Predictions in Dynamics CRM with custom Azure Machine Learning integrations"><p>Earlier this year I wrote a <a href="https://alexanderdevelopment.net/post/2015/10/12/sentiment-analysis-in-dynamics-crm-using-azure-text-analytics/">post</a> that showed how to perform sentiment analysis in Dynamics CRM using <a href="https://datamarket.azure.com/dataset/amla/text-analytics">Microsoft Azure Text Analytics</a>. Azure Text Analytics makes it incredibly easy to use sentiment analysis (with English text only), but the full Azure Machine Learning offering is much more powerful. In today's post I will show how to create a custom predictive web service in Azure ML and make predictions with it in Dynamics CRM.</p>
<h4 id="whyamidoingthis">Why am I doing this?</h4>
<p>One of the exciting announcements about Dynamics CRM 2016 is that it includes some sort of integration with Azure ML, so what's the point of this blog post? Actually, here are two reasons:</p>
<ol>
<li>It's not clear (as of late November 2016) what capabilities the standard CRM-Azure ML integration will have. The approach demonstrated here allows for total customization.</li>
<li>The approach below can be used right now in any version of CRM (online or on-premise) from CRM 2011 onward.</li>
</ol>
<h4 id="thedemodataset">The demo data set</h4>
<p>For this demonstration I am using data from the AdventureWorks data warehouse sample database to build a model to predict whether a contact in CRM is likely to be a bicycle buyer. I created a flat file of contacts that includes several independent variables and a yes/no flag for whether they purchased a bicycle. That sample file is included in my solution source linked at the bottom of this post.</p>
<p>You can also download the full AdventureWorks database from CodePlex <a href="https://msftdbprodsamples.codeplex.com/releases/view/125550">here</a>.</p>
<h4 id="gettingstartedwithazureml">Getting started with Azure ML</h4>
<p>As I was trying to get the hang of Azure ML, I found the <a href="https://bluewatersql.wordpress.com/">Bluewater SQL blog</a> tremendously helpful. If you're just getting started with Azure ML, I suggest you take a look at both of these posts before continuing. <em>(These two posts also use the AdventureWorks data warehouse sample database, though I had already decided to use it for my demo before I found this site. I guess the AdventureWorks data is an obvious choice for this sort of thing.)</em></p>
<ol>
<li><a href="https://bluewatersql.wordpress.com/2014/07/31/azure-machine-learning-first-look/">https://bluewatersql.wordpress.com/2014/07/31/azure-machine-learning-first-look/</a></li>
<li><a href="https://bluewatersql.wordpress.com/2014/08/01/azure-machine-learning-a-deeper-look/">https://bluewatersql.wordpress.com/2014/08/01/azure-machine-learning-a-deeper-look/</a></li>
</ol>
<h4 id="creatingthepredictivewebservice">Creating the predictive web service</h4>
<p>Now that the introductory bits are out of the way, here's an overview of how I set up my predictive web service in Azure ML. I've also shared my work in the Cortana Analytics Gallery, so if you just want to see how the experiments are set up without going through all the steps yourself, skip to the end of this post for the gallery links.</p>
<ol>
<li>Export your data set from CRM. I use a simple KingswaySoft SSIS package to do this. It's included in my sample project files.</li>
<li>Upload your data set to Azure ML Studio. I am using the Azure ML free tier, which requires me to manually upload the data set for the initial upload and any subsequent updates. If I were using the standard tier, it would be possible to upload the data set to Azure blob storage as part of my SSIS package. This would be useful for periodically retraining the model with updated data in the future. <img src="https://alexanderdevelopment.net/content/images/2015/11/ml-01.png#img-thumbnail" alt="Predictions in Dynamics CRM with custom Azure Machine Learning integrations"></li>
<li>Create and run a new experiment to classify bike buyers. I basically followed the steps outlined in the two Bluewater SQL posts, so take a look at those if you want to see a more detailed explanation. <img src="https://alexanderdevelopment.net/content/images/2015/11/ml-02.png#img-thumbnail" alt="Predictions in Dynamics CRM with custom Azure Machine Learning integrations"></li>
<li>Save the trained model from this experiment to use in your predictive web service.</li>
<li>Create a new experiment that will serve as the foundation for the predictive web service</li>
<li>Add the following items to the new experiment canvas:</li>
<li>Data set</li>
<li>Trained model from the earlier experiment</li>
<li>Score model component</li>
<li>Project columns transformation between the data set and score model component to exclude the lpa_bikerbuyername column</li>
<li>Project columns transformation after score model component to only include score labels</li>
<li>Run the experiment.</li>
<li>Create a predictive web service. <img src="https://alexanderdevelopment.net/content/images/2015/11/ml-03.png#img-thumbnail" alt="Predictions in Dynamics CRM with custom Azure Machine Learning integrations"></li>
<li>Run the experiment.</li>
<li>Deploy the web service. <img src="https://alexanderdevelopment.net/content/images/2015/11/ml-04.png#img-thumbnail" alt="Predictions in Dynamics CRM with custom Azure Machine Learning integrations"></li>
<li>Open the web service and copy the API key to use later. <img src="https://alexanderdevelopment.net/content/images/2015/11/ml-05.png#img-thumbnail" alt="Predictions in Dynamics CRM with custom Azure Machine Learning integrations"></li>
<li>Open the request/response page.</li>
<li>Copy the post URL to use later. Leave off the &quot;&amp;details=true&quot; at the end. <img src="https://alexanderdevelopment.net/content/images/2015/11/ml-06.png#img-thumbnail" alt="Predictions in Dynamics CRM with custom Azure Machine Learning integrations"></li>
<li>Scroll down to find the JSON request/response samples and copy them for review later. <img src="https://alexanderdevelopment.net/content/images/2015/11/ml-07.png#img-thumbnail" alt="Predictions in Dynamics CRM with custom Azure Machine Learning integrations"></li>
</ol>
<h4 id="makingpredictionsfromcrm">Making predictions from CRM</h4>
<p>Once your predictive web service is set up, using it in Dynamics CRM is as simple as posting a JSON request to the web service and then parsing the JSON response. A few years ago, I wrote a <a href="https://code.msdn.microsoft.com/Postingprocessing-JSON-in-396ead03">code sample showing an easy way to make JSON requests from CRM custom assemblies</a> that serves as the foundation for the workflow activity I'm using in this demo. There are only a few changes required to that sample:</p>
<ol>
<li>Add an authorization header that includes the bearer API key you copied earlier.</li>
<li>Add input/output parameters that match the inputs and outputs for your predictive web service. I am also passing the API key and service endpoint as input parameters instead of hardcoding them.</li>
<li>Modify the JSON request/response classes to allow for serialization to/deserialization from the request and response messages. Because of how Azure ML passes the inputs/outputs, these are actually fairly generic, so you can probably use mine with no or minimal changes.</li>
<li>Send the correct request parameters and correctly handle the response parameters.</li>
</ol>
<p>To demonstrate the custom workflow activity, I created a sample CRM dialog.<br>
<img src="https://alexanderdevelopment.net/content/images/2015/11/ml-08.png#img-thumbnail" alt="Predictions in Dynamics CRM with custom Azure Machine Learning integrations"></p>
<p>Here's where I supply the input parameters.<br>
<img src="https://alexanderdevelopment.net/content/images/2015/11/ml-09-1.png#img-thumbnail" alt="Predictions in Dynamics CRM with custom Azure Machine Learning integrations"></p>
<p>Here's what the dialog looks like when I run it from a contact record.<br>
<img src="https://alexanderdevelopment.net/content/images/2015/11/ml-10.png#img-thumbnail" alt="Predictions in Dynamics CRM with custom Azure Machine Learning integrations"></p>
<h4 id="thecode">The code</h4>
<p>You can get all the code for this demonstration from my GitHub repository <a href="https://github.com/lucasalexander/Crm-Sample-Code/tree/master/CrmAzureMachineLearningDemo">here</a>. The  sample code includes the following:</p>
<ol>
<li>CRM solution containing:</li>
<li>Contact entity with custom fields added and a system view for data export for Azure ML</li>
<li>Sample dialog (you would need to update the parameters with your own API key and endpoint details)</li>
<li>Compiled custom workflow activity to call the web service</li>
<li>Contact data ready for import to CRM</li>
<li>SSIS package solution for data export</li>
<li>Custom workflow activity source code</li>
</ol>
<p>I've also shared my training and prediction experiments in the Cortana Analytics Gallery. Here are the links where you can open and import them into your own workspace:</p>
<ol>
<li><a href="http://gallery.azureml.net/Details/3f87e56096214a508274c4f61e989cfb">Training experiment</a></li>
<li><a href="http://gallery.azureml.net/Details/ec90eadce2c947608916c64fb3c8fb97">Prediction experiment</a></li>
</ol>
<p>What do you think about this approach? Does it seem like it would be useful to you in a real-world situation? Let me know in the comments!</p>
</div>]]></content:encoded></item><item><title><![CDATA[Sentiment analysis in Dynamics CRM using Azure Text Analytics]]></title><description><![CDATA[<div class="kg-card-markdown"><p>Last year I created a <a href="https://github.com/lucasalexander/CRM-IdolOnDemand-Tools">proof-of-concept solution</a> that showed how to integrate Dynamics CRM with <a href="https://www.havenondemand.com/">HP Haven OnDemand</a> (then called HP IDOL OnDemand) to perform sentiment analysis and index records to support &quot;find similar&quot; queries. While I was working through the <a href="https://challenge.azurecon.com/">AzureCon challenge</a> a few weeks ago, I</p></div>]]></description><link>https://alexanderdevelopment.net/post/2015/10/12/sentiment-analysis-in-dynamics-crm-using-azure-text-analytics/</link><guid isPermaLink="false">5a5837226636a30001b97775</guid><category><![CDATA[Microsoft Dynamics CRM]]></category><category><![CDATA[CRM 2015]]></category><category><![CDATA[text analysis]]></category><category><![CDATA[Azure]]></category><category><![CDATA[analytics]]></category><category><![CDATA[web services]]></category><dc:creator><![CDATA[Lucas Alexander]]></dc:creator><pubDate>Mon, 12 Oct 2015 22:36:23 GMT</pubDate><media:content url="https://alexanderdevelopment.net/content/images/2015/10/dialog-2.png" medium="image"/><content:encoded><![CDATA[<div class="kg-card-markdown"><img src="https://alexanderdevelopment.net/content/images/2015/10/dialog-2.png" alt="Sentiment analysis in Dynamics CRM using Azure Text Analytics"><p>Last year I created a <a href="https://github.com/lucasalexander/CRM-IdolOnDemand-Tools">proof-of-concept solution</a> that showed how to integrate Dynamics CRM with <a href="https://www.havenondemand.com/">HP Haven OnDemand</a> (then called HP IDOL OnDemand) to perform sentiment analysis and index records to support &quot;find similar&quot; queries. While I was working through the <a href="https://challenge.azurecon.com/">AzureCon challenge</a> a few weeks ago, I thought it would be an interesting exercise to update my sentiment analysis code to work with the <a href="https://datamarket.azure.com/dataset/amla/text-analytics">Text Analytics</a> offering from the Microsoft Azure Marketplace.</p>
<h4 id="theapproach">The approach</h4>
<p>As with my Haven OnDemand solution, the approach I'm using with Azure relies on a custom workflow activity that does the following:</p>
<ol>
<li>Parse a supplied text input and strip any HTML tags using a helper function.
</li><li>Create a JSON sentiment analysis request and post it to Azure Text Analytics with an HttpWebRequest.
</li><li>Deserialize the JSON respsonse returned by Azure Text Analytics to a custom class object using a DataContractJsonSerializer.
</li><li>Return the sentiment score to the calling process.
</li></ol>
<p>There are two main differences with the my Azure Text Analytics solution:</p>
<ol>
<li>The Azure service only returns a sentiment score, so this custom workflow activity doesn't return a positive/negative string value.
</li><li>Instead of embedding an access key in the custom workflow activity code, I've made it a parameter, which means you can take the solution straight from GitHub and start using it in your CRM organization as soon as you sign up for the Text Analytics service.
</li></ol>
<h4 id="thesolutioninaction">The solution in action</h4>
<p>Here's a sample dialog I've created to demonstrate the use of the custom workflow activity.<br>
<img src="https://alexanderdevelopment.net/content/images/2015/10/dialog.png#img-thumbnail" alt="Sentiment analysis in Dynamics CRM using Azure Text Analytics"></p>
<p><img src="https://alexanderdevelopment.net/content/images/2015/10/dialog-01-input.png#img-thumbnail" alt="Sentiment analysis in Dynamics CRM using Azure Text Analytics"></p>
<p><img src="https://alexanderdevelopment.net/content/images/2015/10/dialog-02-params.png#img-thumbnail" alt="Sentiment analysis in Dynamics CRM using Azure Text Analytics"></p>
<p><img src="https://alexanderdevelopment.net/content/images/2015/10/dialog-03-output.png#img-thumbnail" alt="Sentiment analysis in Dynamics CRM using Azure Text Analytics"></p>
<p>Here's how the process works for the sample text &quot;I hate you.&quot;</p>
<p><img src="https://alexanderdevelopment.net/content/images/2015/10/hate-01.png#img-thumbnail" alt="Sentiment analysis in Dynamics CRM using Azure Text Analytics"></p>
<p><img src="https://alexanderdevelopment.net/content/images/2015/10/hate-02.png#img-thumbnail" alt="Sentiment analysis in Dynamics CRM using Azure Text Analytics"></p>
<p>Wrapping it up on a more positive note, here's the same dialog with &quot;I love you&quot; instead.</p>
<p><img src="https://alexanderdevelopment.net/content/images/2015/10/love-01.png#img-thumbnail" alt="Sentiment analysis in Dynamics CRM using Azure Text Analytics"></p>
<p><img src="https://alexanderdevelopment.net/content/images/2015/10/love-02.png#img-thumbnail" alt="Sentiment analysis in Dynamics CRM using Azure Text Analytics"></p>
<p>As you can see, the score for &quot;I hate you&quot; is about .06, and the score for &quot;I love you&quot; is about .91, which makes sense as scores closer to one are more positive, and scores closer to zero are more negative.</p>
<h4 id="thecode">The code</h4>
<p>You can download all the custom code and a CRM solution extract from my <a href="https://github.com/lucasalexander/Crm-Sample-Code/tree/master/CrmAzureTextAnalysis">Crm-Sample-Code repository on GitHub</a>. Let me know what you think in the comments!</p>
</div>]]></content:encoded></item></channel></rss>