0

来自https://github.com/combust/mleap/pull/645,XGBoostPredictorClassification 仅通过预测概率来提高性能

我想知道我们是否在同一个项目中同时使用 XGBoostPredictorClassification 和 XGBoostClassification,因为现在我们有多个具有不同操作依赖性的包,有些依赖 XGBoostClassification 来支持叶预测,而有些则不。

例如,以下设置启用 XGBoostPredictorClassificationOp 作为默认操作

ml.combust.mleap.xgboost.ops = [ "ml.combust.mleap.xgboost.runtime.bundle.ops.XGBoostPredictorClassificationOp", "ml.combust.mleap.xgboost.runtime.bundle.ops.XGBoostRegressionOp" ]

以下启用 XGBoostClassificationOp 作为默认 OP

ml.combust.mleap.xgboost.ops = [ "ml.combust.mleap.xgboost.runtime.bundle.ops.XGBoostClassificationOp", "ml.combust.mleap.xgboost.runtime.bundle.ops.XGBoostRegressionOp" ]

我需要 XGBoostClassificationOp 来评估一些带有叶子的 xgboost 预测,同时使用 XGBoostPredictorClassificationOp 来评估其他 xgboost 预测以提高 xgb 性能

4

1 回答 1

0

通过代码注册操作解决了它。

使用 XGBoostClassificationOp 作为默认操作,无需通过 reference.conf 配置

使用 XGBoostPredictorClassificationOp 作为操作,代码如下:

  BundleBuilder bundleBuilder = new BundleBuilder();
  ContextBuilder contextBuilder = new ContextBuilder();
  MleapContext mleapContext = contextBuilder.createMleapContext();
  // Register a different Op to change the deserialization class between tests.
  // Use to deserialize with Predictor rather than xgboost4j
  mleapContext.bundleRegistry().register(new XGBoostPredictorClassificationOp());
  Transformer transformer = bundleBuilder.load(modelFile, mleapContext).root();
  //revert to the original Op
  mleapContext.bundleRegistry().register(new XGBoostClassificationOp());
于 2021-03-29T15:12:36.940 回答