netpot
netpot

Reputation: 1

use both XGBoostPredictorClassification and XGBoostClassification in the same project

from https://github.com/combust/mleap/pull/645, XGBoostPredictorClassification improve performance by only predicting probability

I wonder if we use both XGBoostPredictorClassification and XGBoostClassification in the same project, because now we have multi bundles with different op dependency, some depend on XGBoostClassification to support leaf prediction while some not.

for example, the following setting enable XGBoostPredictorClassificationOp as default op

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

the following enable XGBoostClassificationOp as default OP

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

I need XGBoostClassificationOp to evaluate some xgboost prediction with leaf, in the same time, use XGBoostPredictorClassificationOp to evaluate other xgboost prediction to improve xgb performance

Upvotes: 0

Views: 65

Answers (1)

netpot
netpot

Reputation: 1

solved it by register op through code.

use XGBoostClassificationOp as default op without configure through reference.conf

use XGBoostPredictorClassificationOp as op with following code:

  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());

Upvotes: 0

Related Questions