Search code examples
data-visualizationazure-machine-learning-service

Getting the images produced by AzureML experiments back


I have created a toy example in Azure. I have the following dataset:

  amounts       city code user_id
1    2.95 Colleferro  100     999
2    2.95    Subiaco  100     111
3   14.95   Avellino  101     333
4   14.95 Colleferro  101     999
5   14.95  Benevento  101     444
6  -14.95    Subiaco  110     111
7  -14.95   Sgurgola  110     555
8  -14.95       Roma  110     666
9  -14.95 Colleferro  110     999

I create an AzureML experiment that simply plots the column of the amounts.

enter image description here

The code into the R script module is the following:

data.set <- maml.mapInputPort(1) # class: data.frame  
#-------------------
plot(data.set$amounts);
title("This title is a very long title. That is not a problem for R, but it becomes a problem when Azure manages it in the visualization.")
#-------------------
maml.mapOutputPort("data.set");

Now, if you click on the right output port of the R script and then on "Visualize"

enter image description here

you will see the Azure page where the outputs are shown.

enter image description here

Now, the following happens:

  1. The plot is stucked into an estabilished space (example: the title is cut!!!)
  2. The image produced is a low resolution one.
  3. The JSON produced by Azure is "dirty" (making the decoding in C# difficult).

It seems that this is not the best way to get the images produced by the AzureML experiment.

Possible solution: I would like

to send the picture produced in my experiment to a space like the blob storage.

This would be also a great solution when I have a web-app and I have to pick the image produced by Azure and put it on my Web App page. Do you know if there is a way to send the image somewhere?


Solution

  • To saving the images into Azure Blob Storage with R, you need to do two steps, which include getting the images from the R device output of Execute R Script and uploading the images to Blob Storage.

    There are two ways to implement the steps above.

    1. You can publish the experiment as a webservice, then get the images with base64 encoding from the response of the webservice request and use Azure Blob Storage REST API with R to upload the images. Please refer to the article How to retrieve R data visualization from Azure Machine Learning.

    2. You can directly add a module in C# to get & upload the images from the output of Execute R Script. Please refer to the article Accessing a Visual Generated from R Code in AzureML.