Module Contents


convert(model,feature_names=None,target=”target”,force_32bit_float=True) Convert a trained XGBoost model to Core ML format.
convert(model, feature_names=None, target="target", force_32bit_float=True)

Convert a trained XGBoost model to Core ML format.

decision_tree : Booster
A trained XGboost tree model.
feature_names: [str] | str

Names of input features that will be exposed in the Core ML model interface.

Can be set to one of the following:

  • None for using the feature names from the model.
  • List of names of the input features that should be exposed in the interface to the Core ML model. These input features are in the same order as the XGboost model.
target: str
Name of the output feature name exposed to the Core ML model.
force_32bit_float: bool
If True, then the resulting CoreML model will use 32 bit floats internally.
Returns an MLModel instance representing a Core ML model.
# Convert it with default input and output names
>>> import coremltools
>>> coreml_model = coremltools.converters.xgboost.convert(model)

# Saving the Core ML model to a file.