R - 插入符 - 使用并行后端时的打印迭代

时间:2017-07-27 18:53:51

标签: r parallel-processing r-caret doparallel

我想在使用插入符包运行并行后端时生成进度打印。

同样的问题和解决方案,但解决方案对我不起作用,任何帮助将不胜感激: r package caret-Print iteration when using parallel

版本信息与上面链接的相同。

R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

other attached packages:
[1] randomForest_4.6-12 doSNOW_1.0.14       snow_0.4-2          plyr_1.8.4          gbm_2.1.3           survival_2.41-3    
[7] caret_6.0-76        ggplot2_2.2.1       lattice_0.20-34     doParallel_1.0.10   iterators_1.0.8     foreach_1.4.3   

不起作用的解决方案:

  

库(doSNOW)

     

库(脱字符号)

     

cl< - makeCluster(2,outfile ="")

     

registerDoSNOW(CL)

     

iris< - iris [1:100,]

     

iris $ Species< - as.factor(as.character(iris $ Species))

     

tc< - trainControl(method =" LGOCV",                       summaryFunction = twoClassSummary,                       classProb = T,verboseIter = TRUE)

     

train.rf< - train(Species~。,data = iris,                      method =" rf",trControl = tc,                      metric =" ROC")

Loading required package: randomForest
randomForest 4.6-12
Type rfNews() to see new features/changes/bug fixes.

Attaching package: ‘randomForest’

The following object is masked from ‘package:ggplot2’:

margin

Aggregating results
Selecting tuning parameters
Fitting mtry = 2 on full training set

我还将makeCluster中的outfile语句修改为文本文件,它确实在我的目录中生成了一个文本文件。

cl <- makeCluster(2, outfile="progress.txt") 

无论如何使用它来使其在R控制台中打印?

谢谢

0 个答案:

没有答案