<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Dynamics and cortana intelligence</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/intel/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/intel/feed.xml</link>
    <description>Building intelligent business processes</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:11:29 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>KYC series - basic analysis</title>
      <link>https://docs.microsoft.com/archive/blogs/intel/kyc-series-basic-analysis</link>
      <pubDate>Sun, 09 Jul 2017 08:34:38 GMT</pubDate>
      <dc:creator><![CDATA[AksheyGupta]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/intel/?p=1295</guid>
      <description><![CDATA[First question Contoso wanted to know is are we making money? Is that a surprise to you? Hopefully...]]></description>
      <content:encoded><![CDATA[<strong>First question Contoso wanted to know is are </strong><strong>we making money?</strong> Is that a surprise to you? Hopefully not. But we haven't answered it yet! Primarily because though we have a strong handle on their sales side of things, but the cost data cannot be trusted. There is more business process work to do here before we can answer that question.

We did some basic analysis to get to some understanding of their business. A few plots will illustrate what we found.

<a href="https://msdnshared.blob.core.windows.net/media/2017/07/TotalAmount-e1499589169728.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/07/TotalAmount-1024x584.jpg" alt="" width="1024" height="584" class="alignnone size-large wp-image-1305" /></a>
<ol>
 	<li><span style="color: #000000;font-family: Calibri">Chart 1 – Total amount and total margin move linearly as expected, though as mentioned later there are several customers of interest who fall in negative margin territory. DIG DEEPER.</span></li>
 	<li><span style="color: #000000;font-family: Calibri">Chart 2 – Number of orders doesn’t really have a relationship with total amount. We have customers with more than 400 orders processed with total amounts spread over a wide range from 20k to 50k. UNCELAR PICTURE.</span></li>
 	<li><span style="color: #000000;font-family: Calibri">Chart 3 – Percentage of total orders that are discounted falls as one moves towards the right territory of large total amount. Conversely, one can see that for orders with amount less than 10k, the percent of orders discounted could be anywhere between 0 -100%. UNCLEAR.</span></li>
 	<li><span style="color: #000000;font-family: Calibri">Chart 4 – This clearly shows that customers whose last orders came in quite a while ago do a lot less business with Contoso. Conversely, customers who do a lot of business with Contoso have placed orders quite recently. NO SURPSIES HERE</span></li>
 	<li><span style="color: #000000;font-family: Calibri">Chart 5 – This one also clearly shows that discount percent on discounted orders has a lot of variation only when we look at marginal customers. When we look at customers who do significant business with Contoso, mean discount is quite close to zero. HEALTHY</span></li>
 	<li><span style="color: #000000;font-family: Calibri">Chart 6 – This one also clearly shows that customers who do a lot less business with Contoso can have a lot of gap between their orders. Conversely customers who have little gap between orders are more likely to make high spend with Contoso. NO SURPRISES HERE</span></li>
</ol>
<span style="color: #000000;font-family: Calibri"><span style="color: #333333;font-family: Georgia">keep reading.</span></span>]]></content:encoded>
    </item>
    <item>
      <title>KYC - Basic description of example company</title>
      <link>https://docs.microsoft.com/archive/blogs/intel/kyc-basic-description-of-example-company</link>
      <pubDate>Sun, 09 Jul 2017 08:28:15 GMT</pubDate>
      <dc:creator><![CDATA[AksheyGupta]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/intel/?p=1266</guid>
      <description><![CDATA[Ok, a lot about setting the stage; let’s do it.

First a little bit about our example...]]></description>
      <content:encoded><![CDATA[Ok, a lot about setting the stage; let’s do it.

First a little bit about our example company. Here it is. Contoso Groceries UK, about $500m business. They procure and then distribute various grocery items to other smaller businesses who could be smaller groceries themselves or restaurants of various types or event caterers or even public institutions like hospitals, schools &amp; the like. Customers order through online channels or through call-centers or sometimes walk-ins. Product is delivered through Contoso owned lorries or customers drop by to collect themselves.

<strong><span style="color: #000000;font-family: Calibri">Products </span></strong>

<span style="color: #000000;font-family: Calibri">About 10,000 products are divided into about 20 categories for easy management.</span>

<strong><span style="color: #000000;font-family: Calibri">Customers</span></strong>
<ol type="1" start="1">
 	<li style="margin: 0px 0px 11px;color: #000000;font-family: 'Calibri',sans-serif;font-size: 11pt;font-style: normal;font-weight: normal">About 100,000 customers buy in any given year, some just once, others many times</li>
 	<li style="margin: 0px 0px 11px;color: #000000;font-family: 'Calibri',sans-serif;font-size: 11pt;font-style: normal;font-weight: normal">Customers are divided into 20 different markets for easy management</li>
 	<li style="margin: 0px 0px 11px;color: #000000;font-family: 'Calibri',sans-serif;font-size: 11pt;font-style: normal;font-weight: normal">Customers are also divided into customer types depending on products they buy</li>
 	<li style="margin: 0px 0px 11px;color: #000000;font-family: 'Calibri',sans-serif;font-size: 11pt;font-style: normal;font-weight: normal">Customer accounts themselves are ordered in a hierarchy since many customers use different accounts to order based on sites they order from, or their own ownership structure etc.</li>
</ol>
<strong><span style="font-family: Calibri">Sites</span></strong>

<span style="font-family: Calibri">Products are stored and sold from 15 different large warehouses (or sites) in various places in UK.</span>

<strong><span style="font-family: Calibri">Channels</span></strong>

<span style="font-family: Calibri">1.</span><span style="font: 7pt 'Times New Roman';margin: 0px">       </span><span style="font-family: Calibri">There are many channels however, the ones used most often are of two types – (1) internet or (2) non-internet</span>

<span style="font-family: Calibri">2.</span><span style="font: 7pt 'Times New Roman';margin: 0px">       </span><span style="font-family: Calibri">The channels could also be thought of in terms of (1) delivery and (2) collection channels as in a traditional cash-and-carry operation</span>

<strong><span style="font-family: Calibri">Volume of transactions</span></strong>

<span style="font-family: Calibri">Contoso processes about 10,000 sales orders with 10-20 lines each 360 days’ a year</span>

<strong><span style="font-family: Calibri">Operations velocity</span></strong>

<span style="font-family: Calibri">Most orders can be collected or delivered next day</span>

<span style="font-family: Calibri">For this analysis, we have excluded some portion of sales data to keep Contoso’s financial information confidential.</span>

<a href="https://msdnshared.blob.core.windows.net/media/2017/07/ContosoHierarchies-e1499588765647.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/07/ContosoHierarchies-1024x538.png" alt="" width="1024" height="538" class="alignnone size-large wp-image-1275" /></a>

There are nuances to this business but what you learn here (if we are successful in communicating), you can apply to any distribution operation whether it is within retail, manufacturing or distribution industry. The most necessary ingredient without which such analysis cannot be done is ‘reliable data’. Contoso uses Dynamics AX2012 R3 as single source of truth for this part of their operation and have standardized over the years so when we started working with this customer we had good data to start with. Which ERP or system the data comes from doesn't matter as long as it is good quality reliable data.

<a href="https://blogs.msdn.microsoft.com/intel/archives/1295">Keep reading</a>]]></content:encoded>
    </item>
    <item>
      <title>Know your customer (KYC) - introduction to series</title>
      <link>https://docs.microsoft.com/archive/blogs/intel/know-your-customer-kyc-introduction-to-series</link>
      <pubDate>Sun, 09 Jul 2017 08:18:21 GMT</pubDate>
      <dc:creator><![CDATA[AksheyGupta]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/intel/?p=1235</guid>
      <description><![CDATA[How do you make sense of sales data generated by transactions with 100,000 customers, 10000 products...]]></description>
      <content:encoded><![CDATA[How do you make sense of sales data generated by transactions with 100,000 customers, 10000 products from 15 different sites through 10 different channels? It's easy, you say, because there are now so many tools available to do this and this is not even big data. But it's also hard because you don't need big data to be overwhelmed, even 1/100th of what we use in this example is enough to get the better of you. For most of us in any case. For instance, look at this data.
<div>

<a href="https://msdnshared.blob.core.windows.net/media/2017/07/Bun18WeeklyPrices-e1499586840846.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/07/Bun18WeeklyPrices-1024x576.png" alt="" width="1024" height="576" class="alignnone size-large wp-image-1245" /></a>
<div>This is for a single product over three years. Average of weekly prices offered, and quantity picked up for just one product across the sites and channels. Even though we can see the expected price-quantity relationship, however, can we tell the customer what is a good price to offer? - to which customer? through which channel and site combination - in which weeks so the customer can be assured of maximizing returns? Moreover, this is only one product. How does one do this at scale?</div>
<div>So, that is our challenge. In addition to technical challenge, as we do customer projects we realize the need that project teams face on (1) how to get started with simple analysis when there are many possibilities, perspectives, KPIs etc. and (2) how to root the tools and analysis in the context of a business problem to build a compelling narrative which is what is critical for communication to executives. We try to address some of these issues in this series of posts. So, here we present you with an example - how to take your 'ordinary' 'sales data' from Dynamics 365 for operations <em>sales order table</em> and how to structure your exploration to provide some deeper analysis to your executives.</div>
<div>

We present this in Q&amp;A format so you can follow along with us.
We start with very basic questions that can be answered with simple descriptive analytics and don't need machine learning and then we progress towards deeper analysis. These series of posts are aimed at business analyst audience so we keep you away from technical complexity underneath. However, lets first see an approach that we use to solve this technical challenge.

<a href="https://blogs.msdn.microsoft.com/intel/archives/1246">keep reading</a>

</div>
</div>]]></content:encoded>
    </item>
    <item>
      <title>KYC series - customer lifecycle approach</title>
      <link>https://docs.microsoft.com/archive/blogs/intel/kyc-series-customer-lifecycle-approach</link>
      <pubDate>Sun, 09 Jul 2017 08:17:21 GMT</pubDate>
      <dc:creator><![CDATA[AksheyGupta]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/intel/?p=1246</guid>
      <description><![CDATA[There are many ways to analyze customer data. We present here the approach that may be taken with...]]></description>
      <content:encoded><![CDATA[There are many ways to analyze customer data. We present here the approach that may be taken with the tools that are available with Cortana Intelligence.

<a href="https://msdnshared.blob.core.windows.net/media/2017/07/CustomerLifeCycle-e1499587788820.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/07/CustomerLifeCycle-1024x535.png" alt="" width="1024" height="535" class="alignnone size-large wp-image-1255" /></a>
<ol>
 	<li>Do some basic business analysis - get to know the customer, get to know the data, do some simple charts to see how revenue changes, margins change, what products sell the most etc.,</li>
 	<li>Then do customer segmentation to group similar customers together and away from other groups,</li>
 	<li>Then identify some segments that are more price conscious than others,</li>
 	<li>Develop a machine learning model that calculates price elasticity</li>
 	<li>Identify high selling products (X), that most customers buy</li>
 	<li>Use this ML model to estimate price elasticity per segment for high selling products</li>
 	<li>Then find a couple frequently bought together products (Y) with each of the high selling products using FBT model</li>
 	<li>Find a couple recommended products (Z) for each of the high selling products using recommendation machine learning model</li>
 	<li>Take X,Y,Z together and estimate cross-price elasticity using price elasticity model; so you can say what happens to demand for Y and Z when price for X is lowered</li>
 	<li>Then predict demand for X,Y,Z using demand forecast model that takes into account price elasticity and cross price-elasticity</li>
 	<li>Now you know how much of each is likely to sell for different price points of X, so now calculate revenue, margin (assuming you have costs)</li>
 	<li>Offer this to a price professional who has the knowledge &amp; authority to decide which price to chose for which segment of customers for next promotion</li>
 	<li>Go next step, and use some optimization capability to automatically optimize, but in our experience, pricing experts want to have control so they are not looking to automate this step</li>
 	<li>Run the actual promotion, collect actual sales data and feed it to all the models so they stay current</li>
 	<li>In the end, use customer churn machine learning model to find customers at risk, see what segment they belong to, estimate if price is putting them at risk, evaluate if they should be offered something exclusively in next promotion run</li>
</ol>
You will see some of the elements above in the series of posts in this blog.

Now, let's get to know the company we are going to work with.

<a href="https://blogs.msdn.microsoft.com/intel/archives/1266">Keep reading</a>]]></content:encoded>
    </item>
    <item>
      <title>A Pricing Engine for Everyone built with AzureML and Python</title>
      <link>https://docs.microsoft.com/archive/blogs/intel/building-a-pricing-engine-using-azureml-and-python</link>
      <pubDate>Mon, 27 Feb 2017 16:52:08 GMT</pubDate>
      <dc:creator><![CDATA[Tomas Singliar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/intel/?p=1015</guid>
      <description><![CDATA[This post describes the Microsoft Pricing Engine (MPE), a cloud tool for pricing optimization. MPE...]]></description>
      <content:encoded><![CDATA[<em>This post describes the Microsoft Pricing Engine (MPE), a cloud tool for pricing optimization. MPE is easy to integrate into the business process as it uses the business’ transactional history and does not require A/B testing infrastructure to be set up. A double-residual modeling approach in MPE is the newest advanced causal inference approach to mitigating biases inherent in observational studies.</em>

&nbsp;

Pricing is a core business function for every single company. Yet, there are no one-size-fits-all solutions because every business has a unique history and position in the market. Enormous human, marketing and technical resources are spent on getting pricing right. Today price setting is informed by a combination of experience of long-time employees, competitive market intelligence, experiments and promotions, and supplier forecasts.

Given the abundance of historical data, pricing seems ripe for the application of machine learning. However, the domain is complex, and there are many confounding effects like holidays and promotions. Machine learning tradition prioritizes prediction performance over causal consistency, but pricing decisions need high-quality inference about causation, which is only guaranteed with randomized controlled experiments. Experimentation, also known as A/B testing, is extremely difficult to set up on existing operations systems. Observational approaches are "bolt-on", but tools that guard against the many statistical pitfalls are essential.

In this post, we talk about how to leverage historical data with AzureML and python to build a pricing decision-support application using an advanced observational approach. We call the resulting set of related services the Microsoft Pricing Engine (MPE). We created an Excel-centric workflow interfacing with the services to support interactive use. The demonstration uses the public <a href="https://research.chicagobooth.edu/kilts/marketing-databases/dominicks/general-files">orange juice data</a>, a popular benchmark dataset in pricing econometrics.

System integrators will be able to use the MPE’s web service interface to build pricing decision support applications on Azure, targeting the mid-size companies with small pricing teams without extensive data science support for customized pricing models.

We will give a bit of theory, discuss how price elasticity is modeled, which potential confounders are included, and the architecture of the pricing engine.

&nbsp;
<h2>A little pricing theory</h2>
The core concept is that of <a href="https://en.wikipedia.org/wiki/Price_elasticity_of_demand">price elasticity of demand,</a> a measure of how sensitive the aggregate demand is to price.

Informally, self-price elasticity is the percentage “lift” in sales of a product if we put it on a 1% discount. Most consumer products have elasticities in the range of 1.5-5. Products with more competitors are easier to substitute away from and will have higher elasticity. Discretionary products are more elastic than staples.

&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/03/001_Elasticity.gif"><img src="https://msdnshared.blob.core.windows.net/media/2017/03/001_Elasticity.gif" alt="001_elasticity" class="alignnone wp-image-1095" height="278" width="453" /></a>

Lowering the price will improve both sales quantities and hence revenues for products with elasticities e &lt; -1 (negative since the line slopes down). If your product is inelastic (e &gt; -1), you should increase the price – only a little demand will be lost and your revenue will go up.

The above condition holds if you are optimizing only revenue, which is the case if you have negligible marginal cost (e.g. you sell electronic media). More frequently, you have substantial marginal costs, and want to optimize your gross margin (price – marginal cost). Then the constant -1 in the above calculation is replaced by (Price)/(Gross Margin), also known as the inverse <a href="https://en.wikipedia.org/wiki/Lerner_index">Lerner Index</a>. For example, suppose your marginal cost of oranges is $4 and you are selling them for $5. Then you should increase prices at lower elasticities (e &gt; -5), and decrease them otherwise. (This does not account for fixed costs, you may well have complex optimization problem if your marginal costs are already burdened by a share of fixed cost.)

In addition to self-price elasticity, we recognize cross-price elasticity of demand where the demand of a product changes in response to the price of another product. Substitute products have positive cross-elasticity: if price of Tropicana orange juice increases, so do the sales of Minute Maid orange juice, as customers substitute toward Minute Maid. Complementary products have negative cross-elasticities – lowering the price of peanut butter may increase sales for jam even if price of jam stays constant.
<h2>The pricing data schema and use case</h2>
<h3>Input data preparation</h3>
Data schemas vary from one data warehouse to another. To get started, our service requires a minimal set of data that every business will likely have:

&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/03/002_Schema.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/03/002_Schema.png" alt="002_schema" class="alignnone wp-image-1105" height="237" width="423" /></a>

&nbsp;

There should be exactly 1 row of data for each Item, Site (and Channel if provided) combination provided. It is best to have at least 2 years’ worth of data so that seasonal effects can be captured. You prepare your data into this format in Excel. For example, if your data is on weekly sales of various brands of orange juice, it would look like this:

&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2017/03/003_SchemaExample.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/03/003_SchemaExample.png" alt="003_schemaexample" class="alignnone wp-image-1115" height="450" width="457" /></a>

While we used the Orange Juice dataset, you can use your own data!
<h3>Using the pricing services</h3>
Let us look at the model building phase, and two analyses that interpret the model. We have made the AzureML web services accessible in Excel using the AzureML Excel plugin. Please contact us if you'd like to receive the pre-configured Excel worksheet.
<h4>Building the model and examining elasticities</h4>
First, let us estimate the elasticity model from the orange juice data. We gave the data in the columns with gray heading. Then we configured the Pricing Engine Build (PE_Build) service in the AzureML plugin, pointed it to the data and clicked "Predict as Batch" in the AzureML plugin window. This will take about 3 minutes to output the products, locations and date ranges the engine recognizes. We gave our dataset the name OJ_Demo. You can build models from many datasets, just give them different names.

<a href="https://msdnshared.blob.core.windows.net/media/2017/02/004_PE_BuildModel_2.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/02/004_PE_BuildModel_2.png" alt="004_pe_buildmodel_2" class="alignnone size-full wp-image-1215" height="1158" width="1919" /></a>

The Elasticity service gives one elasticity per Location (store number) and Product (three brands of OJ). Note we referred to the same dataset "OJ_Demo". We see that the elasticity estimates cluster around -5, which is pretty typical for competitive consumer products, and corresponds to optimal gross margins of approximately 1/5 = 20%. The pricing analyst concludes that any products they are earning less than 20% gross margin are probably underpriced, and vice versa.

<a href="https://msdnshared.blob.core.windows.net/media/2017/02/011_Elasticity.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/02/011_Elasticity.png" alt="011_elasticity" class="alignnone size-full wp-image-1195" height="1161" width="1922" /></a>

&nbsp;
<h4>Interpreting Cross-Elasticities</h4>
On the next tab, we consume cross-price elasticities from the PE_CrossPrice.

<a href="https://msdnshared.blob.core.windows.net/media/2017/02/005_PE_CrossPrice_2.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/02/005_PE_CrossPrice_2.png" alt="005_pe_crossprice_2" class="alignnone size-full wp-image-1205" height="1157" width="1915" /></a>

Here, the analysis shows that the products are indeed mostly substitutes - some know this effect as "cannibalization". Note the visualization is not a standard chart, but is a python heat map visualization. This is generated from the engine in the cloud and you get a link to the visual.
<h4>Simulating the effect of promotion</h4>
Finally, putting it all together, we ask the thousand-dollar question: what happens to our total store sales if we change the price of a brand of OJ? We look at the Promotion Effect tab, which simulates the effect of changing the price of Minute Maid orange juice on the sales of Minute Maid as well as the remaining products. This combines the forecast we have for all products with the estimated self-elasticity of Minute Maid, as well as the cross-price elasticity of Minute Maid and the other two brands in the dataset.
<h2><a href="https://msdnshared.blob.core.windows.net/media/2017/02/012_PromoSim.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/02/012_PromoSim.png" alt="012_promosim" class="alignnone size-full wp-image-1225" height="1162" width="1920" /></a></h2>
We see that the predicted effects is an increase in demand for Minute Maid, with customers substituting primarily from the other premium brand, Tropicana, while the value brand is mostly unaffected.

The MPE currently offers these services, each corresponding to a tab in the Excel "app":
<ul>
 	<li>Data and Model  (Build the model)</li>
 	<li>Elasticity              (Retrieve dataframe and visual of self-elasticities)</li>
 	<li>Cross-Elasticity    (Retrieve dataframe and visual of cross-elasticities)</li>
 	<li>Forecasts             (Forecasted demands at current, fixed prices)</li>
 	<li>Demand Curve    (Forecasted demand at varied prices)</li>
 	<li>Promotion Effect (Effect on hypothetical promo on all related products)</li>
 	<li>Retrospective      (How good were past forecasts? Confidence bounds.)</li>
 	<li>Outliers                (Examine worst forecast misses.)</li>
</ul>
<h2></h2>
<h2>Pricing engine Azure architecture</h2>
The pricing model is implemented in python and wrapped as a web service by AzureML. The figure below shows the Excel-centric workflow backed by the cloud components we use for our simple example. We assume that the data is already exported from a business data source into Excel.

<a href="https://msdnshared.blob.core.windows.net/media/2017/02/007_Architecture.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/02/007_Architecture.png" alt="007_architecture" class="alignnone wp-image-1146" height="311" width="544" /></a>

&nbsp;

The first (Build) stage of the python code is compute-intensive and takes a few seconds to a few minutes to process, depending on the amount of data. This stage leaves behind .npy (numpy) files in Azure Blob Storage which contain the estimated elasticities, the baseline forecasts, and the intermediate features for each item, site and channel.

The second stage services query the data left in the storage. The files are stored as blobs, and each service first loads the .npy file it needs. Then it answers the question through a lookup in the data structures contained in the file and/or a simple calculation from the elasticity model. This method is currently resulting in RRS latency that is acceptable for interactive use (&lt;2s). As the data grows, we are preparing to output the intermediate data structures into an Azure SQL database, where it will be indexed for constant-time access. Having data in a database will also allow for easier joining and detailed analysis that goes beyond the pre-implemented python services.

The services themselves are created by deploying a web service from the AzureML Studio. We created wrapper code around the “legacy python” which requires only very short scripts to be deployed into AzureML Execute Python modules in order to create the web services. Most of the code is contained in the PricingEngine python package. The package is included in the script bundle PricingEngine_Python_Dependencies.zip, together with its dependencies (mostly Azure SDK, since sklearn and scipy are already available in the AzureML Python container. The figure below shows the AzureML experiment for GetPromotionEffect - all services are similarly architected.

<a href="https://msdnshared.blob.core.windows.net/media/2017/02/008_AzureML.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/02/008_AzureML.png" alt="008_azureml" class="alignnone wp-image-1155" height="239" width="470" /></a>

&nbsp;
<h3>Deployment</h3>
The solution is deployed into your Azure subscriptions  through <a href="https://start.cortanaintelligence.com">Cortana Intelligence Quick Start (CIQS)</a>, currently in private testing. The CIQS is a user friendly wrapper around <a href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-authoring-templates">an Azure Resource Manager template</a>. Please contact us if you would like to try it.

<a href="https://msdnshared.blob.core.windows.net/media/2017/02/006_CIQS.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/02/006_CIQS.png" alt="006_ciqs" class="alignnone size-full wp-image-1145" height="629" width="1829" /></a>
<h2></h2>
<h2>The data science: elasticity model</h2>
<h3>Core methodology</h3>
The core of the engine is an implementation of the idea of “double-residual effect estimation” applied to price elasticity. Price elasticity of an item is simply the derivative of demand wrt price, other things being equal. Other things being never equal, we need counterfactuals for both demand and price. The engine supplied those today as predictions from a carefully elastic-net-regularized linear model, with regularization parameters picked automatically by cross-validation. The elasticity then comes from regressing the demand residual on the price residual.

In addition, various potentially confounding factors are included in the regression:
<ul>
 	<li>Seasonal indicators</li>
 	<li>The price itself, in absolute, and relative to other products in the same category</li>
 	<li>Lagged changes in price and demand</li>
 	<li>The recent trend in the product’s category prices and demands</li>
 	<li>Indicator variables for the product category and site, channel</li>
 	<li>The recent demand and pricing trends at the site and in the channel</li>
 	<li>Indicator variables for the products category</li>
 	<li>Various interactions between these variables, especially between price change and site, channel and category</li>
</ul>
To control the dimensionality of the model when we have large product hierarchies with many categories up to 5 level deep, we use a model stacking approach. We first estimate the model M1 with only the top-level category indicators enabled. We capture the residuals of M1 and for each level-1 category, we fit a model of the residuals, with level-2 category indicators as additional predictors, using only transactions on items from the level-1 category. This process continues recursively, in effect creating a tree of models. Heavy elastic net regularization occurs at each step. Since the hierarchy is up to 5 levels deep, each demand prediction involves running 5 models along the branch of the category tree.

There is a lot more going on. The engine also estimates pull-forward effects (demand shifting to promotion period from subsequent ones). We'll blog more about that in a detailed future post.
<h3>Data acquisition and cleaning</h3>
A major challenge in development of the model was data cleaning for model fitting purposes – <em>what was the price of oranges on 1/1/2015</em>? Businesses don’t always have the historical offered prices systematically recorded as a dataset and they can be difficult to pull out of the ERP system.

Even when the price history is on hand, it can be surprisingly complicated to answer the question in a B2B context. In B2C context, most customers face one price (but consider coupons and co-branded credit cards!). In B2B, the same item can and does sell at many different prices. The following chart illustrates the sales of one item in one site in time. The x axis is days, the y axis is the volume, and the colors represent different price points.

<a href="https://msdnshared.blob.core.windows.net/media/2017/02/009_Prices_cropped.png"><img src="https://msdnshared.blob.core.windows.net/media/2017/02/009_Prices_cropped.png" alt="009_prices_cropped" class="alignnone size-full wp-image-1185" height="459" width="1263" /></a>

&nbsp;

The prices differ because of channels (delivery vs pick-up, internet vs in-person), preexisting pricing agreements, etc. Price variations open us up to the treacherous modeling issue of “composition of demand”. When multiple customer segments pay different prices, the average price is a function of proportion of customers from different segment and can change even if no one is facing a different price. Thus average sales price is a very poor covariate to use for modeling!

With guidance from the customer, we solved both the problem of historical record and the problem of price variation by considering “the price” to be the weekly customer-modal price (the price at which the most customers bought). We exclude items averaging fewer than 3 sales a week from the modeling.
<h2>Conclusions</h2>
The engine combines strengths of ML, which is good at predicting, with those of econometrics, which is good at preparing training data to mitigate biases and producing causally interpretable models. As a cloud application, it is easy to deploy to your subscription and try out.

Please contact <a href="mailto:Tomas.Singliar@microsoft.com">Tomas.Singliar@microsoft.com</a> with questions.]]></content:encoded>
    </item>
    <item>
      <title>"AutoML" Parameter Search for Hierarchical Demand Forecasting Optimization</title>
      <link>https://docs.microsoft.com/archive/blogs/intel/automl-parameter-search-for-hierarchical-demand-forecasting-optimization</link>
      <pubDate>Tue, 06 Dec 2016 17:21:45 GMT</pubDate>
      <dc:creator><![CDATA[Vanja P]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/intel/?p=1005</guid>
      <description><![CDATA[In general, machine learning approaches expose many options that affect performance and accuracy....]]></description>
      <content:encoded><![CDATA[In general, machine learning approaches expose many options that affect performance and accuracy. "AutoML" (Automated ML) concerns problems of optimizing over such options. Forecasting demand of products that form a hierarchy raises this kind of challenge. We recently wrote a <a target="_blank" href="https://blogs.msdn.microsoft.com/intel/archives/765">blog post</a> about demand forecasting for hierarchical data. We listed several approaches to reconciling forecasts across time series data with hierarchical (or more generally grouped) structure, such as, bottom-up, middle-out, etc., so that the resulting forecasts are agreggate-consistent (lower level forecasts sum up to higher level forecasts). We also talked about the challenges of forecasting highly disaggregated time-series that contain sparse time series at the bottom level. In our approach, we opted to forecast using time-series for the middle level of the hierarchy, and obtain forecasts at lower and higher levels using disaggregation and aggregation, respectively. Depending on the chosen method and the level at which to forecast, the results of the forecast can vary dramatically, making it worthwhile to search over hierarchy levels to find the best.

In this article we describe the parameter search space for hierarchical time series (HTS) forecasting, and demonstrate how to efficiently search it using an iterative optimization approach. The approach relies on a distributed computation platform for efficient computation. We used Spark on an HDInsight cluster and Microsoft R Server as the implementation architecture of choice to distribute the iterative search over the parameter space and efficiently solve the problem.
<h2 id="hts-parameter-search-space">HTS parameter search space</h2>
In general, hierarchical (or grouped) time series forecasting performance greatly varies with the <strong>algorithm parameters</strong> used and the <strong>structure of the hierarchy (or grouping structure)</strong>.

<strong>Algorithm parameters</strong> are any variation in options used in forecasting, such as time series method used to forecast individual time series within the hierarchy, method used to reconcile the forecasts across the hierarchy, weights assigned to the individual forecasts during the reconcililiation, etc. For example, one can use ARIMA or ETS for forecasting individual time series, then use bottom-up or middle-out approaches for reconciling the time series. For an extensive list of different methods and parameters available in hierarchical time series forecasting, check out the <a target="_blank" href="https://cran.r-project.org/web/packages/hts/index.html">'hts' package</a>. It's an excellent utility and resource for understanding and forecasting hierarchical time series. For example, looking into the available parameter options in 'hts' forecasting function, one might construct a search space the following manner:
<pre><code>ts_method        &lt;- c("arima", "ets", "rw")
hts_method       &lt;- c("bu", "comb", "tdgsa", "tdgsf", "tdfp")
comb_hts_weights &lt;- c("sd", "none", "nseries”)
search_space     &lt;- expand.grid(ts_method, hts_method, comb_weights, stringsAsFactors = FALSE)
</code></pre>
<a target="_blank" href="https://github.com/Azure/Azure-MachineLearning-DataScience/blob/master/Misc/KDDCup2016/Code/UseCaseHTS/sample_demo.R">Here</a> we provide a simple R script demonstrating how to create a searchable grid of parameters for the forecasting function on a sample hierarchical data set, travesrse it, and find optimal parameters.

<strong>Structure of the hierarchy (or grouping structure)</strong> has to do with the level at which we decide to forecast, as we described above. In a more general case, when we have grouped time series, we can disaggregate the data using an arbitrary number and combination of our grouping variables. More specifically, given a set <em>S</em> of <em>n</em> grouping variables, the number of possible groupings of the data is the size of the powerset of S, that is 2^|S|. For time series data that can be disaggregated by many variables, this number can quickly become large. For example, in supply chain applications, forecast is often needed at the most granular level, that is, at the SKU level that can run into the 1000s.
<h2 id="iterative-optimization">Iterative optimization</h2>
If for every combination of grouping variables one attempts to forecast across all method parameter options, the search space becomes prohibitively large. Depending on the size of the hierarchy and the selected methods, forecasting at all levels of the hierarchy may take anywhere from a few seconds to several hours.

In our use-case, the option search space consists of 84 parameter settings (in addition to the method parameters listed above, we also varied the time window for which to compute historical proportions for top-down forecast disaggregation) and 255 grouping structures, which results in more than 21,000 possible combinations. In order to make the entire search space tractable, we used an iterative approach to obtain optimal parameters and grouping structure. The iterative approach is shown in the picture below.

<a href="https://msdnshared.blob.core.windows.net/media/2016/12/iterative_param_search.png"><img width="444" height="285" class="wp-image-985 alignnone" alt="iterative_param_search" src="https://msdnshared.blob.core.windows.net/media/2016/12/iterative_param_search.png" /></a>

The search starts at a point in the search space with decent performance, based on experience of default parameters and a default grouping structure, from which we obtain a baseline mean absolute percent error (MAPE). We then fix the grouping structure, and search the space of parameters, to obtain "better" parameters (that minimize MAPE for that structure). We then fix those parameters, and vary the grouping structure to obtain a "better" grouping structure. We continue to iterate in this fashion until we see no change in selected parameters and the grouping structure.

As mentioned, we used MAPE to evaluate our approach, and measured its improvement from the baseline value. The validation is done using training/testing split on time series data of length <em>L,</em> where we train the model on <em>L-h</em> months and test it on the last <em>h</em> months.
<h2 id="architecture">Architecture</h2>
In order to distribute the computation, we used an <a target="_blank" href="https://azure.microsoft.com/en-us/services/hdinsight/">HDInsight cluster</a>, specifically, a Spark cluster with R Server (with 4 nodes, 32 cores). Once we provisioned a cluster, it was simple to distribute the computation on Spark using <a target="_blank" href="https://www.microsoft.com/en-us/cloud-platform/r-server">Microsoft R Server</a>, and in particular, its <strong>rxExec()</strong> function.

If we wrap our forecasting code in a function (e.g. run_hierarchical_forecast) with method parameters and grouping structure as input arguments, then we can map the search space specified in the input arguments to distribute the computation over the distributed system, using the following piece of code:
<pre><code># Sets computing context to Spark
rxSetComputeContext(RxSpark())

rxResult &lt;- rxExec(run_hierarchical_forecast, 
                   rxElemArg(search_space), 
                   … )
</code></pre>
Now each time we run our demand forecasting application (described in our previous <a target="_blank" href="https://blogs.msdn.microsoft.com/intel/archives/765">post</a>), we can improve it by running an AutoML parameter optimization, as shown in the following picture.

<a href="https://msdnshared.blob.core.windows.net/media/2016/12/param_optimization_architecture.png"><img width="788" height="354" class="alignnone wp-image-995 " alt="param_optimization_architecture" src="https://msdnshared.blob.core.windows.net/media/2016/12/param_optimization_architecture.png" /></a>
<h2 id="results">Results</h2>
We ran parameter optimization on a customer demand data set with an extensive grouping structure. We started by using default settings that resulted in baseline MAPE of 9.1%. These parameter settings and the grouping structure were selected based on customer preferences as well as the preliminary evaluation of forecasting performance that showed success against the customer's existing forecasting system. After we ran our iterative optimization, we obtained optimal parameters and an optimal grouping structure that resulted in MAPE of 6.8% (due to confidentiality of the data, we cannot show the raw results). The <strong>reduced error from 9.1% to 6.8%</strong> in our use case translates into measurable business value resulting from improved monthly demand forecasts.

The total execution time took about one day (for an even faster performance, one could provision a cluster with more nodes, but for our use case it was not necessary). We estimated that if we ran the optimization on a single node, it would take about month and a half (based on the number of inividual runs and an average execution time of 144 minutes). The improvement by using Microsoft R Server to distribute the R code on the HDInsight cluster called for just the addition of a few lines of code shown above. (Setting the compute context and running rxExec() function).

For a simpler demonstration on searching a parameter space using 'hts' package and Microsoft R Server on a small public data set, please go to our <a target="_blank" href="https://github.com/Azure/Azure-MachineLearning-DataScience/blob/master/Misc/KDDCup2016/Code/UseCaseHTS/sample_demo.R">sample script</a>.
<h2 id="references">References</h2>
<ol>
 	<li><a target="_blank" href="https://cran.r-project.org/web/packages/hts/index.html">Package 'hts'</a></li>
 	<li><a target="_blank" href="https://www.otexts.org/fpp/9/4">Forecasting: principles and practice - Chapter 9.4 Forecasting hierarchical or grouped time series</a></li>
 	<li><a target="_blank" href="https://github.com/Azure/Azure-MachineLearning-DataScience/blob/master/Misc/KDDCup2016/Code/UseCaseHTS/sample_demo.R">Sample R Script</a></li>
 	<li><a target="_blank" href="https://azure.microsoft.com/en-us/services/hdinsight/">HDInsight</a></li>
 	<li><a target="_blank" href="https://www.microsoft.com/en-us/cloud-platform/r-server">Microsoft R Server</a></li>
</ol>
&nbsp;

Author: Vanja Paunić, Data Scientist, Microsoft]]></content:encoded>
    </item>
    <item>
      <title>Announcing free online Cortana Intelligence virtual workshop on Tuesday, 6 Dec 2016</title>
      <link>https://docs.microsoft.com/archive/blogs/intel/announcing-free-online-cortana-intelligence-virtual-workshop-on-tuesday-6-dec-2016</link>
      <pubDate>Thu, 01 Dec 2016 10:23:53 GMT</pubDate>
      <dc:creator><![CDATA[AksheyGupta]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/intel/?p=975</guid>
      <description><![CDATA[Get hands-on with Cortana Intelligence Suite

If you’d like to learn how to architect solutions in...]]></description>
      <content:encoded><![CDATA[<strong>Get hands-on with Cortana Intelligence Suite</strong>

If you’d like to learn how to architect solutions in Cortana Intelligence Suite and how to build intelligence into your applications, join Microsoft Architects Jin Cho and Todd Kitta for a step-by-step look at the platform. On December 6, 2016, in the “Cortana Intelligence Suite End to End” event, get hands-on, create an end-to-end solution, and wrap up the day with a working web app. Todd and Jin will pause their instruction to give you time to work through the project with them and to ask questions. <strong>Register today!</strong> (<a href="https://mva.microsoft.com/liveevents/cortana-intelligence-suite-end-to-end">https://mva.microsoft.com/liveevents/cortana-intelligence-suite-end-to-end</a>)

Good luck!]]></content:encoded>
    </item>
    <item>
      <title>Announcing availability of machine learning based Recommendation API inside Dynamics 365 for Operations</title>
      <link>https://docs.microsoft.com/archive/blogs/intel/announcing-availability-of-machine-learning-based-recommendation-api-inside-dynamics-365-for-operations</link>
      <pubDate>Thu, 24 Nov 2016 16:24:39 GMT</pubDate>
      <dc:creator><![CDATA[AksheyGupta]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/intel/?p=875</guid>
      <description><![CDATA[We now have the recommendations API integrated and available from within Dynamics 365 for...]]></description>
      <content:encoded><![CDATA[We now have the recommendations API integrated and available from within Dynamics 365 for Operations.

In the Nov. 1, 2016 update to Dynamics 365 for operations, now you can view the product recommendations inside cloud POS.

This is the first time that we bring insights derived from <em>Cortana intelligence suite</em> components using machine learning right within Dynamics 365 for Operations.

There is plenty of ground work done underneath the hood to get this seamlessly to you.

<strong>Pricing</strong>

You are not charged extra for using this service at this point in time. Microsoft provisions all required resources in Azure based on your estimate.

<strong>Scenarios</strong>
<ul>
 	<li>Product Recommendations can be seen only on the cloud POS</li>
 	<li>Product Recommendations can be seen only on the MPOS in online mode</li>
 	<li>These can be seen when you view details of a product, they will appear automatically next to 'related products'</li>
 	<li>These will also appear on the customer detail page</li>
 	<li>These can be seen when you are making transactions on cloud POS or on MPOS when it's in online mode</li>
</ul>
Note: As soon as a customer is added to transactions, recommendations are personalized to the customers' buying pattern and items in their wish list

<strong>Components</strong>
<ol>
 	<li>Azure data factory - for sending data (catalog &amp; usage) to the blob storage</li>
 	<li>Azure blob storage - for storing raw and processed data</li>
 	<li>Hive scripts - for cleansing raw data to reduce the bias from 'unidentified' customers buying through POS in the scenario when you want the API to make personalized recommendations</li>
 	<li>All the components for spinning up the recommendation API itself</li>
 	<li>Some other components for making sure all services involved are properly authenticated and have the right credentials</li>
</ol>
<strong>Setting up</strong>
<ol>
 	<li>When your environment is being created through LCS, if you chose you want to use machine learning, recommendations related components are installed in your environment</li>
</ol>
Once recommendation API related components are available in your environment you need to do following in the relevant legal entity to set it up
<ol>
 	<li>Go to entity store, find the entity 'Retail sales' and hit refresh. This will pick the demo data (or your data) from your operational DB and move it to Entity store</li>
 	<li>Go to Retail parameters --&gt; Machine learning and turn 'enable recommendations' ON</li>
 	<li>If you will like to see recommendations while making POS transactions, go to screen layout designer and drop recommendation control to transactions screen</li>
 	<li>Run the global configuration job - 1110 (to see recommendations on POS) and channel configuration job 1070 (to reflect changes made to POS screen layout designer)</li>
</ol>
<strong>How does it work?</strong>
<ol>
 	<li>When you refresh the entity store entity, following happens
<ul>
 	<li>Data in the format required by the API is extracted from AX DB and send to Entity store</li>
 	<li>This data is then used by ADF copy activity and sent to blob storage</li>
 	<li>If there is cleansing required, Hive scripts are run as part of ADF activities and cleansed data is stored in blob storage</li>
 	<li>Data from blob storage is used by the API to train a recommendation model</li>
</ul>
</li>
 	<li>When you turn 'enable recommendations' and run the configuration jobs following happens
<ul>
 	<li>Model credentials and ID are picked up from the API and stored in AX DB, in the web.config for AOS as well as in the retail server</li>
 	<li>Model credentials and ID are made available to CRT so calls for product recommendations from CPOS and modern POS can be honored</li>
</ul>
</li>
</ol>
<strong>Definitions</strong>

<a target="_blank" href="https://www.microsoft.com/en-us/cloud-platform/cortana-intelligence-suite">Cortana intelligence suite</a>

Microsoft Cortana intelligence suite is a collection of technologies for information management, big data storage, machine learning and analytics and data visualizations. Cortana assistant on Windows 10, Chabot made with Bot framework, Cognitive services and many other applications utilize one or many technologies marketed under the brand of Cortana intelligence.

<a target="_blank" href="https://www.microsoft.com/cognitive-services">Microsoft Cognitive services</a>

The Microsoft Cognitive Services APIs are a suite of several general-purpose Machine Learning APIs that are made available in Microsoft Azure and can be used for any number of applications. These APIs simplify the whole process by abstracting away the complex machine learning models and the operationalization aspects so that users can focus on real business problems. There are several categories of Machine Learning APIs and the Knowledge category includes the Recommendations API.

<a target="_blank" href="https://www.microsoft.com/cognitive-services/en-us/recommendations-api">Recommendation API</a>

The Recommendations API <span> </span>– exposes a general-purpose recommender system capability wrapped in a simple to use REST API.

<strong>Case studies</strong>

There are many customers using this API and many partners integrating the API into their e-commerce systems. Here are some published case studies.
<ol>
 	<li><a target="_blank" href="https://customers.microsoft.com/en-us/story/meocustomerstory">MEO</a></li>
 	<li><a target="_blank" href="https://customers.microsoft.com/en-us/story/dutch-crafters-retail-microsoft-cognitive-services">DutchCrafters</a></li>
 	<li><a target="_blank" href="https://customers.microsoft.com/en-us/story/food-delivery-service-uses-machine-learning-to-revolut">JJ Food</a></li>
</ol>
<strong>Why did we do this?</strong>

This is a natural evolution both for Dynamics 365 and Cortana intelligence powered machine learning services. We will bring more such services into Dynamics 365 in future.

<strong>Previous posts</strong>

Please use <a target="_blank" href="https://blogs.msdn.microsoft.com/intel/archives/34">this</a> post to understand more about this API in relation to Dynamics 365 for Operations, see video of how a customer uses and what our early prototype looked like.

[caption id="attachment_895" align="alignnone" width="1024"]<a href="https://msdnshared.blob.core.windows.net/media/2016/11/LargeMessengersBag-4.jpg"><img width="1024" height="502" class="size-large wp-image-895" alt="See Product Recommendations on Product details page" src="https://msdnshared.blob.core.windows.net/media/2016/11/LargeMessengersBag-4-1024x502.jpg" /></a> See Product Recommendations on Product details page[/caption]

[caption id="attachment_905" align="alignnone" width="1024"]<a href="https://msdnshared.blob.core.windows.net/media/2016/11/LargeMessengersBag-5.jpg"><img width="1024" height="499" class="size-large wp-image-905" alt="See Product Recommendations on POS transactions" src="https://msdnshared.blob.core.windows.net/media/2016/11/LargeMessengersBag-5-1024x499.jpg" /></a> See Product Recommendations on POS transactions[/caption]]]></content:encoded>
    </item>
    <item>
      <title>Announcing availability of machine learning based Recommendation API for Dynamics AX 2012 R3</title>
      <link>https://docs.microsoft.com/archive/blogs/intel/announcing-availability-of-machine-learning-based-recommendation-api-for-dynamics-ax-2012-r3</link>
      <pubDate>Thu, 24 Nov 2016 12:09:26 GMT</pubDate>
      <dc:creator><![CDATA[AksheyGupta]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/intel/?p=935</guid>
      <description><![CDATA[We now have the Recommendation API integrated with Dynamics AX 2012 with cumulative update...]]></description>
      <content:encoded><![CDATA[We now have the Recommendation API integrated with Dynamics AX 2012 with <a target="_blank" href="https://blogs.technet.microsoft.com/dynamicsaxse/2016/11/21/announcing-cumulative-update-12-for-microsoft-dynamics-ax-2012-r3/">cumulative update 12</a>.

You don't need CU12 to have this working. If you have CU8 or higher and have the entity store hotfix, this will work. Download the hotfix <a target="_blank" href="https://mbs2.microsoft.com/knowledgebase/KBDisplay.aspx?scid=kb;EN-US;3201875.">here</a> or search in LCS for KB3201875.

This is the first time that we bring insights derived from <em>Cortana intelligence suite</em> components using machine learning right within Dynamics AX2012. We have provided <a target="_blank" href="https://ax.help.dynamics.com/en/wiki/introduction-to-dynamics-ax7-demand-forecasting/">demand forecasting</a> Azure ML experiments integration to Dynamics AX in the past, however with this capability we provide not only integration to a specific API but an integration pattern in general to any other Azure based intelligent services that you may want to leverage in future.

We have also released this integration for Dynamics 365 for Operations, however with AX2012 R3 integration you have richer customization options. You will find this API will provide you a lift of 1-2% within a couple months of going live. Various customers like JJ Food, Bunzl group use the API in production and other customers and partners are in the implementation process. The API is targeted for any distributor or retailer with a call-center or e-commerce operation.

In this out-of-the-box integration we provide foundation elements that help you interact with the API right within Dynamics AX without need to make any investment in learning data science or other big data technologies. But we do not provide consumption scenarios, i.e. we do not provide UI and code support for actually calling recommendations inside a call-center or AX for retail storefront or E-POS or M-POS or a simple sales order processing. We do not do this because first of all, it's fairly easy to do this on your own for a AX professional (so value add we bring will be limited) and secondly, because each customer scenario is different so even if we did provide it will need to be customized. However, if you will like to use some readymade code to inject into such business processes, please let us know what you will like. In the meantime, there are some additional artifacts in our GitHub repository that will be useful to you <a target="_blank" href="https://github.com/Microsoft/Dynamics-AX-Integration">here</a>.

<strong>Pricing</strong>

As a customer you chose the pricing tier for this API when you sign up for Microsoft Cognitive services in Azure portal. You pay directly to Microsoft based on the API calls you make from your systems. There are several scenarios where you will need partner support for instance to ensure products recommended are in stock before they are shown to the customers. These and other such requirements are not something API by itself can manage and you need to query your systems in order to achieve this. You can read more about solutioning on a previous post <a target="_blank" href="https://blogs.msdn.microsoft.com/intel/archives/34">here.</a>

What you can do with this integration is as follows:
<table width="851" border="1">
<tbody>
<tr>
<td width="210"><strong>Capability</strong></td>
<td width="391"><strong>What you can use it for?</strong></td>
</tr>
<tr>
<td width="210"><strong>Cortana Intelligence services management</strong></td>
<td width="391">
<ul>
 	<li>Connect to your Cognitive services account from within AX</li>
 	<li>Upload data to the recommendations API</li>
 	<li>Trigger machine learning model creation</li>
 	<li>Manage machine learning models and builds</li>
</ul>
</td>
</tr>
<tr>
<td width="210"><strong>Data management</strong></td>
<td width="391">
<ul>
 	<li>Use two new published DIXF data entities as part of this capability to send data to model</li>
 	<li>Create your own entities</li>
 	<li>Upload data manually</li>
 	<li>Check history and status of all data jobs</li>
 	<li>Setup automated data sync</li>
</ul>
</td>
</tr>
<tr>
<td width="210"><strong>Model management</strong></td>
<td width="391">
<ul>
 	<li>Create ML model from within AX</li>
 	<li>Synchronize models between recommendations API service and local AX instance</li>
 	<li>Delete models</li>
</ul>
</td>
</tr>
<tr>
<td width="210"><strong>Build management</strong></td>
<td width="391">
<ul>
 	<li>Trigger build creation for any ML model</li>
 	<li>Change default build parameters</li>
 	<li>Set active builds</li>
 	<li>View existing builds per model</li>
 	<li>Automate build creation</li>
</ul>
</td>
</tr>
<tr>
<td width="210"><strong>Data entities</strong></td>
<td width="391">Two new data entities have been published as part of this integration
<ul>
 	<li>DMFRetailProductCategoryEntity</li>
 	<li>DMFRetailProductTransactionEntity</li>
</ul>
&nbsp;</td>
</tr>
</tbody>
</table>
<strong>Definitions</strong>

<a target="_blank" href="https://www.microsoft.com/en-us/cloud-platform/cortana-intelligence-suite">Cortana intelligence suite</a>

Microsoft Cortana intelligence suite is a collection of technologies for information management, big data storage, machine learning and analytics and data visualizations. Cortana assistant on Windows 10, Chabot made with Bot framework, Cognitive services and many other applications utilize one or many technologies marketed under the brand of Cortana intelligence.

<a target="_blank" href="https://www.microsoft.com/cognitive-services">Microsoft Cognitive services</a>

The Microsoft Cognitive Services APIs are a suite of several general-purpose Machine Learning APIs that are made available in Microsoft Azure and can be used for any number of applications. These APIs simplify the whole process by abstracting away the complex machine learning models and the operationalization aspects so that users can focus on real business problems. There are several categories of Machine Learning APIs and the Knowledge category includes the Recommendations API.

<a target="_blank" href="https://www.microsoft.com/cognitive-services/en-us/recommendations-api">Recommendation API</a>

The Recommendations API <span> </span>– exposes a general-purpose recommender system capability wrapped in a simple to use REST API.

<strong>Case studies</strong>

There are many customers using this API and many partners integrating the API into their e-commerce systems. Here are some published case studies.
<ol>
 	<li><a target="_blank" href="https://customers.microsoft.com/en-us/story/meocustomerstory">MEO</a></li>
 	<li><a target="_blank" href="https://customers.microsoft.com/en-us/story/dutch-crafters-retail-microsoft-cognitive-services">DutchCrafters</a></li>
 	<li><a target="_blank" href="https://customers.microsoft.com/en-us/story/food-delivery-service-uses-machine-learning-to-revolut">JJ Food</a></li>
</ol>
<strong>Why did we do this?</strong>

We did this to provide you with a reference implementation of an integration with machine learning services from Cortana Intelligence to Microsoft Dynamics AX. We want to bring these new technologies to you in the shape you can relate to them. This, we believe lowers the bar for entry into use of advanced analytics for partners and customers in Dynamics ecosystem.

<strong>Whitepaper</strong>

Please use the whitepaper on customersource <a target="_blank" href="https://mbs.microsoft.com/customersource/northamerica/AX/downloads/product-releases/msdax2012r3cu12whatsnew">here</a> to learn more about how to get maximum out of this new capability.

Contributors: Krishnan Duraisamy, Sampath Victor, Luis Cabrera-Cordon, Akshey Gupta]]></content:encoded>
    </item>
    <item>
      <title>Introducing Microsoft Data Science Virtual Machine</title>
      <link>https://docs.microsoft.com/archive/blogs/intel/introducing-microsoft-data-science-virtual-machine</link>
      <pubDate>Mon, 21 Nov 2016 21:10:26 GMT</pubDate>
      <dc:creator><![CDATA[Vanja P]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/intel/?p=835</guid>
      <description><![CDATA[Microsoft Data Science Virtual Machine (DSVM) is a custom virtual machine on Microsoft's Azure cloud...]]></description>
      <content:encoded><![CDATA[Microsoft Data Science Virtual Machine (DSVM) is a custom virtual machine on Microsoft's Azure cloud build specifically for doing data science. It's a powerful data science development sandbox equipped with the most popular tools for data exploration and modelling. You can provision a DSVM with a few clicks on Microsoft Azure <a target="_blank" href="https://azure.microsoft.com/en-us/marketplace/partners/microsoft-ads/standard-data-science-vm/">website</a>, and within 10-20 minutes you will have a running virtual machine to which you can connect via the standard Windows Remote Desktop Connection tool.

DSVM runs on a Windows Server 2012 and contains the following data science and development tools (taken from the <a target="_blank" href="https://azure.microsoft.com/en-us/marketplace/partners/microsoft-ads/standard-data-science-vm/">product page</a>): "The main tools include <strong>Microsoft R Server</strong> Developer Edition, <strong>Anaconda Python</strong> distribution, <strong>Jupyter notebooks for Python and R</strong>, <strong>Visual Studio</strong> Community Edition with Python, R and node.js tools, <strong>Power BI</strong> desktop, <strong>SQL Server 2016</strong> Developer edition. It also includes <strong>deep learning tools like CNTK</strong> (an Open Source Deep Learning toolkit from Microsoft) and <strong>mxnet</strong>; <strong>ML algorithms</strong> like <strong>xgboost</strong>, <strong>Vowpal Wabbit</strong>. The <strong>Azure SDK</strong> and libraries on the VM allows you to build your applications using various services in the cloud that are part of the <strong>Cortana Analytics Suite</strong> which includes <strong>Azure Machine Learning</strong>, <strong>Azure Data Factory</strong>, <strong>Azure Stream Analytics</strong> and <strong>SQL Data Warehouse</strong>, <strong>Hadoop</strong>, <strong>Azure Data Lake</strong>, <strong>Spark</strong> and <strong>more</strong>." There is also an equivalent <a target="_blank" href="https://azure.microsoft.com/en-us/marketplace/partners/microsoft-ads/linux-data-science-vm/">Linux based DSVM</a>.

In this post, we will briefly describe how to provision a data science VM, then go over a simple use case of exploring a large order demand data set using Microsoft R Server. At the end of the post we provide several helpful resources for further reading.
<h2 id="provisioning-a-data-science-vm">Provisioning a Data Science VM</h2>
To provision a DSVM, go to <a target="_blank" href="https://portal.azure.com/">Azure portal</a>, and search for New -&gt; Data Science Virtual Machine, and select Create (as shown in the picture below). This will take you through a configuration wizard, asking for inputs, such as Azure subscription and resource group, VM account credentials, VM size, etc. After completing the wizard and selecting the Buy button, it takes 10-20 minutes for the VM to be created and ready for use.

<a href="https://msdnshared.blob.core.windows.net/media/2016/11/dsvm_provisioning.png"><img width="893" height="567" class="alignnone wp-image-855 " alt="dsvm_provisioning" src="https://msdnshared.blob.core.windows.net/media/2016/11/dsvm_provisioning-1024x650.png" /></a>
<h2 id="microsoft-r-server">Microsoft R Server</h2>
Of particular interest to data scientists who use R for common data science tasks on large data will be Microsoft R Server (MRS) that comes with DSVM. Microsoft R Server is enterprise-class distribution of R that allows for scalable data wrangling and modeling for data that does not fit into available RAM. MRS stores the data in external data frames (xdf) limited only by space on disk in a binary file format that is optimized to work with the MRS libraries. It retrieves data in blocks for efficient reading of arbitrary columns and contiguous rows, and optimizes the block sizes depending on individual computer I/O bandwidth. This results in significant speed-ups with respect to interactive data wrangling and modeling.

To develop R code with Microsoft R Server, we used <a target="_blank" href="https://www.rstudio.com/products/RStudio/">RStudio</a>, a popular IDE for R, which comes pre-installed on the DSVM.

<em>NOTE: To make sure that RStudio loads MRS (instead of MRO - a more limited distribution of MRS), go to Tools -&gt; Global Options -&gt; General, and change the R Version to point to C:\Program Files\Microsoft SQL Server\130\R_SERVER.</em>

Other popular environments for developing R code available on DSVM are <a target="_blank" href="https://www.visualstudio.com/vs/rtvs/">R Tools for Visual Studio</a> and <a target="_blank" href="https://jupyter.org/">Jupyter Notebooks</a>.
<h3 id="example-use-case-exploration-of-product-demand-data">Example use case: exploration of product demand data</h3>
In demand forecasting scenarios, the data is commonly very large, with millions or records indicating shipment records, customer orders, or consumption data. If we wanted to explore the data, look at the variable types, distributions, or visualize the demand over time for hints about trends, seasonality, etc., we might run into issues with the base R version, as the data might be larger than the available memory. Let's look at one such example below, where we used Microsoft R Server to explore and visualize such large data.

We downloaded our data set in a .csv format from a sharepoint site onto the VM. One can easily connect to an external data source (sharepoint, Azure blob, Azure SQL database, etc.), and access the data directly from MRS, or download it onto the VM, and access it locally.

Let's import the data into the .xdf format.
<pre><code>in.file &lt;- file.path('C:/shared/demand_dataset.csv')
xdf.file &lt;- "demand_dataset.xdf"

# Read data from csv 
dataset &lt;- rxImport(inData = in.file,
                    outFile = xdf.file,
                    overwrite = TRUE,
                    type = "text",
                    missingValueString = "N/A",
                    stringsAsFactors = TRUE)
</code></pre>
Let's look at the number of rows and columns in our dataset.
<pre><code>&gt; dim(dataset)
[1] 41034690       20
</code></pre>
It's a relatively large data set with 41,034,690 orders and 20 variables describing those orders.

To get information about the variables in the data set, such as variable names, data types, low/high values for numeric variables, unique values and number of unique values for categorical variables, etc., we can run the following command:
<pre><code># Get variable info
rxGetVarInfo(dataset)
</code></pre>
Due to the privacy of the data, we omit the output here.

Let's look at the summary statistics for the volume variable in our data set.
<pre><code>&gt; # Get summary stats
&gt; rxSummary(~ volume, data = dataset)

Rows Processed: 41034690 
Call:
rxSummary(formula = ~volume, data = dataset, reportProgress = 1)

Summary Statistics Results for: ~volume
Data: dataset (RxXdfData Data Source)
File name: demand_dataset.xdf
Number of valid observations: 41034690 

Name        Mean     StdDev   Min Max       ValidObs MissingObs
volume      48214.28 219421.2 0   135384480 41034690 0
</code></pre>
We can see that the mean order volume was 48,214.28, and the largest order had 135,384,480 volume.

Let's aggregate the volume data and plot it over time. In order to aggregate the data, we will take advantage of R package <a target="_blank" href="https://github.com/RevolutionAnalytics/dplyrXdf">dplyrXdf</a>, which allows for streamlined and simplified data manipulation.
<pre><code># Load dplyrXdf package
library(dplyrXdf)

# Aggregate volume over time (per yyyy-mm-dd)
volume.by.ymd &lt;- dataset %&gt;%
    select(date, volume) %&gt;%
    group_by(date) %&gt;%
    summarise(volume = sum(volume)) %&gt;%
    as.data.frame

# Plot the aggregated data
ggplot(volume.by.ymd, aes(date, volume)) + geom_line() + ggtitle("Daily volume over time")</code></pre>
<h3 id="example-use-case-exploration-of-demand-data"><a href="https://msdnshared.blob.core.windows.net/media/2016/11/daily_volume.png"><img width="998" height="570" class="alignnone wp-image-845 " alt="daily_volume" src="https://msdnshared.blob.core.windows.net/media/2016/11/daily_volume-1024x585.png" /></a></h3>
This plot may be too dense to visually inspect and detect any trends in the daily plot, so let's look at the data aggregated at the monthly level.
<pre><code># Aggregate volume over time (per yyyy-mm)
volume.by.ym &lt;- volume.by.ymd %&gt;%
    select(date, volume) %&gt;%
    mutate(date = as.Date(as.yearmon(date))) %&gt;%
    group_by(date) %&gt;%
    summarise(volume = sum(volume)) %&gt;%
    as.data.frame

# plot the aggregated data
ggplot(volume.by.ym, aes(date, volume)) + geom_line() + ggtitle("Monthly volume over time")
</code></pre>
<pre></pre>
<a href="https://msdnshared.blob.core.windows.net/media/2016/11/monthly_volume.png"><img width="1000" height="571" class="alignnone wp-image-865 size-full" alt="monthly_volume" src="https://msdnshared.blob.core.windows.net/media/2016/11/monthly_volume.png" /></a>

This plot is much clearer and it's easier to see trends and seasonality. There is a decreasing trend in the data in early years, potentially reflecting some changes in data reporting. We can also see a clear seasonal pattern in the data with the major volume dips around the end of each year, reflecting patterns around the winter holidays.

We have shown a simple use case of how to explore a large demand data set using Microsoft R Server on Data Science Virtual Machine. Within less than an hour, we were able to provision a virtual machine with MRS already installed (and other popular data science tools), and gain valuable insights from our data without a need for any deep statistics or machine learning skills.
<h2 id="further-reading">Further Reading</h2>
For more information on what's included in the DSVM, please see links provided under References. Ten common data science tasks you can do on the DSVM are detailed in this <a target="_blank" href="https://azure.microsoft.com/en-us/documentation/articles/machine-learning-data-science-vm-do-ten-things/">document.</a> It walks you through how to use DSVM to perform common data science task, such as---data exploration and modeling using Python, Microsoft R Server, and Jupyter Notebooks, operationalizing your model using Azure ML, sharing your code via Github, and visualizing your reports using Power BI.

DSVM usage is charged Azure usage fees only (monthly usage starts at $76.63), and depends on the size of the provisioned virtual machine. There are no additional software charges for the proprietary software installed on the VM. More information on the pricing can be found <a target="_blank" href="https://azure.microsoft.com/en-us/marketplace/partners/microsoft-ads/standard-data-science-vm/">here</a>.
<h2 id="references">References</h2>
<ol>
 	<li><a target="_blank" href="https://azure.microsoft.com/en-us/documentation/articles/machine-learning-data-science-virtual-machine-overview/">Introduction to the cloud-based Data Science Virtual Machine for Linux and Windows</a></li>
 	<li><a target="_blank" href="https://azure.microsoft.com/en-us/marketplace/partners/microsoft-ads/standard-data-science-vm/">Data Science Virtual Machine - Product page</a></li>
 	<li><a target="_blank" href="https://azure.microsoft.com/en-us/documentation/articles/machine-learning-data-science-provision-vm/">Provision the Microsoft Data Science Virtual Machine</a></li>
 	<li><a target="_blank" href="https://azure.microsoft.com/en-us/documentation/articles/machine-learning-data-science-vm-do-ten-things/">Ten things you can do on the Data science Virtual Machine</a></li>
 	<li><a target="_blank" href="https://www.microsoft.com/en-us/cloud-platform/r-server">Microsoft R Server</a></li>
 	<li><a target="_blank" href="https://github.com/RevolutionAnalytics/dplyrXdf">dplyrXdf - R package for xdf data manipulation</a></li>
</ol>
&nbsp;

<span lang="EN-GB"><span style="color: #000000;font-family: Calibri">Author: Vanja Paunić, Data Scientist, Microsoft </span></span>
<ol></ol>]]></content:encoded>
    </item>
  </channel>
</rss>