【问题标题】:How to pass label to matrix of XGBoost JVM Package如何将标签传递给 XGBoost JVM 包的矩阵
【发布时间】:2022-01-10 05:39:14
【问题描述】:

我在official doc找到了创建数据矩阵的JVM包快速入门示例

float[] data = new float[] {1f,2f,3f,4f,5f,6f};
int nrow = 3;
int ncol = 2;
float missing = 0.0f;
DMatrix dmat = new DMatrix(data, nrow, ncol, missing);

// and a DMatrix could be called by train method
Booster booster = XGBoost.train(dmat, params, nround, watches, null, null);

但是文档说JVM包DMatrix的用法和Python包是一样的,在Python中有一个标签参数

dtrain = xgb.DMatrix(data, label=label)

但是我在JVM包中找不到,如何设置标签?

【问题讨论】:

    标签: xgboost


    【解决方案1】:

    在 XGBoost JVM 包中,我们可以使用dMatrix.setLabel(labelArray) 来设置标签(根据 XGBoost github issue page)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-24
      • 1970-01-01
      • 2015-06-12
      • 1970-01-01
      • 2018-12-24
      • 1970-01-01
      • 2021-12-23
      • 2019-12-10
      相关资源
      最近更新 更多