2017-09-26 70 views
1

This Microsoft Azure documentation顯示瞭如何爲Azure機器學習工作室創作自定義模塊。有一段關於從你的模塊返回多個輸出。然而,按照說明,我只能看到第一個輸出端口可視化中的數據,而其他輸出端口仍然是空的。自定義模塊的多個輸出

這是this one的後續問題。我在那裏接受了答案,因爲我錯誤地解釋了我編寫的自定義模塊的結果 - 有些輸出端口可能是空的,我匆忙認爲輸出是正確的。但是,在RStudio中運行相同的代碼確實會生成應該在ML Studio中返回的數據。此外,打印數據的作品。

小例子:

包含在模塊的ZIP文件的源文件:

test.R

foo <- function() { 
    require(data.table) 
    out1 <- data.table(mtcars) 
    out2 <- data.table(cars) 

    print("out1:") 
    print(head(out1)) 
    print("out2:") 
    print(head(out2)) 

    return(list(out1, out2)) 
} 

的test.xml

<Module name="Multiple outputs"> 
    <Owner>...</Owner> 
    <Language name="R" sourceFile="test.R" entryPoint="foo"/> 
    <Ports> 
     <Output id="out_1" name="out1" type="DataTable"> 
     <Description>...</Description> 
     </Output> 
     <Output id="out_2" name="out2" type="DataTable"> 
     <Description>...</Description> 
     </Output> 
    </Ports> 
</Module> 

其中產量這模塊成功運行:

Module in Azure

輸出的可視化不過是這樣的: Correct visualization of output 1 Empty visualization of output 2

,而輸出日誌看起來不錯:

[ModuleOutput] [1] "out1:" 
[ModuleOutput] 
[ModuleOutput]  mpg cyl disp hp drat wt qsec vs am gear carb 
[ModuleOutput] 
[ModuleOutput] 1: 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4 
[ModuleOutput] 
[ModuleOutput] 2: 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4 
[ModuleOutput] 
[ModuleOutput] 3: 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1 
[ModuleOutput] 
[ModuleOutput] 4: 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1 
[ModuleOutput] 
[ModuleOutput] 5: 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2 
[ModuleOutput] 
[ModuleOutput] 6: 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1 
[ModuleOutput] 
[ModuleOutput] [1] "out2:" 
[ModuleOutput] 
[ModuleOutput] speed dist 
[ModuleOutput] 
[ModuleOutput] 1:  4 2 
[ModuleOutput] 
[ModuleOutput] 2:  4 10 
[ModuleOutput] 
[ModuleOutput] 3:  7 4 
[ModuleOutput] 
[ModuleOutput] 4:  7 22 
[ModuleOutput] 
[ModuleOutput] 5:  8 16 
[ModuleOutput] 
[ModuleOutput] 6:  9 10 

我想我也跟着從文檔的說明正確。 有人遇到過這個問題嗎?有沒有已知的解決方案?

任何幫助將不勝感激!

回答

1

R輸出橋期望的數據幀,嘗試代替data.table

out1 <- data.frame(mtcars) 
out2 <- data.frame(cars)