首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在同一项目中同时使用XGBoostPredictorClassification和XGBoostClassification

在同一项目中同时使用XGBoostPredictorClassification和XGBoostClassification
EN

Stack Overflow用户
提问于 2021-03-29 18:28:51
回答 1查看 29关注 0票数 0

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

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

例如,以下设置将XGBoostPredictorClassificationOp启用为缺省操作

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

以下命令将XGBoostClassificationOp启用为默认操作

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的性能

EN

回答 1

Stack Overflow用户

发布于 2021-03-29 23:12:37

通过代码寄存器操作解决了这个问题。

在不通过reference.conf进行配置的情况下使用XGBoostClassificationOp作为默认操作

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

代码语言:javascript
复制
  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());
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66852572

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档