Supported Functions

azurePredict(Excel.Range inp, string uri, string key, int col) - Predict the output by calling the given Request/Response REST API endpoint.

  • <param name="inp">The excel input range to be passed as input parameters to API for single row of a feature vector.</param>
  • <param name="uri">URI of the Request Response Endpoint.</param>
  • <param name="key">The API key required for the prediction.</param>
  • <param name="col">The number of output columns to be retrieved. This excludes columns representing input columns in the response</param>
  • <returns>returns ',' output with prediction information as per API desired schema.</returns>

getJson(string uri="", string key="") - This function retrieves JSON schema by parsing API Help using URI and key

    Notes: The azurePredict API makes 2 calls - first to retrieve schema and second for prediction - for multiple request, getting schema for every request may be inefficient. This API provides way to retrieve schema only and then use this schema for the subsequent calls.

 

  • <param name="uri">Optional parameter - URI of the Request Response Endpoint. Include it for manually crafted schema</param>
  • <param name="key">Optional parameter - The API key required for the prediction. Include it for manually crafted schema</param>
  • <returns>returns JSON schema extracted from the help API</returns>

 

 

azureFastPredict(Excel.Range inp, int numcols=-1, string jsonSchema1 = "", string uri = "", string key = "") - Predict the output by calling the given Request/Response REST API endpoint. This function assumes schema is already available or previously retrieved.

  • <param name="inp">The excel input range to be passed as input parameters to API.</param>
  • <param name="numcols">The number of output columns to be retrieved. This excludes columns representing input columns in the response</param>
  • <param name="jsonSchema1">Optional parameter - Send manually crafted or previously retrieved JSON schema. Include it for manually crafted JSON schema. If getJson was called in the current session, then don't need to provide this as getJson preserves schema in the current context</param>
  • <param name="uri">Optional parameter - URI of the Request Response Endpoint. Include it for manually crafted schema</param>
  • <param name="key">Optional parameter - The API key required for the prediction. Include it for manually crafted schema</param>
  • <returns>returns ',' output with prediction information as per API desired schema.</returns>

hAzureFastPredict(Excel.Range inp, int numcols = -1, string jsonSchema1 = "", string uri = "", string key = "") - Retrieves prediction just like azureFastPredict but with assumption that input range is arranged as columnwise

  • <param name="inp">The excel input range to be passed as input parameters to API.</param>
  • <param name="numcols">The number of output columns to be retrieved. This excludes columns representing input columns in the response</param>
  • <param name="jsonSchema1">Optional parameter - Send manually crafted or previously retrieved JSON schema. Include it for manually crafted JSON schema</param>
  • <param name="uri">Optional parameter - URI of the Request Response Endpoint. Include it for manually crafted schema</param>
  • <param name="key">Optional parameter - The API key required for the prediction. Include it for manually crafted schema</param>
  • <returns>returns ',' output with prediction information as per API desired schema.</returns>

Step 1: Install Add-in

 c:> cd Windows\Microsoft.Net\Framework\v4.0.30319

c:> RegAsm.exe /codebase <File path to Add In Module DLL> 

For 64-bit office use - c:> cd Windows\Microsoft.Net\Framework64\v4.0.30319\RegAsm.exe

Use RegAsm under Framework directory for 32-bit Office and RegAsm under Framework64 directory for 64-bit Office%MCEPASTEBIN%

 

Step 2: Enable Add-in in Excel

After enabling AzureMLPrediction Add-In, validate if add-in was correctly registered and enabled by clicking fx (excel function) and checking for AzureMLPrediction category in the excel functions as shown in the figure on the below. If you don't seeAzureMLPrediction category, rerun the regasm in the following format: c:\Windows\Microsoft.NET\Framework64\v4.0.30319>regasm /codebase <Path to DLL file>\AzureMLPrediction.dll /tlb:<Path to tlb file>\AzureMLPrediction.tlb

 

 

Step 3: Copy API key and URL to Excel

 

Step 4: Make predictions using AzurePredict function

 

Step 5: Improve Prediction response time using AzureFastPredict

 Step 5a: Establish context by retrieving schema first using getJson

Step 5b: Make prediction using AzureFastPredict 

Step 6: Additional Functions

Step 6a: Use predictions for features (cells) arranged as rows instead of columns

 

Last edited Sep 22, 2014 at 9:15 PM by micman, version 8