使用Caret和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()来获取处理器数量,并使用这个数量。

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注