r-mlr/parallelMap:如何在使用检查点时将libPaths传递给工作人员



这基本上与这个问题相同。当在R中运行并行计算时,如何在workers上设置.libPaths(检查点),但现在解决mlr模型的并行化问题。我知道我需要将parallelMapmlr一起使用,但我如何确保每个员工都使用正确的.libPaths

remove.packages("mlr")
remove.packages("rpart")
checkpoint::checkpoint("2018-09-01",
scanForPackages = TRUE)
library(mlr)
library(parallelMap)
library(rpart)
parallelStartSocket(2L)
task = makeClassifTask(data = iris, target = "Species")
learner = makeLearner("classif.rpart", minsplit = 7, predict.type = "prob")
mod = resample(learner, task, resampling = cv5)
parallelStop()

parallelLibrary中的错误("mlr",master=FALSE,level="mlr.resample",:未能在所有从属服务器上加载包:mlr。

会话信息:

R版本3.5.1(2018-07-02)平台:x86_64-w64-mingw32/x64(64位)运行环境:Windows 7 x64(内部版本7601)Service Pack 1

矩阵产品:默认

区域设置:[1]LC_COLLATE=德国_德国.1252LC_CTYPE=德国.1252 LC_MONETARY=德国.1252[4]LC_NUMERIC=C LC_TIME=德国.1252

附加的基本包:[1]统计图形grDevices实用程序
数据集方法基本

其他附加包:[1]rpart_4.1-13 parallelMap_1.3
mlr_2.13 ParamHelpers_1.11

通过命名空间加载(未附加):[1]Rcpp_0.12.18
pilla_1.3.0 compiler_3.5.1 ply_1.8.4 bindr_0.1.1
tools_3.5.1[7]tibble_1.4.2 gtable_0.2.0
checkmate_1.8.5 lattice_.20-35 pkgconfig_2.0.2 rlang_0.2.2
[13]Matrix_1.2-14 fastmatch_1.1-0 rstudioapi_0.7 yaml2.2.0平行_3.5.1 bindrcpp_0.2.2[19]dplyr_07.6网格_3.5.1tidyselect_0.2.4 glue_1.3.0 data.table_1.11.4 R6_2.2.2
[25]XML_3.98-1.16 survival_2.42-3 ggplot2_3.0.0 purrr_0.2.5magrittr_1.5后台_1.1.2[31]规模_1.0.0 BBmisc_11.11花键_3.5.1装配_0.2.0检查点_0.4.3颜色空间_1.3-2[37]字符串_1.1.7 lazyeval.0.2.1蒙塞尔_0.5.0
蜡笔_1.3.4

如果我使用R_LIBS将默认库路径更改为检查点目录,这对我来说很有效。

remove.packages("mlr")
remove.packages("rpart")
print(.libPaths())
checkpoint::checkpoint("2018-09-01",
scanForPackages = TRUE)
print(.libPaths())
Sys.setenv(R_LIBS = paste(.libPaths()[1], Sys.getenv("R_LIBS"), sep = .Platform$path.sep))
library(mlr)
library(parallelMap)
library(rpart)
parallelStartSocket(2L)
task = makeClassifTask(data = iris, target = "Species")
learner = makeLearner("classif.rpart", minsplit = 7, predict.type = "prob")
mod = resample(learner, task, resampling = cv5)
parallelStop()

相关内容

  • 没有找到相关文章

最新更新