将自定义包添加到Azure Machine Learing Studio

时间:2018-09-11 14:46:12

标签: r azure-machine-learning-studio

我需要在azure机器学习工作室上使用函数tsCV来评估预测模型,但出现错误

could not find function "tsCV

我正在尝试更新预测软件包,但未加载任何软件包。 我遵循了本教程 http://blog.revolutionanalytics.com/2015/10/using-minicran-in-azure-ml.htmlhttps://blog.tallan.com/2016/12/27/adding-r-packages-in-azure-ml/ 但我没有得到相同的结果。 没有包被加载。

我需要一个具有R代码且可以在Azure ML上运行的软件包的示例,或者需要更新预测软件包以使用tsCV函数。

1 个答案:

答案 0 :(得分:1)

我已经安装了预测软件包的最新版本,这是我在安装过程中遵循的步骤。

  1. 下载最新版本的CRAN
  2. 确保tsCV在本地工作
  3. 压缩所有依赖项+预测包
  4. 将所有生成的zip压缩在一起,并将其上传到AMLStudio
  5. 运行以下代码:
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