2016-07-25 15 views
0

我在Azure中創建了一個玩具示例。 我有以下數據集:獲取AzureML實驗產生的圖像

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 

我創建一個AzureML實驗,簡單地繪製了大量的列。

enter image description here

的代碼轉換爲R腳本模塊如下:

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"); 

現在,如果你點擊將R腳本的右輸出端口上,然後在「可視化」

enter image description here

您將看到顯示輸出的Azure頁面。現在

enter image description here

,會發生以下情況:

  1. 情節stucked成estabilished空間(例如:標題被切斷!!!)
  2. 產生的圖像是低分辨率一。
  3. Azure生成的JSON「髒」(使得在C#中解碼困難)。

看來,這不是獲得AzureML實驗產生的圖像的最佳方式。

可能的解決辦法:我想

在我的實驗中產生的圖片發送給像一滴 存儲空間。

這將是一個很好的解決方案,當我有一個網絡應用程序,我必須選擇由Azure生成的圖像並將其放在我的Web應用程序頁面上。 你知道是否有辦法將圖像發送到某個地方?

回答

1

要使用R將圖像保存到Azure Blob存儲中,您需要執行兩個步驟,其中包括從R設備輸出Execute R Script獲取圖像並將圖像上傳到Blob存儲。

有兩種方法可以實現上述步驟。

  1. 可以發佈實驗作爲一個Web服務,然後從Web服務請求的響應得到與base64編碼的圖像,並使用Azure的Blob存儲REST API有R上傳的圖片。請參閱文章How to retrieve R data visualization from Azure Machine Learning

  2. 您可以直接在C#中添加一個模塊,以獲得&上傳來自Execute R Script輸出的圖像。請參閱文章Accessing a Visual Generated from R Code in AzureML

+0

有一點警告:鏈接的文章指的是舊版本天青。上週他們已經介紹了很多新聞! –

+0

@ AndreaIanni5,感謝您的分享。 –

0

您可以按以下方式調整圖像大小:

graphics.off() 
png("myplot.png",width=300,height=300) ## Create new plot with desired size 
plot(data.set); 
file.remove(Sys.glob("*rViz*png")) ## Get rid of default rViz file 
+0

我知道如何調整R中的圖像大小。問題是Azure返回圖像的方式。 –