Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用并行时的r包插入符号打印迭代_R_R Caret - Fatal编程技术网

使用并行时的r包插入符号打印迭代

使用并行时的r包插入符号打印迭代,r,r-caret,R,R Caret,当并行使用caret::train函数时,我们是否可以打印迭代?我知道有一个名为verbose的选项,但如果我使用多核,它似乎不会打印任何内容 我找到了解决办法。 我们只需要通过makeCluster函数注册内核 library(doSNOW) cl <- makeCluster(30, outfile="") registerDoSNOW(cl) 你在用RStudio吗?它以非标准方式指导输出。当我使用多核时,我不会得到任何日志,但我会用常规的R。嗨,Max!我尝试使用R studio

当并行使用
caret::train
函数时,我们是否可以打印迭代?我知道有一个名为verbose的选项,但如果我使用多核,它似乎不会打印任何内容

我找到了解决办法。 我们只需要通过makeCluster函数注册内核

library(doSNOW)
cl <- makeCluster(30, outfile="")
registerDoSNOW(cl)

你在用RStudio吗?它以非标准方式指导输出。当我使用多核时,我不会得到任何日志,但我会用常规的R。嗨,Max!我尝试使用R studio和R server,但如果使用registerdomc/makecluster,它们中没有一个会打印日志。经过一些研究,我发现caret包不是问题,但是foreach包才是问题所在。打印日志有一些技巧。然而,大多数技巧必须在foreach循环内部完成,或者核心必须通过makecluster函数注册。但是,您可能知道,通过makecluster函数注册内核要比doMC运行foreach循环慢得多(两个包的创建者都证实了这一点)。但是,我仍然在寻找其他打印LogsName for RStudio、Win7 64位、R版本3.3.2的技巧:
randomForest\u 4.6-12
doSNOW\u 1.0.14
snow\u 0.4-2
迭代器\u 1.0.8
foreach\u 1.4.3
caret\u 6.0-73
。感谢这项工作,但准确性仍然缺失。如何在文本文件中打印准确度?
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")
Type: EXEC 
loaded caret and set parent environment
Type: EXEC 
loaded caret and set parent environment
Type: EXEC 
Type: EXEC 
+ Resample01: mtry=2 
+ Resample01: mtry=3 
- Resample01: mtry=3 
Type: EXEC 
+ Resample02: mtry=2 
- Resample01: mtry=2 
Type: EXEC 
+ Resample01: mtry=4 
- Resample02: mtry=2 
Type: EXEC 
+ Resample02: mtry=3 
- Resample01: mtry=4 
Type: EXEC 
+ Resample02: mtry=4 
- Resample02: mtry=3 
Type: EXEC 
+ Resample03: mtry=2 
- Resample02: mtry=4 
Type: EXEC 
+ Resample03: mtry=3 
- Resample03: mtry=2 
Type: EXEC 
+ Resample03: mtry=4 
- Resample03: mtry=3 
Type: EXEC 
+ Resample04: mtry=2 
- Resample03: mtry=4 
Type: EXEC 
+ Resample04: mtry=3 
- Resample04: mtry=2 
Type: EXEC 
+ Resample04: mtry=4 
- Resample04: mtry=3 
Type: EXEC 
+ Resample05: mtry=2 
- Resample04: mtry=4 
Type: EXEC 
+ Resample05: mtry=3 
- Resample05: mtry=2 
Type: EXEC 
+ Resample05: mtry=4 
- Resample05: mtry=3 
Type: EXEC 
+ Resample06: mtry=2 
- Resample05: mtry=4 
Type: EXEC 
+ Resample06: mtry=3 
- Resample06: mtry=2 
Type: EXEC 
+ Resample06: mtry=4 
- Resample06: mtry=3 
Type: EXEC 
+ Resample07: mtry=2 
- Resample06: mtry=4 
Type: EXEC 
- Resample07: mtry=2 
+ Resample07: mtry=3 
Type: EXEC 
+ Resample07: mtry=4 
- Resample07: mtry=3 
- Resample07: mtry=4 
Type: EXEC 
Type: EXEC 
+ Resample08: mtry=2 
+ Resample08: mtry=3 
- Resample08: mtry=3 
Type: EXEC 
+ Resample09: mtry=2 
- Resample08: mtry=2 
Type: EXEC 
+ Resample08: mtry=4 
- Resample09: mtry=2 
Type: EXEC 
+ Resample09: mtry=3 
- Resample08: mtry=4 
Type: EXEC 
+ Resample09: mtry=4 
- Resample09: mtry=3 
Type: EXEC 
+ Resample10: mtry=2 
- Resample09: mtry=4 
Type: EXEC 
+ Resample10: mtry=3 
- Resample10: mtry=2 
Type: EXEC 
+ Resample10: mtry=4 
- Resample10: mtry=3 
Type: EXEC 
+ Resample11: mtry=2 
- Resample10: mtry=4 
Type: EXEC 
+ Resample11: mtry=3 
- Resample11: mtry=2 
Type: EXEC 
+ Resample11: mtry=4 
- Resample11: mtry=3 
Type: EXEC 
+ Resample12: mtry=2 
- Resample11: mtry=4 
Type: EXEC 
+ Resample12: mtry=3 
- Resample12: mtry=2 
Type: EXEC 
+ Resample12: mtry=4 
- Resample12: mtry=3 
Type: EXEC 
+ Resample13: mtry=2 
- Resample12: mtry=4 
Type: EXEC 
+ Resample13: mtry=3 
- Resample13: mtry=2 
Type: EXEC 
+ Resample13: mtry=4 
- Resample13: mtry=3 
Type: EXEC 
+ Resample14: mtry=2 
- Resample14: mtry=2 
Type: EXEC 
+ Resample14: mtry=4 
- Resample14: mtry=4 
Type: EXEC 
+ Resample15: mtry=2 
- Resample15: mtry=2 
Type: EXEC 
+ Resample15: mtry=3 
- Resample15: mtry=3 
Type: EXEC 
+ Resample15: mtry=4 
- Resample13: mtry=4 
Type: EXEC 
+ Resample14: mtry=3 
- Resample15: mtry=4 
Type: EXEC 
+ Resample16: mtry=2 
- Resample14: mtry=3 
Type: EXEC 
+ Resample16: mtry=3 
- Resample16: mtry=2 
Type: EXEC 
+ Resample16: mtry=4 
- Resample16: mtry=3 
Type: EXEC 
+ Resample17: mtry=2 
- Resample17: mtry=2 
Type: EXEC 
+ Resample17: mtry=4 
- Resample17: mtry=4 
Type: EXEC 
+ Resample18: mtry=2 
- Resample18: mtry=2 
Type: EXEC 
+ Resample18: mtry=3 
- Resample16: mtry=4 
Type: EXEC 
+ Resample17: mtry=3 
- Resample18: mtry=3 
Type: EXEC 
+ Resample18: mtry=4 
- Resample17: mtry=3 
Type: EXEC 
+ Resample19: mtry=2 
- Resample18: mtry=4 
Type: EXEC 
+ Resample19: mtry=3 
- Resample19: mtry=2 
Type: EXEC 
+ Resample19: mtry=4 
- Resample19: mtry=3 
Type: EXEC 
+ Resample20: mtry=2 
- Resample19: mtry=4 
Type: EXEC 
+ Resample20: mtry=3 
- Resample20: mtry=2 
Type: EXEC 
+ Resample20: mtry=4 
- Resample20: mtry=3 
Type: EXEC 
+ Resample21: mtry=2 
- Resample20: mtry=4 
Type: EXEC 
+ Resample21: mtry=3 
- Resample21: mtry=2 
Type: EXEC 
+ Resample21: mtry=4 
- Resample21: mtry=3 
Type: EXEC 
- Resample21: mtry=4 
+ Resample22: mtry=2 
Type: EXEC 
+ Resample22: mtry=3 
- Resample22: mtry=3 
Type: EXEC 
+ Resample23: mtry=2 
- Resample22: mtry=2 
Type: EXEC 
+ Resample22: mtry=4 
- Resample23: mtry=2 
Type: EXEC 
+ Resample23: mtry=3 
- Resample22: mtry=4 
Type: EXEC 
+ Resample23: mtry=4 
- Resample23: mtry=3 
Type: EXEC 
+ Resample24: mtry=2 
- Resample23: mtry=4 
Type: EXEC 
+ Resample24: mtry=3 
- Resample24: mtry=2 
Type: EXEC 
+ Resample24: mtry=4 
- Resample24: mtry=3 
Type: EXEC 
+ Resample25: mtry=2 
- Resample24: mtry=4 
Type: EXEC 
+ Resample25: mtry=3 
- Resample25: mtry=2 
Type: EXEC 
+ Resample25: mtry=4 
- Resample25: mtry=3 
- Resample25: mtry=4 
Aggregating results
Selecting tuning parameters
Fitting mtry = 2 on full training set