Install R Packages in Azure Ml

Install R Packages in Azure ML

You can use miniCRAN (https://cran.r-project.org/web/packages/miniCRAN/index.html) to build the zip file with all dependencies included then upload the zip file and use it to install your required packages. It also allows you to choose the target platform (type="win.binary") and R version (RVersion="3.1") which are crucial when using Azure ML. There is a tutorial here (http://blog.revolutionanalytics.com/2015/10/using-minicran-in-azure-ml.html) that outlines the steps.

Installing additional R Package on Azure ML

To install a package this way, you have to create a .zip of a .zip. The outer layer of packaging will get unzipped into the src/ folder when the dataset is passed in to the module, and you'll be able to install the inner package from there.

unable to install R library in azure ml

You cannot use the tarball packages. If you are on windows you need to do the following:

Once you install a package (+ it's dependencies) it will download the packages in a directory

C:\Users\xxxxx\AppData\Local\Temp\some directory
name\downloaded_packages

These will be in a zip format. These are the packages you need.

Or download the windows binaries from cran.

Next you need to put all the needed packages in one total zip-file and upload this to AzureML as a new dataset.

in AzureML load the data package connected to a r-script

install.packages("src/ada.zip", lib = ".", repos = NULL, verbose = TRUE)
library(ada, lib.loc=".", verbose=TRUE)

Be sure to check that all dependent packages are available in Azure. Rpart is available.

For a complete overview, look at this msdn blog explaining it a bit better with some visuals.

Add custom packages to Azure Machine Learing Studio

I have installed the latest version of the forecast package and here are the steps I followed during the installation.

  1. Download latest version of CRAN
  2. Be sure that tsCV is working locally
  3. Zip all the dependencies + forecast package
  4. Zip all the generated zips together and upload it to the AMLStudio
  5. Run the following code:
install.packages("src/glue.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/stringi.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/assertthat.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/fansi.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/utf8.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/stringr.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/labeling.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/munsell.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/R6.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/RColorBrewer.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/cli.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/crayon.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/pillar.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/xts.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/TTR.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/curl.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/digest.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/gtable.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/lazyeval.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/plyr.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/reshape2.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/rlang.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/scales.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/tibble.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/viridisLite.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/withr.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/quadprog.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/quantmod.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/colorspace.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/fracdiff.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/ggplot2.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/lmtest.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/magrittr.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/Rcpp.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/timeDate.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/tseries.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/urca.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/uroot.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/zoo.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/RcppArmadillo.zip", lib = ".", repos = NULL, verbose = TRUE)
install.packages("src/forecast.zip", lib = ".", repos = NULL, verbose = TRUE)

library(forecast, lib.loc=".", verbose=TRUE)
far2 <- function(x, h){forecast(Arima(x, order=c(2,0,0)), h=h)}
e <- tsCV(lynx, far2, h=1)

Here is the zip I have generated:

My experiment



Related Topics



Leave a reply



Submit