dkuManagedFolderUploadPath Usage R Recipe
Hello Everyone,
I am trying to build a shiny app and want to use my trained model inside it for predictions. I started with an R recipe,. where I train my ML algorithm (runs just fine until this point), and then I am trying to save the model to a managed folder.
I am using the following command
dkuManagedFolderUploadPath("folder_name", "path_in_folder", data)
The folder is not on my local file system.
Here is the actual command in my code. I save the fit to "model.RData". Then, I am trying to upload the data to the managed folder.
rf_fit <- train(..) save(rf_fit , file = "model.RData") # Recipe outputs dkuManagedFolderUploadPath("model_r", "/" , "model.RData")
I am having hard time setting "path_in_folder" argument. What do I set it to ? I just want the model.RData to be saved to "model_r" folder.
Can someone please suggest what am I doing wrong ? In the log file, after executing this command, it says "Start writing data to temp file for upload ....." but it runs forever and doesn't do anything.
Is my syntax wrong or something ?
Thanks in advance
KC
Answers
-
Hi,
The "path in folder" here should be "model.RData", i.e; it's the filename you want to be present in the folder.
dkuManagedFolderUploadPath does not take a file name as parameter, it takes a R connection.
You will want to use:
save(rf_fit, file= "model.RData") connection <- file("model.RData, "rb") dkuManagedFolderUploadPath("model_r", "model.RData", connection) close(connection)