none
how to output to standard out (RDevice)? RRS feed

  • Question

  • I have an R Script module that has some print commands (like print("hello")) but they do not output to the "standard out" section in the RDevice port.

    They are visible however in the output log.

    How do I make it appear in Std Out (so that I can read it when I fetch RDevice output via a web service?)

    Monday, July 6, 2015 11:40 PM

Answers

All replies

  • Hi,

    Is it possible for you to write these print statements into a data frame and then output it via the 'Execute R Script' module? This output can be then connected to your 'Web Service output' module.  

    Sample code:

    out <- print("hello")

    data.set <- as.data.frame(out)

    maml.mapOutputPort("data.set");

    Regards,
    Jaya.


    Tuesday, July 7, 2015 6:33 PM
  • Hi, thanks for the response. That will definitely work for certain scenarios. \

    However, in general, I'd like to output just data to "output1" and visualizations/print statments (stdout, graphics etc from RDevice) to "output2". (see experiment below)

    Is there an example of this type of API call (2 outputs from 1 RModule)? I'm assuming output1 + output2 will be returned as a JSON array in a single response.


    I guess the other way would be to save the RDevice stuff (print() dataframe + PNG visualizations) to an Azure Blob, and return the blob URL as part of "output1" ...but this isn't optimal.


    • Edited by ascc7 Tuesday, July 7, 2015 7:42 PM
    Tuesday, July 7, 2015 7:40 PM
  • Hi,

    Would it be possible to restructure your experiment like this?

    Then one of the 'Execute R Script' module outputs the data while the other gives the print statements.

    I am not aware of a sample with 2 output from one 'Execute R Script' module but there is another example of where we have 2 outputs. https://azure.microsoft.com/en-us/documentation/articles/machine-learning-retrain-models-programmatically/

    Pls refer to the Gallery page for sample experiments: http://gallery.azureml.net/

    Regards,
    Jaya.


    Tuesday, July 7, 2015 9:55 PM
  • thanks..that might work theoretically..but brings up some other thorny issues (sorry!):


    (1) I think  the following R Code will work, but the API output will probably be some JSON containing a bunch of PNGs as hex code + print statements in between.  

    How would I possibly parse this.... :(

    If there is an example...would be great (I could not find it. And I cannot restructure it so each RModule only outputs 1 visual.)

    #data is data.frame from reader
    
    visual = plot(data) 
    visualFrame1 <- as.data.frame(visual)
    output = as.data.frame(print(data));
    visualFrame2 <- as.data.frame(visual)
    
    outFrame = as.data.frame(visualFrame1, output, visualFrame2);
    
    maml.mapOutpurPort("outFrame")

    (2) is the R Dataset output via API capability planned in the near future?



    • Edited by ascc7 Wednesday, July 8, 2015 5:23 PM
    Tuesday, July 7, 2015 10:26 PM
  • I see...thanks for the link. Good to know definitively that I wasn't missing something.

    Saturday, July 11, 2015 8:39 PM
  • Thanks
    Tuesday, July 14, 2015 6:03 PM