Search code examples
c#azuremachine-learningazure-machine-learning-service

Azure Machine Learning - batch execution partially working


I have been following this gallery sample but I just can't seem to get batch execution to return multiple scores in one job.

Everything works fine i.e. can deploy the prediction web API and request a single scoring. But whenever I send a batch execution job (using the sample C# codes) with more than one request e.g.:

ID1,ID2
1,2
3,1
5,1

Azure ML will only return the prediction scores for the first request 1,2 but not for the other rows.

I'm not sure where I'm doing wrong but I should be expecting results for all three requests. Any help would be appreciated!


Solution

  • It looks like you've chosen an unfortunate example: the custom scripts in the Retail Forecasting web service explicitly drop all but the first ID pair. To see this, try loading the "Retail Forecasting: Step 6A of 6" experiment and check out the code in the "Create a complete time series. Add future time stamps" module. You will find the following:

    all.time <- data.frame(ID1 = data$ID1[1], ID2 = data$ID2[1], time = all.time)
    data <- join(all.time, data, by = c("ID1", "ID2", "time"), type = "left")
    maml.mapOutputPort("data");
    

    The left join statement will ignore any rows where data$ID1 != data$ID1[1] and data$ID2 != data$ID2[1]. That is why you are losing everything but the first ID pair.

    It appears batch prediction for multiple ID pairs in a single job was not a use case that the custom script authors envisioned for their web service. If you are proficient in R and particularly interested in this use case, you could modify the scripts in this experiment to support processing multiple time series concurrently. Otherwise, you might want to simply try another example experiment.