none
How Can I Export .Rdata from Mircosoft Azure ML? RRS feed

  • Question

  • I see I can import .R and .Rdata files by saving them as .zip and attaching them to the zip port on an R script tool; but, how can I save an object and export it so that I can reuse it?  

    For example, I want to create a model, save it, then reload it at a later point so that I don't have to recreate it again.

    Here is how I would prefer to save data with R:

    > save(classifier, file = 'classifier.rda') # save object

    If I try to save a classifier like so:

    library(e1071)

    # Map 1-based optional input ports to variables
    dataset1 <- maml.mapInputPort(1) # class: data.frame

    # Contents of optional Zip port are in ./src/
    # source("src/yourfile.R");
    # load("src/yourData.rdata");

    # Sample operation
    #data.set = rbind(dataset1, dataset2);

    classifier<-naiveBayes(dataset1[,1:4], dataset1[,5]) 

    # Select data.frame to be sent to the output Dataset port
    maml.mapOutputPort("myRData");

    I get the following error:

    Error: Mapped variable must be of class type data.frame at this time.

    If we can't save objects, then we are left to recreate a classifier every time?  This could take hours if you have more than 2 or 3 GBs of data.
    • Edited by _dominic Tuesday, July 22, 2014 7:52 PM
    Tuesday, July 22, 2014 6:42 PM

All replies

  • Hello Dominic,

    This is indeed a limitation in our current R support, sorry for the inconvenience. For now, I would suggest the following workaround while we come up with a more elegant solution: please serialize your model using "serialize(model, con=NULL)" and pass the resulting raw vector as a one-column data.frame. On the way in, you can just deserialize the byte array into a model object.

    Please let us know if this is workable for your use-case.

    Thank you very much.  

    Wednesday, July 23, 2014 9:03 AM
  • Thanks, I believe this may be an acceptable work around.  Thank you.

    However, I am blocked from continuing this project with AzureML because I can't change the locale to Russian.  I am working with Russian text for a machine learning competition on Kaggle.

    I have posted a separate question regarding this issue here: 

    http://social.msdn.microsoft.com/Forums/windowsazure/en-US/f25b2f05-431f-43ee-8057-3b5c4236e293/os-reports-request-to-set-locale-to-russian-cannot-be-honored?forum=MachineLearning

    (sorry, this forum won't let me post links)

    Wednesday, July 23, 2014 1:12 PM