我在R
中使用Caret
来运行机器学习分类问题的xgboost
算法。
运行以下R
代码后,我收到警告消息(如下所示(:
cl <- makeCluster(10, type = "SOCK")
registerDoSNOW(cl)
caret.cv <- train(market ~ .,
data = mydata.train,
method = "xgbTree",
tuneGrid = tune.grid,
trControl = train.control)
Warning messages:
1: closing unused connection 12 (<-John-laptop.mycompany.local:11916)
2: closing unused connection 11 (<-John-laptop.mycompany.local:11916)
3: closing unused connection 10 (<-John-laptop.mycompany.local:11916)
4: closing unused connection 9 (<-John-laptop.mycompany.local:11916)
5: closing unused connection 8 (<-John-laptop.mycompany.local:11916)
6: closing unused connection 7 (<-John-laptop.mycompany.local:11916)
7: closing unused connection 6 (<-John-laptop.mycompany.local:11916)
8: closing unused connection 5 (<-John-laptop.mycompany.local:11916)
9: closing unused connection 4 (<-John-laptop.mycompany.local:11916)
10: closing unused connection 3 (<-John-laptop.mycompany.local:11916)
我可以忽略它们并继续分析还是幕后出了问题?
这太长了,无法发表评论...
启动群集时,R 与每个进程建立了连接。警告消息只是自动关闭的连接。
停止集群并显式关闭它们会更优雅,但如果您没有任何问题,您可以实际忽略它。
类似于 stopCluster(cl)
的东西(取决于您加载了哪些库(将停止集群,但有时您仍然会收到有关未使用连接的错误 - 这不太可能是一个真正的问题,因为您没有接近连接限制。
请注意,笔记本电脑上的 10 个线程可能过多 - 尝试从 parallel
包中detectCores()
,以获取处理器的数量,然后使用它。