使用 Caret 和 xgboost 训练分类模型期间的警告消息

Warning messages during the training of my classification model using Caret and xgboost

我在 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(),获取处理器数量,然后使用它。