在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的性能
发布于 2021-03-29 23:12:37
通过代码寄存器操作解决了这个问题。
在不通过reference.conf进行配置的情况下使用XGBoostClassificationOp作为默认操作
使用XGBoostPredictorClassificationOp作为op,代码如下:
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());https://stackoverflow.com/questions/66852572
复制相似问题