Consume Azure Machine Learning Services in Microsoft Dynamics 365 for Finance and Operations

2019-01-15 By 0 Comments

Today, every business in every industry is looking to take advantage of the Artificial Intelligence, or AI, as a mandatory step in their digital transformation journey. The broad definition of AI is any technique that enables computers to mimic human behavior by allowing computers to learn by example. On the other hand, Machine Learning, is a subset of AI that  can be defined as the ability to learn without explicitly being programmed and its goal is to make predictions and detect patterns that otherwise would have gone unnoticed. 

AI undoubtedly is changing and influencing the ERP (Enterprise Resource Planning) systems.  One key competitive advantage of D365FO compared to others ERP in the marked is the seamless integration with Azure Machine Learning in some scenarios like the Demand Forecasting. Demand Forecasting is used to predict demand from sales orders. To generate the baseline forecast, a summary of historical transactions is passed to a Microsoft Azure Machine Learning service that is hosted on Azure.

The following diagram shows the seamless integration between D365FO and Azure Machine Learning:

Demand forecasting setup in D365FO (For this example, we are using the standard demo data)
1. Demand forecasting parameters

To set up demand forecasting parameters, go to Master planning > Setup > Demand forecasting parameters. Because demand forecasting runs cross-company, the setup is global. In other words, the setup applies to all companies.

By clicking Forecast dimensions in the left pane of the Demand forecasting parameters page, you can also select the set of forecast dimensions to use when the demand forecast is generated. A forecast dimension indicates the level of detail that the forecast is defined for. Company, site, and item allocation key are mandatory forecast dimensions, but you can also generate forecasts at the warehouse, inventory status, customer group, customer account, country/region, state, and item plus all item dimension levels.

At any point, you can add forecast dimensions to the list of dimensions that are used for demand forecasting. You can also remove forecast dimensions from the list. However, manual adjustments are lost if you add or remove a forecast dimension:

Use the General tab to overwrite the parameters globally or use the Item allocation keys tab to overwrite the parameters per item allocation key. Parameters that are overwritten for an item allocation key affect only the forecast of items that are associated with that item allocation key.

Demand forecasting can be used to forecast both dependent and independent demand. For example, if only the Sales order check box is selected, and if all the items that are considered for demand forecasting are items that are sold, the system calculates independent demand. However, critical subcomponents can be added to item allocation keys and included in demand forecasting. In this case, if the Production line check box is selected, a dependent forecast is calculated.

There are two methods for creating a baseline forecast in Finance and Operations. You can use forecasting models on top of historical data, or you can just copy over the historical data to the forecast. The Forecast generation strategy field lets you select between these two methods. To use forecast models, select Azure Machine Learning.

 

 

Once set, the following warning will pop up:

 

Click on Message Details to reveal the remaining setup steps:

  1. Deploying an Azure Machine Learning experiment

To set up the experiment in Azure Machine Learning Studio, visit the Azure AI Gallery:

https://gallery.azure.ai/Experiment/d10ee4a5a4d041d7afed4d77e4092294

Click the “Open in Studio” button to continue.

Sign up for an account. The Free Workspace will work fine for this demo.

Once your account is active, you can deploy the experiment directly from the gallery and select an Azure region for deployment. Please note that if you are deploying D365FO one-box environment or on-premises you will also need an Azure storage account.

 

Now we can see the Demand Forecasting experiment. Machine Learning is a computing technique that has its origins in artificial intelligence (AI) and statistics. The most common Algorithms for Machine Learning include:

  • Classification – Predicting a Boolean true/false value for an entity with a given set of features.
  • Regression – Predicting a real numeric value for an entity with a given set of features.
  • Clustering – Grouping entities with similar features.

In this scenario, the experiment is using a Regression R script generates our forecast. Please select the Run button to execute the experiment:

 

Deploying the Web Service

To generate the forecast, Finance and Operations uses a Machine Learning web service. As a next step click in the Deploy Web Service button. To connect to the service, you must provide Finance and Operations the following information if you sign in to Microsoft Azure Machine Learning Studio:

  • Web service application programming interface (API) key
  • Web service endpoint URL
  • Azure storage account name
  • Azure storage account key

 

Click on the “API help page” for the REQUEST/RESPONSE to get the web service URL:

Note: The Azure storage account name and key are required only if you use a custom storage account. If you deploy the on-premises or One-box version, you must have a custom storage account on Azure, so that the Machine Learning service can access the historical data.

Parameter Update

Finally, we need to update the Demand Forecasting parameters from the Dynamics 365FO portal with our values obtained above:

  1. Generate the Forecast

From the Dynamics 365FO portal we can run demand forecasting from Master planning Forecasting Demand forecasting Generate statistical baseline forecast. In the parameters below, I selected to generate my forecast for the next three months.

This will take a couple of minutes:

Now that it’s executed successfully, we can view the Azure Machine Learning Predictions in Master planning Forecasting Demand forecasting Adjusted demand forecast. As a final step we can Authorize adjusted demand forecast.