设置"silent=True"可以xgboost.DMatrix静音吗

Can xgboost.DMatrix be silent by set "silent=True"

我正在学习 XGBoost。我想用 XGBoost python api 完成一个演示。 当我使用 "xgboost.DMatrix" 函数将数据设置为文件时,静音设置为 True。但是,函数 "xgboost.DMatrix" 总是输出一些消息“[23:28:44] 1441x10 矩阵,其中 11528 个条目从 file_name 加载”。我是在设置错误参数吗? reference

这很有趣。静默值被获取并传递给包装器,但包装器似乎并没有真正使用它!

这显示了适当的代码https://github.com/dmlc/xgboost/blob/master/src/c_api/c_api.cc#L202

其中说:

int XGDMatrixCreateFromFile(const char *fname,
                            int silent,
                            DMatrixHandle *out) {
  API_BEGIN();
  if (rabit::IsDistributed()) {
    LOG(CONSOLE) << "XGBoost distributed mode detected, "
                 << "will split data among workers";
  }
  *out = new std::shared_ptr<DMatrix>(DMatrix::Load(fname, false, true));
  API_END();
}

即即使 silent 是一个参数,它也没有在函数中的任何地方使用......(很奇怪)

所以,现在看来,如果您使用任何包装器(Python、R、julia 等),DMatrix 的静默功能将无法工作。